OpenCV Python Feature Detection: how to provide a mask? (SIFT)

可紊 提交于 2019-12-05 11:33:01
m3h0w

Thanks to Miki I've managed to find a bug.

It turned out that my original mask that I created using threshold operations, even though looked binary, was a 3-channel image ([rows], [cols], 3). Thus it couldn't be accepted as a mask.

After checking for type and shape (has to be uint8 and [rows,cols,1]):

print(mask.dtype)
print(mask.shape)

Convert the mask to gray if it's still 3-channel:

mask = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!