why do i get this error
masked = cv2.bitwise_and(img,img,mask=mask[:,:,2])
cv2_imshow(masked)
cv2.waitKey(0) # Cleanup after any key is pressed
cv2.destroyAllWindows()
This is my code 👆🏽
error Traceback (most recent call last)
<ipython-input-49-5e3cd31dccb0> in <module>()
1 #layer 2 is the red layer. Rememeber (B,G,R)
----> 2 masked = cv2.bitwise_and(img,img,mask=mask[:,:,2])
3 cv2_imshow(masked)
4
5 cv2.waitKey(0) # Cleanup after any key is pressed
error: OpenCV(4.1.2) /io/opencv/modules/core/src/arithm.cpp:245: error: (-215:Assertion failed) (mtype == CV_8U || mtype == CV_8S) && _mask.sameSize(*psrc1) in function 'binary_op'
And the error 👆🏽 P.S. I am using Google Colaboratory
sorry for the downvote, but before asking anywhere, you should try to debug it locally (and use your own head, mate !).
it's either the type or the size, so print that out for all your input arrays (and then probably facepalm ..)
besides that, you cannot use this code on colab:
that's why they have the cv2_imshow() dropin in the 1st place ....