Soham Dutta
Soham Dutta

Reputation: 129

How to convert Ipl image to Mat image in java

I am trying to make a mood detection app in opencv, java. But there is a lag in processing the image and then displaying the emoticon. So I want to directly use the image captured , instead of copying the image to the hard disk. For that I need convert iplimage to matimage .

Upvotes: 1

Views: 1303

Answers (2)

Hadi
Hadi

Reputation: 11

Try this

     IplImage img;
     bmp = Bitmap.createBitmap(img.width(), img.height(), Bitmap.Config.ARGB_8888);

     bmp.copyPixelsFromBuffer(img.getByteBuffer());

     Mat mROI = new Mat(new Size(img.width(), img.height()), CV_8UC4);

     Utils.bitmapToMat(bmp, mROI);

Upvotes: 1

herohuyongtao
herohuyongtao

Reputation: 50687

Try

IplImage *ipl_img;
Mat mat_img(ipl_img);

Upvotes: 1

Related Questions