|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|