Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. VuforiaLocalizer.CloseableFrame frame = vuforia.getFrameQueue().take(); //takes the frame at the head of the queue
  2. long numImages = frame.getNumImages();
  3.  
  4. for (int i = 0; i < numImages; i++) {
  5. if (frame.getImage(i).getFormat() == PIXEL_FORMAT.RGB565) {
  6. rgb = frame.getImage(i);
  7. break;
  8. }
  9. }
  10.  
  11. /*rgb is now the Image object that weve used in the video*/
  12. Bitmap bm = Bitmap.createBitmap(rgb.getWidth(), rgb.getHeight(), Bitmap.Config.RGB_565);
  13. bm.copyPixelsFromBuffer(rgb.getPixels());
  14.  
  15. //put the image into a MAT for OpenCV
  16. Mat tmp = new Mat(rgb.getWidth(), rgb.getHeight(), CvType.CV_8UC4);
  17. Utils.bitmapToMat(bm, tmp);
  18.  
  19. //close the frame, prevents memory leaks and crashing
  20. frame.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement