MATLAB Answers

Kobi
0

Trying to use Wiener filter to remove blurr and noise, get a matrix of NaN, why?

Asked by Kobi
on 9 Mar 2019
Latest activity Edited by Kobi
on 12 Mar 2019
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.

  0 Comments

Sign in to comment.

Products


Release

R2018a

1 Answer

Answer by 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

Sign in to comment.