![]() |
Re: Sample Vision Code, ComputeThreshold() exception
We are also having trouble getting an image using the sample vision code.
I am a complete newbie wrt the FRC competition, and doing my best to learn. The camera.GetImage (image) function is not returning anything in image. The sample code does not initialize image, so it could point to garbage. The call to camera.GetImage (image) passes image by value so I don't see how it could change image and in our tests it doesn't appear to. Since it initially contains a garbage pointer, this might explain some of the errors people send when the code attempts to dereference the pointer. I've tried to find/guess a way to initialize the pointer without success. The sample code doesn't show any way to initialize it, so it's very puzzling to me how it could work. The function documentation is not very information, and all the examples/help talks about what to do once you've obtained an image. Any basic help would be appreciated. |
Re: Sample Vision Code, ComputeThreshold() exception
Quote:
Code:
int GetImage(ColorImage *image); |
Re: Sample Vision Code, ComputeThreshold() exception
Quote:
Trying storing a known value in image before calling GetImage and then comparing that to the value on return. Code:
ColorImage *image = NULL;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. |
Re: Sample Vision Code, ComputeThreshold() exception
I have begun to try C++ and ran the 2013 vision example, but seem to be having a problem similar to what is described here.
I have not yet attempted to debug it much other than to know that the driver station crashes out starting with the following line when I'm trying to use the camera rather than trying the files. BinaryImage *thresholdImage = image->ThresholdHSV(threshold); I was hoping that someone would have posted a solution, but it's not clear from the description here that there is one. However, I presume that someone figured this out before competition. I have loaded the last update available and am using the M1011 camera. If someone identified a clear solution would you please post it. thanks. |
Re: Sample Vision Code, ComputeThreshold() exception
Code:
BinaryImage *thresholdImage = image->ThresholdHSV(threshold);Don't do that. Instead, declare the pointer, then allocate memory and set the pointer to point to the newly allocated memory. Only after that's done can you dereference the pointer. Alternatively, you might want to create thresholdImage as a BinaryImage instead of a pointer to one. |
| All times are GMT -5. The time now is 14:25. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi