I am interested in overlaying a black and white skeleton image where skeleton pixels are 255 (white) onto a 3 channel RGB image. I am not biased towards using OpenCV but when I used the add function, I got the error for the shape incompatibility.
What is the way to do this?
import cv2
skl_img = cv2.imread("sample_skeleton_image/579366_2_train2017_skel.png", 0)
print(skl_img.shape)
plt.imshow(skl_img)
224x400
obj_img = cv2.imread("/content/drive/Shareddrives/Wish 2021/Code/sample_skeleton_image/579366_2_train2017.jpg", cv2.IMREAD_COLOR)
plt.imshow(obj_img)
obj_img shape is 224x400x3
final_img = cv2.add(obj_img,skl_img)
plt.imshow(final_img)
error Traceback (most recent call last)
<ipython-input-27-7de7a4136982> in <module>()
----> 1 final_img = cv2.add(obj_img,skl_img)
2 plt.imshow(final_img)
error: OpenCV(4.1.2) /io/opencv/modules/core/src/arithm.cpp:663: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'arithm_op'
Essentially, I am interested in a final image that looks like the following:







