当前位置:网站首页>Matlab: halftone and dither conversion
Matlab: halftone and dither conversion
2022-06-12 05:20:00 【Morol_】
MATLAB: Image halftone conversion (halftone) And jitter conversion (dither)
《MATLAB: Image halftone (halftone) Display and jitter (dither) Show 》
This paper addresses https://blog.csdn.net/qq_39475211/article/details/86664284
What is halftone (halftone)
Halftone (Halftone) Technology is used in traditional printing to process step and simulate continuous tone (Continue tone) Methods .
chart : Discontinuous and continuous tone
An image printed on a printer or printer , Levels can only be expressed by inking or not , Binary images like this are called halftone images . As long as we adjust different forms 、 Ink dots of different sizes , The principle that the human eye can visually integrate the adjacent ink points in the image , Observe at a certain distance , The binary image can reproduce the feeling of continuous tone .
It can be intuitively understood as sacrificing space to achieve different depths , Use the number of ink points to realize the change of printing depth .
The usual classification
The halftones are amplitude modulation (Amplitude Modulation, AM) And FM (Frequency Modulation, FM), Simply speaking ,AM Is the use of dot area size to show the intensity of the image ;FM It is based on the density of dot arrangement spacing , To present the hierarchy of the image .
A little experiment 1
1. Read cameraman.tif Images , Write your own code , complete 4x4 Of halftone Convert and display ;
AM Method :
Divide the pixel gray value of the image into 16 rank ( In fact, it can also be 17 rank ), Then corresponding to the original pixel position is expanded to 4x4 grid . Different intensity of gray scale will blacken different number of grids .
such as , stay 256 Grayscale medium , The grayscale of a pixel is 30, Because we divide the pixel gray value of the image into 16 rank ( Grayscale 0~15 by 1 rank ,16-31 by 2 rank ……), So this pixel is 4x4 Apply... To the grid 2 grid .
( Where to paint the grid ? In fact, the position of painting is not very important , The key is the number of coats .)
After this treatment , Original 30x30 The image becomes 120x120 size .
Same number of colors , Different painting positions - contrast :
shake (dither)
shake (dither) It is also a classification of halftones , It is mainly divided into two categories: random jitter and ordered jitter . Both algorithms require a template , Also known as jitter matrix or threshold matrix , The dithering matrix not only determines the order in which the dots become black dots when the brightness or gray value decreases , It also determines the quality of halftone image , So the key of dithering algorithm is the construction of dithering matrix .
For specific principles, please refer to the article of the boss :https://blog.csdn.net/songzitea/article/details/40832565
A little experiment 2
- read dither.pdf file , Use after understanding matlab Self contained dither Function pair cameraman.tif Image processing dither Convert and display .
We use it directly MATLAB Self contained dither() function :
MATLAB Official website (https://ww2.mathworks.cn/help/matlab/ref/dither.html?s_tid=srchtitle) There is an introduction in Chinese .
attach : Main code MATLAB
A little experiment 1( Halftonic halftone)
I=imread('cameraman.tif'); % Read images
J=I/16; % Gray scale 16 level
K=zeros(1024,1024); % Create a new empty matrix to save the results
for x=1:1:256
for y=1:1:256
switch J(x,y) % matching 16 Different gray levels , For empty matrix 4X4 halftone preservation
case 1
case 2
K(4*x-3,4*y-3)=1;
case 3
K(4*x-3,4*y-3)=1;K(4*x-2,4*y-2)=1;
case 4
K(4*x-3,4*y-3)=1;K(4*x-2,4*y-2)=1;K(4*x-1,4*y-1)=1;
case 5
K(4*x-3,4*y-3)=1;K(4*x-2,4*y-2)=1;K(4*x-1,4*y-1)=1;K(4*x,4*y)=1;
case 6
K(4*x-3,4*y-3)=1;K(4*x-2,4*y-2)=1;K(4*x-1,4*y-1)=1;K(4*x,4*y)=1;
K(4*x-2,4*y-1)=1;
case 7
K(4*x-3,4*y-3)=1;K(4*x-2,4*y-2)=1;K(4*x-1,4*y-1)=1;K(4*x,4*y)=1;
K(4*x-2,4*y-1)=1;K(4*x-3,4*y-2)=1;
case 8
K(4*x-3,4*y-3)=1;K(4*x-2,4*y-2)=1;K(4*x-1,4*y-1)=1;K(4*x,4*y)=1;
K(4*x-2,4*y-1)=1;K(4*x-3,4*y-2)=1;K(4*x-1,4*y)=1;
case 9
K(4*x-3,4*y-3)=1;K(4*x-2,4*y-2)=1;K(4*x-1,4*y-1)=1;K(4*x,4*y)=1;
K(4*x-2,4*y-1)=1;K(4*x-3,4*y-2)=1;K(4*x-1,4*y)=1;K(4*x-3,4*y-1)=1;
case 10
K(4*x-3,4*y-3)=1;K(4*x-2,4*y-2)=1;K(4*x-1,4*y-1)=1;K(4*x,4*y)=1;
K(4*x-2,4*y-1)=1;K(4*x-3,4*y-2)=1;K(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-1,4*y-3)=1;K(4*x,4*y-2)=1;
case 16
K(4*x-3,4*y-3)=1;K(4*x-2,4*y-2)=1;K(4*x-1,4*y-1)=1;K(4*x,4*y)=1;
K(4*x-2,4*y-1)=1;K(4*x-3,4*y-2)=1;K(4*x-1,4*y)=1;K(4*x-3,4*y-1)=1;
K(4*x-2,4*y)=1;K(4*x-3,4*y)=1;K(4*x-2,4*y-3)=1;K(4*x-1,4*y-2)=1;
K(4*x-1,4*y-3)=1;K(4*x,4*y-2)=1;K(4*x,4*y-1)=1;
end
end
end
Complete code in https://download.csdn.net/download/qq_39475211/10940207
There is no way to modify C The coin …… You can find a treasure to download it
A little experiment 2( shake dither)
I = imread('cameraman.tif');
X = dither(I);
subplot(1,2,1),imshow(I),title("sample");
subplot(1,2,2),imshow(X),title("dither");
by:Morol
[email protected]
边栏推荐
- [getting to the bottom] five minutes to understand the combination evaluation model - fuzzy borde (taking the C question of the 2021 college students' numerical simulation national competition as an e
- [GIS tutorial] ArcGIS for sunshine analysis (with exercise data download)
- 59 - II. Maximum value of the queue
- Calculation method notes for personal use
- Pupanvr create project and management script (2)
- @Configurationproperties value cannot be injected
- Main business objects of pupanvr record (5)
- Thingsboard view telemetry data through database
- Parallélisation de l'entraînement accéléré TF. Données. Générateur de données
- MySQL Linux Installation mysql-5.7.24
猜你喜欢

Why is Julia so popular?

ShanMeng and Beijing Adoption Day start NFT digital collection public offering

Spatial distribution data of national multi-year average precipitation 1951-2021, temperature distribution data, evapotranspiration data, evaporation data, solar radiation data, sunshine data and wind
![February 19, 2022 [Nolan] Nolan resurrected? Change · Nolan [soul orchid] can be connected to XDD / silly girl](/img/1a/ab2158a532683632f3a12fe41812f5.jpg)
February 19, 2022 [Nolan] Nolan resurrected? Change · Nolan [soul orchid] can be connected to XDD / silly girl

According to aiqicha, keep went public in Hong Kong and hit the "first share of online fitness"

Big manufacturers compete to join rust, performance and safety are the key, and the 2021 rust developer survey report is announced

Simulation of array implementation stack

Multi thread learning III. classification of threads

It costs less than 30 yuan, but we still don't build it quickly - check the small knowledge of software application

Detailed explanation of data envelopment analysis (DEA) (taking the 8th Ningxia provincial competition as an example)
随机推荐
59 - II. Maximum value of the queue
Ecosystem type distribution data, land use data, vegetation type distribution and nature reserve distribution data
MySQL Linux Installation mysql-5.7.24
Servlet core
cellular automaton
【C语言】实现字符串截取功能
Force/release learning arrangement in IC Verification (5) research on the influence of reg type signals
[backtracking] backtracking method to solve combinatorial problems
Google reinforcement learning framework seed RL environment deployment
Yolo opencv scale identification scale reading identification water gauge identification water level identification source code
[backtracking method] queen n problem
Detailed analysis of mathematical modeling problem a (vaccine production scheduling problem) of May Day cup in 2021
Variables and data types
Reason: Canonical names should be kebab-case (‘-‘ separated), lowercase alpha-numeric characters and
Please remove any half-completed changes then run repair to fix the schema history
The emergence of new ides and the crisis of programmers?
According to aiqicha, keep went public in Hong Kong and hit the "first share of online fitness"
【cjson】根节点注意事项
Static keyword and inheritance, polymorphic and special classes
1008 color classification