Method of detecting center line

The method simplifies the detection of center lines in images by analyzing specific pixel distances within the contour line, addressing the complexity of conventional methods and achieving efficient detection.

JP2025088065AActive Publication Date: 2025-06-11MEIJO UNIVERSITY
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
JP2023202506
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-11-30
Publication Date
2025-06-11
Estimated Expiration
2043-11-30

AI Technical Summary

Technical Problem

Conventional methods for detecting the center line of an image are complex and require intricate local feature analysis, making them inefficient for simple detection.

Method used

A method that involves reading a target image, converting it to grayscale, smoothing, and binarizing it, followed by detecting specific pixels within the contour line and determining center line pixels based on the distance between these specific pixels.

Benefits of technology

This method simplifies the detection of center lines by reducing the complexity of pixel analysis, allowing for efficient identification of center line pixels in the target image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025088065000001_ABST
    Figure 2025088065000001_ABST
Patent Text Reader

Abstract

To simply detect a center line of a subject in a target image.SOLUTION: A centerline detection method includes a first detection method that comprises: a first step of reading a target image; a second step of converting the target image into a grayscale image, smoothing the grayscale image, and binarizing the image to generate a binary image; a third step of detecting, as specified pixels, for inside pixels which are located inside contour component pixels constituting a contour of a subject in the binary image, a first pixel which is a contour component pixel located at the shortest distance, and a second pixel which is a contour component pixel located within a distance obtained by adding a predetermined distance to the shortest distance; and a fourth step of detecting, as centerline component pixels, for the inside pixels, a plurality of detected specified pixels when a distance between a pair of the farthest specified pixels of the specified pixels is equal to or larger than a predetermined value.SELECTED DRAWING: Figure 4
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for detecting a center line.

Background Art

[0002] The image processing apparatus disclosed in Patent Document 1 includes a contour pixel extraction unit that determines whether a target pixel is a contour, and a thinning amount calculation unit that calculates the amount of thinning to be applied to the target pixel when the contour pixel extraction unit determines that the target pixel is a contour. Further, this image processing apparatus includes a rectangular region connectivity determination unit that determines whether a pixel region including the target pixel is a predetermined pixel pattern, and a selective correction output unit that applies thinning to the target pixel with the amount of thinning when the rectangular region connectivity determination unit does not determine that the pixel region including the target pixel is a predetermined pixel pattern, and applies thinning to the target pixel with an alternative amount of thinning different from the amount of thinning when the rectangular region connectivity determination unit determines that the pixel region including the target pixel is a predetermined pixel pattern.

Prior Art Documents

Patent Documents

[0003]

Patent Document 1

Summary of the Invention

Problems to be Solved by the Invention

[0004] In the conventional method for detecting the center line of an image, like the image processing performed by the image processing apparatus of Patent Document 1, it is determined whether each pixel on the contour line itself is a center line constituent pixel based on the result of local feature analysis of individual pixels on the contour line, and that process is complicated. Therefore, there is a need for a method that can detect the center line of the subject in the target image in a simpler way.

[0005] The present invention has been made in view of the above conventional circumstances, and can simply detect the center line of the subject in the target image.

Means for Solving the Problems

[0006] The detection method of the center line of the first invention is as follows: A first step of reading a target image; A second step of converting the target image into grayscale, smoothing it, and binarizing it to generate a binarized image; For each inner pixel inside the contour line constituting pixels of the subject in the binarized image, a first pixel that is the contour line constituting pixel located at the shortest distance and a second pixel that is the contour line constituting pixel located within a distance obtained by adding a predetermined distance to the shortest distance are detected as specific pixels in a third step; A fourth step of detecting, as a center line constituting pixel, when a plurality of the specific pixels are detected for each of the inner pixels, if the distance between the pair of the specific pixels that are the farthest apart among the plurality of the specific pixels is greater than or equal to a predetermined value; A first detection method having the above steps is provided.

[0007] The detection method of the center line of the second invention is as follows: A first step of reading a target image; A second step of converting the target image into grayscale, smoothing it, and binarizing it to generate a binarized image; A third step of removing protruding pixels that are composed of two pixels that protrude outward adjacent to each other at a pixel pitch distance or one pixel that protrudes outward among the contour line constituting pixels of the subject in the binarized image to detect new contour line constituting pixels; A fourth step of detecting, as new contour line constituting pixels, pixels that constitute a new contour line of the subject composed of pixels inside the contour line constituting pixels; A fifth step of detecting, as a center line constituting pixel, one of the inner pixels between a pair of pixels among the contour line constituting pixels when only two inner pixels exist between the pair of pixels, and detecting the inner pixel between the pair of pixels as the center line constituting pixel when only one inner pixel exists between the pair of pixels; A detection method of the center line is provided, which has the above steps and repeats the fourth step and the fifth step.

Advantages of the Invention

[0008] The technology according to the present disclosure can simply detect the center line of the subject in the target image.

Brief Description of Drawings

[0009]

Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

Figure 6

Figure 7

Figure 8

Figure 9

Figure 10

DETAILED DESCRIPTION OF THE INVENTION

[0010] Hereinafter, embodiments of the present disclosure will be listed and exemplified. [1] A first step of reading a target image, A second step of converting the target image into grayscale, smoothing it, and binarizing it to generate a binarized image, For each inner pixel inside the contour line constituent pixels that constitute the contour line of the subject in the binarized image, a first pixel that is the contour line constituent pixel located at the shortest distance, and a second pixel that is the contour line constituent pixel located within a distance obtained by adding a predetermined distance to the shortest distance are detected as specific pixels in a third step, A fourth step of detecting, as center line constituent pixels, when a plurality of the specific pixels are detected for each of the inner pixels, and when the distance between the pair of the specific pixels that are the farthest apart among the plurality of the specific pixels is equal to or greater than a predetermined value, A method for detecting a center line including a first detection method.

[0011] According to this configuration, in the third step, specific pixels (the first pixel and the second pixel) corresponding to the inner pixels of the subject in the target pixel can be detected. In the fourth step, among a plurality of inner pixels, those in which the specific pixels (the first pixel and the second pixel) are in a predetermined relationship can be detected as center line constituent pixels. In this way, the process of discriminating the center line constituent pixels is greatly simplified compared to the conventional method by a method based on a simple principle. Therefore, after detecting the contour line of the binarized image of the target image, the center line of the subject can be easily detected based on the contour line.

[0012] [2] A first step of reading a target image, a second step of converting the target image into grayscale, smoothing it, and binarizing it to generate a binarized image, a third step of removing protruding pixels composed of two pixels that protrude outward adjacent to each other or one pixel that protrudes outward at a pixel pitch distance among the contour line constituent pixels constituting the contour line of the subject in the binarized image to detect new said contour line constituent pixels, a fourth step of detecting pixels constituting a new contour line of the subject composed of pixels inside the contour line constituent pixels as new said contour line constituent pixels, a fifth step of detecting one of the inner pixels between a pair of pixels among the contour line constituent pixels as a center line constituent pixel when only two inner pixels exist between the pair of pixels, and detecting the inner pixel between the pair of pixels as the center line constituent pixel when only one inner pixel exists between the pair of pixels among the contour line constituent pixels, and having a second detection method for repeating the fourth step and the fifth step, the method for detecting a center line.

[0013] According to this configuration, in the third step, it is possible to prevent the protruding pixels of the binarized image from affecting the detection of the contour line constituent pixels in the fourth step and the detection of the center line constituent pixels in the fifth step. By the fourth step and the fifth step, while successively shrinking the contour line of the binarized image from the outermost shell, the center line constituent pixels can be detected based on the feature analysis of the pixels on each contour line. In this way, the process of discriminating the center line constituent pixels is greatly simplified compared to the prior art by a method based on a simple principle. Therefore, by paying attention to the positional relationship between any two pixels on the contour line, the pixels outside the contour line sandwiched between these two pixels can be detected as the center line constituent pixels, and the center line of the subject can be easily detected.

[0014] [3] For the subject constituted by the center line constituent pixels detected by the first detection method described in [1], perform the third step of the second detection method described in [2], and repeat the fourth step and the fifth step, the method for detecting a center line.

[0015] According to this configuration, in addition to the first detection method, by the second detection method, paying attention to the positional relationship between any two pixels on the contour line, pixels outside the contour line sandwiched between these two pixels can be detected as center line constituent pixels, and the center line of the subject can be accurately detected.

[0016] <First Embodiment> (Image Processing Apparatus) Hereinafter, an image processing apparatus 10 according to a first embodiment embodying the present invention will be described with reference to FIG. 1. The image processing apparatus 10 performs a process of detecting the center line of a subject in a target image. The image processing apparatus 10 is an information processing apparatus (computer) that executes an image processing program described later. The image processing program is a program that causes the image processing apparatus 10 to execute the "method for detecting a center line including a first detection method" and the "method for detecting a center line including a second detection method" of the present invention. The image processing apparatus 10 is a device that stores various image data and performs display based on the stored various image data.

[0017] The image processing by the image processing apparatus 10 can be used for detecting the center line of a biological sample (such as a fibrous structure) included in an image. Further, this image processing can be used for detecting shape distortion by detecting the center line of an industrial product included in the image. Further, this image processing can be used for character recognition by detecting the center line of characters included in the image. Further, this image processing can be used for extracting a road network from an image of map data by detecting the center line of a road.

[0018] As shown in FIG. 1, the image processing apparatus 10 includes a control unit 11, a storage unit 12, an input unit 13, and a display unit 14.

[0019] The control unit 11 controls the entire image processing apparatus 10. The control unit 11 includes, for example, an arithmetic device such as an MCU (Micro Processor Unit) and other peripheral circuits, and can perform various controls and calculations. The control unit 11 performs control based on, for example, a program (such as an image processing program) stored in the storage unit 12.

[0020] The storage unit 12 is composed of a known storage device such as a semiconductor memory, and for example, a RAM, a ROM, a non-volatile memory, etc. correspond to this. The storage unit 12 stores various programs and the like. The storage unit 12 stores a program to be executed by the control unit 11 (such as an image processing program that causes the control unit 11 to perform control in the flow shown in FIGS. 2 and 6 described later).

[0021] The input unit 13 is an input interface for inputting data, which is composed of, for example, a keyboard, a touch panel, a mouse, a scanner, etc. The input unit 13 has a target image and various setting values (such as the "predetermined distance" and "predetermined value" described later) input thereto.

[0022] The display unit 14 is configured as a known image display device such as a liquid crystal display, an organic electroluminescence display, a touch panel, etc. The display unit 14 performs display based on various image data stored in the storage unit 12.

[0023] (First Image Processing Control) The image processing apparatus 10 performs the following first image processing control. The first image processing control is control for causing the "center line detection method including the first detection method" of the present invention to be executed.

[0024] FIG. 2 is a flowchart showing the flow of the first image processing control executed by the control unit 11 of the image processing apparatus 10. An example of the image processing program of the present invention is a program that causes the control unit 11 to perform control in the flow as shown in FIG. 2.

[0025] When a predetermined start condition is satisfied, the control unit 11 starts the control in FIG. 2. The satisfaction of the predetermined start condition is, for example, that an operation for executing an image processing program is performed in the image processing apparatus 10 or the like.

[0026] First, the control unit 11 reads a target image (step S1). Step S1 corresponds to the "first step" of the present invention. The target image is, for example, stored in the storage unit 12 in advance.

[0027] Subsequently, the control unit 11 converts the target image read in step S1 into grayscale, smoothes it, and binarizes it to generate a binarized image (step S2). Step S2 corresponds to the "second step" of the present invention. Smoothing can be performed based on general smoothing processing (such as an averaging filter). For binarization, white pixels and black pixels are set, for example, so that the subject is composed of white pixels. For example, the control unit 11 generates a binarized image as shown in FIG. 3(A). In FIG. 3(A), what is represented by the white square is a white pixel, and what is composed of all white pixels corresponds to the subject.

[0028] Subsequently, the control unit 11 acquires the coordinates of the white pixels of the binarized image, the image of the contour line, the grayscale image of the contour line, and the coordinates of the pixels constituting the contour line (step S3). Here, the coordinates of a pixel are, for example, the coordinates (two-dimensional coordinates) at which the pixel is located when a predetermined position in the binarized image is taken as the origin. The two-dimensional coordinates include, for example, the X coordinate (the left-right direction when the image is viewed from the front) and the Y coordinate (the up-down direction when the image is viewed from the front). The position of a pixel is represented by the coordinates of the geometric center point of the pixel. The image of the contour line is, for example, an image obtained by extracting the portion that constitutes the contour line (the outermost line forming the outer shape of the subject) of the subject in the target image. The pixels constituting the contour line are the pixels that constitute the contour line of the subject in the target image. For example, FIG. 3(B) is an image in which the pixels constituting the contour line are left as white pixels as they are and all the inner pixels inside the pixels constituting the contour line are set as black pixels with respect to the binarized image shown in FIG. 3(A). The control unit 11 stores the information on the coordinates of the white pixels of the binarized image, the image of the contour line, the grayscale image of the contour line, and the coordinates of the pixels constituting the contour line in the storage unit 12.

[0029] Subsequently, the control unit 11 stores (records) the grayscale image, binary image, and contour image of the target image in the storage unit 12 (step S4). The grayscale image and binary image of the target image are the images generated in step S1. The contour image is the image generated in step S2. These grayscale image, binary image, and contour image are stored (recorded) in the storage unit 12 as a composite image with the image of the center point or center line (also referred to as the center image) in step S6 described later, and can be displayed on the display unit 14.

[0030] Subsequently, the control unit 11 performs a detection process of the center line of the target image with respect to the subject using the first detection method (step S5). First, the control unit 11 performs a third step of detecting, as specific pixels, a first pixel that is a contour constituent pixel located at the shortest distance (excluding 0) from each inner pixel inside the contour constituent pixels, and a second pixel that is a contour constituent pixel located within a distance obtained by adding a predetermined distance to the shortest distance. Here, the distance between pixels is the distance between the coordinates of the pixels (the geometric center point of the pixels). The shortest distance between pixels, and the distance between adjacent pixels sharing a side is called the pixel pitch. The value of the pixel pitch is set to 1.

[0031] Here, an example of specifying the second pixel as a contour constituent pixel located within a distance obtained by adding a distance of '0.5 times' the pixel pitch to the shortest distance is shown. FIG. 4(A) is an image including contour constituent pixels (white pixels) and center line constituent pixels (pixels indicated by hatching) to be specified later. For example, as shown in FIG. 4(A), when focusing on the inner pixel A1, the contour constituent pixel located at the shortest distance (3) from the inner pixel A1 is the contour constituent pixel (first pixel) A2. When focusing on the inner pixel A1, the contour constituent pixel excluding the first pixel A2 located within a distance (3.5) obtained by adding a distance of 0.5 times the pixel pitch (1) to the shortest distance (3) is the contour constituent pixel (second pixel) A3. Therefore, the specific pixels for the inner pixel A1 are the first pixel A2 and the second pixel A3. Similarly, focusing on the inner pixel B1, the contour line forming pixel located at the shortest distance (3√2) is the contour line forming pixel (first pixel) B2. Focusing on the inner pixel B1, the contour line forming pixel excluding the first pixel B2 located within a distance (3√2 + 0.5) obtained by adding a distance of 0.5 times the pixel pitch (1) to the shortest distance (3√2) is the contour line forming pixel (second pixel) B3. Therefore, the specific pixels for the inner pixel B1 are the first pixel B2 and the second pixel B3. Similarly, focusing on the inner pixel C1, the contour line forming pixel located at the shortest distance (2√2) is the contour line forming pixel (first pixel) C2. Focusing on the inner pixel C1, the contour line forming pixel excluding the first pixel C2 located within a distance (2√2 + 0.5) obtained by adding a distance of 0.5 times the pixel pitch (1) to the shortest distance (2√2) is the contour line forming pixel (second pixel) C3. Therefore, the specific pixels for the inner pixel C1 are the first pixel C2 and the second pixel C3. Similarly, focusing on the inner pixel D1, the contour line forming pixel located at the shortest distance (√5) is the contour line forming pixel (first pixel) D2. Focusing on the inner pixel D1, there is no contour line forming pixel excluding the first pixel D2 located within a distance (√5 + 0.5) obtained by adding a distance of 0.5 times the pixel pitch (1) to the shortest distance (√5). Therefore, the specific pixel for the inner pixel D1 is the first pixel D2. The specification of the specific pixels as described above is performed for all the inner pixels.

[0032] Subsequently, when a plurality of specific pixels are detected for each inner pixel, the control unit 11 performs a fourth step of detecting a center line forming pixel when the distance between the pair of specific pixels that are the farthest among the plurality of specific pixels is equal to or greater than a predetermined value. The predetermined value can be arbitrarily set, for example, 6. Also, the predetermined value may be, for example, a value obtained by doubling the minimum distance among the distances between the inner pixel and the specific pixel corresponding to the inner pixel among the plurality of inner pixels for which the specific pixels are specified. For example, as shown in FIG. 4(A), when focusing on the inner pixel A1, since the distance (2√10) between the pair of specific pixels (for example, the pixels indicated by A13 and A23 in FIG. 4(A)) that are the farthest apart among the plurality of specific pixels (A2, A3) is equal to or greater than a predetermined value (6), the inner pixel A1 is detected as a center line constituent pixel. Similarly, when focusing on the inner pixel B1, since the distance (2√10) between the pair of specific pixels (for example, the pixels indicated by B13 and B23 in FIG. 4(A)) that are the farthest apart among the plurality of specific pixels (B2, B3) is equal to or greater than a predetermined value (6), the inner pixel B1 is detected as a center line constituent pixel. Similarly, when focusing on the inner pixel C1, since the distance (2√10) between the pair of specific pixels (for example, the pixels indicated by C13 and C23 in FIG. 4(A)) that are the farthest apart among the plurality of specific pixels (C2, C3) is equal to or greater than a predetermined value (6), the inner pixel C1 is detected as a center line constituent pixel. Similarly, when focusing on the inner pixel D1, since no plurality of specific pixels are detected, no center line constituent pixel is detected. The detection of the center line constituent pixels as described above is performed for all the inner pixels.

[0033] In the example of specifying the contour line constituent pixels located within the distance obtained by adding the distance of '0.5 times' the pixel pitch to the shortest distance in the specification of the second pixel described above, in FIG. 4(A), what is composed of all the center line constituent pixels (center points) indicated by hatching becomes the center line of the object. However, the center line in FIG. 4(A) is interrupted and discontinuous. Therefore, in the specification of the second pixel described above, the contour line constituent pixels located within the distance obtained by adding the distance of '√2 times' the pixel pitch as a predetermined distance to the shortest distance are specified. In this case, the center line (a plurality of center line constituent pixels) is detected as the pixels (image of the center line) indicated by hatching as shown in FIG. 4(B). Thereby, a center line with high continuity can be obtained.

[0034] Furthermore, smoothing may be performed on the obtained center point or the image of the center line, and the second image processing control described later (specifically, the steps of the second detection method that repeats the fourth and fifth steps after the third step described later) may be performed. Smoothing can use common methods. For example, for each centerline constituent pixel, eight pixels surrounding it are specified as new centerline constituent pixels. In this case, as shown in FIG. 5(A), the gray pixels are specified as new centerline constituent pixels. Note that for each centerline constituent pixel, twenty-four pixels that doubly surround it may be specified as new centerline constituent pixels. After smoothing, as a result of performing the second image processing control (specifically, the steps of the second detection method that repeats the fourth and fifth steps after the third step described later), a new centerline image shown in FIG. 5(B) is obtained.

[0035] Note that when detecting centerline constituent pixels for all inner pixels, if the distance between the detected centerline constituent pixels is within a predetermined value, new centerline constituent pixels may be set to connect the centerline constituent pixels with a line segment (pixel) of line width 1. Also, by raising the entire calculation formula in the control unit 11 to a power as needed, the number of occurrences of square roots in the calculation formula may be minimized.

[0036] Subsequently, based on the centerline (a plurality of centerline constituent pixels) detected in step S5, the control unit 11 stores (memorizes) the coordinates of the center point (centerline constituent pixel), the image of the center point or the centerline (also referred to as the center image), the composite image of the center image and the target image, the composite image of the center image and the binarized image, and the composite image of the center image and the contour line image (step S6). Note that the control unit 11 can display the center image, the composite image of the center image and the target image, the composite image of the center image and the binarized image, and the composite image of the center image and the contour line image on the display unit 14.

[0037] When the control unit 11 finishes the process of step S6, it finishes the first image processing control of FIG. 2.

[0038] (Second Image Processing Control) The image processing apparatus 10 performs the following second image processing control. The second image processing control is control for executing the “method for detecting a centerline including the second detection method” of the present invention.

[0039] FIG. 6 is a flowchart showing the flow of the second image processing control executed by the control unit 11 of the image processing apparatus 10. An example of the image processing program of the present invention is a program that causes the control unit 11 to perform control in the flow as shown in FIG. 6.

[0040] When a predetermined start condition is satisfied, the control unit 11 starts the control of FIG. 6. The satisfaction of the predetermined start condition means, for example, that an operation for executing the image processing program is performed in the image processing apparatus 10 or the like.

[0041] First, the control unit 11 reads a target image (step S21). Subsequently, the control unit 11 converts the target image read in step S21 into grayscale, smooths it, and binarizes it to generate a binarized image (step S22). Note that steps S21 and S22 are the same processes as steps S1 and S2 of the first image processing control described above.

[0042] Subsequently, the control unit 11 performs removal of protruding pixels (step S23). The process of removing protruding pixels is a third process of detecting new contour line constituent pixels by removing protruding pixels composed of two adjacent outer protruding pixels or one outer protruding pixel among the contour line constituent pixels constituting the contour line of the subject in the binarized image, with a pixel pitch distance. Specifically, the protruding pixels (two or one pixel) are removed, and two or one inner pixel adjacent to the protruding pixels is specified as a new contour line constituent pixel.

[0043] Subsequently, the control unit 11 acquires the coordinates of the white pixels of the binarized image, the image of the contour line, the grayscale image of the contour line, and the coordinates of the pixels constituting the contour line (step S24). For example, FIG. 7(A) is an image in which the pixels constituting the contour line are used as white pixels as they are, and all the inner pixels inside the pixels constituting the contour line are used as black pixels, for the binarized image shown in FIG. 3. Subsequently, the control unit 11 stores (stores) the grayscale image, the binarized image, and the contour line image of the target image in the storage unit 12 (step S25). Note that steps S24 and S25 are the same processes as steps S3 and S4 of the first image processing control described above.

[0044] Subsequently, the control unit 11 performs detection processing of the center line of the subject in the target image using the second detection method (step S26). First, the control unit 11 performs a fourth step of detecting, as new contour line constituent pixels, the pixels that constitute a new contour line of the subject, which are constituted by the pixels inside the contour line constituent pixels. That is, the control unit 11 subtracts the outermost contour line from the binarized image to obtain a new binarized image. Specifically, the pixels located inside at a distance of √2 or less from the contour line constituent pixels are detected as new contour line constituent pixels. FIG. 7(B) is an image in which a new contour line is detected from the contour line image of FIG. 7(A).

[0045] Subsequently, the control unit 11 performs a fifth step of detecting, as center line constituent pixels, one of the inner pixels between two inner pixels when only two inner pixels exist between a pair of pixels among the contour line constituent pixels, and detecting the inner pixel between a pair of pixels among the contour line constituent pixels as a center line constituent pixel when only one inner pixel exists. Here, "one of the inner pixels between two inner pixels when only two inner pixels exist between a pair of pixels among the contour line constituent pixels" can be arbitrarily set. For example, it is the left inner pixel among two inner pixels arranged in the left-right direction (X-axis direction), and the upper inner pixel among two inner pixels arranged in the up-down direction (Y-axis direction). For example, in the image of FIG. 7(B), since only two inner pixels exist between a pair of pixels (the pixels indicated by E) among the contour line constituent pixels, one of the inner pixels therebetween (the upper inner pixel indicated by hatching) is detected as a center line constituent pixel. The other inner pixels indicated by hatching in FIG. 7(B) are similarly detected as center line constituent pixels. FIG. 8(A) is an image in which a new contour line is detected from the contour line image of FIG. 7(B). For example, in the image of FIG. 8(A), since only one inner pixel exists between a pair of pixels (the pixels indicated by F) among the contour line constituent pixels, the inner pixel therebetween (the inner pixel indicated by hatching) is detected as a center line constituent pixel. The other inner pixels indicated by hatching in FIG. 8(A) are similarly detected as center line constituent pixels. In FIG. 8(A), since there are also cases where only two inner pixels exist between a pair of pixels among the contour line constituent pixels, one of the inner pixels therebetween (the left or upper inner pixel indicated by hatching) is detected as a center line constituent pixel.

[0046] The control unit 11 repeatedly performs the above-described fourth step and fifth step. The repetition of the fourth step and the fifth step ends when new contour line constituent pixels cannot be detected in the fourth step. For example, after generating the image of FIG. 8(A) described above, the fourth step and the fifth step are repeated to sequentially generate the images shown in FIGS. 8(B) - 10(A). In FIGS. 8(B) - 10(A), each inner pixel indicated by hatching is a pixel detected as a center line constituent pixel. In this case, the center line (a plurality of center line constituent pixels) is detected as a pixel (image of the center line) indicated by hatching as shown in FIG. 10(B).

[0047] Note that when detecting center line constituent pixels for all inner pixels, if the distance between the detected center line constituent pixels is within a predetermined value, new center line constituent pixels may be set to be positioned so as to connect the center line constituent pixels with a line segment (pixel) having a line width of 1. Further, by raising the entire calculation formula in the control unit 11 to a power as necessary, the number of occurrences of the square root in the calculation formula may be minimized.

[0048] Subsequently, based on the center line (a plurality of center line constituent pixels) detected in step S26, the control unit 11 stores (records) the coordinates of the center point (center line constituent pixel), the image of the center point or the center line (also referred to as the center image), the composite image of the center image and the target image, the composite image of the center image and the binary image, and the composite image of the center image and the contour line image (step S27). Note that the control unit 11 can display the center image, the composite image of the center image and the target image, the composite image of the center image and the binary image, and the composite image of the center image and the contour line image on the display unit 14.

[0049] When the control unit 11 finishes the process of step S27, it ends the second image processing control of FIG. 6.

[0050] (Operation and Effect of the First Embodiment) The method for detecting the center line in the first embodiment (the method used in the first image processing control) includes a first step of reading a target image, a second step of converting the target image into grayscale, smoothing it, and binarizing it to generate a binary image, and for each inner pixel inside the contour line constituent pixels that constitute the contour line of the subject in the binary image, a first pixel that is a contour line constituent pixel located at the shortest distance and a second pixel that is a contour line constituent pixel located within a distance obtained by adding a predetermined distance to the shortest distance are detected as specific pixels in a third step, and in a fourth step, when a plurality of specific pixels are detected for each inner pixel, if the distance between the pair of specific pixels that are the farthest among the plurality of specific pixels is greater than or equal to a predetermined value, it is detected as a center line constituent pixel, and includes a first detection method having these steps. According to this configuration, in the third step, specific pixels (the first pixel and the second pixel) corresponding to the inner pixels of the subject in the target pixel can be detected. In the fourth step, among a plurality of inner pixels, those in which the specific pixels (the first pixel and the second pixel) have a predetermined relationship can be detected as center line constituent pixels. In this way, the process of discriminating the center line constituent pixels is significantly simplified compared to the prior art by a method based on a simple principle. Therefore, after detecting the contour line of the binary image of the target image, the center line of the subject can be easily detected based on the contour line.

[0051] The method for detecting the center line of the first embodiment (the method used for the second image processing control) includes a first step of reading a target image, a second step of converting the target image into grayscale, smoothing it, and binarizing it to generate a binarized image, and among the contour line constituent pixels that constitute the contour line of the subject in the binarized image, removing the protruding pixels composed of two pixels that protrude outward adjacent to each other at the distance of the pixel pitch or one pixel that protrudes outward to detect new contour line constituent pixels. A third step, a fourth step of detecting, as new contour line constituent pixels, the pixels that constitute the contour line of the new subject composed of the pixels inside the contour line constituent pixels, and when only two inner pixels exist between a pair of pixels among the contour line constituent pixels, detecting one of the inner pixels between them as a center line constituent pixel, and when only one inner pixel exists between a pair of pixels among the contour line constituent pixels, detecting the inner pixel between them as a center line constituent pixel. And a fifth step, and includes a second detection method that repeats the fourth step and the fifth step.

[0052] According to this configuration, it is possible to prevent the third step from affecting the detection of the contour line constituent pixels in the fourth step where the protruding pixels of the binarized image continue and the detection of the center line constituent pixels in the fifth step. By the fourth step and the fifth step, it is possible to detect the center line constituent pixels based on the feature analysis of the pixels on each contour line while gradually reducing the contour line of the binarized image from the outermost shell in order. In this way, the process of discriminating the center line constituent pixels is significantly simplified compared to the prior art by a method based on a simple principle. Therefore, by paying attention to the positional relationship between any two pixels on the contour line, the pixels outside the contour line sandwiched between these two pixels can be detected as the center line constituent pixels, and the center line of the subject can be easily detected.

[0053] In the method for detecting the center line of the first embodiment, for the subject constituted by the center line constituent pixels detected by the first detection method (the method used for the first image processing control), the third step of the second detection method (the method used for the second image processing control) is performed, and the fourth step and the fifth step are repeated. According to this configuration, in addition to the first detection method, by the second detection method, paying attention to the positional relationship between any two pixels on the contour line, pixels outside the contour line sandwiched between these two pixels can be detected as center line constituent pixels, and the center line of the subject can be accurately detected.

[0054] <Other Embodiments> The present invention is not limited to the embodiments described above and in the drawings. For example, the following embodiments are also included in the technical scope of the present invention. Also, various features of the above-described embodiments and the embodiments described later may be combined in any combination as long as they do not conflict.

[0055] In the first embodiment described above, image processing control was performed on the entire target image. However, the target image may be divided, image processing control may be performed on each of the divided images, and then the center line constituent pixels of each image may be connected to generate an overall center line.

[0056] It should be considered that all the embodiments disclosed this time are illustrative in all respects and not restrictive. The scope of the present invention is not limited to the embodiments disclosed this time, and it is intended that all modifications within the scope shown by the claims or within the scope equivalent to the claims are included.

Explanation of Reference Numerals

[0057] 10: Image Processing Apparatus 11: Control Unit 12: Storage Unit 13: Input Unit 14: Display Unit

Claims

1. A first step of reading a target image; A second step of converting the target image into grayscale, smoothing it, and binarizing it to generate a binarized image; For each inner pixel inside the contour line constituent pixels that constitute the contour line of the subject in the binarized image, a first pixel that is the contour line constituent pixel located at the shortest distance, and a second pixel that is the contour line constituent pixel located within a distance obtained by adding a predetermined distance to the shortest distance are detected as specific pixels in a third step; A fourth step of detecting, as a center line constituent pixel, when the distance between the pair of specific pixels that are the farthest among the plurality of specific pixels is equal to or greater than a predetermined value when a plurality of the specific pixels are detected for each of the inner pixels; A method for detecting a center line comprising a first detection method having the above.

2. A first step of reading a target image; A second step of converting the target image into grayscale, smoothing it, and binarizing it to generate a binarized image; A third step of removing protruding pixels composed of two pixels that protrude outward adjacent to each other or one pixel that protrudes outward at a pixel pitch distance among the contour line constituent pixels that constitute the contour line of the subject in the binarized image, and detecting new contour line constituent pixels; A fourth step of detecting, as new contour line constituent pixels, the pixels that constitute the contour line of a new subject composed of the pixels inside the contour line constituent pixels; A fifth step of detecting, as a center line constituent pixel, one of the inner pixels between them when only two inner pixels exist between a pair of pixels among the contour line constituent pixels, and detecting the inner pixel between them as the center line constituent pixel when only one inner pixel exists between a pair of pixels among the contour line constituent pixels; A method for detecting a center line having the above, and comprising a second detection method that repeats the fourth step and the fifth step.

3. A method for detecting a center line, wherein the third step of the second detection method according to claim 2 is performed on the subject constituted by the center line constituent pixels detected by the first detection method according to claim 1, and the fourth step and the fifth step are repeated.

Citation Information

Patent Citations

  • Processor for thinning line

    JP1994020041A

  • Method and device for measuring diameter distribution of fiber

    JP2001174227A

  • Image processing apparatus, image processing method, and image processing program

    JP2021184165A

  • Image processing apparatus, image processing method, and image processing program

    US20210366145A1

  • Counting system, counting device, machine learning device, counting method, component arrangement method, and program

    WO2020183837A1