Change the image contrast using imtool

조회 수: 1 (최근 30일)
Marko Baros
Marko Baros 2012년 8월 20일
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
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
Ryan 2012년 8월 20일
I am not sure what you are looking to do exactly, but perhaps imadjust would help?
adjustedImage = imadjust(inputImage,[low_in; high_in], [low_out; high_out]);

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

답변 (1개)

Image Analyst
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]);

카테고리

Help CenterFile Exchange에서 Explore and Edit Images with Image Viewer App에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by