When running cv2.seamlessClone() the error is a bit misleading when the incorrect image path is supplied. It doesn't make it obvious that the problem is in the path
import cv2
# Read images
DATA_PATH = "data_set/data"
source = cv2.imread(f"{DATA_PATH}/this image doesn't exist.png")
target = cv2.imread(f"{DATA_PATH}/10226_bg_27794.png")
swap = cv2.imread(f"{DATA_PATH}/10226_sw_27794_19200.png")
mask = cv2.imread(f"{DATA_PATH}/10226_mask_27794_19200.png")
# mask = mask/255
center = (112, 112)
output_normal = cv2.seamlessClone(swap, target, mask, center, cv2.NORMAL_CLONE)
output_mixed = cv2.seamlessClone(swap, target, mask, center, cv2.MIXED_CLONE)
# Output
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-3-faf121550370> in <module>
10 # mask = mask/255
11 center = (112, 112)
---> 12 output_normal = cv2.seamlessClone(swap, target, mask, center, cv2.NORMAL_CLONE)
13 output_mixed = cv2.seamlessClone(swap, target, mask, center, cv2.MIXED_CLONE)
error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-kh7iq4w7\opencv\modules\core\src\matrix.cpp:811: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'cv::Mat::Mat'
System information (version)
Detailed description
When running cv2.seamlessClone() the error is a bit misleading when the incorrect image path is supplied. It doesn't make it obvious that the problem is in the path
Steps to reproduce
Issue submission checklist
forum.opencv.org, Stack Overflow, etc and have not found solution