Estimating the largest width as in the previous post [Link] is interesting but in most cases, we want a distribution of widths...
2. Distribution of widths
A new test image (Fig.1) ...Fig.1: Test image |
Edit > Invert
), select all the image with Ctrl + A, and compute a plot profile with Analyze > Plot Profile
(or Ctrl + K) as shown in Fig. 2. The plot profile is calculated by adding all the horizontal profiles contained in the rectangular selection. Fig. 2: Plot of Fig. 1. The values correspond to the vertical distances. |
2.1. Method #1: Using EDM
Usually, the object is not parallel to the horizontal axis and we need a more general approach.Download the test image in Fig. 1, open it in ImageJ, and duplicate it before computing the EDM (Fig.3)...
Fig. 3: Euclidean Distance Map of image of Fig.4 |
From the original image (Fig. 1), duplicate it again and compute the skeleton (or median axis) with
Process > Binary > Skeletonize
(Fig. 4)Fig. 4: Skeleton of image of Fig.1 |
Process > Image Calculator
). The skeleton appears as a gray level median axis whose pixel values correspond to the half distance (Fig. 5). Fig. 5: Result of the operation NOT(Skeleton) AND EDM |
Finally, to get the half distances, you have to write a small script whose synopsis is:
loop y=0 to image_height loop x= to image_width if (pixel(x,y) !=0) append pixel(x,y) in array end_loop end_loop print array
Hope that helps.
<< Largest Width : PreviousNext: Using stripes >>
No comments:
Post a Comment