Reputation: 1876
I'm a complete beginner in opencv so please do excuse me if my question is foolish .Actually I was trying the following opencv
function to reduce noise of an image but the function i.e Photo.fastNlMeansDenoising(mat,mat)
is not working I don't understand why. As per the error it's showing that we can only use CV1,CV2 and CV3
which is there in my case but still I'm getting the error.
I also tried this answer but it couldn't solve my problem .
Can anyone please help me to fix this issue ?
Code:
Mat tmp = new Mat (bitmap.getWidth(), bitmap.getHeight(), CvType.CV_8UC3);
Utils.bitmapToMat(bitmap, tmp);
Photo.fastNlMeansDenoising(tmp,tmp);
Utils.matToBitmap(tmp,bitmap);
Error:
CvException [org.opencv.core.CvException: cv::Exception: /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/photo/src/denoising.cpp:78: error: (-5) Unsupported image format! Only CV_8UC1, CV_8UC2 and CV_8UC3 are supported in function void cv::fastNlMeansDenoising(cv::InputArray, cv::OutputArray, float, int, int)
]
at org.opencv.photo.Photo.fastNlMeansDenoising_0(Native Method)
at org.opencv.photo.Photo.fastNlMeansDenoising(Photo.java:57)
at opengl.community.myopencvexample.MainActivity$3.onClick(MainActivity.java:83)
at android.view.View.performClick(View.java:4478)
at android.view.View$PerformClick.run(View.java:18698)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Upvotes: 0
Views: 138
Reputation: 411
Try to update your library and your problem would be solved means if you're using 2.x then update it to opencv 3.0
Upvotes: 1