|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Sample Vision Code, ComputeThreshold() exception
So, our team is trying to get the sample vision code to work using the Axis M1011 camera, and we are getting a weird exception. As we step through the code, I'm finding that the cause (or at least where the error occurs) is when "image->ThresholdHSV(threshold)" is called.
By going into ColorImage.cpp we have found that the exception occurs on line 37 when "wpi_setImaqErrorWithContext(success, "ImaqThreshold error")" is called. The value of success is 0, which I assume means it was successful but I'm not sure. We have not tried this process with any images loaded onto the cRio. We can see the camera by viewing it on the Dashboard and/or in a web browser. The IP is set to 10.15.51.11. Any help or suggestions would be much appreciated. ![]() Code:
void Autonomous(void)
{
Threshold threshold(60, 100, 90, 255, 20, 255); //HSV threshold criteria, ranges are in that order ie. Hue is 60-100
ParticleFilterCriteria2 criteria[] = {
{IMAQ_MT_AREA, AREA_MINIMUM, 65535, false, false}
}; //Particle filter criteria, used to filter out small particles
AxisCamera &camera = AxisCamera::GetInstance("10.15.51.11"); //To use the Axis camera uncomment this line
while (IsAutonomous() && IsEnabled()) {
/**
* Do the image capture with the camera and apply the algorithm described above. This
* sample will either get images from the camera or from an image file stored in the top
* level directory in the flash memory on the cRIO. The file name in this case is "testImage.jpg"
*/
ColorImage *image;
//image = new RGBImage("/testImage.jpg"); // get the sample image from the cRIO flash
camera.GetImage(image); //To get the images from the camera comment the line above and uncomment this one
BinaryImage *thresholdImage = image->ThresholdHSV(threshold); // get just the green target pixels
//thresholdImage->Write("/threshold.bmp");
...
...
Code:
BinaryImage *ColorImage::ComputeThreshold(ColorMode colorMode,
int low1, int high1,
int low2, int high2,
int low3, int high3)
{
BinaryImage *result = new BinaryImage();
Range range1 = {low1, high1},
range2 = {low2, high2},
range3 = {low3, high3};
int success = imaqColorThreshold(result->GetImaqImage(), m_imaqImage, 1, colorMode, &range1, &range2, &range3);
wpi_setImaqErrorWithContext(success, "ImaqThreshold error");
return result;
}
|
|
#2
|
||||
|
||||
|
Re: Sample Vision Code, ComputeThreshold() exception
Have you seen the error readout on the driver station? I am having the same problem and get an error saying that the image is not large enough. Although I can't use Windriver debugging or deploy code to the cRio through windriver and have an FTP workaround instead
|
|
#3
|
||||
|
||||
|
Re: Sample Vision Code, ComputeThreshold() exception
I don't recall noticing anything on the drivers station, that's not to say I just didn't see it. I will definitely check to see what the readout says next time though, which might not be until Thursday unless another member can give it a try. We had the net console up at the time and the program just quits with a fatal kernel task exception.
We also had a lot of problems getting the debugger to work properly. I somehow got it working but I did not change anything that I know of, it just started to work. We have the same configurations (as far as I could tell) on my laptop and another team laptop and only mine can actually debug without it terminating too early. It's very frustrating. We can deploy new code fine, so that's not the issue. I don't think this should matter but we over-installed WR with the 2013 version. We have updated workbench with both the 1/5 and 1/18 updates. We've gone through the documentation several times so I'm not sure why this is happening. What errors do you get when you try to deploy code? You have the correct team number and x.out file selected correct? |
|
#4
|
|||
|
|||
|
Re: Sample Vision Code, ComputeThreshold() exception
The IMAQ functions being used are documented here ... C:\Program Files (x86)\National Instruments\Vision\Documentation in the NIVisionCVI.chm file.
For the function imaqColorThreshold() it states that the return value is nonzero for success and zero for failure and states that imaqGetLastError() will give more detail. From what I see, that isn't happening, so the error is simply a generic threshold failure. There are several requirements documented for the original function. These requirement include that the image type of the dest is a U8, that the source is a three element color, either RGB or HS(LVI). From statically looking at the code fragments you attached, I see nothing wrong, which is why it would be key to see what the error code tells us. Greg McKaskle |
|
#5
|
||||
|
||||
|
Re: Sample Vision Code, ComputeThreshold() exception
I don't get an error, the code simply starts transferring and gets anywhere from 50%to 90%before it stops transferring. It does not actually load code onto the cRIO. We have everything configured properly and the communication exists because we can load our code via FTP. It's an error somewhere in windriver's deploy function.
|
|
#6
|
||||
|
||||
|
Re: Sample Vision Code, ComputeThreshold() exception
Thanks for the suggestion. We will try calling imaqGetLastError() after success is set to 0. Once we do this, I'll post an update with the error message.
|
|
#7
|
|||
|
|||
|
Re: Sample Vision Code, ComputeThreshold() exception
Quote:
|
|
#8
|
||||
|
||||
|
Re: Sample Vision Code, ComputeThreshold() exception
I had the same issue. I ended up solving it by recreating the main part of the code manually in my own function and class. All the other functions were copied over directly.
|
|
#9
|
||||
|
||||
|
Re: Sample Vision Code, ComputeThreshold() exception
Because I'm having a similar issue, the Driver Station Messages are as follows:
Code:
<Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) Error in convex hull operation: ...in ConvexHull() in C:/WindRiver/workspace/WPILib/Vision/BinaryImage.cpp at line 209 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) Error in convex hull operation: ...in ConvexHull() in C:/WindRiver/workspace/WPILib/Vision/BinaryImage.cpp at line 209 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) Error in convex hull operation: ...in ConvexHull() in C:/WindRiver/workspace/WPILib/Vision/BinaryImage.cpp at line 209 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) Error in convex hull operation: ...in ConvexHull() in C:/WindRiver/workspace/WPILib/Vision/BinaryImage.cpp at line 209 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) Error in convex hull operation: ...in ConvexHull() in C:/WindRiver/workspace/WPILib/Vision/BinaryImage.cpp at line 209 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) Error in convex hull operation: ...in ConvexHull() in C:/WindRiver/workspace/WPILib/Vision/BinaryImage.cpp at line 209 IMAQ Vision: Not an image. <Code>-1074396120 ERROR: status = -1074396120 (0xBFF60428) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: Not an image. Warning <Code> 44002 occurred at Ping Results: link-GOOD, DS radio(.4)-bad, robot radio(.1)-GOOD, cRIO(.2)-GOOD, FMS-bad Driver Station <time>1/23/2013 2:58:58 PM<unique#>7 FRC: Driver Station ping status has changed. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396159 ERROR: status = -1074396159 (0xBFF60401) Error in convex hull operation: ...in ConvexHull() in C:/WindRiver/workspace/WPILib/Vision/BinaryImage.cpp at line 209 IMAQ Vision: Not enough memory for requested operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. Warning <Code> 44002 occurred at Ping Results: link-GOOD, DS radio(.4)-bad, robot radio(.1)-GOOD, cRIO(.2)-GOOD, FMS-bad Driver Station <time>1/23/2013 2:58:37 PM<unique#>6 FRC: Driver Station ping status has changed. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. <Code>-1074396154 ERROR: status = -1074396154 (0xBFF60406) ImaqThreshold error: ...in ComputeThreshold() in C:/WindRiver/workspace/WPILib/Vision/ColorImage.cpp at line 37 IMAQ Vision: The image is not large enough for the operation. |
|
#10
|
|||
|
|||
|
Re: Sample Vision Code, ComputeThreshold() exception
Those errors are far less mysterious. It looks like one of the images used in threshold and convex hull and the other calls hasn't been allocated or has been closed or released before being used.
Inspect the code that creates the images that go into those calls. Greg McKaskle |
|
#11
|
|||
|
|||
|
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;
}
My full code is here: https://github.com/TeamExcel/Project.../Robot2012.cpp Line 795 has the camera code. Edit/Delete Message |
|
#12
|
|||
|
|||
|
Re: Sample Vision Code, ComputeThreshold() exception
We're having a similar issue as the OP with a fatal exception on the Threshold line. We invoked GetWidth() on the image prior to the call and got a very large non-sensical value.
(Sorry about the reply in 2 similar threads , but I'm not sure if both are getting the same attention.) |
|
#13
|
||||
|
||||
|
Re: Sample Vision Code, ComputeThreshold() exception
We have tried a few different things and still haven't figured out how to get valid images. We transfered some images to the cRio via ftp and used those and it worked fine. Whenever we use the camera it fails with the initial exception. We would like to call the imaqGetLastError(), but once the exception happens everything just blows up, even with try/catch.
It seems that the image we get from camera.GetImage() is not valid. As a few other posters have noted, the height and width seem ridiculously large with values in the range of 17 million. When we use the images loaded onto the cRio the sizes was 320x240. We also didn't notice any strange output on the DS when the errors occur. [IMG] [/IMG] |
|
#14
|
||||
|
||||
|
Re: Sample Vision Code, ComputeThreshold() exception
I have been using the 2013 Vision Code example and am getting the same errors. We are using an 8-slot cRIO and a computer that didnt have windriver on it previously.
When I load the example code, and switch it so that it pulls in the image from the camera, I get an error on the driver station diagnostics: Warning <Code> 44002 ocurred at Ping Results: link-bad, DS radio(.4)-bad, robot radio(.1)-GOOD, cRIO(.2)-GOOD, FMS-bad Driver Station <time>1/15/2013 1:00:55 AM>unique#>4 FRC: Driver Station ping status has changed. (Our system clock and date are way off, ignore it) Emphasis mine. Also, earlier when I tried to change the value of the Hue in the code so that it could be any Hue, as we are using a white light and don't want just green, I got the same error message as the OP, in the Target Exception error box. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|