Identification element (Queue)

xiaoxiao2021-03-05  25

Void label () {// initializing wall for (INT i = 0; i <= m 1; i ) {Pixel [0] [i] = Pixel [M 1] [i] = 0; Pixel [i] [0] = Pixel [i] [m 1] = 0;}

// Initialize Offset Position Offset [4]; Offset [0 ].Row = 0; Offset [0] .col = 1; // Right Offset [1] .Row = 1; Offset [1] .col = 0; / / Next Offset [2 ].Row = 0; Offset [2] .col = -1; // Left Offset [3] .row = -1; Offset [3] .col = 0; //

Int numofnbrs = 4; LinkedQueue q; int ID = 1; Position Here, NBR;

/ / Scan all pixel for (int R = 1; r <= m; R ) for (int C = 1; c <= m; C ) {IF (Pixel [R] [C] == 1) // New Chamber {Pixel [R] [C] == id; here.row = r; here.col = c;}

// Look for the remaining filling DO {for (int i = 0; I

Ref: << Data Structure, Algorithm & Applications >> P204 ~ 206

转载请注明原文地址:https://www.9cbs.com/read-32226.html

New Post(0)