|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Sample vision code not working
Hi,
We tried to use the sample vision code that came from the latest c++ update and we were not able to get it to work. We placed debug lines to print out to the driver station lcd after every line and found the bad line of code. Code:
BinaryImage *thresholdImage = image->ThresholdHSV(threshold); Does anyone know how to get around this and get the sample vision code working? |
|
#3
|
|||
|
|||
|
Re: Sample vision code not working
What kind of checking are you doing to verify your image is valid when you call camera.getImage.
Last year, people had some issues with images that were valid pointers, 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:
if ((colorImage == (void *) 0) || (colorImage->GetWidth() == 0) || (colorImage->GetHeight() == 0))
{
return returnVal;
}
Line 795 has the camera code. |
|
#4
|
|||
|
|||
|
Re: Sample vision code not working
We ran the check to see if the image was valid and it passed. We then wanted to see what what the height value was.
Code:
screen->PrintfLine(DriverStationLCD::kUser_Line3, "Valid image:%dx%d, image->GetHeight(), image->GetWidth()); |
|
#5
|
|||
|
|||
|
Re: Sample vision code not working
Our team is having a similar issue trying to run the VisionSample2013 code.
We added a GetWidth query after the GetImage line and the value is a very large value. Similar result that we have a fatal error on the Threshold line. We also wrote and read the resolution to/from the camera and that seems to be working. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|