error: (-209) The operation is neither 'array op array' (where arrays have the same size and type),
nor 'array op scalar', nor 'scalar op array' in function cv::binary_op
Solution: input data into np.uint8 type, such as
img = img.astype(np.uint8)