How can we slide say a 3X3 window on a matrix and perform an operation (i.e. Sum) on the 3X3 window, and then move that 3X3 window to the next part until we reach the end of the matrix? Thanks.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
meziane madani
am 15 Apr. 2015
Kommentiert: Image Analyst
am 15 Apr. 2015
How can we slide say a 3X3 window on a matrix and perform an operation (i.e. Sum) on the 3X3 window, and then move that 3X3 window to the next part until we reach the end of the matrix? Thanks. i have a program of 2X2 but i went 3, thanks.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 15 Apr. 2015
You can use conv2():
blurredImage = conv2(double(grayImage), ones(3), 'same');
imshow(blurredImage, []);
You could also use imfilter(). Use ones(3)/9 if you want the average instead of the sum.
2 Kommentare
Image Analyst
am 15 Apr. 2015
You're welcome. If it did the job for you and there are no other questions, can you mark the answer as "Accepted"?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!