Sohaib
Sohaib

Reputation: 4704

Range of HSV values to sample an Image as done by adobe

I have an image as shown in the inset. I sampled it in Adobe Photoshop using the blue color as the image shows. The sampled image is shown in gray-scale on the left.

I know that openCV provides a similar method to sample images that is the inRange() function. How can I find out the range of HSV values that Adobe checked for to sample my image. Since the resultant image is pretty much what I want and I am not able to determine the range myself It would be a great help if some one could guide me for the same.

Photoshop Sampled

Upvotes: 0

Views: 625

Answers (1)

Michele mpp Marostica
Michele mpp Marostica

Reputation: 2472

You can convert your image in HSV with cv::cvtColor(...) here the documentation

Then accordingly to Wikipedia the blue is near to 240° of the HUE channel of your image. You can set something like maxHue = 270 and a minHue = 180 or other values to scan your image.

Maybe you should set a minSaturation and a minValue to avoid the black and white.

To find the best ranges you can link them with some sliders in a Qt GUI and change them until you get the same result as photoshop...

Upvotes: 1

Related Questions