我的英语不好) 我正在使用 opencv v2.4.2
Bitmap bitmap = BitmapFactory.decodeFile(mDefaultPath + name_s + type);
Bitmap mBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, false);
Mat s_image = new Mat();
Utils.bitmapToMat(mBitmap,s_image);
Mat rgb0 = new Mat();
Mat o_image = new Mat();
MatOfKeyPoint points = new MatOfKeyPoint();
FeatureDetector surf0 = FeatureDetector.create(FeatureDetector.ORB);
surf0.detect(s_image, points);
Log.d(TAG, "Sum of keypoints "+points.toList().size());
Imgproc.cvtColor(s_image, rgb0, Imgproc.COLOR_RGBA2RGB);
Features2d.drawKeypoints(rgb0, points, rgb0);
Imgproc.cvtColor(rgb0, o_image, Imgproc.COLOR_RGB2RGBA);
Utils.matToBitmap(o_image, mBitmap);
Highgui.imwrite(mDefaultPath + name_o + type, o_image);
在这个操作之后,我在屏幕上(在 ImageView 上)得到了正常的图像,但是在我的 sdcard 上的文件中,我得到了蓝色效果的图像 我认为将位图转换为 map ,或将 rgba 转换为 rgb 并返回的问题
你能帮帮我吗?
最佳答案
imwrite
函数需要传递图像中 channel 的 BGR 顺序。
关于java - 为什么我在 android 上使用 opencv 时会出现蓝色效果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15157604/