Image size reduction by averaging pixels into one

Hello, I want to reduce the size of an image by averaging every 4 neighbouring pixels into 1 pixel of the output image. This should help me to get an N/2 x N/2 image from an N x N image.
I was using a kernal = ones(2) and conv2(). But I was not able to get the dientions to half of the original image. Can you please help?
Thank you.

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 2일
편집: Ameer Hamza 2020년 11월 2일
There can be several ways to do this in MATLAB. Check my answer here: https://www.mathworks.com/matlabcentral/answers/543872-compress-down-a-1000x1000-matrix-into-a-100x100-matrix. Apart from those methods, imresize() will also work
im_resized = imresize(img, 1/2)

추가 답변 (0개)

카테고리

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

질문:

2020년 11월 2일

댓글:

2020년 11월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by