matlab 如何实现jpg图像的反转_matlab gui中怎样对彩色图片进行翻转处理?

这是我的读取图像和翻转处理的函数为什么只能对灰度处理后的图像翻转对彩色图像会报错?我用的是7.0的!我是初学者啊求大神!!!!!!functionwenjian_open_Callback(hObject,event...

这是我的读取图像和翻转处理的函数为什么只能对灰度处理后的图像翻转对彩色图像会报错?我用的是7.0的!我是初学者啊 求大神!!!!!!

function wenjian_open_Callback(hObject, eventdata, handles)

% hObject handle to wenjian_open (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

[filename,pathname]=uigetfile({'*.jpg';'*.bmp';'*.tif';'*.*'},'载入图像');

if isequal(filename,0)|isequal(pathname,0)

errordlg('没有选中文件','出错');

return;

else

file=[pathname,filename];

global S %设置一个全局变量S,保存初始图像路径,以便之后的还原操作

S=file;

x=imread(file);

set(handles.axes1,'HandleVisibility','ON');

axes(handles.axes1);

imshow(x);

set(handles.axes1,'HandleVisibility','OFF');

axes(handles.axes2);

imshow(x);

handles.img=x;

guidata(hObject,handles);

end

图像翻转:

function uipanel7_SelectionChangeFcn(hObject, eventdata, handles) %图像翻转

% hObject handle to uipanel7 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

str=get(hObject,'string');

axes(handles.axes2);

global T

switch str

case '左右翻转'

T=handles.img;

f=fliplr(handles.img);

imshow(f);

handles.img=f;

guidata(hObject,handles);

case '上下翻转'

T=handles.img;

f=flipud(handles.img);

imshow(f);

handles.img=f;

guidata(hObject,handles);

end

set(handles.uipanel7,'Visible','on');

if strcmp(get(gcbo, 'Checked'),'on')

set(handles.uipanel7,'Visible','on');

set(gcbo, 'Checked', 'off');

set(handles.uipanel7,'Visible','off');

else

set(gcbo, 'Checked', 'on');

end

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值