Trying to use Wiener filter to remove blurr and noise, get a matrix of NaN, why?
2 views (last 30 days)
Hi, i'm trying to remove blurr and noise from an image using wiener filter and can't do this, i get the reconstruction as a NaN complex matrix, how can i fix it?
and please don't show me any built in function, i'm trying to do this by definition.
John D'Errico on 9 Mar 2019
You want to do this yourself. So you need to learn to fix the problem. You fix it by learning how a NaN is created, AND by learning where the NaN first occurs. Look at that line.
So go back. Execute each line of that code, ONE at a time. It is pretty short, so no problem. Does a NaN occur (or even an inf)? You could even use
dbstop if naninf
But it is better to just look carefully at your code, at what you are computing.
A nan arises in relatively few cases. Usually they arise from operations like this:
So any operation where the result is indeterminate, this causes a NaN. So, as soon as a NaN or inf arises, look to see what caused it. Look carefully at the operations in that line. Did you do something silly? Do you have something you might not expect in one or more of your variables in that line?