function varargout = MainForm(varargin)
% MAINFORM MATLAB code for MainForm.fig
% MAINFORM, by itself, creates a new MAINFORM or raises the existing
% singleton*.
% H = MAINFORM returns the handle to a new MAINFORM or the handle to
% the existing singleton*.
%
% MAINFORM('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MAINFORM.M with the given input arguments.
%
% MAINFORM('Property','Value',...) creates a new MAINFORM or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before MainForm_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to MainForm_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help MainForm
% Last Modified by GUIDE v2.5 28-Dec-2023 12:27:40
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @MainForm_OpeningFcn, ...
'gui_OutputFcn', @MainForm_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before MainForm is made visible.
function MainForm_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to MainForm (see VARARGIN)
% Choose default command line output for MainForm
handles.output = hObject;
clc;
% axis(handles.axes1); cla reset; box on;
% set(gca, 'XTickLabel', '', 'YTickLabel', '');
%
% axis(handles.axes2); cla reset; box on;
% set(gca, 'XTickLabel', '', 'YTickLabel', '');
handles.Img = 0;
handles.ImgH = 0;
handles.ImgL = 0;
handles.strH = 0;
handles.strL = 0;
InitFig(hObject,handles);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes MainForm wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = MainForm_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --------------------------------------------------------------------
function File_Callback(hObject, eventdata, handles)
% hObject handle to File (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function OpenFile_Callback(hObject, eventdata, handles)
% hObject handle to OpenFile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% 打开
warning off all;
% 载入图像
[FileName,PathName,FilterIndex] = uigetfile({'*.bmp;*.jpg;*.tif;*.png;*.gif', ...
'所有图像文件';...
'*.*','所有文件' },'载入图像',...
'.\images\\lena.bmp');
if isequal(FileName, 0) || isequal(PathName, 0)
return;
end
InitFig(hObject, handles);
Img = imread(fullfile(PathName, FileName));
axes(handles.axes1);
imshow(Img, []);
handles.Img = Img;
handles.ImgH = 0;
handles.ImgL = 0;
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function textInfo_CreateFcn(hObject, eventdata, handles)
% hObject handle to textInfo (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --------------------------------------------------------------------
function SnapImg_Callback(hObject, eventdata, handles)
% hObject handle to SnapImg (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% 截图
SnapImage();
% --------------------------------------------------------------------
function SaveImg_Callback(hObject, eventdata, handles)
% hObject handle to SaveImg (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% 保存
if isequal(handles.ImgH, 0) && isequal(handles.ImgL, 0)
msgbox('请进行压缩处理!', '提示信息');
return;
end
if ~isequal(handles.ImgH, 0)
SaveImage(handles.ImgH);
end
if ~isequal(handles.ImgL, 0)
SaveImage(handles.ImgL);
end
msgbox('处理结果保存成功!', '提示信息');
% --------------------------------------------------------------------
function Exit_Callback(hObject, eventdata, handles)
% hObject handle to Exit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close();
% --------------------------------------------------------------------
function CompressAlgorithm_Callback(hObject, eventdata, handles)
% hObject handle to CompressAlgorithm (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Huffman_Callback(hObject, eventdata, handles)
% hObject handle to Huffman (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
str1=sprintf('思路\n\n');
str2=sprintf('欢迎沟通交流Q:3752243968\n');
string=[str1 str2];
msgbox(string,'温馨提示','none');
% --------------------------------------------------------------------
function Help_Callback(hObject, eventdata, handles)
% hObject handle to Help (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function HisteqContrast_Callback(hObject, eventdata, handles)
% hObject handle to HisteqContrast (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% 直方图对比
if isequal(handles.ImgH, 0) && isequal(handles.ImgL, 0)
msgbox('请进行压缩处理!', '提示信息');
return;
end
if ~isequal(handles.ImgH, 0)
HisteqContrast(handles.Img, handles.ImgH);
end
if ~isequal(handles.ImgL, 0)
HisteqContrast(handles.Img, handles.ImgL);
end
% --------------------------------------------------------------------
function AlgorithmFlow_Callback(hObject, eventdata, handles)
% hObject handle to AlgorithmFlow (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
str = '图像压缩系统,首先选择文件,打开载图像,然后选择霍夫曼图像压缩算法,我们可以比较压缩效果,最后可以观察直方图对比效果。';
msgbox(str, '提示信息');
% -----------------------------
没有合适的资源?快使用搜索试试~ 我知道了~
matlab基于霍夫曼图像压缩重建.zip代码13
共24个文件
jpg:14个
m:8个
png:1个
需积分: 1 0 下载量 190 浏览量
2024-05-01
12:53:44
上传
评论
收藏 1.67MB ZIP 举报
温馨提示
matlab基于霍夫曼图像压缩重建,matlab基于霍夫曼图像压缩重建,matlab基于霍夫曼图像压缩重建
资源推荐
资源详情
资源评论
收起资源包目录
13 基于霍夫曼图像压缩重建.zip (24个子文件)
13 基于霍夫曼图像压缩重建
snap_images
Frequency.m 176B
AddNode.m 196B
MainForm.fig 42KB
Decode.m 68B
0识别结果图.png 255KB
SnapImage.m 515B
MainForm.m 9KB
HisteqContrast.m 715B
SaveImage.m 445B
images
2.jpg 34KB
6.jpg 604KB
1.jpg 18KB
5.jpg 65KB
3.jpg 65KB
7.jpg 405KB
4.jpg 51KB
results
result3.jpg 12KB
result7.jpg 34KB
result5.jpg 18KB
result2.jpg 31KB
result4.jpg 31KB
result1.jpg 7KB
result6.jpg 54KB
InitFig.m 498B
共 24 条
- 1
资源评论
Matlab程序设计
- 粉丝: 15
- 资源: 105
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功