"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Crop Camera Image

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

AlessandroB

Fri, 07/19/2013 - 13:26

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,).