By ffatihkose
on Fri, 07/19/2013 - 13:09
Hi everybody,
Is there a way to crop the captured image as below in c++, before sending it to Java part as byte[] array?
QCAR::Image *imageRGB565 = NULL; QCAR::Frame frame = state.getFrame(); for (int i = 0; i < frame.getNumImages(); ++i) { const QCAR::Image *image = frame.getImage(i); if (image->getFormat() == QCAR::RGB565) { imageRGB565 = (QCAR::Image*)image; break; } } if (imageRGB565) { JNIEnv* env = 0; if ((javaVM != 0) && (activityObj != 0) && (javaVM->GetEnv((void**)&env, JNI_VERSION_1_4) == JNI_OK)) { const short* pixels = (const short*) imageRGB565->getPixels(); int width = imageRGB565->getWidth(); int height = imageRGB565->getHeight(); int numPixels = width * height;
Thanks
Crop Camera Image
Yes, of course you can crop the image before sending it to Java.
The const short *pixels is just a pointer to an array of short that represents the pixels of your image in a standard way (i.e. row-by-row,).