当前位置:网站首页>Hilditch refinement (implementation I)
Hilditch refinement (implementation I)
2022-07-24 20:39:00 【51CTO】
For the current pixel , Scan its 8 Neighborhood , If the pixel value of the neighborhood is 255, be b[i]=1(i=0…8), The pixel value is 128( Indicates that the pixel is marked for deletion in the previous cycle ),b[i]=-1, If the pixel value is 0, be b[i]=0.
The following will be based on b[i] The value of the to 6 There are two conditions , If the conditions are met , The pixel value will be marked as GRAY(128).
1. b[0]=1, That is, the current pixel must be the front scenic spot .
2. 1-abs(b1) + 1 – abs(b3) + 1 –abs(b5) + 1 – abs(b7) >= 1, This condition indicates that the current pixel is a boundary point , That is, at least one of the four points in the East, West, north, South b[i]=0.
3. abs(b1)+…+abs(b8)>=2, This condition indicates that the endpoint cannot be deleted , namely p0 Only one point around the point is 1 or -1 The situation of .
4. Statistics b1 To b8 be equal to 1 The number of , The quantity value must be greater than 1, This condition indicates that the endpoint cannot be deleted .、
5. Connectivity detection , Use the following formula : First, according to the current pixel around 3*3 Domain value , Record d[9] Array , If b[i] be equal to 0, be d[i]=0, otherwise d[i]=1, The final calculation d1-d1*d2*d3+d3-d3*d4*d5+d5-d5*d6*d7+d7-d7*d8*d1 Is it 1, by 1 Then the connectivity is satisfied , You can delete .
6. The last condition guarantees that when the contour is 2 Pixels wide , Delete only one side . Statistics sum Value , The duty of 8 When , You can delete .
It may not be easy to understand , Here are a few gif Show the refinement process , Red indicates the points deleted in this round .
Green in the figure below indicates : This round meets the first condition , But points that do not meet the second condition .

Green in the figure below indicates : Points that meet the first condition but do not meet the third condition .

Green in the figure below indicates : Points that meet the first condition but do not meet the fourth condition .

The figure below is green : Points that meet the first condition but do not meet the fifth condition .

The figure below is green : Points that meet the first condition but do not meet the sixth condition :

The sixth condition may not be easy to understand , Width ( Height ) Only 2 Pixel image , If there is no condition six , It's gone .
The first round of the first five conditions , No green .




Sixth , There's a line ( Column ) Rate .

边栏推荐
- Lunch break train & problem thinking: on multidimensional array statistics of the number of elements
- 1. Mx6u-alpha development board (buzzer experiment)
- Merge sort
- [training Day10] point [enumeration] [bidirectional linked list]
- Rhodamine B labeled PNA | rhodamine b-pna | biotin modified PNA | biotin modified PNA | specification information
- 1. Mx6u-alpha development board (key input experiment)
- [msp430g2553] graphical development notes (1) configuration environment
- Application layer - typical protocol analysis
- RESNET interpretation and 1 × 1 Introduction to convolution
- Go language structure
猜你喜欢

Unitywebgl project summary (unfinished)

How to set appium script startup parameters

Open source demo | release of open source example of arcall applet

Each blogger needs to ask himself seven basic questions

Eight transformation qualities that it leaders should possess

Istio II traffic hijacking process
![[advanced data processing technology] data filtering, advanced data filling, initial and advanced data transformation](/img/0c/70643343d73137926963013a4862d0.png)
[advanced data processing technology] data filtering, advanced data filling, initial and advanced data transformation
![[training Day8] tent [mathematics] [DP]](/img/d3/42869ed5bb7c9148d9fa7367a9af02.png)
[training Day8] tent [mathematics] [DP]

whistle ERR_ CERT_ AUTHORITY_ INVALID

API data interface for historical data of A-share index
随机推荐
[training Day10] point [enumeration] [bidirectional linked list]
Unity's ugui text component hard row display (improved)
Applet wonderful bug update~
Career development suggestions shared by ten CIOs
English grammar_ Demonstrative pronoun this / these / that / those
[feature transformation] feature transformation is to ensure small information loss but high-quality prediction results.
Methods of using tyrosine modified peptide nucleic acid PNA | Tyr PNA | BZ Tyr PNA | 99Tcm survivinmrna antisense peptide nucleic acid
[training Day8] tent [mathematics] [DP]
96. Strange tower of Hanoi
Appium obtains and clicks coordinates, which is very easy to use when elements are inconvenient to locate
TCP sliding window, singleton mode (lazy and hungry) double checked locking / double checked locking (DCL)
A new UI testing method: visual perception test
[training Day10] linear [mathematics] [thinking]
Teach you five ways to crack the computer boot password
Five digital transformation strategies of B2B Enterprises
How to apply Po mode in selenium automated testing
Inconsistent time
[sciter]: window communication
When using vscode, the tab indentation changes from 4 spaces to small arrows (solved)
Vscode connected to the remote server cannot format the code / document (resolved)