Mat to int[] and vice versa
I'm completely new to this library, so apologize for my simple question. I'm using OpenCV library in Android. So Java.
Given a homographyMatrix :
Mat srcMat, dstMat;
int[] srcPixels, dstPixels;
//... srcPixels filled with int values of pixels
srcPixels conversion to srcMat
Imgproc.warpPerspective(srcMat, dstMat, homographyMatrix, dstMat.size())
dstMat conversion to dstPixels
this because i use int[] objects
in order to display images.
Yes, i've already seen this question, but the answer is in c++ and does not really answer.
why are you using an int array for your src pixels ?
opencv holds its images in uchar arrays (3 or 4 bytes per pixel), so to use opencv functionality , you would have to re-pack your src array (which will be very expensive).
because all my operations and all my program (that is long) works with int[] arrays. Now i have to compute this warp, i'm using OpenCV only for : findHomography and warpPerspective, so the decisions are two : or I modify ALL my program to work with Mat (ofc no ;) or i try this solution. So i don't have solutions... by the way images are 800x600 so they aren't so expensive
again, unfortunate decision. if you at least can make a Bitmap, or a BufferedImage from that, the transition will be easier, still tremendously expensive.
ok i will convert my display component to bitmap obj. How can i convert ;Mat to Bitmap and vice versa?
opencv4android has Utility functions for this
oh thank you very much!!