Tracking by chroma in varying light conditions

asked 2019-07-03 14:36:26 -0500

eric_engineer gravatar image

updated 2019-07-04 09:44:42 -0500

I've been working with openCV to try to track a green ring. Basically I convert to HSV space, pyramid down twice, blur, then split the channels and equalize the V. Then I merge the channels, set upper and lower bounds for each channel and do an in-range. From there I do some circle detection using a simple Blob detector. All I'm after is the center of this ring as it moves around so I just want that keypoint.

What I find is it works great if I adjust the upper and lower bounds at my desk. Even if I turn off my light or shine a flashlight on it. But then I go out in the hallway under different light and it doesn't work. I can of course adjust it to get it to work.

Am I going about this the wrong way? I was thinking of next trying to run detection at different preset ranges, or a sliding window of ranges to find my circle.

Edit: Adding picture for clarity Tube

edit retag flag offensive close merge delete

Comments

2

How about widening the range of the H-component? Have you checked what H values you get in the hallway (and at your desk) or you just assumed it to be 60+-10 or 15?

Witek gravatar imageWitek ( 2019-07-03 17:15:36 -0500 )edit
1

I should have recorded the values. I set sliders for everything so I can adjust the range of H and S (and V if I want) and usually get a good result. The problem is then I get too much in my image and my circle detection fails. I realize I have a lot to learn about this.

eric_engineer gravatar imageeric_engineer ( 2019-07-03 17:20:29 -0500 )edit
1

It would be much easier to give you some hints if you posted some pictures where you want to detect the ring.

Witek gravatar imageWitek ( 2019-07-03 17:58:13 -0500 )edit

Sure I should have done that before. I added to my question up top. This is my tube, depending on the length of the tube you might see light through it like this, or it might be fairly dark in the center. Thank you for your help!

eric_engineer gravatar imageeric_engineer ( 2019-07-04 09:45:33 -0500 )edit