How can you make it in Python? I faced a problem with this line
img_rgb.Set(mask,cv2.Scalar(0,0,255))
and here is the code :
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))
cv2.imshow("imgOriginal", img_rgb) # show windows
cv2.imshow("output", res) # show windows
cv2.imshow("mask", mask) # show windows
cv2.waitKey(0)
ret, mask = cv2.threshold(Conv_hsv_Gray, 1, 255,cv2.THRESH_BINARY_INV)
(not sure whether thres value is inclusive or exclusive) instead. Please post your input image too, jpeg might introduce some artifacts so that "black" might not be "pure black". – Devora