How to convert Ipl image to Mat image in java

一世执手 提交于 2019-12-11 07:59:39

问题


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 .


回答1:


Try

IplImage *ipl_img;
Mat mat_img(ipl_img);



回答2:


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);


来源:https://stackoverflow.com/questions/20987989/how-to-convert-ipl-image-to-mat-image-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!