0

In my live video from my web cam i am trying to track yellow, green and blue color objects (in opencv-python). I detected each color seperately as given here. so that i can combine the results. Is there a better way to this are there any libraries available to do this

Community
  • 1
  • 1
user93
  • 1,866
  • 5
  • 26
  • 45
  • since i intended to live video processing this method causes enormous amount of delay so it is not good as expected. – user93 Mar 10 '15 at 10:08
  • Out of curiosity, are you filtering each color on the same frame or separate frames when combining? Also have you tried using a lower waitkey – Eni Mar 10 '15 at 11:19
  • It might be an issue with the way you're combining the thresholds, can you supply the code – Eni Mar 10 '15 at 11:19
  • i apply filters to multiple copy of the frame so that each color gets detected separately and i combine these frames so that i can get the detected objects in one frame – user93 Mar 10 '15 at 11:23
  • So what is your current waitkey value, resolution you're capturing the image at and frame rate? when filtering only a single color – Eni Mar 10 '15 at 11:32
  • Because the application you decribed is not really that intensive to severy affect the framerate – Eni Mar 10 '15 at 11:34

1 Answers1

0

Check this post: https://stackoverflow.com/a/10951189/4653204

You can use this and build further on it for multiple colors..

Community
  • 1
  • 1
  • the real problem is detecting different colors which are not very close to each other. So if I try to extend scale then many unwanted colors also gets detected. also if there are any libraries that perform the method i used in a more fine tuned way it would be better. – user93 Mar 10 '15 at 10:16
  • Yes, but you should not create 1 filter and then search within that. You should create 3 different color filters (yellow, green and blue), so you can specify the correct range for a color. Then apply a filter, search your desired object, then the next color, apply filter, search object, and etc. –  Mar 10 '15 at 10:29
  • Btw, pre-defined functions aren't always better for as I've experienced. If you create your own function, you can get more specific results and always tweak as you'd like.. –  Mar 10 '15 at 10:31
  • it is how i did initially but combining them is what takes more time and since i am trying to process live video this delay is very high above acceptable value. I am trying to track the object not just detect it. – user93 Mar 10 '15 at 10:47
  • Well.. I also have a color filtering live tracking kind of application which unfortunately works at 4 / 5 frames per second at 1080p. Kind of the best I could get out of it. You'd need some bad-ass multi core processing power to get to +- 27 f/p.s. Orrrr maybe, process it with CUDA, using the graphical card processing power. You'll get some massive improvements. But real real-time? "Maybe". My graphical card isn't supported by OpenCV, but maybe you'll have better luck. Search youtube for: CUDA opencv. You'll get some examples. –  Mar 10 '15 at 11:21