OpenCV: get the highest value of R colord

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

begueradj gravatar image

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

I use this code to read an image:

import cv2

imbgr=cv2.imread('rgbpic.jpg')

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

edit retag flag offensive close merge delete

Comments

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 -0600 )edit
2

@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 -0600 )edit

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

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

@begueradj you can edit the question and the code

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