11/07/2011

Distance Indication in Binary Images

Exercise 5.8: Distance and Danielsson.

Take an exercise from Chapter 4, for example, Exercise 4.20, and insert the function IMAQ Distance. You may provide the function IMAQ Danielsson as well and put it in a Case Structure, which can be used to select the function type. See Figure 5.24 for the front panel and Figure 5.25 for the diagram.

Figure 5.24. Distance Indication in Binary Images

graphics/05fig24.gif

Figure 5.25. Diagram of Exercise 5.8

graphics/05fig25.gif

Figure 5.24 shows the result of the distance function in the binary bear image. Again, it is clear that this image is not appropriate for this function, although the principle is clear: Each object shows a number of color lines, which indicate the distance to the background.

Figure 5.26 shows the same function applied to the motor image of the last exercise. The effect of the distance function gets even clearer, but look at the areas near the straight edges of the image. Inside these four regions, which look like a big "V," are pixels with the same distance mapping. But it can be clearly seen that their distance to the next black pixel is different; this algorithm is obviously not very accurate.

Figure 5.26. Distance Function Applied to a Binary Motor Image

graphics/05fig26.gif

The Danielsson function is based on an algorithm called Euclidean Distance Mapping and was introduced by P. E. Danielsson in 1980.[2] As Figure 5.27 shows, the algorithm shows more reliable results.

[2] P. E. Danielsson: "Euclidean Distance Mapping." Computer Graphics and Image Processing, Volume 14, 1980, pp. 227-248.

Danielsson himself calls the algorithms he developed "Four-point Sequential Euclidean Distance Mapping" (4SED) and "Eight-point Sequential Euclidean Distance Mapping" (8SED), respectively, which reminds us of Figure 4.48, showing the definition of connectivity =4 and connectivity =8.

Figure 5.27. Danielsson Function Applied to a Binary Motor Image

graphics/05fig27.gif

Labeling and Segmentation

We also discussed functions like IMAQ Convex, which require "labeling" of objects in a binary image, which means that these objects are classified and numbered. The next exercise creates a labeled binary image.

Exercise 5.9: Labeling Particles.

Modify Exercise 5.8 by inserting the function IMAQ Label (to be found in Motion and Vision / Image Processing / Processing). Figure 5.28 shows that the labeling is visualized by assignment of a color of the binary palette (visible by different gray levels in Figure 5.28). Use a numeric indicator to display the number of objects. See Figure 5.29 for the diagram.

Figure 5.28. Labeling of Binary Images

graphics/05fig28.gif

Figure 5.29. Diagram of Exercise 5.9

graphics/05fig29.gif

The function IMAQ Segmentation requires a labeled binary image and expands the objects until each object reaches its neighbors. The expanding is done by multiple dilation functions until the image contains no more background areas.

Exercise 5.10: Segmentation of Images.

Insert the function IMAQ Segmentation in Exercise 5.9, so that it follows IMAQ Label. It is useful to display the labeled image as well as the segmented image, so you have to do some changes in the wiring. See Figure 5.30 for the panel and the results and Figure 5.31 for the diagram.

Figure 5.30. Segmentation of Labeled Binary Images

graphics/05fig30.gif

Figure 5.31. Diagram of Exercise 5.10

graphics/05fig31.gif

The segmentation of a binary image can be interpreted as the calculation of an influence region of each labeled object. Figure 5.32 shows the labeling and segmentation result for the motor image.

Figure 5.32. Segmentation Result of the Motor Image

graphics/05fig32.gif

Circle Detection

The next function, IMAQ Find Circles, detects circles in binary images and is therefore very similar to the function IMAQ Find Circular Edge. The only difference is that IMAQ Find Circles searches not only for edges, but for the entire circle area. We test this function in the next exercise.

Exercise 5.11: Finding Circles.

Modify Exercise 5.9 (not 5.10) by replacing IMAQ Label with IMAQ Find Circles. Provide numeric controls for the specification of the minimum and the maximum circle radius value, and indicators for the number of detected circles and the circles data. See Figure 5.33 for the panel, Figure 5.34 for results, and Figure 5.35 for the diagram.

Figure 5.33. Circle Detection Exercise

graphics/05fig33.gif

Circles Data is an array of clusters, one cluster for each detected circle, consisting of the following elements:

· the x coordinate,

· the y coordinate,

· the radius of the detected circle, and

· the entire circle area.

http://www.cadfamily.com/html/Article/Distance%20Indication%20in%20Binary%20Images_921_1.htm

http://www.cadfamily.com/html/Article/Distance%20Indication%20in%20Binary%20Images_921_2.htm

http://www.cadfamily.com/html/Article/Distance%20Indication%20in%20Binary%20Images_921_3.htm

http://www.cadfamily.com/html/Article/Distance%20Indication%20in%20Binary%20Images_921_4.htm

No comments: