View Single Post
  #11   Spotlight this post!  
Unread 24-01-2013, 14:34
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: Sample Vision Code, ComputeThreshold() exception

Last year, people had some issues with images that were valid pointers (I think), but had 0 width, and would crash (due to an exception). I used this guard code after getting the image, but before converting to a binaryImage.
Code:
Code:
if ((colorImage == (void *) 0) || (colorImage->GetWidth() == 0) || (colorImage->GetHeight() == 0))
{
return returnVal;
}
Similarly, you should check the binary image after it is created.

My full code is here: https://github.com/TeamExcel/Project.../Robot2012.cpp
Line 795 has the camera code.
Edit/Delete Message
Reply With Quote