Hello
I want to downsample an image and I want to replace one pixel in new Image with average of four pixel in first image.
Could you help me ?

 채택된 답변

Walter Roberson
Walter Roberson 2015년 7월 2일

0 개 추천

Letting the image be IM and assuming it is double(),
NewImage = (IM(1:2:end, 1:2:end) + IM(2:2:end, 1:2:end) + IM(1:2:end, 2:2:end) + IM(2:2:end, 2:2:end)) / 4;

댓글 수: 3

bkshn
bkshn 2015년 7월 4일
Hello walter Roberson, thanks for your answer.
I have a question Does this formula contains all pixels in an Image?
Could you help me How it works?
Walter Roberson
Walter Roberson 2015년 7월 5일
This formula processes all pixels in the image at the same time. I just noticed that it will fail if the height or width are odd.
It works by taking the average of the pixels at (I,J), (I+1,J), (I,J+1), (I+1,J+1), doing so for every second row and ever second column.
bkshn
bkshn 2015년 7월 8일
Hello Walter Roberson
I think it's ok for grayscale image. Could you help me about rgbImage?
thanks

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

태그

질문:

2015년 7월 2일

댓글:

2015년 7월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by