
24-02-2012, 23:39
|
 |
Programming Lead
AKA: Joe Doyle
 FRC #2729 (Storm)
Team Role: Programmer
|
|
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
|
|
|
Re: Tracking Multiple Targets
I see quite a bit wrong with that code... so I'll break it down one piece at a time: - Remove large objects - You don't catch its return (which is a BinaryImage), so you have a memory leak. Also, I'm a little confused about why you want to remove large objects. I'd assume that the targets would come out as fairly large objects, so you're probably removing the very things you're trying to track.
- Convex hull - You don't catch this return either, so more memory leaked. This operation, though, is worthwhile, though if you're going to do, say, a small object removal, you probably want this first.
- filteredImage - You never use this (and never free it, so leak there).
- Operations are cumulative, but provide you with new images - You repeatedly perform operations on bImg. None of these operations actually affect bImg, but instead return a new image, which contains the transformed bImg. To do, say, a convex hull, without allocating a new BinaryImage, you would have to do NIVision.convexHull(bImg.image,bImg.image,0);
- You're still only tracking the bottom target.
So in short, no, I don't think it can track multiple targets. It's a step in the right direction, but you definitely made some mistakes.
|