Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Matlab Filter Error, Plz Help

  1. Feb 22, 2010 #1
    1. The problem statement, all variables and given/known data
    I am doing a project on mathematical analysis of image restoration techniques, using linear restoration filters such as
    1.inverse filter
    2.pseudo inverse filter
    3.weiner filter and
    4.constrained least square filter


    2. Relevant equations



    3. The attempt at a solution
    For the pseudo inverse filter, I've programmed as following:

    clc;
    clear all;
    close all;
    f=imread('C:\Documents and Settings\Jerin\Desktop\lenna.gif');
    PSF=fspecial('motion', 14,0);
    gb=imfilter(f,PSF);
    g=imnoise (gb,'gaussian',0,200/(255*255));
    fr=deconvwnr (g,PSF);
    k=fft(fr);
    for i=1:1:150;
    H=pfilter('ideal',size(fr,1),size(fr,2),i);
    G=H.*k;
    g1=real(ifft2(G));
    g1=g1(1:size(fr,1),1:size(fr,2));
    e=double (f)-double(g1);
    [m,n]=size(e);
    rmse(i)=sqrt(sum(e(:).^2)/(m*n));
    end;
    i=1:1:150;
    figure(2);
    plot(i,rmse(i));

    Now i am getting an error like this:
    2rwnuwn.jpg

    The output should be like this:
    23hao9f.jpg

    If posssible, guys please copy the program and work it out in matlab for the correct output, i know you can sort it out very easily. Please its urgent.

    What filter i should use? is the pfilter correct? I got this programmed from a friend.
     
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted