Info

This question is closed. Reopen it to edit or answer.

Need to insert following

1 view (last 30 days)
Komal Gaikwad
Komal Gaikwad on 19 Feb 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
i m trying to insert the median and averaging filter in my code but it giving me errors ,as i am a beginner in matlab it is taking a lot of time ,i have very limited time for this project,someone can please insert that code in my existing code.and need the corrupt pixel nos for both median & average filter.In my existing code it is calculating the corrupt no of pixels.My project is SR using Adaptive Wiener filter and compare it with median and average filter and show adaptive wiener filter is better than other two.
  3 Comments
Komal Gaikwad
Komal Gaikwad on 19 Feb 2018
Edited: Stephen23 on 19 Feb 2018
After adding noise in the image,i have to filter it using median filter and show the corrupt pixels corrupted and % error free the filtered image is,similarily i have to show for average filter and then the existing filter i.e., adaptive wiener filter code should run and show the corrupt pixels corrupted and % error free the image is.And finally i have to compare and show that adaptive wiener filter is better.I tried to insert the new function for median filter by making changes in the existing GUI but its not working.Also my project time constrainst.Please someone help me atleast with one filter i will try it out with the other one.Thanks in advance
EDIT by Stephen Cobeldick: attached rather large code as a file
Jan
Jan on 19 Feb 2018
Brrr, a GUI using globals to share data. A lot of code without comments, such that it cannot be debugged efficiently. It is a bad idea to mix GUI and calculations. The code contains a lot of very ugly loops like:
for k=0:(2*ln)
A_mat(p_im_n(i-1,j+k)+1)=A_mat(p_im_n(i-1,j+k)+1)-1;
A_mat(p_im_n(i+(2*ln),j+k)+1)=A_mat(p_im_n(i+(2*ln),j+k)+1)+1;
end
This is an evil method also:
warning off all;
Warnings are very important. Care for them. Remove the cause of warnings instead of suppressing the messages.
IND=find(A_mat ~=0);
V_O=[];
for h=1:length(IND)
V_O = [V_O IND(h)*ones(1,A_mat(IND(h)))];
end
I think this is a smarter version:
V_O = repelem(Ind, A_mat(Ind));
In the current form the code is not usable in any way. It can neither be debugged seriously, nor understood or maintained. Therefore trying to help you would require to write the complete code from scratch. This is more than you can expect from a forum and this is your project.
Sorry for this pessimistic view.
The problem description is still weak: "I tried to insert the new function for median filter by making changes in the existing GUI but its not working." Walter has suggested to read this already: http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer . This is a valuable advice.

Answers (0)

Community Treasure Hunt

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

Start Hunting!