Ask Your Question

detect colored bars from an object

asked 2014-03-09 07:01:02 -0500

madmax gravatar image


I am trying to filter for the colored bars like you can see in this image:

image description

Right now I try with a mean()over the rgb image and crop all under this threshold.
But then it looks like this:

image description

Do you have any idea what I could do better or other methods for getting the color?
Or should I just search for the colors? (There are about 10 colors that can occur)

edit retag flag offensive close merge delete



You can use the HSV-color wheel here to choose correct color.

Haris gravatar imageHaris ( 2014-03-09 22:55:47 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2014-03-10 19:18:57 -0500

wuling gravatar image

updated 2014-03-10 20:46:09 -0500

when you decide to use hsv color space then drawing histogram and try in error to get threshold value Remember that the in each color space min, & max. threshold value may fail in 0<=min<=max<=255 or 0~min & max~255. Finally you use morphology like erode,dilate,region filling etc,and get the shape you want.

edit flag offensive delete link more

answered 2014-03-09 07:26:28 -0500

wuling gravatar image

updated 2014-03-09 10:29:02 -0500

Hi try to use inRangelink text and cvcolor to coverter color space like hsv,cym etc to solve this problem

edit flag offensive delete link more


To filter all but the color bars or to filter for each color that can occur?

madmax gravatar imagemadmax ( 2014-03-09 13:06:59 -0500 )edit

There are two soluation here: 1. in color space(RGB ,HSV,CYM.......): use inRange 2. separate each color channel that easy to handle: use threshold. you can use filter to reduce some noise.

wuling gravatar imagewuling ( 2014-03-09 19:48:01 -0500 )edit

Just as a remark. The RBG (or BGR for OpenCV) is the worst color space for efficient color thresholding. I suggest using the HSV color space like suggested!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-03-10 10:03:54 -0500 )edit

Yes, for color detection I am using HSV already, but was wondering how I could segment the bars best.

madmax gravatar imagemadmax ( 2014-03-10 12:10:39 -0500 )edit

Question Tools


Asked: 2014-03-09 07:01:02 -0500

Seen: 740 times

Last updated: Mar 09 '14