Trying to use Wiener filter to remove blurr and noise, get a matrix of NaN, why?
2 views (last 30 days)
Show older comments
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.
2 Comments
Answers (1)
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:
0/0
ans =
NaN
>> inf-inf
ans =
NaN
>> inf/inf
ans =
NaN
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?
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!