Line Segment Experiment Instructor: Professor Henderson, Thomas. Student: Chun-Kai Wang Outline The line-segment program – Prototype – The architecture – Meaning of each option Examples – How to read a pixel region picture in examples – Examples of binary image – Examples of gray-tone image Issue of performance evaluate The line-segment program Prototype function segments = lineSegs(img, mag_thres, zero_thres, len, varargin) % input: img - The input image. It is a binary image or a gray-tone image. Here we assume the foreground color is black and background color is white. mag_thres - The threshold value that determines the foregrounds and the backgrounds. zero_thres - The threshold value that determines how many variances from the zero degree can be tolerated. len - The len value for mark-seeds algorithm. varargin - Options. Those are strings. % output: segments - List of begin and end points of line segments. Example call: segs = lineSegs(im00, 0.49, 0.01, 9, ‘thin’, ‘sobel’); The architecture Meaning of each option (1) Pre- edge detecting – ‘thres’: Convert the input image to binary by Otsu’s method. This option is automatically enable when the option ‘thin’ is enable. The default value is disable. – ‘thin’: Thinning the image with Matlab built-in thinning algorithm (from “Thinning Methodologies-A Comprehensive Survey,” Louisa Lam, Seong-Whan Lee, and Ching Y. Wuen, IEEE TrPAMI, vol. 14, no. 9, pp. 869-885, 1992). This is design for the binary image only. The default value is disable. Meaning of each option (2) Edge detecting – ‘sobel’: Use Sobel edge detector. One and only one of options ‘sobel’ and ‘markseeds’ must be set enable. The default value is enable. – ‘sobelmerge’: Merge the two directions of edges that are detected by Sobel edge detector into one. This option is meaningful only when the option ‘sobel’ is enable. The default value is disable. – ‘markseeds’: Use Mark-Seeds edge detector. One and only one of options ‘sobel’ and ‘markseeds’ must be set enable. The default value is disable. Examples How to read a pixel region picture A pixel region picture is a picture that shows values of each pixel in some region of a image. If a pixel region picture is for displaying line segments, each 1-pixel wide horizontal line or vertical line is a line segment. For example, there are eight line segments in the following pictures, each with a unique color. Examples of binary image (1) The binary image and the region that we will use in the following examples. Examples of binary image (2) Line segments with Sobel edge detector. Examples of binary image (3) Line segments with Sobel edge detector and edge merging. Examples of binary image (4) Line segments with thinning algorithm and Sobel edge detector. Examples of binary image (5) Line segments with thinning algorithm, Sobel edge detector, and edge merging. Examples of binary image (6) Line segments with mark-seeds edge detector. Examples of binary image (7) Line segments with thinning algorithm and mark-seeds edge detector. Examples of gray-tone image (1) The binary image and the region that we will use in the following examples. Examples of gray-tone image (2) Line segments with Sobel edge detector. Issue of performance evaluate Original image MINUS Segments image. – But not all of lines in the original image are one-pixel wide. It is hard to find a automatic line segment program performance evaluating tool because we need to know line segments at the first hand to evaluate such a program, but how can we find a perfect line segment program at the first hand? The dependable method that I can think of is to evaluate the performance manually.