Ask Your Question

Possible BUG in denoise_TVL1

asked 2017-03-09 05:09:10 -0500

guidovitale gravatar image

I re-ask the question since I didnt found help with that. I'm pretty about to post it in the BUG section, if still nobody has any clue.

I would like to denoise a grayscale image using the TV regularization, in order to prevent sharp edges being smoothed out. I'm working in win10 with Qt 5.4.1, mingw compiler and OpenCV 3.0. I tried the aforementioned algorithm but this gives me the following error: OpenCV Error: Assertion failed ((flags & FIXED_TYPE) != 0) in type, file C:\opencv\sources\modules\core\src\matrix.cpp, line 1821 seems like a type error, but it looks strange to me since I'm just loading a grayscale image. please note that the function 'fastNlMeansDenoising' works flawlessly within the same framework. For better clarity, here's the pseudo code:

String  imageName  = "imageName.jpg";
Mat I = imread(imageName, CV_LOAD_IMAGE_GRAYSCALE);
double lambda = 2;
int niters = 5;
Mat Denoised;
denoise_TVL1( I, Denoised,  lambda,  niters);       //  ! NOT WORKING !
fastNlMeansDenoising(I, Denoised, 8, 7, 25);        //  ! WORKING !

thank you for your help, Guido.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2017-03-09 05:52:19 -0500

berak gravatar image

please note, that denoise_TVL1 takes a vector<Mat> as 1st arg, not a simple Mat (like with fastNlMeansDenoising)!


vector<Mat> vecm(1,I)
denoise_TVL1( vecm, Denoised,  lambda,  niters);       //  ! WORKING !
edit flag offensive delete link more

answered 2017-03-09 05:12:51 -0500

Eduardo gravatar image

You can find here an example. You should test to see if you have a problem or not.

Also, did you try with other images?

edit flag offensive delete link more


I've tried with several images, but of the same type. jpg in grayscale

guidovitale gravatar imageguidovitale ( 2017-03-09 05:58:01 -0500 )edit

Indeed, the problem was with the input argument, I did not understand that a vector<mat> rather than a Mat was needed. Thanks and sorry for the double post.

guidovitale gravatar imageguidovitale ( 2017-03-09 07:05:31 -0500 )edit

Question Tools

1 follower


Asked: 2017-03-09 05:09:10 -0500

Seen: 405 times

Last updated: Mar 09 '17