How can we find average of matrix, considering a 7 by 7 matrix in an image????

댓글 수: 1

Guillaume
Guillaume 2019년 1월 29일
You'll have to be clearer about what you want. Providing an example of input and desired output really helps. What does considering a 7 by 7 matrix in an image mean?
Doesn't the mean function or the mean2 (requires image processing toolbox) function work for what you want? They work on any size matrix, including 7x7 ones.

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt J
Matt J 2019년 1월 29일
편집: Matt J 2019년 1월 29일

0 개 추천

If you want a 7x7 sliding window, you would use convolution
out=conv2(yourImage,ones(7)/49,'valid');
If instead you want to decompose your image into non-overlapping 7x7 tiles, then I would recommend sepblockfun (Download).
out=sepblockfun(yourImage,[7,7],'mean');

댓글 수: 4

Walter Roberson
Walter Roberson 2019년 1월 29일
filter2 can be used instead of conv2. There are some differences in internal optimization in some cases. conv2 flips the mask compared to filter2 .
viswanath reddy
viswanath reddy 2019년 1월 30일
i want to calculate mean for every pixel by moving the mask throughout the image starting as shown
Matt J
Matt J 2019년 1월 30일
OK. But your question has already been answered (so please Accept-click).
Guillaume
Guillaume 2019년 1월 30일
As Matt wrote, "If you want a 7x7 sliding window, you would use convolution" and he gave you the code.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

질문:

2019년 1월 29일

댓글:

2019년 1월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by