Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

计算两张缺口滑动图时,报错(-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' #163

Open
yuzepeng opened this issue Jan 18, 2024 · 4 comments

Comments

@yuzepeng
Copy link

如题,使用det.slide_match(target_bytes, background_bytes)函数时 正确的传入了两张图片的byte数据,结果直接报一下错误

target = cv2.cvtColor(np.asarray(target), cv2.IMREAD_ANYCOLOR) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cv2.error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:196: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

使用的图片是 京东 登录时拼图验证图片

如果在slide_match函数调用时加上simple_target=True 不会报错 但是效果就不行了

@Lockey-J
Copy link

因为get_target函数有点问题。无法准确截取滑块导致。修改一下这个函数就可以了。

@zehuiguan
Copy link

因为get_target函数有点问题。无法准确截取滑块导致。修改一下这个函数就可以了。

请问这个怎么改呢

@Lockey-J
Copy link

Lockey-J commented Mar 2, 2024

使用opencv的轮廓。获取最大轮廓就行了。或者原函数增加2个y方向的缓存变量进行递进查找。

@JustForSmiling
Copy link

你好,请问滑块的小块图片怎么单独获取到的呀,一般情况下,小块不也是在大图上面吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants