Go to Post Incidentally, this is a good example of why lawyering the FIRST rules is good practice for the real world. By critically analyzing FIRST's errors, you practice for the day when you need to critically analyze legislators' errors (and deliberate trickery). - Tristan Lall [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-02-2015, 13:17
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 543
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
imaqMorphology && imaqConvexHull

I'm trying to add the followng lines to the "Vision Color Tracking" sample

Code:
				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

Code:
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.java:19583), org.usfirst.frc.team1684.robot.Robot.autonomous(Robot.java:120), edu.wpi.first.wpilibj.SampleRobot.startCompetition(SampleRobot.java:133), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:234)]
if I comment out the second and third line, the first line (MorphologyMethod.GRADIENTOUT) gives me this error

Code:
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.java:19583), org.usfirst.frc.team1684.robot.Robot.autonomous(Robot.java:119), edu.wpi.first.wpilibj.SampleRobot.startCompetition(SampleRobot.java:133), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java: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..?
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2015, 06:29
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: imaqMorphology && imaqConvexHull

The exception says that your image border property is not valid for that operation. When the image is created, you will want to add a few pixels of border. For a 5x5, I assume 2 pixels is the minimum necessary.

I don't understand the other condition, but it may be related.

Greg McKaskle
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 13:36.

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