Set pixel value to zero in intensity image

I wish to set the value of a pixel at a certain coordinate to zero in an image. Any idea how to do this? The coordinate is (641,513) (the middle).
Thanks in advance,
JB

 채택된 답변

Nitin
Nitin 2013년 6월 25일

0 개 추천

I = imread(img);
I(614,513)=0;

댓글 수: 3

J B
J B 2013년 6월 25일
Thanks a lot! Actually did this myself but interestingly didn't work as the x and y axes had somehow switched. Think it may be to do with using the fftshift function before setting the pixel to zero
J B
J B 2013년 6월 25일
So for this I had to use I(513,614) for the centre even though the matrix was originally 1280x1024. It had changed to 1024x1280 after performing fftshift.
Image Analyst
Image Analyst 2013년 6월 25일
x is column, y is row. So I(x,y) is not the same location as I(row, column). If you want x = 20, y = 100, you need to do I(100, 20), not I(20,100) because the row (the y value) index comes first. This is a common source of confusion and errors and you need to always watch out for this.

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

추가 답변 (0개)

질문:

J B
2013년 6월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by