Go to Post Set your goals as high as your team thinks they can achieve (drafted, drafting, win awards, regional champs, world champs, etc) and go for them. Let the chips fall and have no regrets. - BPetry234 [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 27-01-2016, 21:24
rtrahms rtrahms is offline
Registered User
FRC #1778
 
Join Date: Dec 2013
Location: United States
Posts: 4
rtrahms is a jewel in the roughrtrahms is a jewel in the roughrtrahms is a jewel in the rough
ColorImage java method results in 'not an image' exception

Hi all -

Using Java (wpilibj), we have successfully instantiated an Axis Camera, get an image from it, and doing a thresholdHSV on the ColorImage object doesn't crash the roborio... but the moment we query the BinaryImage object, an NIVisionException 'not an image' is thrown. Code below:

... within our TargetFinder object....

private AxisCamera camera;
private String address;
private boolean hasTarget;

public void initCamera(String address) {
camera = new AxisCamera(address); // get an instance of the camera
}

public void findTarget() {
try {
if (camera.isFreshImage()) {
System.out.println("Got image");

// these calls are okay. image returns height and width okay
ColorImage image = camera.getImage();
System.out.println("Color image data = " + image.getHeight() + "," + image.getWidth());

// this call is okay
BinaryImage thresholdImage = image.thresholdHSV(H_LOW, H_HIGH, S_LOW, S_HIGH, V_LOW, V_HIGH);

// this call throws the 'not an image' exception on the call to getHeight()
System.out.println("Binary image data = " + thresholdImage.getHeight() + "," + thresholdImage.getWidth());

thresholdImage.free();
image.free();
}

} catch (NIVisionException ex) {
ex.printStackTrace();
}
}

Last edited by rtrahms : 27-01-2016 at 21:26.
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:44.

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