我设计了一个MATLAB,其中有两个轴来显示图像。我使用‘不对比度’功能来调整图像在第一轴上的亮度/对比度。现在,我想将这个增强输出(亮度/对比度调整输出)存储在一些变量中。由于“无对比度”函数不返回输出图像,那么如何获得输出图像?或者是否有任何方法从特定的轴读取图像数据?我尝试了'getimage‘函数,但它返回包含在Handle对象中的第一个图像数据(即以前显示的输入图像),而不是最新的亮度/对比度调整图像。请帮助我保存亮度/对比度调整图像给出的‘不对比度’功能。
发布于 2014-05-17 16:15:17
用这个-
imcontrast(gca) %// Perform imcontrast
waitfor(gcf); %// Wait for figure data to be updated with imcontrast
image_data = getimage(gcf);%// Store image data as image_data variable如何在GUI中使用
为了展示如何使用它,您可以用MATLAB-Guide创建一个按钮,并在它的回调函数中使用-
%// Show the image on an existing image axes of the GUI.
imshow('pout.tif') %// This image is available in MATLAB image library.
imc_figure = imcontrast(gca) %// Perform imcontrast
waitfor(imc_figure); %// Wait for the data to be updated in the current figure
image_data = getimage(gcf);%// image data stored into image_data variable
%// Open image_data on a separate figure window for verification.
%// Make sure this is the updated image.
figure,imshow(image_data)如何使用作为独立代码的
Im = imread('cameraman.tif');%// This image is available in MATLAB image library.
h1 = imshow(Im)
h2 = imcontrast(gca); %// Perform imcontrast
waitfor(h2); %// Wait for figure data to be updated with imcontrast
image_data = getimage(gcf);%// Store modified image data
%// Show modified image data for verification
figure,imshow(image_data)https://stackoverflow.com/questions/23712923
复制相似问题