| Algorithm 1 The flow of image segmentation method |
| Step 1: Input digital image I, which has a size of M × N. The grayscale image F is obtained by graying out the image I; Step 2: The grayscale image F is nonlocal mean filtered to obtain the nonlocal mean image G according to Equations (9)–(12); Step 3: A two-dimensional image histogram is constructed using the grayscale values and nonlocal means in F and G; Step 4: Compute the two-dimensional Kapur’s entropy according to Equations (13)–(15); Step 5: Kapur’s entropy of the two-dimensional histogram is optimized using WGWO; Step 6: Multi-threshold image segmentation is performed according to the optimal threshold set to obtain pseudo-color and gray images. |