当前位置:网站首页>[image segmentation] image segmentation based on Markov random field with matlab code
[image segmentation] image segmentation based on Markov random field with matlab code
2022-06-11 18:57:00 【Matlab scientific research studio】
1 brief introduction
In daily life , People use images to acquire and exchange information , therefore , Application of image processing
Wai must involve people's lives 、 All aspects of work and study . And with the development of society , Human life
The dynamic range is also expanded , The application scope of image processing also changes . To be exact, image processing is
About image acquisition 、 transmission 、 Storage 、 Transformation 、 Show 、 A discipline of understanding and comprehensive utilization . Images
The main reason for the original processing is to improve the quality of the image , It takes people as the standard , By changing the image
Visual effects to achieve the purpose of improvement . In the process of image processing , The input of the running program is inferior
Images , The final output is the processed image with perfect quality , Currently commonly used image processing methods
Method has image enhancement 、 Restore 、 code 、 Compression etc. . since 1975 Years later , Image processing technology has been deeply developed
exhibition , Digital image processing is moving towards a higher level 、 Deeper development . People have begun to study how to use computers
Systematic interpretation of images , To achieve the purpose of understanding the outside similar to the human visual system , This is called image understanding or counting
Computer vision .
Digital images are often affected by various factors such as equipment environment in the process of acquisition and transmission .
For example, the sensitivity of components in the equipment is not uniform , The images obtained on rainy and sunny days are different , Of the image transmission process
Error and human factors , Will affect image acquisition and transmission . Especially the noise in the image
The influence of sound , It will change the original optimized image quality . Therefore, it is necessary to further operate the image
front , We usually remove the noise in the image first . Otherwise, it is likely to make us get
There is a large deviation or error between the result and the actual demand . In order to preserve the useful information in the image , And image denoising
It has become an important part of image processing , To reduce or eliminate noise and interference in the image . In practice
Application , In order to better complete the subsequent image processing ( Such as image segmentation , Image recognition, etc ), We will take the image to
Noise as a preprocessing of image processing and recognition . So how can you deliver quickly 、 Storing and processing information
At the same time, not changing the quality of information has become an urgent problem to be solved .
Markov random Airport (Markov Random Field) It has two meanings : First, what is Mar
Keefer , Second, what is random airport . The so-called Markov refers to the nature of Markov . When a random
Given the present state and all the past states of the process , The conditional probability distribution of its future state only depends on
In the current state ; let me put it another way , Given the present state , It's different from the state of the past ( That is, the historical path of the process
path ) It's conditionally independent , Then this stochastic process is Markov . A pass with Markov properties
Process is usually called Markov process . The first layer of theory is already familiar to people , The following focuses on Mar
The relevant theory of Markov random field .






2 Part of the code
% Segment the imageclcclearclose allimg = double(imread('rice.png'));% Read RGB Color images% img=double(rgb2gray(I));% Turn a color image into a grayscale image , And change the pixel value to double typeclass_number = 6;% Set the number of categoriesmax_iter = 40;% Maximum number of iterations%------------- Random initialization label ----------------label = randi([1,class_number],size(img));iter = 0;while iter < max_iter%------- Calculate the prior probability ---------------% A priori probability is used to determine whether the labels of pixels and two-dimensional fields are the same%------ Collect the labels of points in the two-dimensional neighborhood --------label_u = imfilter(label,[0,1,0;0,0,0;0,0,0],'replicate');% Onlabel_d = imfilter(label,[0,0,0;0,0,0;0,1,0],'replicate');% Nextlabel_l = imfilter(label,[0,0,0;1,0,0;0,0,0],'replicate');% Leftlabel_r = imfilter(label,[0,0,0;0,0,1;0,0,0],'replicate');% Rightlabel_ul = imfilter(label,[1,0,0;0,0,0;0,0,0],'replicate');% Top leftlabel_ur = imfilter(label,[0,0,1;0,0,0;0,0,0],'replicate');% The upper rightlabel_dl = imfilter(label,[0,0,0;0,0,0;1,0,0],'replicate');% The lower leftlabel_dr = imfilter(label,[0,0,0;0,0,0;0,0,1],'replicate');% The lower rightpro_c = zeros(class_number,size(label,1)*size(label,2));% Calculating pixels 8 The number of domain labels is the same for each classfor i = 1:class_numberlabel_i = i * ones(size(label));temp = ~(label_i - label_u) + ~(label_i - label_d) + ...~(label_i - label_l) + ~(label_i - label_r) + ...~(label_i - label_ul) + ~(label_i - label_ur) + ...~(label_i - label_dl) +~(label_i - label_dr);% Frequency of occurrencepro_c(i,:) = temp(:)/8;% Calculate the probability by dividing the frequency by the total numberendpro_c(pro_c == 0) = 0.00001;% Prevent emergence 0%--------------- Calculate the conditional probability ----------------iter = iter + 1;%---- Draw the original picture for comparison ---if iter==max_itersubplot(3,3,n);imshow(img)title(' Original picture ');endend
3 Simulation results




4 reference
About bloggers : Good at intelligent optimization algorithms 、 Neural networks predict 、 signal processing 、 Cellular automata 、 The image processing 、 Path planning 、 UAV and other fields Matlab Simulation , relevant matlab Code problems can be exchanged by private letter .
Some theories cite network literature , If there is infringement, contact the blogger to delete .
边栏推荐
- Balanced search binary tree -- AVL tree
- 开发中必备的文件的上传与下载
- 让我们的坦克欢快的动起来吧
- Flink CDC 在大健云仓的实践
- Non recursive traversal of binary tree
- Niuke brush questions part6
- Leetcode: sword finger offer 59 - ii Maximum value of queue [deque + sortedlist]
- Dynamic explosion effect
- 视觉SLAM十四讲笔记-10-1
- 「案例分享」基于 AM57x+ Artix-7 FPGA开发板——PRU开发手册详解
猜你喜欢

Teach you how to learn the first set and follow set!!!! Hematemesis collection!! Nanny level explanation!!!

《经济学人》:WTO MC12重启 数字经济成为全球经济复苏和增长的核心引擎
![cf:A. Print a Pedestal (Codeforces logo?) [simple traversal simulation]](/img/5e/0acd39d572954e5ecb936f49511d94.png)
cf:A. Print a Pedestal (Codeforces logo?) [simple traversal simulation]
2022 coming of age ceremony, to every college entrance examination student

Niu Ke's questions -- binary search tree and bidirectional linked list

Why is ti's GPMC parallel port more often used to connect FPGA and ADC? I give three reasons

【信号去噪】基于FFT和FIR实现信号去噪附matlab代码

动态爆炸效果

2023年西安交通大学管理学院MPAcc提前批面试网报通知

Force deduction 23 questions, merging K ascending linked lists
随机推荐
基于TI AM5728 + Artix-7 FPGA开发板(DSP+ARM) 5G通信测试手册
Force buckle 34 finds the first and last positions of elements in a sorted array
今天睡眠质量记录60分
【图像分割】基于马尔可夫随机场实现图像分割附matlab代码
On the sequence traversal of binary tree
In 2023, the MPAcc of School of management of Xi'an Jiaotong University approved the interview online in advance
Swagger2 easy to use
Swagger2简单使用
Web3 Games: exploring and reshaping the game experience
关于我的 “二进制部署 kubernetes 集群” 的体验
On the sequence traversal of binary tree Ⅱ
开发中必备的文件的上传与下载
北京邮电大学2023级工商管理硕士MBA(非全日制)已开启
The US inflation rate reached a 41 year high of 8.6%! High inflation fever? The stock and encryption markets fell first!
视觉SLAM十四讲笔记-10-2
Niu Ke swipes the question -- converting a string to an integer
Teach you how to learn the first set and follow set!!!! Hematemesis collection!! Nanny level explanation!!!
Dynamic explosion effect
防止敌方坦克重叠
New project construction environment method