Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

# Need to insert following

조회 수: 1 (최근 30일)
Komal Gaikwad 2018년 2월 19일
마감: MATLAB Answer Bot 2021년 8월 20일
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이전 댓글 1개 표시이전 댓글 1개 숨기기
Komal Gaikwad 2018년 2월 19일
편집: Stephen23 2018년 2월 19일
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 2018년 2월 19일
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.

### Community Treasure Hunt

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

Start Hunting!

Translated by