public void performCompleteMeasurement(MeasurementPoint meas_point) throws RadiometryException { try { if (CameraHeadMeasurementPoint.class.isInstance(meas_point)) { CameraHeadMeasurementPoint _camera_point = (CameraHeadMeasurementPoint) meas_point; int _width = captureDevice.getImageWidth(); int _height = captureDevice.getImageHeight(); _camera_point.setMeasurementImage(new BufferedImage(_width, _height, RASTER_TYPE)); capturedImage = captureDevice.captureImage(capturedImage); int _capt_index = 0; WritableRaster _raster = _camera_point.getMeasurementImage().getRaster(); for (int _row = 0; _row < _height; _row++) { for (int _col = 0; _col < _width; _col++) { int _value = capturedImage[_capt_index++]; _raster.setSample(_col, _row, 0, _value); } } } else { throw new RadiometryException( "Bad MeasurementPoint type : " + meas_point.getClass().getName()); } } catch (ImageCaptureException _e) { throw new RadiometryException("Camera error", _e); } }
@Override protected void finalize() throws Throwable { try { captureDevice.endCapture(); } catch (ImageCaptureException _e) { _e.printStackTrace(); } finally { super.finalize(); } }
/** * It is supposed that the format name parameter corresponds to the format suffix parameter. * * @param image_format_formal_name (@see {@link ImageIO#getWriterFormatNames()} * @param image_format_suffix (@see {@link ImageIO#getWriterFileSuffixes()} * @throws RadiometryException */ public CameraHead(String image_format_formal_name, String image_format_suffix) throws RadiometryException { captureDevice = new XCD90ImageCapture(); imageFormatUnformalName = image_format_formal_name; imageSuffix = image_format_suffix; capturedImage = null; try { captureDevice.initCapture(); } catch (ImageCaptureException _e) { throw new RadiometryException("cannot initialize camera", _e); } }