Go to Post On the other hand, if the tires were marked "NOT FOR FRISBEE SHOOTER USE" I'd be worried. - Ken Streeter [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-01-2013, 20:30
Pulverator's Avatar
Pulverator Pulverator is offline
Registered User
FRC #1551 (The Grapes of Wrath)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Naples
Posts: 8
Pulverator is an unknown quantity at this point
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;
}
Reply With Quote
  #2   Spotlight this post!  
Unread 19-01-2013, 23:27
xraymypanda's Avatar
xraymypanda xraymypanda is offline
Cowboy programmer
AKA: Chris M
FRC #0599 (RoboDox)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2011
Location: Granada Hills,CA
Posts: 82
xraymypanda has a spectacular aura aboutxraymypanda has a spectacular aura about
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
__________________

2011: Head Scout
2012: (figure)Head Programmer
2013: Head Programmer, Chief Strategist, Outreach Executive, and Driver
Reply With Quote
  #3   Spotlight this post!  
Unread 20-01-2013, 00:44
Pulverator's Avatar
Pulverator Pulverator is offline
Registered User
FRC #1551 (The Grapes of Wrath)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Naples
Posts: 8
Pulverator is an unknown quantity at this point
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?
Reply With Quote
  #4   Spotlight this post!  
Unread 20-01-2013, 09:34
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #5   Spotlight this post!  
Unread 20-01-2013, 10:01
xraymypanda's Avatar
xraymypanda xraymypanda is offline
Cowboy programmer
AKA: Chris M
FRC #0599 (RoboDox)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2011
Location: Granada Hills,CA
Posts: 82
xraymypanda has a spectacular aura aboutxraymypanda has a spectacular aura about
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.
__________________

2011: Head Scout
2012: (figure)Head Programmer
2013: Head Programmer, Chief Strategist, Outreach Executive, and Driver
Reply With Quote
  #6   Spotlight this post!  
Unread 20-01-2013, 10:48
Pulverator's Avatar
Pulverator Pulverator is offline
Registered User
FRC #1551 (The Grapes of Wrath)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Naples
Posts: 8
Pulverator is an unknown quantity at this point
Re: Sample Vision Code, ComputeThreshold() exception

Quote:
Originally Posted by Greg McKaskle View Post
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.
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.
Reply With Quote
  #7   Spotlight this post!  
Unread 20-01-2013, 11:13
dxc dxc is offline
Registered User
FRC #1551
 
Join Date: Jan 2013
Location: naples,ny
Posts: 5
dxc is an unknown quantity at this point
Re: Sample Vision Code, ComputeThreshold() exception

Quote:
Originally Posted by Pulverator View Post
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.
there are two differences between "works" and "doesn't work" configurations: 1) the working laptop had windriver updated to 2013 whereas the other had 2012 uninstalled and wiped then 2013 installed; and 2) the working laptop was talking to a 4 slot cRIO and the non-working to an 8 slot. either config will deploy and run code without the debugger.
Reply With Quote
  #8   Spotlight this post!  
Unread 22-01-2013, 19:10
d.kho's Avatar
d.kho d.kho is offline
Registered User
AKA: Daniel Kho
FRC #2473 (CHSR)
Team Role: Leadership
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Cupertino
Posts: 8
d.kho is an unknown quantity at this point
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.
Reply With Quote
  #9   Spotlight this post!  
Unread 23-01-2013, 18:02
xraymypanda's Avatar
xraymypanda xraymypanda is offline
Cowboy programmer
AKA: Chris M
FRC #0599 (RoboDox)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2011
Location: Granada Hills,CA
Posts: 82
xraymypanda has a spectacular aura aboutxraymypanda has a spectacular aura about
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.
__________________

2011: Head Scout
2012: (figure)Head Programmer
2013: Head Programmer, Chief Strategist, Outreach Executive, and Driver
Reply With Quote
  #10   Spotlight this post!  
Unread 23-01-2013, 21:30
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #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
  #12   Spotlight this post!  
Unread 25-01-2013, 09:38
AaronS AaronS is offline
Registered User
FRC #0166
 
Join Date: Jan 2013
Location: Merrimack, NH
Posts: 6
AaronS is an unknown quantity at this point
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.)
Reply With Quote
  #13   Spotlight this post!  
Unread 26-01-2013, 14:45
Pulverator's Avatar
Pulverator Pulverator is offline
Registered User
FRC #1551 (The Grapes of Wrath)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Naples
Posts: 8
Pulverator is an unknown quantity at this point
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]
Reply With Quote
  #14   Spotlight this post!  
Unread 26-01-2013, 16:19
dmitch's Avatar
dmitch dmitch is offline
Chief Head Electrical Guy
AKA: Daniel Mitchell
FRC #1997 (Stag Robotics)
Team Role: Programmer
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Bishop Miege High School
Posts: 142
dmitch is a jewel in the roughdmitch is a jewel in the roughdmitch is a jewel in the roughdmitch is a jewel in the rough
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.
__________________
Reply With Quote
  #15   Spotlight this post!  
Unread 26-01-2013, 18:21
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Sample Vision Code, ComputeThreshold() exception

Quote:
Originally Posted by dmitch View Post
...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.
That's not an error. It's not really even a warning, even though it claims to be. It's just a status indication. The important parts are "link", "robot radio(.1)", and "cRIO(.2)". If the cRIO is listed as GOOD, that's...well, good. If you're using a wired connection, the link should be GOOD; if you're using wireless, the robot radio should be GOOD.

Unless you're using a separate router connected to the Driver Station (perhaps for better range or 5 GHz WiFi), the DS radio will show as bad, and that's okay. The FMS will always show as bad until you're actually plugged in to a competition field.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:31.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi