You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I tested seamlessClone, I have noticed that the placement of the crop that I used is different from the case where I use simple alpha-blend. Digging into the code, I have noticed this:
Meaning that seamless clone, crops the src image, and the mask to remove zero margins from the mask - this is probably for improving the performance of the module. In this process, seamlessClone places the cropped source image on the destination image where the Point p is the center of the cropped source (after margin removal) - and not the center of the original source. This will cause a deviation in relation to the original InputArray _src that is provided to the function.
I think that this behavior is wrong or at least misleading - as when a developer uses the seamlessClone function, the information that is generally available (in the debug phase) - is the shapes of the destination, source & the mask images (knowing the zero margins is not always trivial). If this is intentional, then it should be documented here: https://docs.opencv.org/4.x/df/da0/group__photo__clone.html#ga2bf426e4c93a6b1f21705513dfeca49d
I suggest adding an offset to the destination ROI that will cancel the change of location of the original src image. The offset can be added here:
System information (version)
Detailed description
When I tested seamlessClone, I have noticed that the placement of the crop that I used is different from the case where I use simple alpha-blend. Digging into the code, I have noticed this:
opencv/modules/photo/src/seamless_cloning.cpp
Lines 81 to 83 in 2b60166
Meaning that seamless clone, crops the src image, and the mask to remove zero margins from the mask - this is probably for improving the performance of the module. In this process, seamlessClone places the cropped source image on the destination image where the
Point p
is the center of the cropped source (after margin removal) - and not the center of the original source. This will cause a deviation in relation to the originalInputArray _src
that is provided to the function.I think that this behavior is wrong or at least misleading - as when a developer uses the seamlessClone function, the information that is generally available (in the debug phase) - is the shapes of the destination, source & the mask images (knowing the zero margins is not always trivial). If this is intentional, then it should be documented here:
https://docs.opencv.org/4.x/df/da0/group__photo__clone.html#ga2bf426e4c93a6b1f21705513dfeca49d
I suggest adding an offset to the destination ROI that will cancel the change of location of the original src image. The offset can be added here:
opencv/modules/photo/src/seamless_cloning.cpp
Line 83 in 2b60166
Thanks,
Roee
Issue submission checklist
I report the issue, it's not a question
I checked the problem with documentation, FAQ, open issues,
forum.opencv.org, Stack Overflow, etc and have not found any solution
I updated to the latest OpenCV version and the issue is still there
There is reproducer code and related data files: videos, images, onnx, etc
The text was updated successfully, but these errors were encountered: