如何在Java中将Ipl图像转换为Mat图像 [英] How to convert Ipl image to Mat image in java

查看:106
本文介绍了如何在Java中将Ipl图像转换为Mat图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在opencvjava中制作一个心情检测应用程序.但是在处理图像然后显示表情符号方面存在滞后.所以我想直接使用捕获的图像,而不是将图像复制到硬盘上.为此,我需要将iplimage转换为matimage.

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 .

推荐答案

尝试一下

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

这篇关于如何在Java中将Ipl图像转换为Mat图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆