View Single Post
  #18   Spotlight this post!  
Unread 27-01-2013, 02:09
bmbroom bmbroom is offline
Registered User
FRC #3103
 
Join Date: Jan 2013
Location: Houston
Posts: 2
bmbroom is an unknown quantity at this point
Re: Sample Vision Code, ComputeThreshold() exception

Quote:
Originally Posted by Pulverator View Post
I'm pretty sure it passes by pointer as this is the declaration in AxisCamera.h.
Code:
int GetImage(ColorImage *image);
It's my understanding that calling this method will set the passed pointer which in this case is "image."
My understanding is that it can change whatever image is pointing to, but to change image itself it needs a pointer/reference to the image variable itself.

Trying storing a known value in image before calling GetImage and then comparing that to the value on return.
Code:
ColorImage *image = NULL;
camera.GetImage (image);
SmartDashboard::PutString ("image changed", image == NULL ? "no" : "yes");
(Apologies in advance if I messed up the syntax/function calls. This is from memory. I hope you get the general idea.)

P.S. Don't keep processing if image==NULL, the pointer dereference will cause an error.

In our tests, the value in image never changed.

I looked for other ways to initialize image but couldn't find anything.

One thing I'll try when I next get a chance on the robot will be to put the access to the test image back in and see if that will work as a workable initializer.
Reply With Quote