OpenCV: get the highest value of R colord

asked 2015-02-25 05:33:36 -0500

begueradj gravatar image

updated 2015-02-25 06:49:51 -0500

I use this code to read an image:

import cv2


How can I get the higest value of the redcolor that exists in this picture ?

edit retag flag offensive close merge delete


I think you shall use the HSV space (cvtColor(img, COLOR_BGR2HSV)), then create a mask of blue colors (like around 240° that is 120 in H) and get the highest S

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-02-25 06:12:31 -0500 )edit

@begueradj , please, not so sloppy.

your title asks about red, your question about blue, you mention a LAB model, but your code does only bgr.

more effort, please !

berak gravatar imageberak ( 2015-02-25 06:15:21 -0500 )edit

@berak I was awkward ... sorry ...

begueradj gravatar imagebegueradj ( 2015-02-25 06:50:15 -0500 )edit

@begueradj you can edit the question and the code

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-02-25 06:54:24 -0500 )edit