Android Javacv将drawable加载到IplImage cvLoadImage

时间:2015-01-07 11:39:03

标签: android image-processing javacv

我是图像处理的初学者。基本上,我想要实现的是使用JavaCv从图片中检测红色。经过几天的研究,从这个blog加载来自IplImage cvLoadImage的图像时,它需要一个字符串参数。如何从android drawables将图像加载到IplImage?另外我想知道如何向ImageView显示IplImage。我发现site also向ImageView显示IplImage但它让我困惑。如果有人愿意帮助我的话。

这是来自此blog的IpLImage的代码:

    //read image
    IplImage orgImg = cvLoadImage("colordetectimage.jpg");
    //create binary image of original size
    IplImage imgThreshold = cvCreateImage(cvGetSize(orgImg), 8, 1);
    //apply thresholding
    cvInRangeS(orgImg, min, max, imgThreshold);
    //smooth filter- median
    cvSmooth(imgThreshold, imgThreshold, CV_MEDIAN, 13);
    //save
    cvSaveImage("threshold.jpg", imgThreshold);

正如您所见,IplImage orgImg = cvLoadImage("colordetectimage.jpg");代码需要一个字符串参数。我想要实现的是它将从android drawable加载,处理它们以检测红色,然后将其显示在imageview上。

0 个答案:

没有答案