Lines Matching full:y
122 for (int y = -gap; y < roi.height + gap; ++y) in findInPair() local
126 int y1 = roi.y - tl1.y + y; in findInPair()
129 submask1.at<uchar>(y + gap, x + gap) = mask1.at<uchar>(y1, x1); in findInPair()
131 submask1.at<uchar>(y + gap, x + gap) = 0; in findInPair()
133 int y2 = roi.y - tl2.y + y; in findInPair()
136 submask2.at<uchar>(y + gap, x + gap) = mask2.at<uchar>(y2, x2); in findInPair()
138 submask2.at<uchar>(y + gap, x + gap) = 0; in findInPair()
152 for (int y = 0; y < roi.height; ++y) in findInPair() local
156 if (seam.at<uchar>(y + gap, x + gap)) in findInPair()
157 mask2.at<uchar>(roi.y - tl2.y + y, roi.x - tl2.x + x) = 0; in findInPair()
159 mask1.at<uchar>(roi.y - tl1.y + y, roi.x - tl1.x + x) = 0; in findInPair()
209 Point intersectTl(std::max(tl1.x, tl2.x), std::max(tl1.y, tl2.y)); in process()
212 std::min(tl1.y + image1.rows, tl2.y + image2.rows)); in process()
214 if (intersectTl.x >= intersectBr.x || intersectTl.y >= intersectBr.y) in process()
217 unionTl_ = Point(std::min(tl1.x, tl2.x), std::min(tl1.y, tl2.y)); in process()
220 std::max(tl1.y + image1.rows, tl2.y + image2.rows)); in process()
222 unionSize_ = Size(unionBr_.x - unionTl_.x, unionBr_.y - unionTl_.y); in process()
227 Mat tmp = mask1_(Rect(tl1.x - unionTl_.x, tl1.y - unionTl_.y, mask1.cols, mask1.rows)); in process()
230 tmp = mask2_(Rect(tl2.x - unionTl_.x, tl2.y - unionTl_.y, mask2.cols, mask2.rows)); in process()
238 for (int y = 0; y < unionSize_.height; ++y) in process() local
242 if (mask1_(y, x) && in process()
243 ((x == 0 || !mask1_(y, x-1)) || (x == unionSize_.width-1 || !mask1_(y, x+1)) || in process()
244 (y == 0 || !mask1_(y-1, x)) || (y == unionSize_.height-1 || !mask1_(y+1, x)))) in process()
246 contour1mask_(y, x) = 255; in process()
249 if (mask2_(y, x) && in process()
250 ((x == 0 || !mask2_(y, x-1)) || (x == unionSize_.width-1 || !mask2_(y, x+1)) || in process()
251 (y == 0 || !mask2_(y-1, x)) || (y == unionSize_.height-1 || !mask2_(y+1, x)))) in process()
253 contour2mask_(y, x) = 255; in process()
277 for (int y = 0; y < unionSize_.height; ++y) in findComponents() local
281 if (mask1_(y, x) && mask2_(y, x)) in findComponents()
282 labels_(y, x) = std::numeric_limits<int>::max(); in findComponents()
283 else if (mask1_(y, x)) in findComponents()
284 labels_(y, x) = std::numeric_limits<int>::max()-1; in findComponents()
285 else if (mask2_(y, x)) in findComponents()
286 labels_(y, x) = std::numeric_limits<int>::max()-2; in findComponents()
288 labels_(y, x) = 0; in findComponents()
292 for (int y = 0; y < unionSize_.height; ++y) in findComponents() local
296 if (labels_(y, x) >= std::numeric_limits<int>::max()-2) in findComponents()
298 if (labels_(y, x) == std::numeric_limits<int>::max()) in findComponents()
300 else if (labels_(y, x) == std::numeric_limits<int>::max()-1) in findComponents()
302 else if (labels_(y, x) == std::numeric_limits<int>::max()-2) in findComponents()
305 floodFill(labels_, Point(x, y), ++ncomps_); in findComponents()
306 tls_.push_back(Point(x, y)); in findComponents()
307 brs_.push_back(Point(x+1, y+1)); in findComponents()
311 if (labels_(y, x)) in findComponents()
313 int l = labels_(y, x); in findComponents()
317 tls_[ci].y = std::min(tls_[ci].y, y); in findComponents()
319 brs_[ci].y = std::max(brs_[ci].y, y+1); in findComponents()
321 … if ((x == 0 || labels_(y, x-1) != l) || (x == unionSize_.width-1 || labels_(y, x+1) != l) || in findComponents()
322 … (y == 0 || labels_(y-1, x) != l) || (y == unionSize_.height-1 || labels_(y+1, x) != l)) in findComponents()
324 contours_[ci].push_back(Point(x, y)); in findComponents()
352 int y = contours_[ci][i].y; in findEdges() local
355 if (x > 0 && labels_(y, x-1) && labels_(y, x-1) != l) in findEdges()
357 wedges[std::make_pair(ci, labels_(y, x-1)-1)]++; in findEdges()
358 wedges[std::make_pair(labels_(y, x-1)-1, ci)]++; in findEdges()
361 if (y > 0 && labels_(y-1, x) && labels_(y-1, x) != l) in findEdges()
363 wedges[std::make_pair(ci, labels_(y-1, x)-1)]++; in findEdges()
364 wedges[std::make_pair(labels_(y-1, x)-1, ci)]++; in findEdges()
367 if (x < unionSize_.width-1 && labels_(y, x+1) && labels_(y, x+1) != l) in findEdges()
369 wedges[std::make_pair(ci, labels_(y, x+1)-1)]++; in findEdges()
370 wedges[std::make_pair(labels_(y, x+1)-1, ci)]++; in findEdges()
373 if (y < unionSize_.height-1 && labels_(y+1, x) && labels_(y+1, x) != l) in findEdges()
375 wedges[std::make_pair(ci, labels_(y+1, x)-1)]++; in findEdges()
376 wedges[std::make_pair(labels_(y+1, x)-1, ci)]++; in findEdges()
433 for (int y = tls_[c1].y; y < brs_[c1].y; ++y) in resolveConflicts() local
435 if (labels_(y, x) == l1) in resolveConflicts()
436 labels_(y, x) = l2; in resolveConflicts()
465 int y0 = tls_[c[i]].y, y1 = brs_[c[i]].y; in resolveConflicts()
471 for (int y = y0; y < y1; ++y) in resolveConflicts() local
475 if (labels_(y, x) == l[i]) in resolveConflicts()
478 tls_[c[i]].y = std::min(tls_[c[i]].y, y); in resolveConflicts()
480 brs_[c[i]].y = std::max(brs_[c[i]].y, y+1); in resolveConflicts()
482 … if ((x == 0 || labels_(y, x-1) != l[i]) || (x == unionSize_.width-1 || labels_(y, x+1) != l[i]) || in resolveConflicts()
483 … (y == 0 || labels_(y-1, x) != l[i]) || (y == unionSize_.height-1 || labels_(y+1, x) != l[i])) in resolveConflicts()
485 contours_[c[i]].push_back(Point(x, y)); in resolveConflicts()
501 int dx1 = unionTl_.x - tl1.x, dy1 = unionTl_.y - tl1.y; in resolveConflicts()
502 int dx2 = unionTl_.x - tl2.x, dy2 = unionTl_.y - tl2.y; in resolveConflicts()
504 for (int y = 0; y < mask2.rows; ++y) in resolveConflicts() local
508 int l = labels_(y - dy2, x - dx2); in resolveConflicts()
509 if (l > 0 && (states_[l-1] & FIRST) && mask1.at<uchar>(y - dy2 + dy1, x - dx2 + dx1)) in resolveConflicts()
510 mask2.at<uchar>(y, x) = 0; in resolveConflicts()
514 for (int y = 0; y < mask1.rows; ++y) in resolveConflicts() local
518 int l = labels_(y - dy1, x - dx1); in resolveConflicts()
519 if (l > 0 && (states_[l-1] & SECOND) && mask2.at<uchar>(y - dy1 + dy2, x - dx1 + dx2)) in resolveConflicts()
520 mask1.at<uchar>(y, x) = 0; in resolveConflicts()
561 bool DpSeamFinder::closeToContour(int y, int x, const Mat_<uchar> &contourMask) in closeToContour() argument
567 if (y + dy >= 0 && y + dy < unionSize_.height) in closeToContour()
572 contourMask(y + dy, x + dx)) in closeToContour()
596 int y = contours_[comp1][i].y; in getSeamTips() local
598 if (closeToContour(y, x, contour1mask_) && in getSeamTips()
599 closeToContour(y, x, contour2mask_) && in getSeamTips()
600 ((x > 0 && labels_(y, x-1) == l2) || in getSeamTips()
601 (y > 0 && labels_(y-1, x) == l2) || in getSeamTips()
602 (x < unionSize_.width-1 && labels_(y, x+1) == l2) || in getSeamTips()
603 (y < unionSize_.height-1 && labels_(y+1, x) == l2))) in getSeamTips()
605 specialPoints.push_back(Point(x, y)); in getSeamTips()
640 double cx1 = cvRound(sum[i].x / size1), cy1 = cvRound(sum[i].y / size1); in getSeamTips()
641 double cx2 = cvRound(sum[j].x / size2), cy2 = cvRound(sum[j].y / size1); in getSeamTips()
661 double cy = cvRound(sum[idx[i]].y / size); in getSeamTips()
669 (points[idx[i]][j].y - cy) * (points[idx[i]][j].y - cy); in getSeamTips()
734 int dx1 = unionTl_.x - tl1.x, dy1 = unionTl_.y - tl1.y; in computeCosts()
735 int dx2 = unionTl_.x - tl2.x, dy2 = unionTl_.y - tl2.y; in computeCosts()
742 for (int y = roi.y; y < roi.br().y; ++y) in computeCosts() local
746 if (labels_(y, x) == l && x > 0 && labels_(y, x-1) == l) in computeCosts()
748 float costColor = (diff(image1, y + dy1, x + dx1 - 1, image2, y + dy2, x + dx2) + in computeCosts()
749 … diff(image1, y + dy1, x + dx1, image2, y + dy2, x + dx2 - 1)) / 2; in computeCosts()
751 costV(y - roi.y, x - roi.x) = costColor; in computeCosts()
754 … float costGrad = std::abs(gradx1_(y + dy1, x + dx1)) + std::abs(gradx1_(y + dy1, x + dx1 - 1)) + in computeCosts()
755 … std::abs(gradx2_(y + dy2, x + dx2)) + std::abs(gradx2_(y + dy2, x + dx2 - 1)) + 1.f; in computeCosts()
756 costV(y - roi.y, x - roi.x) = costColor / costGrad; in computeCosts()
760 costV(y - roi.y, x - roi.x) = badRegionCost; in computeCosts()
766 for (int y = roi.y; y < roi.br().y+1; ++y) in computeCosts() local
770 if (labels_(y, x) == l && y > 0 && labels_(y-1, x) == l) in computeCosts()
772 float costColor = (diff(image1, y + dy1 - 1, x + dx1, image2, y + dy2, x + dx2) + in computeCosts()
773 … diff(image1, y + dy1, x + dx1, image2, y + dy2 - 1, x + dx2)) / 2; in computeCosts()
775 costH(y - roi.y, x - roi.x) = costColor; in computeCosts()
778 … float costGrad = std::abs(grady1_(y + dy1, x + dx1)) + std::abs(grady1_(y + dy1 - 1, x + dx1)) + in computeCosts()
779 … std::abs(grady2_(y + dy2, x + dx2)) + std::abs(grady2_(y + dy2 - 1, x + dx2)) + 1.f; in computeCosts()
780 costH(y - roi.y, x - roi.x) = costColor / costGrad; in computeCosts()
784 costH(y - roi.y, x - roi.x) = badRegionCost; in computeCosts()
807 isHorizontal = std::abs(dst.x - src.x) > std::abs(dst.y - src.y); in estimateSeam()
817 else if (src.y > dst.y) in estimateSeam()
839 for (int y = 0; y < roi.height; ++y) in estimateSeam() local
845 if (labels_(y + roi.y, x + roi.x) == l) in estimateSeam()
847 if (reachable(y, x-1)) in estimateSeam()
848 steps[nsteps++] = std::make_pair(cost(y, x-1) + costH(y, x-1), 1); in estimateSeam()
849 if (y > 0 && reachable(y-1, x-1)) in estimateSeam()
850 … steps[nsteps++] = std::make_pair(cost(y-1, x-1) + costH(y-1, x-1) + costV(y-1, x), 2); in estimateSeam()
851 if (y < roi.height-1 && reachable(y+1, x-1)) in estimateSeam()
852 … steps[nsteps++] = std::make_pair(cost(y+1, x-1) + costH(y+1, x-1) + costV(y, x), 3); in estimateSeam()
858 cost(y, x) = opt.first; in estimateSeam()
859 control(y, x) = (uchar)opt.second; in estimateSeam()
860 reachable(y, x) = 255; in estimateSeam()
867 for (int y = src.y+1; y <= dst.y; ++y) in estimateSeam() local
875 if (labels_(y + roi.y, x + roi.x) == l) in estimateSeam()
877 if (reachable(y-1, x)) in estimateSeam()
878 steps[nsteps++] = std::make_pair(cost(y-1, x) + costV(y-1, x), 1); in estimateSeam()
879 if (x > 0 && reachable(y-1, x-1)) in estimateSeam()
880 … steps[nsteps++] = std::make_pair(cost(y-1, x-1) + costV(y-1, x-1) + costH(y, x-1), 2); in estimateSeam()
881 if (x < roi.width-1 && reachable(y-1, x+1)) in estimateSeam()
882 … steps[nsteps++] = std::make_pair(cost(y-1, x+1) + costV(y-1, x+1) + costH(y, x), 3); in estimateSeam()
888 cost(y, x) = opt.first; in estimateSeam()
889 control(y, x) = (uchar)opt.second; in estimateSeam()
890 reachable(y, x) = 255; in estimateSeam()
909 if (control(p) == 2) p.y--; in estimateSeam()
910 else if (control(p) == 3) p.y++; in estimateSeam()
916 for (; p.y != src.y; seam.push_back(p + roi.tl())) in estimateSeam()
920 p.y--; in estimateSeam()
936 Mat_<int> mask = Mat::zeros(brs_[comp1].y - tls_[comp1].y, in updateLabelsUsingSeam()
951 for (int y = 0; y < mask.rows; ++y) in updateLabelsUsingSeam() local
953 if (!mask(y, x) && labels_(y + tls_[comp1].y, x + tls_[comp1].x) == l1) in updateLabelsUsingSeam()
954 floodFill(mask, Point(x, y), ++ncomps); in updateLabelsUsingSeam()
959 int y = contours_[comp1][i].y - tls_[comp1].y; in updateLabelsUsingSeam() local
968 int r = y + dy[j]; in updateLabelsUsingSeam()
974 mask(y, x) = mask(r, c); in updateLabelsUsingSeam()
979 mask(y, x) = 0; in updateLabelsUsingSeam()
987 int y = seam[i].y - tls_[comp1].y; in updateLabelsUsingSeam() local
989 if (y < mask.rows-1 && mask(y+1, x) && mask(y+1, x) != 255) in updateLabelsUsingSeam()
990 mask(y, x) = mask(y+1, x); in updateLabelsUsingSeam()
992 mask(y, x) = 0; in updateLabelsUsingSeam()
1000 int y = seam[i].y - tls_[comp1].y; in updateLabelsUsingSeam() local
1002 if (x < mask.cols-1 && mask(y, x+1) && mask(y, x+1) != 255) in updateLabelsUsingSeam()
1003 mask(y, x) = mask(y, x+1); in updateLabelsUsingSeam()
1005 mask(y, x) = 0; in updateLabelsUsingSeam()
1024 int y = contours_[comp1][i].y; in updateLabelsUsingSeam() local
1026 if ((x > 0 && labels_(y, x-1) == l2) || in updateLabelsUsingSeam()
1027 (y > 0 && labels_(y-1, x) == l2) || in updateLabelsUsingSeam()
1028 (x < unionSize_.width-1 && labels_(y, x+1) == l2) || in updateLabelsUsingSeam()
1029 (y < unionSize_.height-1 && labels_(y+1, x) == l2)) in updateLabelsUsingSeam()
1031 connect2[mask(y - tls_[comp1].y, x - tls_[comp1].x)]++; in updateLabelsUsingSeam()
1034 if ((x > 0 && labels_(y, x-1) != l1 && labels_(y, x-1) != l2) || in updateLabelsUsingSeam()
1035 (y > 0 && labels_(y-1, x) != l1 && labels_(y-1, x) != l2) || in updateLabelsUsingSeam()
1036 (x < unionSize_.width-1 && labels_(y, x+1) != l1 && labels_(y, x+1) != l2) || in updateLabelsUsingSeam()
1037 (y < unionSize_.height-1 && labels_(y+1, x) != l1 && labels_(y+1, x) != l2)) in updateLabelsUsingSeam()
1039 connectOther[mask(y - tls_[comp1].y, x - tls_[comp1].x)]++; in updateLabelsUsingSeam()
1053 for (int y = 0; y < mask.rows; ++y) in updateLabelsUsingSeam() local
1055 if (mask(y, x) && isAdjComp[mask(y, x)]) in updateLabelsUsingSeam()
1056 labels_(y + tls_[comp1].y, x + tls_[comp1].x) = l2; in updateLabelsUsingSeam()
1099 for (int y = 0; y < src[i].rows; ++y) in find() local
1101 const Point3f* dx_row = dx.ptr<Point3f>(y); in find()
1102 const Point3f* dy_row = dy.ptr<Point3f>(y); in find()
1103 float* dx_row_ = dx_[i].ptr<float>(y); in find()
1104 float* dy_row_ = dy_[i].ptr<float>(y); in find()
1122 for (int y = 0; y < img_size.height; ++y) in setGraphWeightsColor() local
1127 graph.addTermWeights(v, mask1.at<uchar>(y, x) ? terminal_cost_ : 0.f, in setGraphWeightsColor()
1128 mask2.at<uchar>(y, x) ? terminal_cost_ : 0.f); in setGraphWeightsColor()
1134 for (int y = 0; y < img_size.height; ++y) in setGraphWeightsColor() local
1138 int v = y * img_size.width + x; in setGraphWeightsColor()
1141 float weight = normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x)) + in setGraphWeightsColor()
1142 normL2(img1.at<Point3f>(y, x + 1), img2.at<Point3f>(y, x + 1)) + in setGraphWeightsColor()
1144 if (!mask1.at<uchar>(y, x) || !mask1.at<uchar>(y, x + 1) || in setGraphWeightsColor()
1145 !mask2.at<uchar>(y, x) || !mask2.at<uchar>(y, x + 1)) in setGraphWeightsColor()
1149 if (y < img_size.height - 1) in setGraphWeightsColor()
1151 float weight = normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x)) + in setGraphWeightsColor()
1152 normL2(img1.at<Point3f>(y + 1, x), img2.at<Point3f>(y + 1, x)) + in setGraphWeightsColor()
1154 if (!mask1.at<uchar>(y, x) || !mask1.at<uchar>(y + 1, x) || in setGraphWeightsColor()
1155 !mask2.at<uchar>(y, x) || !mask2.at<uchar>(y + 1, x)) in setGraphWeightsColor()
1172 for (int y = 0; y < img_size.height; ++y) in setGraphWeightsColorGrad() local
1177 graph.addTermWeights(v, mask1.at<uchar>(y, x) ? terminal_cost_ : 0.f, in setGraphWeightsColorGrad()
1178 mask2.at<uchar>(y, x) ? terminal_cost_ : 0.f); in setGraphWeightsColorGrad()
1184 for (int y = 0; y < img_size.height; ++y) in setGraphWeightsColorGrad() local
1188 int v = y * img_size.width + x; in setGraphWeightsColorGrad()
1191 float grad = dx1.at<float>(y, x) + dx1.at<float>(y, x + 1) + in setGraphWeightsColorGrad()
1192 dx2.at<float>(y, x) + dx2.at<float>(y, x + 1) + weight_eps; in setGraphWeightsColorGrad()
1193 float weight = (normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x)) + in setGraphWeightsColorGrad()
1194 … normL2(img1.at<Point3f>(y, x + 1), img2.at<Point3f>(y, x + 1))) / grad + in setGraphWeightsColorGrad()
1196 if (!mask1.at<uchar>(y, x) || !mask1.at<uchar>(y, x + 1) || in setGraphWeightsColorGrad()
1197 !mask2.at<uchar>(y, x) || !mask2.at<uchar>(y, x + 1)) in setGraphWeightsColorGrad()
1201 if (y < img_size.height - 1) in setGraphWeightsColorGrad()
1203 float grad = dy1.at<float>(y, x) + dy1.at<float>(y + 1, x) + in setGraphWeightsColorGrad()
1204 dy2.at<float>(y, x) + dy2.at<float>(y + 1, x) + weight_eps; in setGraphWeightsColorGrad()
1205 float weight = (normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x)) + in setGraphWeightsColorGrad()
1206 … normL2(img1.at<Point3f>(y + 1, x), img2.at<Point3f>(y + 1, x))) / grad + in setGraphWeightsColorGrad()
1208 if (!mask1.at<uchar>(y, x) || !mask1.at<uchar>(y + 1, x) || in setGraphWeightsColorGrad()
1209 !mask2.at<uchar>(y, x) || !mask2.at<uchar>(y + 1, x)) in setGraphWeightsColorGrad()
1237 for (int y = -gap; y < roi.height + gap; ++y) in findInPair() local
1241 int y1 = roi.y - tl1.y + y; in findInPair()
1245 subimg1.at<Point3f>(y + gap, x + gap) = img1.at<Point3f>(y1, x1); in findInPair()
1246 submask1.at<uchar>(y + gap, x + gap) = mask1.at<uchar>(y1, x1); in findInPair()
1247 subdx1.at<float>(y + gap, x + gap) = dx1.at<float>(y1, x1); in findInPair()
1248 subdy1.at<float>(y + gap, x + gap) = dy1.at<float>(y1, x1); in findInPair()
1252 subimg1.at<Point3f>(y + gap, x + gap) = Point3f(0, 0, 0); in findInPair()
1253 submask1.at<uchar>(y + gap, x + gap) = 0; in findInPair()
1254 subdx1.at<float>(y + gap, x + gap) = 0.f; in findInPair()
1255 subdy1.at<float>(y + gap, x + gap) = 0.f; in findInPair()
1258 int y2 = roi.y - tl2.y + y; in findInPair()
1262 subimg2.at<Point3f>(y + gap, x + gap) = img2.at<Point3f>(y2, x2); in findInPair()
1263 submask2.at<uchar>(y + gap, x + gap) = mask2.at<uchar>(y2, x2); in findInPair()
1264 subdx2.at<float>(y + gap, x + gap) = dx2.at<float>(y2, x2); in findInPair()
1265 subdy2.at<float>(y + gap, x + gap) = dy2.at<float>(y2, x2); in findInPair()
1269 subimg2.at<Point3f>(y + gap, x + gap) = Point3f(0, 0, 0); in findInPair()
1270 submask2.at<uchar>(y + gap, x + gap) = 0; in findInPair()
1271 subdx2.at<float>(y + gap, x + gap) = 0.f; in findInPair()
1272 subdy2.at<float>(y + gap, x + gap) = 0.f; in findInPair()
1297 for (int y = 0; y < roi.height; ++y) in findInPair() local
1301 if (graph.inSourceSegment((y + gap) * (roi.width + 2 * gap) + x + gap)) in findInPair()
1303 if (mask1.at<uchar>(roi.y - tl1.y + y, roi.x - tl1.x + x)) in findInPair()
1304 mask2.at<uchar>(roi.y - tl2.y + y, roi.x - tl2.x + x) = 0; in findInPair()
1308 if (mask2.at<uchar>(roi.y - tl2.y + y, roi.x - tl2.x + x)) in findInPair()
1309 mask1.at<uchar>(roi.y - tl1.y + y, roi.x - tl1.x + x) = 0; in findInPair()
1344 for (int y = 0; y < src[i].rows; ++y) in find() local
1346 const Point3f* dx_row = dx.ptr<Point3f>(y); in find()
1347 const Point3f* dy_row = dy.ptr<Point3f>(y); in find()
1348 float* dx_row_ = dx_[i].ptr<float>(y); in find()
1349 float* dy_row_ = dy_[i].ptr<float>(y); in find()
1380 for (int y = -gap; y < roi.height + gap; ++y) in findInPair() local
1384 int y1 = roi.y - tl1.y + y; in findInPair()
1388 subimg1.at<Point3f>(y + gap, x + gap) = img1.at<Point3f>(y1, x1); in findInPair()
1389 submask1.at<uchar>(y + gap, x + gap) = mask1.at<uchar>(y1, x1); in findInPair()
1390 subdx1.at<float>(y + gap, x + gap) = dx1.at<float>(y1, x1); in findInPair()
1391 subdy1.at<float>(y + gap, x + gap) = dy1.at<float>(y1, x1); in findInPair()
1395 subimg1.at<Point3f>(y + gap, x + gap) = Point3f(0, 0, 0); in findInPair()
1396 submask1.at<uchar>(y + gap, x + gap) = 0; in findInPair()
1397 subdx1.at<float>(y + gap, x + gap) = 0.f; in findInPair()
1398 subdy1.at<float>(y + gap, x + gap) = 0.f; in findInPair()
1401 int y2 = roi.y - tl2.y + y; in findInPair()
1405 subimg2.at<Point3f>(y + gap, x + gap) = img2.at<Point3f>(y2, x2); in findInPair()
1406 submask2.at<uchar>(y + gap, x + gap) = mask2.at<uchar>(y2, x2); in findInPair()
1407 subdx2.at<float>(y + gap, x + gap) = dx2.at<float>(y2, x2); in findInPair()
1408 subdy2.at<float>(y + gap, x + gap) = dy2.at<float>(y2, x2); in findInPair()
1412 subimg2.at<Point3f>(y + gap, x + gap) = Point3f(0, 0, 0); in findInPair()
1413 submask2.at<uchar>(y + gap, x + gap) = 0; in findInPair()
1414 subdx2.at<float>(y + gap, x + gap) = 0.f; in findInPair()
1415 subdy2.at<float>(y + gap, x + gap) = 0.f; in findInPair()
1446 for (int y = 0; y < roi.height; ++y) in findInPair() local
1450 if (labels(y + gap, x + gap)) in findInPair()
1452 if (mask1.at<uchar>(roi.y - tl1.y + y, roi.x - tl1.x + x)) in findInPair()
1453 mask2.at<uchar>(roi.y - tl2.y + y, roi.x - tl2.x + x) = 0; in findInPair()
1457 if (mask2.at<uchar>(roi.y - tl2.y + y, roi.x - tl2.x + x)) in findInPair()
1458 mask1.at<uchar>(roi.y - tl1.y + y, roi.x - tl1.x + x) = 0; in findInPair()
1483 for (int y = 0; y < img_size.height; ++y) in setGraphWeightsColor() local
1487 float source = mask1.at<uchar>(y, x) ? terminal_cost_ : 0.f; in setGraphWeightsColor()
1488 float sink = mask2.at<uchar>(y, x) ? terminal_cost_ : 0.f; in setGraphWeightsColor()
1489 terminals_(y, x) = saturate_cast<int>((source - sink) * 255.f); in setGraphWeightsColor()
1495 for (int y = 0; y < img_size.height; ++y) in setGraphWeightsColor() local
1501 float weight = normL2(img1.at<Point3f>(y, x - 1), img2.at<Point3f>(y, x - 1)) + in setGraphWeightsColor()
1502 normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x)) + in setGraphWeightsColor()
1504 if (!mask1.at<uchar>(y, x - 1) || !mask1.at<uchar>(y, x) || in setGraphWeightsColor()
1505 !mask2.at<uchar>(y, x - 1) || !mask2.at<uchar>(y, x)) in setGraphWeightsColor()
1507 leftT_(x, y) = saturate_cast<int>(weight * 255.f); in setGraphWeightsColor()
1510 leftT_(x, y) = 0; in setGraphWeightsColor()
1514 float weight = normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x)) + in setGraphWeightsColor()
1515 normL2(img1.at<Point3f>(y, x + 1), img2.at<Point3f>(y, x + 1)) + in setGraphWeightsColor()
1517 if (!mask1.at<uchar>(y, x) || !mask1.at<uchar>(y, x + 1) || in setGraphWeightsColor()
1518 !mask2.at<uchar>(y, x) || !mask2.at<uchar>(y, x + 1)) in setGraphWeightsColor()
1520 rightT_(x, y) = saturate_cast<int>(weight * 255.f); in setGraphWeightsColor()
1523 rightT_(x, y) = 0; in setGraphWeightsColor()
1525 if (y > 0) in setGraphWeightsColor()
1527 float weight = normL2(img1.at<Point3f>(y - 1, x), img2.at<Point3f>(y - 1, x)) + in setGraphWeightsColor()
1528 normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x)) + in setGraphWeightsColor()
1530 if (!mask1.at<uchar>(y - 1, x) || !mask1.at<uchar>(y, x) || in setGraphWeightsColor()
1531 !mask2.at<uchar>(y - 1, x) || !mask2.at<uchar>(y, x)) in setGraphWeightsColor()
1533 top_(y, x) = saturate_cast<int>(weight * 255.f); in setGraphWeightsColor()
1536 top_(y, x) = 0; in setGraphWeightsColor()
1538 if (y < img_size.height - 1) in setGraphWeightsColor()
1540 float weight = normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x)) + in setGraphWeightsColor()
1541 normL2(img1.at<Point3f>(y + 1, x), img2.at<Point3f>(y + 1, x)) + in setGraphWeightsColor()
1543 if (!mask1.at<uchar>(y, x) || !mask1.at<uchar>(y + 1, x) || in setGraphWeightsColor()
1544 !mask2.at<uchar>(y, x) || !mask2.at<uchar>(y + 1, x)) in setGraphWeightsColor()
1546 bottom_(y, x) = saturate_cast<int>(weight * 255.f); in setGraphWeightsColor()
1549 bottom_(y, x) = 0; in setGraphWeightsColor()
1575 for (int y = 0; y < img_size.height; ++y) in setGraphWeightsColorGrad() local
1579 float source = mask1.at<uchar>(y, x) ? terminal_cost_ : 0.f; in setGraphWeightsColorGrad()
1580 float sink = mask2.at<uchar>(y, x) ? terminal_cost_ : 0.f; in setGraphWeightsColorGrad()
1581 terminals_(y, x) = saturate_cast<int>((source - sink) * 255.f); in setGraphWeightsColorGrad()
1587 for (int y = 0; y < img_size.height; ++y) in setGraphWeightsColorGrad() local
1593 float grad = dx1.at<float>(y, x - 1) + dx1.at<float>(y, x) + in setGraphWeightsColorGrad()
1594 dx2.at<float>(y, x - 1) + dx2.at<float>(y, x) + weight_eps; in setGraphWeightsColorGrad()
1595 float weight = (normL2(img1.at<Point3f>(y, x - 1), img2.at<Point3f>(y, x - 1)) + in setGraphWeightsColorGrad()
1596 normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x))) / grad + in setGraphWeightsColorGrad()
1598 if (!mask1.at<uchar>(y, x - 1) || !mask1.at<uchar>(y, x) || in setGraphWeightsColorGrad()
1599 !mask2.at<uchar>(y, x - 1) || !mask2.at<uchar>(y, x)) in setGraphWeightsColorGrad()
1601 leftT_(x, y) = saturate_cast<int>(weight * 255.f); in setGraphWeightsColorGrad()
1604 leftT_(x, y) = 0; in setGraphWeightsColorGrad()
1608 float grad = dx1.at<float>(y, x) + dx1.at<float>(y, x + 1) + in setGraphWeightsColorGrad()
1609 dx2.at<float>(y, x) + dx2.at<float>(y, x + 1) + weight_eps; in setGraphWeightsColorGrad()
1610 float weight = (normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x)) + in setGraphWeightsColorGrad()
1611 … normL2(img1.at<Point3f>(y, x + 1), img2.at<Point3f>(y, x + 1))) / grad + in setGraphWeightsColorGrad()
1613 if (!mask1.at<uchar>(y, x) || !mask1.at<uchar>(y, x + 1) || in setGraphWeightsColorGrad()
1614 !mask2.at<uchar>(y, x) || !mask2.at<uchar>(y, x + 1)) in setGraphWeightsColorGrad()
1616 rightT_(x, y) = saturate_cast<int>(weight * 255.f); in setGraphWeightsColorGrad()
1619 rightT_(x, y) = 0; in setGraphWeightsColorGrad()
1621 if (y > 0) in setGraphWeightsColorGrad()
1623 float grad = dy1.at<float>(y - 1, x) + dy1.at<float>(y, x) + in setGraphWeightsColorGrad()
1624 dy2.at<float>(y - 1, x) + dy2.at<float>(y, x) + weight_eps; in setGraphWeightsColorGrad()
1625 float weight = (normL2(img1.at<Point3f>(y - 1, x), img2.at<Point3f>(y - 1, x)) + in setGraphWeightsColorGrad()
1626 normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x))) / grad + in setGraphWeightsColorGrad()
1628 if (!mask1.at<uchar>(y - 1, x) || !mask1.at<uchar>(y, x) || in setGraphWeightsColorGrad()
1629 !mask2.at<uchar>(y - 1, x) || !mask2.at<uchar>(y, x)) in setGraphWeightsColorGrad()
1631 top_(y, x) = saturate_cast<int>(weight * 255.f); in setGraphWeightsColorGrad()
1634 top_(y, x) = 0; in setGraphWeightsColorGrad()
1636 if (y < img_size.height - 1) in setGraphWeightsColorGrad()
1638 float grad = dy1.at<float>(y, x) + dy1.at<float>(y + 1, x) + in setGraphWeightsColorGrad()
1639 dy2.at<float>(y, x) + dy2.at<float>(y + 1, x) + weight_eps; in setGraphWeightsColorGrad()
1640 float weight = (normL2(img1.at<Point3f>(y, x), img2.at<Point3f>(y, x)) + in setGraphWeightsColorGrad()
1641 … normL2(img1.at<Point3f>(y + 1, x), img2.at<Point3f>(y + 1, x))) / grad + in setGraphWeightsColorGrad()
1643 if (!mask1.at<uchar>(y, x) || !mask1.at<uchar>(y + 1, x) || in setGraphWeightsColorGrad()
1644 !mask2.at<uchar>(y, x) || !mask2.at<uchar>(y + 1, x)) in setGraphWeightsColorGrad()
1646 bottom_(y, x) = saturate_cast<int>(weight * 255.f); in setGraphWeightsColorGrad()
1649 bottom_(y, x) = 0; in setGraphWeightsColorGrad()