i want to change the black pixels in the image to Red
i faced a problem with this i want to write this line in python
img_rgb .setTo(cv::Scalar(0,0,255), mask);
this the input image : http://i.stack.imgur.com/FjEXu.jpg
this is the masking image : http://i.stack.imgur.com/wWIcR.png
this is the output desired image : http://i.stack.imgur.com/vhb67.png
and my Code this :
import numpy as np import imutils
import cv2
img_rgb = cv2.imread('figi.jpg')
Conv_hsv_Gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
ret, mask = cv2.threshold(Conv_hsv_Gray, 0, 255,cv2.THRESH_BINARY_INV |cv2.THRESH_OTSU)
img_rgb.Set(mask,cv2.Scalar(0,0,255)) #the problem
cv2.imshow("imgOriginal", img_rgb)
cv2.imshow("output", res)
cv2.imshow("mask", mask)
cv2.waitKey(0)