Ask Your Question

convert the RGB image to a grayscale representation of its redness

asked 2016-04-22 10:16:40 -0600

updated 2016-04-22 10:21:22 -0600

berak gravatar image

Hi mate , I need RGB-->Grayscale_redness image that is to convert the more a pixel appears as red in the RGB image, the brighter it will be in the converted image.More specifically, it performs an RGB to Lab* color space conversion, then maps a range of a* values to grayscale values, such that white is assigned to the highest a* value resulting from the conversion, and black is assigned to a positive a* value determined by an algorithm parameter. How can I do ? Use Imgproc.cvtColor ( scr, dst , RGB2Lab ) or use Imgrpc.cvtColor( scr , dst , RGB2Gray ) and equalizeHist( scr, dst ) ? help me Please ? Thanks .

edit retag flag offensive close merge delete



can't you just take the RED bgr channel ? (this sounds overly complicated for no reason)

berak gravatar imageberak ( 2016-04-22 10:20:58 -0600 )edit

yes is a great idea . any tips to select only red channel by OpenCV ?

effedetto gravatar imageeffedetto ( 2016-04-22 11:56:55 -0600 )edit

in 3.10 version , it not work , moreover, I need to valutate the a* value for many threshold input . Any tips , to converse a* value to greyscale in 3.10 OpenCV ?

effedetto gravatar imageeffedetto ( 2016-04-28 11:59:04 -0600 )edit

Thx to whoever deleted my ObjC answer. I tried and was unable to get back in ...apparently it was when the hardware went out. Im 47, half blind, and didnt see the tag button that said java. :o) In my defense the font on the button is smaller and hard to read.....for older folks.

jmbapps gravatar imagejmbapps ( 2016-05-13 08:48:10 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-04-22 12:03:16 -0600

berak gravatar image

there's an easy way to achieve this:


 Mat image = ...
 Mat red = new Mat();
 Core.extractChannel(image, red, 2); // btw, it's bgr in opencv, not rgb.
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-04-22 10:16:40 -0600

Seen: 1,395 times

Last updated: Apr 22 '16