hello every one
I want to extract one piece of a shape in a picture.
the solution for this is to make a black image and white rectangle in black image.
then the mask image and original image get in and operator to get out the piece of image.
but I get get Error “cv2.bitwise_and(img, blk_copy)”.
my code:
np_img = np.array(img)
black = np.zeros(img.shape)
white = np.ones(img.shape)
blk_copy = black.copy()
cv2.rectangle(blk_copy , (301 , 350) , (60, 110) , (255,255,255) , -1)
new_img = cv2.bitwise_and(img, img, mask = blk_copy)
cv2.imshow(“rec” , blk_copy)
cv2.imshow(“image” , new_img)
cv2.waitKey(0)
can anyone help me.
thanks.