PrasadImageIn
Lurker
Hello Everyone.
I'm developing an Image processing app in Android using OpenCV library. I want to convert the color image into grayscale, when user selects image from the SD card. I've used the below code -
Bitmap b =BitmapFactory.decodeFile(picturePath);Mat tmp =newMat(b.getWidth(), b.getHeight(),CvType.CV_8UC1);ImageView imgView =(ImageView) findViewById(R.id.imgview2);Utils.bitmapToMat(b, tmp);Imgproc.cvtColor(tmp, tmp,Imgproc.COLOR_BGR2GRAY,0);Utils.matToBitmap(tmp, b);
imgView.setImageBitmap(b);
There is no compile time error in this code. But when I run this app in my smartphone, the app gets crashed and sends an messsage as - unfortunately the app stopped working. Kindly provide me the correct code to solve this issue. Thank you in advance.
I'm developing an Image processing app in Android using OpenCV library. I want to convert the color image into grayscale, when user selects image from the SD card. I've used the below code -
Bitmap b =BitmapFactory.decodeFile(picturePath);Mat tmp =newMat(b.getWidth(), b.getHeight(),CvType.CV_8UC1);ImageView imgView =(ImageView) findViewById(R.id.imgview2);Utils.bitmapToMat(b, tmp);Imgproc.cvtColor(tmp, tmp,Imgproc.COLOR_BGR2GRAY,0);Utils.matToBitmap(tmp, b);
imgView.setImageBitmap(b);
There is no compile time error in this code. But when I run this app in my smartphone, the app gets crashed and sends an messsage as - unfortunately the app stopped working. Kindly provide me the correct code to solve this issue. Thank you in advance.