Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I have an image which has black and another color. How do I check if it is within range and print the color?

I basically want to convert the image to hsv and then place boundaries. If it is within the given boundary it should print the color. For example if it is within the hsv region of red which I define, It should return a boolean value like 1 or 0 to another variable and using "if loops", I should be able to check and print it. This was my idea, but If there is any other function or method available plese let me know. any suggestion is valued. I have attached a sample image, if posible please show me a sample code for this, (But I first want to the bgr image convert to hsv).

I was wondering about the cv::inRange function but I don't know as to how it works. Please show me a sample code of how to go about this. I am new to opencv . Thanks a lot in advance.

Sample image : image description

I have an image which has black and another color. How do I check if it is within range and print the color?

I basically want to convert the image to hsv and then place boundaries. If it is within the given boundary it should print the color. For example if it is within the hsv region of red which I define, It should return a boolean value like 1 or 0 to another variable and using "if loops", I should be able to check and print it. This was my idea, but If there is any other function or method available plese let me know. any suggestion is valued. How do I have attached a sample image, if posible please show me a sample code for this, (But I first want to the bgr image convert to hsv).

I was wondering about the cv::inRange function but I don't know as to how it works. Please show me a sample code of how to go about this. I am new to opencv . it and if possible please help me with the code. Thanks a lot in advance.

Sample image : image description