Change the image contrast using imtool
1 回表示 (過去 30 日間)
古いコメントを表示
Hey!
I need a little push about one simple problem, and I want to automate one thing.
For example: Img is a grayscale image and I need to put min and max values as [0 160], then I want to 'Adjust Data', and save an output image.
imtool(Img,[0 160])
% here I need line which is for adjusting changed data
ImgOutput=getimage(imgca);
Thank you in advance!
2 件のコメント
Jürgen
2012 年 8 月 20 日
Hi,
maybe I am mistaken, but based on your information I do not understand what you want to do? Do you to do? " I want to 'Adjust Data', and save an output image." what do you mean by adjust?
saving an image can be done: saveas(gcf,'YourFig.jpg')
Ryan
2012 年 8 月 20 日
adjustedImage = imadjust(inputImage,[low_in; high_in], [low_out; high_out]);
回答 (1 件)
Image Analyst
2012 年 8 月 20 日
編集済み: Image Analyst
2012 年 8 月 20 日
You can use intlut()
clc; % Clear command window.
workspace; % Make sure the workspace panel is showing.
% Read in sample image.
grayImage = imread('moon.tif');
subplot(1, 2, 1);
imshow(grayImage);
colorbar;
% Create a look up table to map [min, max] to [0 160]
minGL = min(grayImage(:));
maxGL = max(grayImage(:));
lut = zeros(1, 256, 'uint8');
lut(minGL+1:maxGL+1) = linspace(0, 160, maxGL-minGL+1);
lut(maxGL+2:end) = 160;
% Apply the look up table to create a new image
% which will be in the range 0-160.
image160 = intlut(grayImage, lut);
% Display image.
subplot(1, 2, 2);
imshow(image160);
colorbar;
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!