Return a boolean status (true: interpolation is OK) and the interpolated value for a pixel, ignoring pixels given by badmask
2149 static int ndatamax = 40;
2154 shAssert(badmask != NULL && badmask->type == shTypeGetFromName(
"OBJMASK"));
2155 shAssert(reg != NULL && reg->type == TYPE_PIX);
2160 for (z1 = colc - 1; z1 >= 0; z1--) {
2161 if (!phPixIntersectMask(badmask, z1, rowc)) {
2167 for (z2 = colc + 1; z2 < ncol; z2++) {
2168 if (!phPixIntersectMask(badmask, z2, rowc)) {
2174 i0 = (z1 > 2) ? z1 - 2 : 0;
2175 i1 = (z2 < ncol - 2) ? z2 + 2 : ncol - 1;
2177 if (i0 < 2 || i1 >= ncol - 2) {
2181 ndata = (i1 - i0 + 1);
2182 if (ndata > ndatamax) {
2186 data = alloca(ndata*
sizeof(PIX));
2187 for (i = i0; i <= i1; i++) {
2188 data[i - i0] = reg->ROWS[rowc][i];
2190 val = &data[colc - i0];
2192 for (z1 = rowc - 1; z1 >= 0; z1--) {
2193 if (!phPixIntersectMask(badmask, colc, z1)) {
2199 for (z2 = rowc + 1; z2 < nrow; z2++) {
2200 if (!phPixIntersectMask(badmask, colc, z2)) {
2206 i0 = (z1 > 2) ? z1 - 2 : 0;
2207 i1 = (z2 < nrow - 2) ? z2 + 2 : nrow - 1;
2209 if (i0 < 2 || i1 >= ncol - 2) {
2213 ndata = (i1 - i0 + 1);
2214 if (ndata > ndatamax) {
2218 data = alloca(ndata*
sizeof(PIX));
2219 for (i = i0; i <= i1; i++) {
2220 data[i - i0] = reg->ROWS[i][colc];
2222 val = &data[rowc - i0];
2225 defect.x1 = z1 - i0;
2226 defect.x2 = z2 - i0;
2227 classify_defects(&defect, 1, ndata);
2228 do_defect(&defect, 1, data, ndata, minval);
2233 return std::make_pair(
false, std::numeric_limits<typename MaskedImageT::Image::Pixel>::min());