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

3 vues (au cours des 30 derniers jours)
Kobi
Kobi le 9 Mar 2019
Commenté : Image Analyst le 29 Nov 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.
  2 commentaires
Joan B
Joan B le 29 Nov 2019
Were you able to figure it out? I'm stuck on pretty much the same thing.
Image Analyst
Image Analyst le 29 Nov 2019
Try wiener2() or deconvwnr().

Connectez-vous pour commenter.

Réponses (1)

John D'Errico
John D'Errico le 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?

Produits


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by