detect objects using Look up table-LUT

hi sir, can I know how to define the HSV look up table when I wanna used it to detect object.thanks.

2 Comments

I guess you will can have a array to do this. why not? Each element is a possible object. You can add new object to that array. how big the array is the question. too large takes time. then you will have a way to like binary search. if you know what i mean.
Brian,How to assign LUT in matlab? same with matlab Blobs demo..?how to make it robust.

Sign in to comment.

 Accepted Answer

HSV has floating point values so you don't use a lookup table. You can use thresholding, like I do in my HSV color detection demo.

6 Comments

Tulips
Tulips on 21 Oct 2012
Edited: Tulips on 21 Oct 2012
Yes, I'd tried it up.its good actually. however, is it possible if I wanna combine the different value of hue and saturation to detect others objects. e.g. bump sign or yield sign..how can I do that. thanks me answering me?
Just threshold each and combine
hBinary = h > hLow & h < hHigh;
sBinary = s > sLow & s < sHigh;
vBinary = v > vlow & v < vHigh;
overallBinary = hBinary & sBinary & vBinary;
Tulips
Tulips on 21 Oct 2012
Edited: Tulips on 21 Oct 2012
sir, the above algortihm is robust to all object detection by using HSV threshold?I need to use for and if loops right?because of the HSV threshold have different value for different colors, right?
sir, I have tried it up but seems doesnt work!please advice.
No it is not robust for detecting all objects. It will only get those pixels with colors that can be selected by carving out a cylindrical sector in hsv color space. Imagine that hsv is a cylindrical color space. Bright and dark is up and down. The hue goes around the circumference as the colors in a rainbow. And as you go in and out radially, the saturation goes from really pure colors (red, blue, etc.) to less saturated colors (pink, sky blue) to neutral (a shade of gray). Take a look at my avatar to the left. I'm sure you can find pictures of hsv color space on the internet.
I have code that does work for hsv color detection in my File Exchange. Did you check that out? Because that is the advice I'd give. You can adapt it to read in your image, and adjust the high and low thresholds for each color channel to extract out pixels in the cylindrical sector and see what pixels they correspond to in your image.
thanks sir for answering my q's. finally I can combine the color to detect object in different colors. however, just like u said, its not robust .e.g. the input is red and blue.If I want to detect red, it will detect rd and blue also.how to eliminate this?because in my threshold value the hsv color space to detect red,blue and yellow sign has been assigned.When given input is red and blue , how can I detect only red color and remove blue color, instead of using bwareaopen?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!