After converting image to bitmap, image doesn't displayed

asked 2016-06-09 19:55:19 -0500

capricorngirl gravatar image

When I'm trying to convert the Mat image to Bitmap the image doesn't displayed in my device, on the contrary when I use Bitmap.Config.RGB_565 the displayed image is black. Here is my code:

Mat src = new Mat(bmp.getHeight(), bmp.getWidth(), CvType.CV_8UC1);
    imgToProcess = Utils.bitmapToMat(bmp, src);

    Bitmap bmpOut = Bitmap.createBitmap(imgToProcess.cols(), imgToProcess.rows(), Bitmap.Config.ARGB_8888);
    Utils.matToBitmap(imgToProcess, bmpOut);
    imv.setImageBitmap(bmpOut);
    rotateImage(bmpOut);
edit retag flag offensive close merge delete

Comments

What is your device/OS? What libraries are you using? (Utils, Bitmap,...???)

kbarni gravatar imagekbarni ( 2016-06-10 02:26:28 -0500 )edit

My device is running Android API 22. I'm using the following libraries:

import org.opencv.android.OpenCVLoader;
import org.opencv.android.Utils;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
capricorngirl gravatar imagecapricorngirl ( 2016-06-10 13:08:25 -0500 )edit