当前位置:网站首页>Mise en œuvre du codage Huffman et du décodage avec interface graphique par MATLAB
Mise en œuvre du codage Huffman et du décodage avec interface graphique par MATLAB
2022-07-07 11:49:00 【MATLAB Research Studio】
1 Introduction
InmatlabSimulation moyenneCListe des chaînes moyennes,En utilisant des opérations complexes,Contactez les caractères et les probabilités spécifiques,Le numéro correspondant à deux caractères de la probabilité minimale trouvée à chaque fois,Notez dans l'ordre,Enfin, selon les différentes implémentations du Code de paritéHuffmanCodage.Cet algorithme est nouveau et unique,Facile à comprendre,Programmation.
2 Code partiel
function varargout = huffman_GUI(varargin)
% HUFFMAN_GUI M-file for huffman_GUI.fig
% HUFFMAN_GUI, by itself, creates a new HUFFMAN_GUI or raises the existing
% singleton*.
%
% H = HUFFMAN_GUI returns the handle to a new HUFFMAN_GUI or the handle to
% the existing singleton*.
%
% HUFFMAN_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in HUFFMAN_GUI.M with the given input arguments.
%
% HUFFMAN_GUI('Property','Value',...) creates a new HUFFMAN_GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before huffman_GUI_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to huffman_GUI_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 huffman_GUI
% Last Modified by GUIDE v2.5 10-Jan-2014 18:20:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @huffman_GUI_OpeningFcn, ...
'gui_OutputFcn', @huffman_GUI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(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 huffman_GUI is made visible.
function huffman_GUI_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 huffman_GUI (see VARARGIN)
% Choose default command line output for huffman_GUI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes huffman_GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = huffman_GUI_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;
% --- Executes during object creation, after setting all properties.
function xylj_CreateFcn(hObject, eventdata, handles)
% hObject handle to xylj (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function xylj_Callback(hObject, eventdata, handles)
% hObject handle to xylj (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of xylj as text
% str2double(get(hObject,'String')) returns contents of xylj as a double
% --- Executes on button press in dqxy.
function dqxy_Callback(hObject, eventdata, handles)
% hObject handle to dqxy (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({'*.txt'},'Veuillez sélectionner un fichier'); % Sélectionnez la fonction de la zone de fichier
str=[Pathname Filename]; % Obtenir le chemin et le nom du fichier
xinyuan=textread(str,'%s'); %Sous forme de chaîne, Lire dans un fichier texte
xinyuan=xinyuan{:}; %Oui.cell Les données de type sont converties en char
set(handles.xylj,'string',str) % Afficher le chemin de la source
set(handles.xy,'string',xinyuan) % Afficher la source
% --- Executes during object creation, after setting all properties.
function xy_CreateFcn(hObject, eventdata, handles)
% hObject handle to xy (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function xy_Callback(hObject, eventdata, handles)
% hObject handle to xy (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of xy as text
% str2double(get(hObject,'String')) returns contents of xy as a double
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in bm.
function bm_Callback(hObject, eventdata, handles)
% hObject handle to bm (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clc; %Effacercommand window
data=get(handles.xy,'String'); % Lire la source
data=uint8(data); % Convertir la source en uint8
[codeword_OK,simbolsout1,fout1,simbolsout2,fout2,zipped,info] = norm2huff(data); %Codage
%Avant le tri
for i=1:length(fout1)
fout1str{i}=num2str(fout1(i)); % Convertir la probabilité avant le tri en cellDonnées de type,PratiquelistboxUtiliser
str1{i}=char(simbolsout1(i)-1); % Convertir les symboles avant le tri en cellDonnées de type,PratiquelistboxUtiliser,charOui.ASCIICode à caractère
end
handles.str1=str1; % Obtenez les symboles de pré - tri
handles.fout1str=fout1str; % Obtenir la probabilité de pré - tri
%Après tri
for i=1:length(fout2)
str2{i}=char(simbolsout2(i)-1); % Convertir les symboles triés en cellDonnées de type,PratiquelistboxUtiliser,charOui.ASCIICode à caractère
end
handles.str2=str2; % Obtenir les symboles triés
% Obtenir le Code
for i=1:length(codeword_OK)
codestr{i}=num2str(double(codeword_OK{i}));
codestr{i}=codestr{i}(find(codestr{i}~=' ')); % Supprimer les espaces dans la chaîne , Obtenir le Code Hoffman
end
handles.codestr=codestr; % Enregistrer le Code Hoffman
handles.zipped=zipped; % Enregistrer les résultats encodés
handles.info=info;
guidata(hObject, handles); %Mise à jourhandlesStructure
% --- Executes on button press in myzl.
function myzl_Callback(hObject, eventdata, handles)
% hObject handle to myzl (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.xsmyzl,'Value',1)
set(handles.xsmyzl,'String',handles.str1);
% --- Executes during object creation, after setting all properties.
function xsmyzl_CreateFcn(hObject, eventdata, handles)
% hObject handle to xsmyzl (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on selection change in xsmyzl.
function xsmyzl_Callback(hObject, eventdata, handles)
% hObject handle to xsmyzl (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns xsmyzl contents as cell array
% contents{get(hObject,'Value')} returns selected item from xsmyzl
error('input argument must be a uint8 vector')
end
%f=repmat(0,1,256);
% Scan Vector
len=length(vector);
for index=0:255; % Notez que le paramètre Index du vecteur est de 0Au début
f(index+1)=sum(vector==uint8(index));
end
%
3 Résultats de la simulation
4 Références
[1] Wu Ji - Qun , Li shuangke . MatlabRéalisationhuffmanCodage[J]. Information scientifique et technologique en Chine, 2006(19):2.
Profil du blogueur:Bon algorithme d'optimisation intelligent、Prédiction du réseau neuronal、Traitement des signaux、Automates cellulaires、Traitement d'images、Planification des itinéraires、Dans de nombreux domaines tels que les dronesMatlabSimulation,AutresmatlabLes problèmes de code peuvent être échangés par courrier privé.
Une partie de la théorie cite la littérature en ligne,Si un blogueur de contact contrefait supprime.
边栏推荐
- There are ways to improve self-discipline and self-control
- 问下flinkcdc2.2.0的版本,支持并发,这个并发是指多并行度吗,现在发现,mysqlcdc全
- Talk about SOC startup (VI) uboot startup process II
- R language Visual facet chart, hypothesis test, multivariable grouping t-test, visual multivariable grouping faceting boxplot, and add significance levels and jitter points
- 【最短路】Acwing1128信使:floyd最短路
- [shortest circuit] acwing 1127 Sweet butter (heap optimized dijsktra or SPFA)
- [question] Compilation Principle
- 简单介绍一下闭包及它的一些应用场景
- Summed up 200 Classic machine learning interview questions (with reference answers)
- R语言可视化分面图、假设检验、多变量分组t检验、可视化多变量分组分面箱图(faceting boxplot)并添加显著性水平、添加抖动数据点(jitter points)
猜你喜欢
【纹理特征提取】基于matlab局部二值模式LBP图像纹理特征提取【含Matlab源码 1931期】
Talk about SOC startup (VI) uboot startup process II
总结了200道经典的机器学习面试题(附参考答案)
In SQL, I want to set foreign keys. Why is this problem
Half of the people don't know the difference between for and foreach???
正在運行的Kubernetes集群想要調整Pod的網段地址
Use metersphere to keep your testing work efficient
正在运行的Kubernetes集群想要调整Pod的网段地址
Test the foundation of development, and teach you to prepare for a fully functional web platform environment
一度辍学的数学差生,获得今年菲尔兹奖
随机推荐
EasyUI learn to organize notes
In SQL, I want to set foreign keys. Why is this problem
人大金仓受邀参加《航天七〇六“我与航天电脑有约”全国合作伙伴大会》
一起探索云服务之云数据库
What is high cohesion and low coupling?
Design intelligent weighing system based on Huawei cloud IOT (STM32)
對比學習之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments
R language Visual facet chart, hypothesis test, multivariable grouping t-test, visual multivariable grouping faceting boxplot, and add significance levels and jitter points
【神经网络】卷积神经网络CNN【含Matlab源码 1932期】
正在运行的Kubernetes集群想要调整Pod的网段地址
Automated testing framework
What is cloud computing?
通过环境变量将 Pod 信息呈现给容器
Technology sharing | packet capturing analysis TCP protocol
Swiftui swift internal skill how to perform automatic trigonometric function calculation in swift
There are ways to improve self-discipline and self-control
Verilog design responder [with source code]
超标量处理器设计 姚永斌 第8章 指令发射 摘录
简单介绍一下闭包及它的一些应用场景
How to add aplayer music player in blog