Go to Post Engineering is so much easier when you give all the components personalities. Then you just watch the drama unfold and try to fix it. - EricVanWyk [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 31-01-2015, 11:40
sretter's Avatar
sretter sretter is offline
Registered User
AKA: Shaked
FRC #2231 (OnyxTronix)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Shoham
Posts: 33
sretter is on a distinguished road
Vision processing - Not an image error

Hello,
We've had a problem while trying to do some basic vision processing, when we try to get an image then threshold that image, every method we do on the result fails(things we've tried: write,getHeight, getWidth, convexHull, particleFilter) and the error we receive:
Quote:
Unhandled exception: VisionException [com.ni.vision.VisionException: imaqError: -1074396120: Not an image.]
The camera seems to be fine(we can see the image on the dashboard, and when we write the image we get after using getImage() it's valid) so we're kinda stuck and don't know what to do.
We'd love to get some help to solve this

Here is an example of some code we ran:
Quote:
package org.usfirst.frc.team2231.robot;

import com.ni.vision.NIVision.Image;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.image.BinaryImage;
import edu.wpi.first.wpilibj.image.ColorImage;
import edu.wpi.first.wpilibj.image.NIVisionException;
import edu.wpi.first.wpilibj.vision.AxisCamera;

public class Robot extends SampleRobot {
int session;
Image frame;
ColorImage image;
BinaryImage thresholdImage;
AxisCamera camera;

public void robotInit() {

// open the camera at the IP address assigned. This is the IP address that the camera
// can be accessed through the web interface.
camera = new AxisCamera("10.22.31.11");
}

public void operatorControl() {

while (isOperatorControl() && isEnabled()) {
try {
image = camera.getImage();
thresholdImage = image.thresholdHSL(0, 255, 0, 255, 0, 255);
thresholdImage.write("/tmp/threshold.jpg");
image.free();
thresholdImage.free();thresholdImage.

} catch (NIVisionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


/** robot code here! **/
Timer.delay(0.005); // wait for a motor update time
}
}

public void test() {
}
}
And the error:

Quote:
ERROR Unhandled exception: VisionException [com.ni.vision.VisionException: imaqError: -1074396120: Not an image.] at [com.ni.vision.NIVision._imaqWriteFile(Native Method), com.ni.vision.NIVision.imaqWriteFile(NIVision.java :20506), edu.wpi.first.wpilibj.image.BinaryImage.write(Bina ryImage.java:111), org.usfirst.frc.team2231.robot.Robot.operatorContr ol(Robot.java:54), edu.wpi.first.wpilibj.SampleRobot.startCompetition (SampleRobot.java:148), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:234)]
Reply With Quote
 


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 22:30.

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