public ByteBuffer getImageBytes() {

		if (!isReady()) {
			return null;
		}

		assert driver != null;
		assert device != null;

		long t1 = 0;
		long t2 = 0;

		// some devices can support direct image buffers, and for those call
		// processor task, and for those which does not support direct image
		// buffers, just convert image to RGB byte array

		if (device instanceof BufferAccess) {
			t1 = System.currentTimeMillis();
			try {
				return new WebcamGetBufferTask(driver, device).getBuffer();
			} finally {
				t2 = System.currentTimeMillis();
				if (device instanceof WebcamDevice.FPSSource) {
					fps = ((WebcamDevice.FPSSource) device).getFPS();
				} else {
					fps = (4 * fps + 1000 / (t2 - t1 + 1)) / 5;
				}
			}
		} else {
			throw new IllegalStateException(String.format("Driver %s does not support buffer access", driver.getClass().getName()));
		}
	}
public ByteBuffer getImageBytes ( ) { if ( ! isReady ( ) ) { return null ; } assert driver != null ; assert device != null ; long t1 = 0 ; long t2 = 0 ; if ( device instanceof BufferAccess ) { t1 = System . currentTimeMillis ( ) ; try { return new WebcamGetBufferTask ( driver , device ) . getBuffer ( ) ; } finally { t2 = System . currentTimeMillis ( ) ; if ( device instanceof WebcamDevice . FPSSource ) { fps = ( ( WebcamDevice . FPSSource ) device ) . getFPS ( ) ; } else { fps = ( 4 * fps + 1000 / ( t2 - t1 + 1 ) ) / 5 ; } } } else { throw new IllegalStateException ( String . format ( "Driver %s does not support buffer access" , driver . getClass ( ) . getName ( ) ) ) ; } }
Get RAW image ByteBuffer. It will always return buffer with 3 x 1 bytes per each pixel, where
RGB components are on (0, 1, 2) and color space is sRGB.<br>
<br>
<b>IMPORTANT!</b><br>
Some drivers can return direct ByteBuffer, so there is no guarantee that underlying bytes
will not be released in next read image operation. Therefore, to avoid potential bugs you
should convert this ByteBuffer to bytes array before you fetch next image.

@return Byte buffer