Ask Your Question

Mohamed_Elsayed's profile - activity

2020-09-23 13:46:55 -0600 received badge  Famous Question (source)
2020-02-13 19:09:34 -0600 received badge  Notable Question (source)
2019-11-05 02:00:19 -0600 received badge  Popular Question (source)
2016-08-23 16:18:14 -0600 received badge  Supporter (source)
2016-08-23 16:13:34 -0600 asked a question dtection the black objects

now im working on object black detection project with opencv using python and the pixels of the black is very small

snd do noisy to detect and i had tried to Convert the black color to red but no results as what i want and in tried to

invert the black color to white cuz the white pixels is easy to detect but no results .

so eny idea or eny sugg of new soloution .

2016-08-22 21:57:40 -0600 received badge  Student (source)
2016-08-20 23:41:03 -0600 asked a question 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)