mirror of
https://github.com/opencv/opencv.git
synced 2025-07-31 01:47:12 +08:00
Merge pull request #16950 from alalek:fix_16945
This commit is contained in:
commit
f15e885baf
@ -745,7 +745,9 @@ void DpSeamFinder::computeCosts(
|
||||
{
|
||||
for (int x = roi.x; x < roi.br().x+1; ++x)
|
||||
{
|
||||
if (labels_(y, x) == l && x > 0 && labels_(y, x-1) == l)
|
||||
if (x > 0 && x < labels_.cols &&
|
||||
labels_(y, x) == l && labels_(y, x-1) == l
|
||||
)
|
||||
{
|
||||
float costColor = (diff(image1, y + dy1, x + dx1 - 1, image2, y + dy2, x + dx2) +
|
||||
diff(image1, y + dy1, x + dx1, image2, y + dy2, x + dx2 - 1)) / 2;
|
||||
@ -769,7 +771,9 @@ void DpSeamFinder::computeCosts(
|
||||
{
|
||||
for (int x = roi.x; x < roi.br().x; ++x)
|
||||
{
|
||||
if (labels_(y, x) == l && y > 0 && labels_(y-1, x) == l)
|
||||
if (y > 0 && y < labels_.rows &&
|
||||
labels_(y, x) == l && labels_(y-1, x) == l
|
||||
)
|
||||
{
|
||||
float costColor = (diff(image1, y + dy1 - 1, x + dx1, image2, y + dy2, x + dx2) +
|
||||
diff(image1, y + dy1, x + dx1, image2, y + dy2 - 1, x + dx2)) / 2;
|
||||
|
Loading…
Reference in New Issue
Block a user