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

Assertion failed #33

Closed
shxiangyan opened this issue May 4, 2020 · 2 comments
Closed

Assertion failed #33

shxiangyan opened this issue May 4, 2020 · 2 comments

Comments

@shxiangyan
Copy link

There is no problem in running the alignment part of the demo.What is the reason for the following error when running my own picture?

python test_pre_process.py -i sample_data/my_photo/

Traceback (most recent call last):
File "test_pre_process.py", line 108, in
back_align = alignImages(back, image,mask)
File "test_pre_process.py", line 42, in alignImages
im1Reg = cv2.warpPerspective(im1, h, (width, height))
cv2.error: OpenCV(3.4.5) /io/opencv/modules/imgproc/src/imgwarp.cpp:2927: error: (-215:Assertion failed) (M0.type() == CV_32F || M0.type() == CV_64F) && M0.rows == 3 && M0.cols == 3 in function 'warpPerspective'

@sunkest
Copy link

sunkest commented May 7, 2020

I have same issue, and I recognized that the matrix H(returned from cv2.findHomography) was None.
I found that cv2.findHomography can return None if the matrix H cannot be calculated but I could not find any solution for that..
Is anybody know how to solve the problem?

@senguptaumd
Copy link
Owner

This may happen if the background is featureless, like a flat wall. For homography, it needs to find sufficient keypoints via AKAZE features, match them reliably and calculate homography (needs at least 8 points), if not it will break.

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

3 participants