Go to Post Winning or losing on the field has nothing to do with this success. - E. Wood [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 26-02-2016, 13:53
jabarabara's Avatar
jabarabara jabarabara is offline
Registered User
FRC #2415 (WiredCats)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2012
Location: Atlanta, Georgia
Posts: 4
jabarabara is an unknown quantity at this point
Problems with Morphology

So, in the past week I've been working on computer vision for this year's competition. I was able to create a binary image by thresholding an image for HSV ranges, but when I try to use morphology dilation I get an error

Code:
        NIVision.Image img, bin, morph;
	NIVision.RawData colorTable;
	
	final NIVision.Range HUE_RANGE = new NIVision.Range(213,255);
	final NIVision.Range SAT_RANGE = new NIVision.Range(217,255);
	final NIVision.Range VIS_RANGE = new NIVision.Range(102,204);
	
        public void robotInit() {
    	    	img = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);
    	    	bin = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_U8, 0);
    	    	morph = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_U8, 0); 
    	    	colorTable = new NIVision.RawData();
        }

        public void operatorControl() {
    	    	NIVision.imaqReadFile(img, "/home/lvuser/capture.jpg");
    	    	NIVision.imaqColorThreshold(bin, img, 255, NIVision.ColorMode.HSV, HUE_RANGE, SAT_RANGE, VIS_RANGE);
    	    	NIVision.imaqWriteJPEGFile(bin, "/home/lvuser/bin.jpg", 2000, colorTable);
    	    	NIVision.imaqMorphology(morph, bin, NIVision.MorphologyMethod.DILATE, new NIVision.StructuringElement(3,3,1));
    	    	NIVision.imaqWriteJPEGFile(morph, "/home/lvuser/morph.jpg", 2000, colorTable);
        }
I got this error from the code above:

Code:
VisionException [com.ni.vision.VisionException: imaqError: -1232673104: Unknown error]
	at com.ni.vision.NIVision._imaqMorphology(Native Method)
	at com.ni.vision.NIVision.imaqMorphology(NIVision.java:24502)
	at org.usfirst.frc.team2415.robot.Robot.operatorControl(Robot.java:47)
	at edu.wpi.first.wpilibj.SampleRobot.startCompetition(SampleRobot.java:159)
	at edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:242)
I've already tried searching for the problem to find a solution and couldn't. I don't see what's wrong. Any ideas?
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 08:47.

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