How to set grayscale just between 100 to 250?

1 view (last 30 days)
Dear all, Im a newby to matlab.I have 8bit gray scale image "X". I want to set the gray level just between 100 -250. Any respond will be appreciated. Thanks

Accepted Answer

Jan
Jan on 4 Mar 2015
The question is not clear. But let me guess:
X = randi([0, 255], 640, 480, 'uint8'); % Example image
X(X < 100) = 100;
X(X > 250) = 250;
Or:
X = min(max(X, uint8(100)), uint8(250));

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!