How can I detect green colors in an image?

I'm developing a code to detect objects in an image through the algorithm of Viola and Jones, but it did not work out perfectly because the image has many details. So I decided to start by first detecting the color and then defining the objects through recognition. How can I detect green colors in an image? Since I'm grateful!

Respuestas (2)

KALYAN ACHARJYA
KALYAN ACHARJYA el 27 de Nov. de 2018
Editada: KALYAN ACHARJYA el 27 de Nov. de 2018
See color detection is very vast topic, any color generation based on three components R, G,B.
Green color also varies from lower to maximum.
Are you looking for those pixels which having R=0,G=Maximum Level, and B=0? In 8 bit image it would be (0,255,0)
green_component=imageRGB(:,:,2)

4 comentarios

KALYAN ACHARJYA
KALYAN ACHARJYA el 27 de Nov. de 2018
No, if you want to detect the scale of green then you can use conditioning.
Color is subjective term (human perception), better to talk with pixel values
There are numerous article on color detection, check here custom function.
Raphael Ferreira
Raphael Ferreira el 27 de Nov. de 2018
Does this function detect on any scale of green? How to in this image:
IMG_5179 (Cópia).JPG
Raphael Ferreira
Raphael Ferreira el 27 de Nov. de 2018
Okay! I'll look!
Raphael Ferreira
Raphael Ferreira el 27 de Nov. de 2018
Editada: Raphael Ferreira el 27 de Nov. de 2018
I can detect it with your code KALYAN ACHARJYA . However the lighting of the image influences a lot. Is there any function or code that leaves the illumination in the uniform image?

Iniciar sesión para comentar.

SC P
SC P el 29 de Nov. de 2018

0 votos

How to detect green color variation?

Preguntada:

el 27 de Nov. de 2018

Respondida:

el 29 de Nov. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by