After converting image to bitmap, image doesn't displayed

asked 2016-07-20 05:35:08 -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);

and I'm using all the following libraries:

import org.opencv.android.OpenCVLoader;
import org.opencv.android.Utils;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Scalar;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

How can i fix my code so i can begin with the image processing? Thanks in advance.

edit retag flag offensive close merge delete