Flexible printed circuit (FPC) image rapid segmentation method and FPC image segmentation system
Through Gaussian pyramid downsampling and chi-square distance evaluation technology, combined with OTSU algorithm, the problem of low image processing efficiency of large-size and high-resolution FPC is solved, fast and accurate image segmentation is achieved, and the online implementation capability of FPC defect detection is improved.
Patent Information
- Application Number
- CN202411731319.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-18
AI Technical Summary
The existing OTSU algorithms significantly reduce the processing efficiency when processing large-size and high-resolution FPC images, limiting the online implementation capability of FPC defect detection technology.
The Gaussian pyramid layer by layer downsampling technology is used to calculate the chi-square distance of the grayscale histogram, and the differences between images at different levels and the original image are dynamically evaluated, adaptively determine the number of downsampling termination layers, and the best segmentation threshold is calculated using the OTSU algorithm.
It significantly improves image processing speed, ensures the algorithm's good adaptability to different types of FPC images, and maintains high-quality segmentation results while improving efficiency.
Smart Images

Figure CN119648730A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of machine vision, and in particular relates to a flexible printed circuit image fast segmentation method and an FPC image segmentation system. Background Art
[0002] In the current technological environment, machine vision technology is developing at an astonishing speed and gradually integrating into our daily lives, becoming a key driving force for promoting digital transformation, intelligent manufacturing, and the upgrading of daily consumer electronic products. Especially in the field of FPC (flexible printed circuit board), the application of this technology is particularly important. Due to its unique flexibility and lightness, FPC has been widely used in many industries such as automotive electronics and medical equipment, and the market has shown a trend of sustained growth. In order to ensure the quality of FPC, bare board inspection has become a crucial step in the entire production process, and the image segmentation of printed circuits is the core link in the inspection process.
[0003] In terms of image segmentation technology, there are currently a variety of methods, including fixed threshold method, adaptive threshold method, OTSU algorithm and deep learning-based methods. These methods have their own advantages and disadvantages: the fixed threshold method is more sensitive to changes in lighting conditions, resulting in poor stability; the adaptive threshold method is difficult to meet the needs of real-time processing due to its high computational complexity; although deep learning performs well in accuracy, it has extremely high requirements for computing resources and model training takes a long time. In contrast, the OTSU algorithm, with its simple and efficient characteristics and the advantage of being able to automatically determine the optimal threshold, performs well in dealing with uneven grayscale distribution of FPC lines and changeable lighting conditions, and has therefore been widely used in the segmentation of FPC bare board lines.
[0004] However, the manufacturing process characteristics of flexible circuits determine that FPC images usually have large size and high resolution, which poses a challenge to the existing OTSU algorithm. When faced with such a large amount of data, the processing efficiency of the OTSU algorithm drops significantly, which greatly restricts the online implementation of FPC defect detection technology. To solve this problem, it is necessary to further research and develop more efficient and adaptable image processing algorithms to meet the growing needs of the FPC manufacturing industry. Summary of the invention
[0005] The present invention aims at the defects of the prior art and provides a method for fast segmentation of flexible printed circuit images and an FPC image segmentation system, which can realize FPC image segmentation quickly and accurately.
[0006] To achieve the above object, the present invention adopts the following technical solution, a method for fast segmentation of flexible printed circuit images, comprising the following steps:
[0007] S1. Use the Gaussian pyramid to downsample the FPC image layer by layer to gradually reduce the resolution of the image.
[0008] S2. Calculate the grayscale histogram of each downsampled FPC image and compare it with the grayscale histogram of the original FPC image; use the chi-square distance as a metric to evaluate the difference between the histograms of images at different levels and the histogram of the original FPC image; determine the termination number of downsampling layers based on the result of the chi-square distance.
[0009] S3. For the selected termination layer image, the OTSU algorithm is used to calculate the optimal segmentation threshold, and the optimal segmentation threshold is used as the final segmentation threshold of the original FPC image; thereby, while ensuring the effectiveness of the segmentation threshold, the time required to determine the segmentation threshold is greatly reduced.
[0010] Furthermore, S1 is specifically divided into:
[0011] S1.1. Use a low-pass filter to smooth the FPC image and remove high-frequency details in the image; that is, define a Gaussian filter to smooth the FPC image. The Gaussian filter function is defined as follows:
[0012]
[0013] Among them, x and y are the offsets of the pixel coordinates relative to the center point, and σ is the standard deviation of the Gaussian function, which controls the degree of blur: the larger the σ value, the higher the degree of image blur.
[0014] S1.2, downsampling the blurred FPC image to reduce the image size;
[0015] That is, the image size is reduced by half. Assuming that the size of the original FPC image is m×n, the FPC image G of the kth layer of the Gaussian pyramid is k (i,j) is the k-1th layer image G k-1 (i,j) is obtained by downsampling, and the formula is as follows;
[0016]
[0017] Wherein, w(m,n)=h(m)·h(n) is the window function, and h is the Gaussian density distribution function;
[0018] S1.3. Repeat the above two steps to construct the next layer of the Gaussian pyramid by repeatedly performing the Gaussian blur and downsampling steps.
[0019] Furthermore, S2 determines the optimal downsampling level by comparing the similarity of the grayscale histograms of the images before and after downsampling, so as to obtain an image with the grayscale histogram distribution that is extremely similar to the original image and has the smallest resolution; this not only ensures the consistency of the OTSU segmentation threshold, but also reduces the calculation time. Specifically divided into:
[0020] S2.1. Establish a measurement standard and use chi-square distance for measurement. Assume that H o and H k are the normalized grayscale histograms of the original FPC image and the FPC image of the kth layer of the Gaussian pyramid, respectively. The chi-square distance is expressed by the following formula:
[0021]
[0022] Where I represents the gray level, ranging from 0 to 255, then H0(I) and H k (I) represents the frequencies of the original FPC image at gray level I and the FPC image at the kth layer of the Gaussian pyramid.
[0023] S2.2. The quality of the FPC image sequences obtained at different downsampling rates of the original FPC image is evaluated in turn, and the chi-square distance value is used to evaluate its relative quality to the original FPC image I ori degree of distortion.
[0024] If the chi-square distance between the FPC image of a layer n in the FPC image sequence and the original FPC image histogram is greater than the set threshold, it indicates that the image distortion is unacceptable, and downsampling is stopped; at this time, the FPC image I of the n-1th layer n-1 This is the maximum downsampling layer that can meet the OTSU segmentation requirements.
[0025] Furthermore, S3 specifically includes:
[0026] S3.1, calculate the optimal segmentation threshold T;
[0027] For the selected maximum downsampling layer FPC image I n-1 , the optimal segmentation threshold T is calculated using the OTSU algorithm.
[0028] S3.2, apply segmentation threshold;
[0029] The original FPC image I is segmented using the calculated optimal segmentation threshold T. ori Perform threshold segmentation to obtain a small resolution FPC image I n-1 The threshold calculation time is shortened to complete the segmentation threshold determination of the original FPC image with large resolution, thereby greatly reducing the time required for segmentation threshold determination while ensuring the effectiveness of the segmentation threshold.
[0030] FPC image segmentation system, including:
[0031] The image preprocessing module is used to downsample the FPC image layer by layer using the Gaussian pyramid to gradually reduce the resolution of the image.
[0032] The image quality assessment module is used to compare the similarity between the grayscale histogram of the downsampled FPC image and the histogram distribution of the original FPC image, and use the chi-square distance to measure the difference between the histograms, so as to automatically determine the termination layer number of image downsampling.
[0033] The segmentation threshold calculation module is used to calculate the optimal segmentation threshold for the selected termination layer FPC image using the OTSU algorithm.
[0034] The image segmentation module is used to apply the calculated threshold to the segmentation of the original FPC image, thereby greatly reducing the time required to determine the segmentation threshold while ensuring the effectiveness of the segmentation threshold.
[0035] Furthermore, the image preprocessing module specifically includes:
[0036] The Gaussian blur submodule is used to smooth the FPC image using a low-pass filter, i.e., Gaussian blur, and defines a Gaussian filter to smooth the image and remove high-frequency details in the image.
[0037] The downsampling submodule is used to downsample the blurred FPC image, that is, to reduce the image size by half.
[0038] The pyramid construction submodule is used to repeatedly perform Gaussian blur and downsampling steps to construct the next layer of the Gaussian pyramid.
[0039] Furthermore, the image quality assessment module specifically includes: a similarity measurement submodule, which is used to use chi-square distance to measure the similarity between the grayscale histogram distribution of the downsampled FPC image and the histogram distribution of the original FPC image.
[0040] The quality assessment submodule is used to sequentially assess the quality of the FPC image sequences obtained at different downsampling rates of the original FPC image, and use the chi-square distance value to assess its relative quality to the original FPC image I ori The degree of distortion determines the maximum downsampling layer.
[0041] Furthermore, the segmentation threshold calculation module specifically includes: an optimal threshold calculation submodule for calculating the maximum downsampling layer FPC image I n-1 , the optimal segmentation threshold T is calculated using the OTSU algorithm.
[0042] Furthermore, the image segmentation module specifically includes: a threshold segmentation submodule for using the calculated threshold T to segment the original FPC image I oriPerform threshold segmentation and determine the segmentation threshold of the original FPC image with high resolution.
[0043] Compared with the prior art, the present invention has beneficial effects.
[0044] The (FPC) image segmentation method and segmentation system of the present invention greatly reduces the amount of data processing through the Gaussian pyramid layer-by-layer downsampling technology, and significantly improves the image processing speed. The chi-square distance is used to dynamically evaluate the difference between images of different levels and the original image, and the most appropriate downsampling termination layer is adaptively determined, ensuring the good adaptability of the algorithm to different types of FPC images. After the level is selected, the OTSU algorithm is used to calculate the optimal segmentation threshold to ensure that the high-quality segmentation results are maintained while improving efficiency.
[0045] The flexible printed circuit image segmentation method based on multi-level automatic downsampling OTSU proposed in the present invention can greatly save time for segmenting FPC images. Compared with the prior art, its speed improvement effect is obvious. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods. The protection scope of the present invention is not limited to the following description.
[0047] Figure 1 This is the original image of FPC.
[0048] Figure 2 Yes Figure 1 Half sampling in both length and width directions
[0049] Figure 3 Yes Figure 1 One quarter sampling is performed in both the length and width directions.
[0050] Figure 4 Yes Figure 1 One eighth sampling is carried out in both length and width directions.
[0051] Figure 5 Yes Figure 1 One sixteenth sampling is performed in both the length and width directions.
[0052] Figure 6 It is a flow chart of the OTSU segmentation method based on multi-level automatic downsampling of the present invention.
[0053] Figure 7 Yes Figure 1-Figure 5 The grayscale histograms of the five images are normalized and compared.
[0054] Figure 8 Determined using the OTSU method Figure 1 The segmentation threshold of the original image is the result of threshold segmentation.
[0055] Fig. 9 It is determined by the method of the present invention Figure 1 The final segmentation threshold is the result of threshold segmentation on the original image.
[0056] Fig.10 Yes Figure 1 Table 1 contains the detailed data of five images, including the original image and its four downsampled images.
[0057] Fig.11 is the T of 252 pictures in the embodiment gallery fo and t fo The distribution of .
[0058] Fig.12 is the t of 252 image samples in the embodiment fo distributed. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical scheme and beneficial effects of the embodiments of the present invention clearer, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0060] The method of the present invention comprises the following steps:
[0061] Step 1: Use the Gaussian pyramid to gradually reduce the resolution of the FPC image.
[0062] Step 2: Compare the grayscale histogram of the downsampled image with the histogram distribution of the original image, and use the chi-square distance to measure the difference between the histograms, so as to automatically determine the termination layer number of image downsampling.
[0063] Step 3: For the selected termination layer image, the OTSU algorithm is used to calculate the optimal segmentation threshold, and the threshold is used as the final segmentation threshold of the original image of the printed circuit. This ensures the effectiveness of the segmentation threshold while greatly reducing the time required to determine the segmentation threshold, which is of great significance for the segmentation of large-format and high-resolution images.
[0064] Furthermore, in step 1, the processing steps of the Gaussian pyramid are:
[0065] Step 1.1, first use a Gaussian filter to smooth the FPC image, that is, Gaussian blur, define a Gaussian filter to smooth the image and remove high-frequency details in the image. The function is defined as follows:
[0066]
[0067] Among them, x and y are the offsets of the pixel coordinates relative to the center point, and σ is the standard deviation of the Gaussian function, which controls the degree of blur: the larger the σ value, the more blurred the image.
[0068] Step 1.2: Downsample the blurred image, that is, reduce the image size by half. Assuming that the size of the original image is m×n, the image G at the kth layer of the Gaussian pyramid is k (i,j) is the k-1th layer image G k-1 (i,j) is obtained by downsampling, and the formula is as follows;
[0069]
[0070] Among them, w(m,n)=h(m)·h(n) is the window function, and h is the Gaussian density distribution function.
[0071] Step 1.3: Repeat the above two steps to build the next layer of the pyramid by repeating the Gaussian blur and downsampling steps.
[0072] Furthermore, for images processed by Gaussian pyramid, it is necessary to measure the similarity of the grayscale histograms of the images before and after downsampling, and automatically determine the number of downsampling required based on the defined similarity evaluation index, so as to select the appropriate number of pyramid layers. This layer of image is the image that satisfies the maximum similarity with the grayscale histogram distribution of the original image and has the minimum resolution. The maximum similarity with the grayscale histogram of the original image ensures the consistency of the OTSU segmentation threshold. At the same time, the small resolution reduces the calculation time of the OTSU segmentation threshold.
[0073] Step 2.1, first formulate the measurement standard, use chi-square distance to measure, assuming H o and H k are the normalized grayscale histograms of the original image and the kth layer of the Gaussian pyramid, respectively. The chi-square distance can be expressed by the following formula:
[0074]
[0075] Where I represents the gray level, which ranges from 0 to 255, then H0(I) and H k (I) represents the frequency of the original image and the k-th layer image of the pyramid at gray level I. Set the similarity threshold T Det , when the chi-square distance exceeds T Det , the two images are no longer considered similar enough.
[0076] Step 2.2: The quality of the image sequence obtained at different downsampling rates is evaluated, and the chi-square distance value is used to evaluate its relative quality to the original image I oriIf the chi-square distance between the image of a layer n in the image sequence and the original image histogram is greater than the set threshold T Det , it indicates that the image distortion is unacceptable, and downsampling is stopped. Then the image I of layer n-1 n-1 This is the maximum downsampling layer that can meet the OTSU segmentation requirements.
[0077] Step 2.3: For the selected maximum downsampled image layer I n-1 , use the OTSU algorithm to calculate the optimal segmentation threshold T; and use the threshold T to segment the original image I ori Threshold segmentation is performed to obtain a small resolution image I that has been downsampled multiple times. n-1 The threshold calculation time is shortened to complete the segmentation threshold determination of the original image with large resolution, thereby greatly reducing the time required for segmentation threshold determination while ensuring the effectiveness of the segmentation threshold.
[0078] Step 3.1: Use the OTSU algorithm to perform threshold segmentation on the original image. First, given an original image I containing G gray levels, calculate the histogram count value H(0), H(1), ..., H(G-1) of each gray level in the image. By dividing the image I ori Normalize the histogram using the pixels in the image — the histogram now represents the probability of each gray level.
[0079] Step 3.2: For each possible threshold t=0, ..., G-2, the histogram is divided into background B (gray level less than or equal to t) and foreground F (gray level greater than t).
[0080] Step 3.3, calculate the variance σ of the background gray level B (t) and the variance σ of the foreground gray level F (t). Calculate the probability that a pixel is background.
[0081]
[0082] Among them, ω B (T) is the weight of the background, which indicates the probability that the pixel falls into the background class, and is used to further calculate the inter-class variance to find the optimal threshold. F The calculation method of (t) is similar.
[0083] make
[0084] σ(t)=ω B (t)σ B (t)+ω F (t)σ F (t)
[0085] Then choose the optimal threshold as T=min t(σ(t)).
[0086] like Figure 1 As shown in Example 1: The segmentation method of the present invention comprises: for an FPC image Image0 collected by a linear array industrial camera under a high-brightness strip light source, as Figure 1 , the resolution of image Image0 is 1575*1048, the image size is 1.14MB, get the grayscale histogram h of image Image0 Image0 , Figure 7 Then, the resulting image Image0 is smoothed using a Gaussian filter to reduce noise and make the changes between adjacent pixels smoother. Next, the smoothed image is downsampled, and the generated new image is half the size of the previous layer, as shown in Figure 2 , and obtain the grayscale histogram h of the sampled image Image1 ( Figure 7 Green line in the middle); calculate the histogram h Image1 The grayscale histogram of the original image h Image0 The chi-square distance value Det (see Table 1) is smaller than the threshold value T Det =10, then continue to downsample the image and calculate the grayscale histogram of the new downsampled image and h Image0 Whether the chi-square distance Det is less than the threshold T Det =10, until Det is greater than T Det =10, then the above downsampling and chi-square distance calculation and judgment cycle is stopped. Suppose the number of downsampling of the current image is n, then the n-1th sampling image is selected as the sampling termination image I end In this embodiment, when n is 4, the downsampled image Image4 is obtained, and its grayscale histogram is similar to h Image0 The chi-square distance value is 29, which is greater than 10. Therefore, the 4-1th downsampled image Image3 is selected as the sampling termination image. Next, the segmentation threshold T of the image Image3 is calculated using the OTSU algorithm. In this embodiment, T is 79. Finally, T is used to segment the original image Image0 to separate the FPC line from the background area.
[0087] In this embodiment, the four down-sampling images are respectively as follows: Figure 2-Figure 5 As shown, the corresponding grayscale histogram curve distribution is as follows Figure 7As shown, the size of each downsampled image, the chi-square distance value between the downsampled image and the original image are shown in Table 1; the OTSU threshold of each downsampled image, and the time consumed by using the OTSU algorithm to calculate the threshold are also listed in Table 1. It can be seen from Table 1 that with the increase of the number of downsampling times, the amount of image data gradually decreases, and the time consumed by the OTSU threshold calculation also gradually decreases; at the same time, it can be seen that the chi-square distance value between the downsampled image and the original image is small in the first three downsampling times, indicating that the downsampled image and the original image have a large similarity in grayscale distribution at this time, which can also be verified from the parameter of the OTSU threshold, that is, although the threshold gradually decreases with the increase of the number of downsampling times, the difference with the OTSU threshold of the original image is always less than 30% (16.0% in this embodiment), but the time consumed by the threshold calculation is reduced by 62.5%. Figure 8 and Fig. 9 The results of threshold segmentation of Image0 are shown by using the segmentation threshold (94 in this embodiment) obtained directly from the image Image0 using the OTSU algorithm and the segmentation threshold (79 in this embodiment) obtained from the termination downsampling layer Image3 determined by the method of the present invention. It can be seen that the FPC lines are completely segmented and well distinguished from the background. This verifies the effectiveness of the method of the present invention.
[0088] Example 2: In order to systematically verify the effectiveness of the algorithm in this paper, a visual imaging system was built on the assembly line of the industrial production site of laptop keyboard FPC, and an image of a laptop keyboard FPC with a size of 680mm (length) × 450mm (width) was collected to obtain 100 FPC bare board image data with a size of 8192×7500. We randomly cropped the 100 original images and constructed a library SUT-FPC-24 with a size of 1575*1048 and 252 images. Among them, in the constructed FPC bare board visual imaging system, the camera used is an industrial linear array camera, whose model is P4-CM-08K07, and the light source used is a linear high-brightness white light source, whose model is OPT-LST562-W. The camera and light source are installed on the mobile platform above the FPC production line, and the center of the light covers the camera imaging range, and at the same time makes it parallel to the "long" direction of the FPC board, and then the camera is triggered by the grating ruler during the process of the lead screw to collect images.
[0089] The method of the present invention is used to segment 252 pictures in the picture library SUT-24, and the original OTSU threshold T of each picture is recorded. ori , and the time t required to execute the OTSU algorithm on the original image to obtain the segmentation threshold ori , downsampling termination layer OTSU threshold T fin , and the time t taken to execute the OTSU algorithm on the downsampling termination layer to obtain the segmentation thresholdfin . Define T fin Relative to T ori Changes in T fo =(T ori -T fin ) / T ori ×100%, and t fin Relative to t ori Changes in t fo =(t ori -t fin ) / t ori × 100%. Get the T of 252 pictures in the gallery fo and t fo The distribution of Fig.11 shown. Fig.11 Shows the segmentation threshold T of OTSU method for 252 image samples ori , the image segmentation threshold T determined by the method of this application fin , and the relative change of the two fo Distribution. It can be seen that the T fo The T of individual samples is less than 20%. fo It is greater than 20% and less than 30%, which shows the effectiveness of the proposed method in threshold determination. Fig.12 Shows t for 252 image samples fo It can be seen that the number of samples with an execution efficiency between 50% and 90% of the original OTSU algorithm exceeds half, and the average t fo It reaches 52.88%, which fully proves the high speed of the method of the present invention.
[0090] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features therein may be replaced by equivalents. Therefore, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the claims of the present invention.
Claims
1. A method for fast segmentation of flexible printed circuit images, characterized in that: The following steps are involved: S1, using Gaussian pyramid to downsample the FPC image layer by layer, gradually reducing the resolution of the image; S2, for each layer of downsampled FPC image, calculate its grayscale histogram and compare it with the grayscale histogram of the original FPC image; use the chi-square distance as a metric to evaluate the difference between the histograms of images at different levels and the histogram of the original FPC image; determine the termination number of downsampling layers based on the result of the chi-square distance; S3. For the selected termination layer image, the OTSU algorithm is used to calculate the optimal segmentation threshold, and the optimal segmentation threshold is used as the final segmentation threshold of the original FPC image; thereby, while ensuring the effectiveness of the segmentation threshold, the time required to determine the segmentation threshold is greatly reduced.
2. The method for fast segmentation of flexible printed circuit images according to claim 1, characterized in that: S1 is divided into: S1.
1. Use a low-pass filter to smooth the FPC image and remove high-frequency details in the image; that is, define a Gaussian filter to smooth the FPC image. The Gaussian filter function is defined as follows: Among them, x and y are the offsets of the pixel coordinates relative to the center point, and σ is the standard deviation of the Gaussian function, which controls the degree of blur: the larger the σ value, the higher the degree of image blur; S1.2, downsampling the blurred FPC image to reduce the image size; That is, the image size is reduced by half. Assuming that the size of the original FPC image is m×n, the FPC image G of the kth layer of the Gaussian pyramid is k (i,j) is the k-1th layer image G k-1 (i,j) is obtained by downsampling, and the formula is as follows; Wherein, w(m,n)=h(m)·h(n) is the window function, and h is the Gaussian density distribution function; S1.
3. Repeat the above two steps to construct the next layer of the Gaussian pyramid by repeatedly performing the Gaussian blur and downsampling steps.
3. The method for fast segmentation of flexible printed circuit images according to claim 1, characterized in that: S2 determines the optimal downsampling level by comparing the similarity of the grayscale histograms of the images before and after downsampling, so as to obtain an image with the grayscale histogram distribution that is extremely similar to the original image and with the minimum resolution; this not only ensures the consistency of the OTSU segmentation threshold, but also reduces the calculation time; specifically, it is divided into: S2.
1. Establish a measurement standard and use chi-square distance for measurement. Assume that H o and H k are the normalized grayscale histograms of the original FPC image and the FPC image of the kth layer of the Gaussian pyramid, respectively. The chi-square distance is expressed by the following formula: Where I represents the gray level, ranging from 0 to 255, then H0(I) and H k (I) represents the frequencies of the original FPC image and the FPC image of the kth layer of the Gaussian pyramid at gray level I, respectively; S2.
2. The quality of the FPC image sequences obtained at different downsampling rates of the original FPC image is evaluated in turn, and the chi-square distance value is used to evaluate its relative quality to the original FPC image I ori The degree of distortion; If the chi-square distance between the FPC image of a layer n in the FPC image sequence and the original FPC image histogram is greater than the set threshold, it indicates that the image distortion is unacceptable, and downsampling is stopped; at this time, the FPC image I of the n-1th layer n-1 This is the maximum downsampling layer that can meet the OTSU segmentation requirements.
4. The method for fast segmentation of flexible printed circuit images according to claim 1, characterized in that: S3 specifically includes: S3.1, calculate the optimal segmentation threshold T; For the selected maximum downsampling layer FPC image I n-1 , use the OTSU algorithm to calculate the optimal segmentation threshold T; S3.2, apply segmentation threshold; The original FPC image I is segmented using the calculated optimal segmentation threshold T. ori Perform threshold segmentation to obtain a small resolution FPC image I n-1 The threshold calculation time is shortened to complete the segmentation threshold determination of the original FPC image with large resolution, thereby greatly reducing the time required for segmentation threshold determination while ensuring the effectiveness of the segmentation threshold. 5.FPC image segmentation system, including: The image preprocessing module is used to downsample the FPC image layer by layer using the Gaussian pyramid to gradually reduce the resolution of the image; The image quality assessment module is used to compare the grayscale histogram of the downsampled FPC image with the histogram distribution of the original FPC image, and use the chi-square distance to measure the difference between the histograms, so as to automatically determine the termination layer number of image downsampling; A segmentation threshold calculation module is used to calculate the optimal segmentation threshold using the OTSU algorithm for the selected termination layer FPC image; The image segmentation module is used to apply the calculated threshold to the segmentation of the original FPC image, thereby greatly reducing the time required to determine the segmentation threshold while ensuring the effectiveness of the segmentation threshold.
6. The FPC image segmentation system according to claim 5, characterized in that: The image preprocessing module specifically includes: The Gaussian blur submodule is used to smooth the FPC image using a low-pass filter, i.e., Gaussian blur, which defines a Gaussian filter to smooth the image and remove high-frequency details in the image; The downsampling submodule is used to downsample the blurred FPC image, i.e. reduce the image size by half; The pyramid construction submodule is used to repeatedly perform Gaussian blur and downsampling steps to construct the next layer of the Gaussian pyramid.
7. The FPC image segmentation system according to claim 5, characterized in that: The image quality assessment module specifically includes: A similarity measurement submodule is used to measure the similarity between the grayscale histogram of the downsampled FPC image and the histogram distribution of the original FPC image using the chi-square distance; The quality assessment submodule is used to sequentially assess the quality of the FPC image sequences obtained at different downsampling rates of the original FPC image, and use the chi-square distance value to assess its relative quality to the original FPC image I ori The degree of distortion determines the maximum downsampling layer.
8. The FPC image segmentation system according to claim 5, characterized in that: The segmentation threshold calculation module specifically includes: The optimal threshold calculation submodule is used to calculate the maximum downsampling layer FPC image I n-1 , the optimal segmentation threshold T is calculated using the OTSU algorithm.
9. The FPC image segmentation system according to claim 5, characterized in that: The image segmentation module specifically includes: The threshold segmentation submodule is used to use the calculated threshold T to segment the original FPC image I ori Perform threshold segmentation and determine the segmentation threshold of the original FPC image with high resolution.