Arhowk
01-02-2015, 13:17
I'm trying to add the followng lines to the "Vision Color Tracking" sample
NIVision.imaqMorphology(binaryFrame, binaryFrame, MorphologyMethod.GRADIENTOUT, new StructuringElement(5, 5, 1));
NIVision.imaqMorphology(binaryFrame, binaryFrame, MorphologyMethod.GRADIENTIN, null);
NIVision.imaqConvexHull(binaryFrame, binaryFrame, 1);
if I comment out the first line and third line, the second line (MorphologyMethod.GRADIENTIN) gives me this error
ERROR Unhandled exception: VisionException [com.ni.vision.VisionException: imaqError: -1074396072: Invalid image border.] at [com.ni.vision.NIVision._imaqMorphology(Native Method), com.ni.vision.NIVision.imaqMorphology(NIVision.jav a:19583), org.usfirst.frc.team1684.robot.Robot.autonomous(Ro bot.java:120), edu.wpi.first.wpilibj.SampleRobot.startCompetition (SampleRobot.java:133), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:234)]
if I comment out the second and third line, the first line (MorphologyMethod.GRADIENTOUT) gives me this error
ERROR Unhandled exception: VisionException [com.ni.vision.VisionException: imaqError: -1074395269: Null pointer.] at [com.ni.vision.NIVision._imaqMorphology(Native Method), com.ni.vision.NIVision.imaqMorphology(NIVision.jav a:19583), org.usfirst.frc.team1684.robot.Robot.autonomous(Ro bot.java:119), edu.wpi.first.wpilibj.SampleRobot.startCompetition (SampleRobot.java:133), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:234)]
If i comment out the first two lines, the convex hull call completely erases the image and leaves me with a Mat of zero's.
(Yes, I'm sure that, for all of these functions, binaryImage is returning a good image.)
What am I doing wrong..?
NIVision.imaqMorphology(binaryFrame, binaryFrame, MorphologyMethod.GRADIENTOUT, new StructuringElement(5, 5, 1));
NIVision.imaqMorphology(binaryFrame, binaryFrame, MorphologyMethod.GRADIENTIN, null);
NIVision.imaqConvexHull(binaryFrame, binaryFrame, 1);
if I comment out the first line and third line, the second line (MorphologyMethod.GRADIENTIN) gives me this error
ERROR Unhandled exception: VisionException [com.ni.vision.VisionException: imaqError: -1074396072: Invalid image border.] at [com.ni.vision.NIVision._imaqMorphology(Native Method), com.ni.vision.NIVision.imaqMorphology(NIVision.jav a:19583), org.usfirst.frc.team1684.robot.Robot.autonomous(Ro bot.java:120), edu.wpi.first.wpilibj.SampleRobot.startCompetition (SampleRobot.java:133), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:234)]
if I comment out the second and third line, the first line (MorphologyMethod.GRADIENTOUT) gives me this error
ERROR Unhandled exception: VisionException [com.ni.vision.VisionException: imaqError: -1074395269: Null pointer.] at [com.ni.vision.NIVision._imaqMorphology(Native Method), com.ni.vision.NIVision.imaqMorphology(NIVision.jav a:19583), org.usfirst.frc.team1684.robot.Robot.autonomous(Ro bot.java:119), edu.wpi.first.wpilibj.SampleRobot.startCompetition (SampleRobot.java:133), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:234)]
If i comment out the first two lines, the convex hull call completely erases the image and leaves me with a Mat of zero's.
(Yes, I'm sure that, for all of these functions, binaryImage is returning a good image.)
What am I doing wrong..?