How to detect a black rectangle in specific area of image?

2 views (last 30 days)
Hey everyone,
For my current project I want to track a moving black box in a video. But to start, I'd like to know how to do this in an image. I thought using HSV is the easiest, as in my case I'm trying to recognize pixels with [0 0 0] with a tolerance of [0.9 0.9 0.05]. However, I want to recognize this box inside of a specific frame within the image. After that, I want to know the coordinates of the center of gravity. I have tried using the colorDetectHSV script by Theodoros Giannakopoulos but I can't seem to get that one running either.
Does anyone know an easy way to do this?
Thanks in advance

Answers (0)

Community Treasure Hunt

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

Start Hunting!