Research Article
Deep Learning Based Tongue Prickles Detection in Traditional Chinese Medicine
Algorithm 1
Mask morphology processing.
| Input: Binary tongue mask I width and height H | | Output: Tongue mask with structural integrity | | num_label = 0 | | for y = 0 to H − 1 do | | for x = 0 to − 1 do | | N = neighbours (I[y, x]) | | if I[y, x] = = 1 then | | if 0 not in N then | | I[y, x] = num_label//Give each mask pixel a label | | num_label+=1 | | else if has_mask(N) then | | label = min(N) | | I[y, x] = label//If neighbours have label, use the minimum one. | | labelSet[label].append(N.all_labels()) | | for y = 0 to H − 1 do | | for x = 0 to − 1 do | | I(y, x) = min(labelSet[I(y, x)])//Unify the label of each component | | Select the mask component with largest area as tongue and discard others | | Select the background component with largest area and discard others//Fill holes in mask | | Return I |
|