temp_image.nChannels() == 1 ? FLYCAPTURE_MONO16 : FLYCAPTURE_RGB16);
}
if (conv_image.pixelFormat() == format && conv_image.iRowInc() == stride) {
// we just need a copy to swap bytes..
ShortBuffer in = raw_image.getByteBuffer().order(frameEndian).asShortBuffer();
ShortBuffer out = temp_image.getByteBuffer().order(ByteOrder.nativeOrder()).asShortBuffer();
out.put(in);
alreadySwapped = true;
} else if (!colorrgb) {
error = flycaptureConvertImage(context, raw_image, conv_image);
if (error != FLYCAPTURE_OK) {
throw new Exception("flycaptureConvertImage() Error " + error);
}
}
}
if (!alreadySwapped && depth != IPL_DEPTH_8U &&
!frameEndian.equals(ByteOrder.nativeOrder())) {
// ack, the camera's endianness doesn't correspond to our machine ...
// swap bytes of 16-bit images
ByteBuffer bb = temp_image.getByteBuffer();
ShortBuffer in = bb.order(frameEndian).asShortBuffer();
ShortBuffer out = bb.order(ByteOrder.nativeOrder()).asShortBuffer();
out.put(in);
}
if (colorMode == ColorMode.BGR && numChannels != 3 && !colorbayer) {
cvCvtColor(temp_image, return_image, CV_GRAY2BGR);
} else if (colorMode == ColorMode.GRAY && (colorbayer || colorrgb)) {