Adding constant if the pixel intensity is greater than 50?

조회 수: 2 (최근 30일)
Writer
Writer 2015년 9월 2일
댓글: Writer 2015년 9월 2일
Hello, I am new to Matlab, I would like to check every pixel in 16 bit image, If the pixel intensity is less than 50 its fine but if the intensity is greater than 50 in certain pixels, I should add that particular pixel with a constant and proceed to the next. The aim is to produce a new image by adding 2000 to the pixel Intensity>50, leaving pixel Intensity<50 unchanged. My Image size is 480x640; Thank You very much,
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 9월 2일
How do you intend to view the image? Are you using uint16 images?
Is it possible you meant add 200 rather than 2000? Even so, what result would you like for the places that start with at least 56, after which adding 200 would reach the limit of 255 for uint8 images.

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

채택된 답변

David Young
David Young 2015년 9월 2일
Assuming your image is stored in a variable called img:
highValues = img > 50;
img(highValues) = img(highValues) + 2000;
You don't say what you want to do with values equal to 50. The code above leaves them unchanged.
  댓글 수: 3
Writer
Writer 2015년 9월 2일
Thank you very much David Young It worked :)
Writer
Writer 2015년 9월 2일
Dear Walter Roberson I want to do this on 16 bit Image, May be I did not mentioned it clearly in my question. Thanks for the comments :)

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by