View Single Post
  #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