Method, device and equipment for correcting ripples in nematode images and storage medium

By using a method for correcting the positional deviation of edge curves and diagonal lines based on local detection, the accuracy problem of sliding window lane line detection algorithm under interference sources is solved, and efficient image correction effect is achieved.

CN116863123BActive Publication Date: 2026-04-24SHANGHAI INSTITUTE OF TECHNICAL PHYSICS CHINESE ACADEMY OF SCIENCES
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI INSTITUTE OF TECHNICAL PHYSICS CHINESE ACADEMY OF SCIENCES
Filing Date
2023-07-31
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing sliding window lane detection algorithms are inaccurate in detecting lane baselines when interference sources are present, exhibit poor robustness, and fail to effectively remove noise and blocky interference sources, leading to detection errors.

Method used

A local detection-based method is used to detect ripple curves in nematode images. The positional deviation between the edge curve and the oblique line is obtained through edge detection and straight line fitting, and then the image is corrected.

Benefits of technology

It effectively removes noise and blocky interference sources, improves the efficiency and accuracy of ripple curve detection, and achieves efficient image correction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116863123B_ABST
    Figure CN116863123B_ABST
Patent Text Reader

Abstract

The application relates to a nematode image wave ripple distortion correction method, device, equipment and storage medium. The method comprises the following steps: performing wave curve detection on a target image based on a row direction by adopting a local detection mode, performing edge detection on the detected curve to obtain an edge curve, and performing straight line fitting on the edge curve to obtain an inclined line; the position deviation of the edge curve and the inclined line in the horizontal direction is obtained by subtraction, and the wave curve of the target image is corrected according to the position deviation of the edge curve and the inclined line in the horizontal direction. The method realizes wave curve detection based on a local detection mode, continuously detects the detected target pixels, classifies the points meeting the continuity requirement as curve points, and improves the curve detection accuracy; in the wave ripple distortion correction, the position of the whole image is corrected according to the position deviation of the edge curve and the corresponding fitting inclined line in the horizontal direction, and the correction efficiency is relatively high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of nematode image ripple distortion correction technology, and in particular to a method, apparatus, computer equipment and storage medium for nematode image ripple distortion correction. Background Technology

[0002] Currently, research closely related to wavy curve detection is lane line detection. Most lane curve detection algorithms first perform preprocessing such as image denoising and enhancement, and then use curve fitting to achieve the final lane line detection. In their paper "Lane Line Detection Based on Polynomial Curve Fitting," Bao Xianfu, Qiang Zanxia, ​​and others used a sliding window approach for initial lane line detection, and then employed curve fitting to perform the final lane line detection.

[0003] The preliminary algorithm flow for lane line detection using a sliding window is as follows: 1) Determine the coordinates of the lane base point and the base values ​​of the height and width of the sliding window; 2) Calculate the window width, determine the coordinates of the four boundaries of the window, and count the number of non-zero pixels within the sliding window; 3) If the number of non-zero pixels is greater than the set threshold minpix, update the window width base value and execute step 2 again; 4) If the number of non-zero pixels is less than the set threshold minpix, update the window width base value, store the non-zero pixels in an array, determine the coordinates of the lane base point based on the average value of the non-zero pixels, and execute step 2 again; 5) If the number of executions of step 2 exceeds n, the loop ends, and the lane detection algorithm based on the sliding window is completed.

[0004] The above-mentioned lane curve detection method based on sliding windows has the following defects: 1. The algorithm stores non-zero points within the window into an array without considering the internal structural relationship between pixels within the curve. Some points may be interference sources next to the lane line; 2. Using the average coordinates of non-zero points as the coordinates of the loop reference point, the calculated reference point is inaccurate in the presence of interference sources, resulting in deviations in the detected lane lines. Using a fixed loop reference point has poor robustness; 3. The algorithm does not re-evaluate the detected lane lines, leading to errors in the detected lane lines. Summary of the Invention

[0005] Therefore, it is necessary to provide a method, apparatus, computer device, and storage medium for correcting the wavy distortion of images of nematodes based on spatial culture, which can correct the wavy distortion of the capture channel and the nematodes inside.

[0006] On the one hand, a method for correcting ripple distortion in nematode images is provided, the method comprising:

[0007] The target image is subjected to local detection based on the row direction to detect ripple curves. The detected curves are then subjected to edge detection to obtain edge curves, and the edge curves are fitted with straight lines to obtain oblique lines.

[0008] The positional deviation is obtained by subtracting the horizontal position of the edge curve from that of the oblique line. Based on the horizontal positional deviation of the edge curve and the oblique line, the target image is corrected for ripple curves line by line.

[0009] In one embodiment, the step of detecting the ripple curve of the target image using a local detection method based on the row direction includes:

[0010] The image is segmented based on histogram to separate the background from the foreground, and then median filtering is performed to remove particle noise to obtain the first processed image.

[0011] The first processed image is binarized, and connected regions are obtained. The smallest enclosing circle in the connected regions is found. The circular regions with a radius smaller than a preset threshold are filled with background gray values, and the remaining regions are filled with foreground gray values ​​to remove block noise and obtain the second processed image.

[0012] The obtained second processed image is used to perform ripple curve detection of the nematode capture area based on the row direction using a local detection method.

[0013] In one embodiment, in the step of binarizing the obtained first processed image, the background grayscale value is set to 255 and the foreground grayscale value is set to 0.

[0014] In one embodiment, the step of detecting the ripple curve of the nematode capture area using local detection based on the row direction in the obtained second processed image includes:

[0015] Input a second processed image, and set the second processed image to record a pixel with a gray value of zero when it is found in the row direction as a zero value point. Search downwards from the zero value point, and search downwards for an odd number of neighboring pixels in the row direction at each step.

[0016] The second processed image is searched line by line to determine whether there is a zero point in the current line, until a zero point is found in the target line;

[0017] The number of zero-value points on the target row is obtained. Using the first zero-value point on the target row as the new base point, the search continues downward. It is determined whether there is a zero-value point in the odd number of pixels corresponding to the row below the first zero-value point on the target row. If so, the search continues downward with the zero-value point in the row below the first zero-value point as the new base point. When there is no zero-value point in the odd number of pixels corresponding to the row below the first zero-value point, the search stops at that zero-value point position. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the first zero-value point. If the number of zero-value points on the target row is greater than two, the search continues downward with the second zero-value point on the target row as the new base point. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the second zero-value point.

[0018] The coordinates of consecutive zero points obtained by searching down row by row on the target row are stored in an array, and the coordinates of all consecutive zero points in the array are connected to form the detected curve.

[0019] In one embodiment, the step of detecting the ripple curve of the nematode capture area using local detection based on the row direction in the obtained second processed image includes:

[0020] Set a maximum search step threshold for the second processed image;

[0021] When the number of rows searched downwards from the target row exceeds the maximum search step threshold, the search continues downwards from the zero point corresponding to the last row as the new base point.

[0022] In one embodiment, the step of detecting the ripple curve of the nematode capture area using local detection based on the row direction in the obtained second processed image includes:

[0023] Set a threshold for the width of the number of search pixels in each row for the second processed image;

[0024] When the total number of pixels searched in the row direction is greater than the width threshold, the search for pixels in the current row is terminated to determine whether there are zero-value points in the current row.

[0025] In one embodiment, the step of subtracting the horizontal position of the edge curve from that of the diagonal line to obtain the positional deviation, and then performing ripple curve correction on the target image row by row based on the horizontal positional deviation of the edge curve and the diagonal line, includes:

[0026] Obtain the coordinates of all zero points on the edge curve.

[0027] Obtain the oblique line y obtained by straight-line fitting of the edge curve;

[0028] Let Δx represent the difference in horizontal coordinates between a point on the edge curve and a point on the diagonal line y, which are located in the same row in the horizontal direction.

[0029] Constructing the correction formula: I out(i,j) =I in (i-Δx,j); i=1,2,...,width; j=1,2,...,height; where, I in (i-Δx,j) is the pixel at coordinates (i-Δx,j) in the target image, I out(i,j) It is the pixel at coordinates (i,j) in the output image, where i is the x-coordinate of the target image, j is the y-coordinate of the target image, width is the threshold for the width of the target image in the horizontal direction, and height is the threshold for the maximum number of search steps in the target image in the vertical direction.

[0030] The target image is corrected by row-by-row using a correction formula based on the horizontal positional deviation between the edge curve and the oblique line.

[0031] On the other hand, a device for correcting ripple distortion in nematode images is provided, the device comprising:

[0032] The wavy curve detection module is used to detect wavy curves in the target image based on the row direction using a local detection method, perform edge detection on the detected curves to obtain edge curves, and perform straight line fitting on the edge curves to obtain oblique lines;

[0033] The ripple curve correction module is used to subtract the horizontal position of the edge curve from that of the oblique line to obtain the position deviation, and to perform ripple curve correction on the target image line by line based on the horizontal position deviation of the edge curve and the oblique line.

[0034] In another aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0035] The target image is subjected to local detection based on the row direction to detect ripple curves. The detected curves are then subjected to edge detection to obtain edge curves, and the edge curves are fitted with straight lines to obtain oblique lines.

[0036] The positional deviation is obtained by subtracting the horizontal position of the edge curve from that of the oblique line. Based on the horizontal positional deviation of the edge curve and the oblique line, the target image is corrected for ripple curves line by line.

[0037] In another aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0038] The target image is subjected to local detection based on the row direction to detect ripple curves. The detected curves are then subjected to edge detection to obtain edge curves, and the edge curves are fitted with straight lines to obtain oblique lines.

[0039] The positional deviation is obtained by subtracting the horizontal position of the edge curve from that of the oblique line. Based on the horizontal positional deviation of the edge curve and the oblique line, the target image is corrected for ripple curves line by line.

[0040] The aforementioned method, apparatus, computer equipment, and storage medium for correcting ripple distortion in nematode images can remove noise and effectively eliminate blocky interference sources by detecting ripple curves, thus improving the detection efficiency of ripple curves. It employs a local detection method to achieve ripple curve detection, performing continuous detection on detected target pixels and classifying points that meet the continuity requirement as curve points, thereby improving curve detection accuracy. In the ripple distortion correction method, the horizontal position of the ripple edge curve after edge detection is subtracted from the corresponding fitted oblique line pixel by pixel to obtain the positional deviation. Based on this deviation, the entire image is corrected row by row, resulting in high correction efficiency. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0042] Figure 1 A normal image of nematodes cultured in space in the capture area in one embodiment;

[0043] Figure 2 The image shown is a distorted image of a space-cultured nematode in the capture area in one embodiment.

[0044] Figure 3 This is a flowchart illustrating a method for correcting ripple distortion in nematode images in one embodiment.

[0045] Figure 4 This is a flowchart illustrating the principle and steps of curve detection based on row direction in one embodiment.

[0046] Figure 5 For one embodiment, the corresponding Figure 4 A schematic diagram illustrating the principle, steps, and detection process of the test.

[0047] Figure 6 This is a schematic diagram illustrating the principle of performing ripple curve correction on the target image row by row based on the horizontal positional deviation between the edge curve and the oblique line in one embodiment;

[0048] Figure 7 This is a structural block diagram of a nematode image ripple distortion correction device in one embodiment;

[0049] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0051] As described in the background section, the sliding window-based lane curve detection method has the following drawbacks: 1. The algorithm stores non-zero points within the window into an array without considering the internal structural relationships between pixels within the curve, and some points may be interference sources next to the lane line; 2. Using the average coordinates of non-zero points as the coordinates of the loop reference point, the calculated reference point is inaccurate in the presence of interference sources, resulting in deviations in the detected lane lines, and the robustness of using a fixed loop reference point is poor; 3. The algorithm does not re-evaluate the detected lane lines, resulting in errors in the detected lane lines.

[0052] Images of space-cultured nematodes in the capture area, as shown below. Figure 1 , Figure 2 As shown, where Figure 1 It's a normal image. Figure 2 The image is distorted; as can be seen, there is a lot of background noise, and the capture channel and the nematodes inside exhibit wavy twisting. The purpose of this invention is to correct the wavy twisting of the capture channel and the nematodes inside.

[0053] To solve the above problems, such as Figure 3 As shown in the figure, this invention creatively proposes a method for correcting the ripple distortion of nematode images, comprising the following steps:

[0054] Step S1: Detect ripple curves in the target image using a local detection method based on the row direction; perform edge detection on the detected curves to obtain edge curves; and perform straight line fitting on the edge curves to obtain oblique lines.

[0055] Step S2: Subtract the horizontal position of the edge curve from that of the oblique line to obtain the position deviation, and perform ripple curve correction on the target image line by line based on the horizontal position deviation of the edge curve and the oblique line.

[0056] In this embodiment, the step of detecting the ripple curve of the target image using a local detection method based on the row direction includes:

[0057] The image is segmented based on histogram to separate the background from the foreground, and then median filtering is performed to remove particle noise to obtain the first processed image.

[0058] The first processed image is binarized, and connected regions are obtained. The smallest enclosing circle in the connected regions is found. The circular regions with a radius smaller than a preset threshold are filled with background gray values, and the remaining regions are filled with foreground gray values ​​to remove block noise and obtain the second processed image.

[0059] The obtained second processed image is used to perform ripple curve detection of the nematode capture area based on the row direction using a local detection method.

[0060] In this embodiment, in the step of binarizing the obtained first processed image, the background grayscale value is set to 255 and the foreground grayscale value is set to 0.

[0061] In this embodiment, the step of detecting the ripple curve of the nematode capture area using local detection based on the row direction in the obtained second processed image includes:

[0062] Input a second processed image, and set the second processed image to record a pixel with a gray value of zero when it is found in the row direction as a zero value point. Search downwards from the zero value point, and search downwards for an odd number of neighboring pixels in the row direction at each step.

[0063] The second processed image is searched line by line to determine whether there is a zero point in the current line, until a zero point is found in the target line;

[0064] The number of zero-value points on the target row is obtained. Using the first zero-value point on the target row as the new base point, the search continues downward. It is determined whether there is a zero-value point in the odd number of pixels corresponding to the row below the first zero-value point on the target row. If so, the search continues downward with the zero-value point in the row below the first zero-value point as the new base point. When there is no zero-value point in the odd number of pixels corresponding to the row below the first zero-value point, the search stops at that zero-value point position. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the first zero-value point. If the number of zero-value points on the target row is greater than two, the search continues downward with the second zero-value point on the target row as the new base point. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the second zero-value point.

[0065] The coordinates of consecutive zero points obtained by searching down row by row on the target row are stored in an array, and the coordinates of all consecutive zero points in the array are connected to form the detected curve.

[0066] In this embodiment, the step of detecting the ripple curve of the nematode capture area using local detection based on the row direction in the obtained second processed image includes:

[0067] Set a maximum search step threshold for the second processed image;

[0068] When the number of rows searched downwards from the target row exceeds the maximum search step threshold, the search continues downwards from the zero point corresponding to the last row as the new base point.

[0069] In this embodiment, the step of detecting the ripple curve of the nematode capture area using local detection based on the row direction in the obtained second processed image includes:

[0070] Set a threshold for the width of the number of search pixels in each row for the second processed image;

[0071] When the total number of pixels searched in the row direction is greater than the width threshold, the search for pixels in the current row is terminated to determine whether there are zero-value points in the current row.

[0072] To facilitate understanding of this application's scheme, curve detection is based on row direction detection, and the detection principle for each row is as follows: Figure 4 As shown, Figure 4 The flowchart in the middle can be used Figure 5 Please provide an explanation.

[0073] First, a zero-value point 1 is found in the row direction. The search continues downwards from point 1, with a maximum search step of 20. Each step searches down to the next 5 pixels in the row direction. In the first step, pixel A is found to be a zero-value pixel. Next, a continuity check is performed on point A. Using A as the new base point, the search continues downwards, finding pixels B and C as zero-value pixels, satisfying the condition that the number of pixels in their left and right 5 neighboring regions is greater than 0. Then, using B as the new base point, the search continues downwards; no zero-value pixels are found in the 5 neighboring regions, as shown in square 1. Next, using C as the base point, the search continues downwards, finding pixel D as a zero-value pixel. Continuing the search downwards from D as the base point, pixels E and F are found to be zero-value pixels. Using E as the base point, the search continues downwards, but no zero-value pixels are found. Then, using F as the base point, the search continues, but still no zero-value pixels are found. At this point, the search stops, and pixel A is no longer continuous within the 20*5 area. Perform the next row-direction zero-value search. If the next zero-value point is 2, check its continuity within the 20*5 area. If continuous, store it in the array; otherwise, discard it and continue the row-direction search until the number of pixels searched reaches the total width of the image's rows. Here, square 1 and the row below it represent squares in the same row. Similarly, square 2 and the row below it also represent squares in the same row.

[0074] In this embodiment, the step of subtracting the horizontal position of the edge curve from that of the oblique line to obtain the positional deviation, and then performing ripple curve correction on the target image row by row based on the horizontal positional deviation of the edge curve and the oblique line includes:

[0075] Obtain the coordinates of all zero points on the edge curve.

[0076] Obtain the oblique line y obtained by straight-line fitting of the edge curve;

[0077] Let Δx represent the difference in horizontal coordinates between a point on the edge curve and a point on the diagonal line y, which are located in the same row in the horizontal direction.

[0078] Constructing the correction formula: I out(i,j) =I in (i-Δx,j); i=1,2,...,width; j=1,2,...,height; where, I in (i-Δx,j) is the pixel at coordinates (i-Δx,j) in the target image, I out(i,j) It is the pixel at coordinates (i,j) in the output image, where i is the x-coordinate of the target image, j is the y-coordinate of the target image, width is the threshold for the width of the target image in the horizontal direction, and height is the threshold for the maximum number of search steps in the target image in the vertical direction.

[0079] The target image is corrected by row-by-row using a correction formula based on the horizontal positional deviation between the edge curve and the oblique line.

[0080] like Figure 6 As shown, the S-shaped curve represents the detected curve, the red straight line represents the oblique line y, and Δx and Δy represent the difference between the two points on the curve in the horizontal direction and the oblique line y in the horizontal coordinate.

[0081] In the above-mentioned nematode image ripple distortion correction method, ripple curve detection can remove noise and block interference sources, improving the detection efficiency of ripple curves. A local detection-based method is used to detect ripple curves, performing continuous detection on the detected target pixels and classifying points that meet the continuity requirement as curve points, thus improving the accuracy of curve detection. In the ripple distortion correction method, the horizontal position of the ripple edge curve after edge detection is subtracted from the corresponding fitted oblique line pixel by pixel to obtain the positional deviation. Based on this deviation, the entire image is corrected row by row, resulting in high correction efficiency.

[0082] In one embodiment, such as Figure 7 As shown, a nematode image ripple distortion correction device 10 is provided, including: a ripple curve detection module 1 and a ripple curve correction module 2.

[0083] The wavy curve detection module 1 is used to detect wavy curves in the target image based on the row direction using a local detection method, to obtain edge curves by edge detection of the detected curves, and to obtain oblique lines by straight line fitting of the edge curves.

[0084] The ripple curve correction module 2 is used to subtract the position of the edge curve from that of the oblique line in the horizontal direction to obtain the position deviation, and to perform ripple curve correction on the target image line by line based on the position deviation of the edge curve and the oblique line in the horizontal direction.

[0085] In this embodiment, the step of detecting the ripple curve of the target image using a local detection method based on the row direction includes:

[0086] The image is segmented based on histogram to separate the background from the foreground, and then median filtering is performed to remove particle noise to obtain the first processed image.

[0087] The first processed image is binarized, and connected regions are obtained. The smallest enclosing circle in the connected regions is found. The circular regions with a radius smaller than a preset threshold are filled with background gray values, and the remaining regions are filled with foreground gray values ​​to remove block noise and obtain the second processed image.

[0088] The obtained second processed image is used to perform ripple curve detection of the nematode capture area based on the row direction using a local detection method.

[0089] In this embodiment, in the step of binarizing the obtained first processed image, the background grayscale value is set to 255 and the foreground grayscale value is set to 0.

[0090] In this embodiment, the step of detecting the ripple curve of the nematode capture area using local detection based on the row direction in the obtained second processed image includes:

[0091] Input a second processed image, and set the second processed image to record a pixel with a gray value of zero when it is found in the row direction as a zero value point. Search downwards from the zero value point, and search downwards for an odd number of neighboring pixels in the row direction at each step.

[0092] The second processed image is searched line by line to determine whether there is a zero point in the current line, until a zero point is found in the target line;

[0093] The number of zero-value points on the target row is obtained. Using the first zero-value point on the target row as the new base point, the search continues downward. It is determined whether there is a zero-value point in the odd number of pixels corresponding to the row below the first zero-value point on the target row. If so, the search continues downward with the zero-value point in the row below the first zero-value point as the new base point. When there is no zero-value point in the odd number of pixels corresponding to the row below the first zero-value point, the search stops at that zero-value point position. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the first zero-value point. If the number of zero-value points on the target row is greater than two, the search continues downward with the second zero-value point on the target row as the new base point. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the second zero-value point.

[0094] The coordinates of consecutive zero points obtained by searching down row by row on the target row are stored in an array, and the coordinates of all consecutive zero points in the array are connected to form the detected curve.

[0095] In this embodiment, the step of detecting the ripple curve of the nematode capture area using local detection based on the row direction in the obtained second processed image includes:

[0096] Set a maximum search step threshold for the second processed image;

[0097] When the number of rows searched downwards from the target row exceeds the maximum search step threshold, the search continues downwards from the zero point corresponding to the last row as the new base point.

[0098] In this embodiment, the step of detecting the ripple curve of the nematode capture area using local detection based on the row direction in the obtained second processed image includes:

[0099] Set a threshold for the width of the number of search pixels in each row for the second processed image;

[0100] When the total number of pixels searched in the row direction is greater than the width threshold, the search for pixels in the current row is terminated to determine whether there are zero-value points in the current row.

[0101] In this embodiment, the step of subtracting the horizontal position of the edge curve from that of the oblique line to obtain the positional deviation, and then performing ripple curve correction on the target image row by row based on the horizontal positional deviation of the edge curve and the oblique line includes:

[0102] Obtain the coordinates of all zero points on the edge curve.

[0103] Obtain the oblique line y obtained by straight-line fitting of the edge curve;

[0104] Let Δx represent the difference in horizontal coordinates between a point on the edge curve and a point on the diagonal line y, which are located in the same row in the horizontal direction.

[0105] Constructing the correction formula: I out(i,j) =I in (i-Δx,j); i=1,2,...,width; j=1,2,...,height; where, I in (i-Δx,j) is the pixel at coordinates (i-Δx,j) in the target image, I out(i,j) It is the pixel at coordinates (i,j) in the output image, where i is the x-coordinate of the target image, j is the y-coordinate of the target image, width is the threshold for the width of the target image in the horizontal direction, and height is the threshold for the maximum number of search steps in the target image in the vertical direction.

[0106] The target image is corrected by row-by-row using a correction formula based on the horizontal positional deviation between the edge curve and the oblique line.

[0107] In the aforementioned nematode image ripple distortion correction device, noise can be removed and blocky interference sources can be effectively eliminated by ripple curve detection, thus improving the detection efficiency of ripple curves. A local detection-based method is used to detect ripple curves, performing continuous detection on the detected target pixels and classifying points that meet the continuity requirement as curve points, thereby improving the accuracy of curve detection. In the ripple distortion correction method, the horizontal position of the ripple edge curve after edge detection is subtracted from the corresponding fitted oblique line pixel by pixel to obtain the positional deviation. Based on this deviation, the entire image is corrected row by row, resulting in high correction efficiency.

[0108] Specific limitations regarding the nematode image ripple distortion correction device can be found in the limitations of the nematode image ripple distortion correction method described above, and will not be repeated here. Each module in the aforementioned nematode image ripple distortion correction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0109] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores nematode image ripple distortion correction data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a nematode image ripple distortion correction method.

[0110] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0111] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0112] The target image is subjected to local detection based on the row direction to detect ripple curves. The detected curves are then subjected to edge detection to obtain edge curves, and the edge curves are fitted with straight lines to obtain oblique lines.

[0113] The positional deviation is obtained by subtracting the horizontal position of the edge curve from that of the oblique line. Based on the horizontal positional deviation of the edge curve and the oblique line, the target image is corrected for ripple curves line by line.

[0114] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0115] The step of detecting the ripple curve of the target image using a local detection method based on the row direction includes:

[0116] The image is segmented based on histogram to separate the background from the foreground, and then median filtering is performed to remove particle noise to obtain the first processed image.

[0117] The first processed image is binarized, and connected regions are obtained. The smallest enclosing circle in the connected regions is found. The circular regions with a radius smaller than a preset threshold are filled with background gray values, and the remaining regions are filled with foreground gray values ​​to remove block noise and obtain the second processed image.

[0118] The obtained second processed image is used to perform ripple curve detection of the nematode capture area based on the row direction using a local detection method.

[0119] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0120] In the step of binarizing the obtained first processed image, the background grayscale value is set to 255 and the foreground grayscale value is set to 0.

[0121] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0122] The step of detecting the ripple curve of the nematode capture area in the obtained second processed image using a local detection method based on the row direction includes:

[0123] Input a second processed image, and set the second processed image to record a pixel with a gray value of zero when it is found in the row direction as a zero value point. Search downwards from the zero value point, and search downwards for an odd number of neighboring pixels in the row direction at each step.

[0124] The second processed image is searched line by line to determine whether there is a zero point in the current line, until a zero point is found in the target line;

[0125] The number of zero-value points on the target row is obtained. Using the first zero-value point on the target row as the new base point, the search continues downward. It is determined whether there is a zero-value point in the odd number of pixels corresponding to the row below the first zero-value point on the target row. If so, the search continues downward with the zero-value point in the row below the first zero-value point as the new base point. When there is no zero-value point in the odd number of pixels corresponding to the row below the first zero-value point, the search stops at that zero-value point position. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the first zero-value point. If the number of zero-value points on the target row is greater than two, the search continues downward with the second zero-value point on the target row as the new base point. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the second zero-value point.

[0126] The coordinates of consecutive zero points obtained by searching down row by row on the target row are stored in an array, and the coordinates of all consecutive zero points in the array are connected to form the detected curve.

[0127] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0128] The step of detecting the ripple curve of the nematode capture area in the obtained second processed image using a local detection method based on the row direction includes:

[0129] Set a maximum search step threshold for the second processed image;

[0130] When the number of rows searched downwards from the target row exceeds the maximum search step threshold, the search continues downwards from the zero point corresponding to the last row as the new base point.

[0131] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0132] The step of detecting the ripple curve of the nematode capture area in the obtained second processed image using a local detection method based on the row direction includes:

[0133] Set a threshold for the width of the number of search pixels in each row for the second processed image;

[0134] When the total number of pixels searched in the row direction is greater than the width threshold, the search for pixels in the current row is terminated to determine whether there are zero-value points in the current row.

[0135] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0136] The step of subtracting the edge curve from the oblique line in the horizontal direction to obtain the positional deviation, and then performing ripple curve correction on the target image row by row based on the positional deviation between the edge curve and the oblique line, includes:

[0137] Obtain the coordinates of all zero points on the edge curve.

[0138] Obtain the oblique line y obtained by straight-line fitting of the edge curve;

[0139] Let Δx represent the difference in horizontal coordinates between a point on the edge curve and a point on the diagonal line y, which are located in the same row in the horizontal direction.

[0140] Constructing the correction formula: I out(i,j) =I in (i-Δx,j); i=1,2,...,width; j=1,2,...,height; where, I in (i-Δx,j) is the pixel at coordinates (i-Δx,j) in the target image, I out(i,j) It is the pixel at coordinates (i,j) in the output image, where i is the x-coordinate of the target image, j is the y-coordinate of the target image, width is the threshold for the width of the target image in the horizontal direction, and height is the threshold for the maximum number of search steps in the target image in the vertical direction.

[0141] The target image is corrected by row-by-row using a correction formula based on the horizontal positional deviation between the edge curve and the oblique line.

[0142] For specific limitations on the steps implemented by the processor when executing a computer program, please refer to the limitations on the method for correcting the ripple distortion of nematode images mentioned above, which will not be repeated here.

[0143] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0144] The target image is subjected to local detection based on the row direction to detect ripple curves. The detected curves are then subjected to edge detection to obtain edge curves, and the edge curves are fitted with straight lines to obtain oblique lines.

[0145] The positional deviation is obtained by subtracting the horizontal position of the edge curve from that of the oblique line. Based on the horizontal positional deviation of the edge curve and the oblique line, the target image is corrected for ripple curves line by line.

[0146] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0147] The step of detecting the ripple curve of the target image using a local detection method based on the row direction includes:

[0148] The image is segmented based on histogram to separate the background from the foreground, and then median filtering is performed to remove particle noise to obtain the first processed image.

[0149] The first processed image is binarized, and connected regions are obtained. The smallest enclosing circle in the connected regions is found. The circular regions with a radius smaller than a preset threshold are filled with background gray values, and the remaining regions are filled with foreground gray values ​​to remove block noise and obtain the second processed image.

[0150] The obtained second processed image is used to perform ripple curve detection of the nematode capture area based on the row direction using a local detection method.

[0151] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0152] In the step of binarizing the obtained first processed image, the background grayscale value is set to 255 and the foreground grayscale value is set to 0.

[0153] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0154] The step of detecting the ripple curve of the nematode capture area in the obtained second processed image using a local detection method based on the row direction includes:

[0155] Input a second processed image, and set the second processed image to record a pixel with a gray value of zero when it is found in the row direction as a zero value point. Search downwards from the zero value point, and search downwards for an odd number of neighboring pixels in the row direction at each step.

[0156] The second processed image is searched line by line to determine whether there is a zero point in the current line, until a zero point is found in the target line;

[0157] The number of zero-value points on the target row is obtained. Using the first zero-value point on the target row as the new base point, the search continues downward. It is determined whether there is a zero-value point in the odd number of pixels corresponding to the row below the first zero-value point on the target row. If so, the search continues downward with the zero-value point in the row below the first zero-value point as the new base point. When there is no zero-value point in the odd number of pixels corresponding to the row below the first zero-value point, the search stops at that zero-value point position. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the first zero-value point. If the number of zero-value points on the target row is greater than two, the search continues downward with the second zero-value point on the target row as the new base point. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the second zero-value point.

[0158] The coordinates of consecutive zero points obtained by searching down row by row on the target row are stored in an array, and the coordinates of all consecutive zero points in the array are connected to form the detected curve.

[0159] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0160] The step of detecting the ripple curve of the nematode capture area in the obtained second processed image using a local detection method based on the row direction includes:

[0161] Set a maximum search step threshold for the second processed image;

[0162] When the number of rows searched downwards from the target row exceeds the maximum search step threshold, the search continues downwards from the zero point corresponding to the last row as the new base point.

[0163] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0164] The step of detecting the ripple curve of the nematode capture area in the obtained second processed image using a local detection method based on the row direction includes:

[0165] Set a threshold for the width of the number of search pixels in each row for the second processed image;

[0166] When the total number of pixels searched in the row direction is greater than the width threshold, the search for pixels in the current row is terminated to determine whether there are zero-value points in the current row.

[0167] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0168] The step of subtracting the edge curve from the oblique line in the horizontal direction to obtain the positional deviation, and then performing ripple curve correction on the target image row by row based on the positional deviation between the edge curve and the oblique line, includes:

[0169] Obtain the coordinates of all zero points on the edge curve.

[0170] Obtain the oblique line y obtained by straight-line fitting of the edge curve;

[0171] Let Δx represent the difference in horizontal coordinates between a point on the edge curve and a point on the diagonal line y, which are located in the same row in the horizontal direction.

[0172] Constructing the correction formula: I out(i,j) =I in (i-Δx,j); i=1,2,...,width; j=1,2,...,height; where, I in (i-Δx,j) is the pixel at coordinates (i-Δx,j) in the target image, I out(i,j) It is the pixel at coordinates (i,j) in the output image, where i is the x-coordinate of the target image, j is the y-coordinate of the target image, width is the threshold for the width of the target image in the horizontal direction, and height is the threshold for the maximum number of search steps in the target image in the vertical direction.

[0173] The target image is corrected by row-by-row using a correction formula based on the horizontal positional deviation between the edge curve and the oblique line.

[0174] For specific limitations on the steps implemented when a computer program is executed by a processor, please refer to the limitations on the method for correcting the ripple distortion of nematode images mentioned above, which will not be repeated here.

[0175] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0176] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0177] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for correcting ripple distortion in nematode images, characterized in that, include: The target image is subjected to local detection based on the row direction to detect ripple curves. The detected curves are then subjected to edge detection to obtain edge curves, and the edge curves are fitted with straight lines to obtain oblique lines. The positional deviation is obtained by subtracting the horizontal position of the edge curve from that of the oblique line. Based on the horizontal positional deviation of the edge curve and the oblique line, the target image is corrected for ripple curves row by row. The step of detecting ripple curves in the target image using a local detection method based on the row direction includes: The image is segmented based on histogram to separate the background from the foreground, and then median filtering is performed to remove particle noise to obtain the first processed image. The first processed image is binarized, and connected regions are obtained. The smallest enclosing circle in the connected regions is found. The circular regions with a radius smaller than a preset threshold are filled with background gray values, and the remaining regions are filled with foreground gray values ​​to remove block noise and obtain the second processed image. The obtained second processed image is used to perform local detection based on the row direction to complete the ripple curve detection of the nematode capture area; In the step of binarizing the obtained first processed image, the background grayscale value is set to 255 and the foreground grayscale value is set to 0. The step of detecting the ripple curve of the nematode capture area in the obtained second processed image using a local detection method based on the row direction includes: Input a second processed image, and set the second processed image to record a pixel with a gray value of zero when it is found in the row direction as a zero value point. Search downwards from the zero value point, and search downwards for an odd number of neighboring pixels in the row direction at each step. The second processed image is searched line by line to determine whether there is a zero point in the current line, until a zero point is found in the target line; The number of zero-value points on the target row is obtained. Using the first zero-value point on the target row as the new base point, the search continues downward. It is determined whether there is a zero-value point in the odd number of pixels corresponding to the row below the first zero-value point on the target row. If so, the search continues downward with the zero-value point in the row below the first zero-value point as the new base point. When there is no zero-value point in the odd number of pixels corresponding to the row below the first zero-value point, the search stops at that zero-value point position. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the first zero-value point. If the number of zero-value points on the target row is greater than two, the search continues downward with the second zero-value point on the target row as the new base point. The search ends when there is no zero-value point in the odd number of pixels corresponding to the row below all zero-value points corresponding to the second zero-value point. The coordinates of consecutive zero points obtained by searching down row by row on the target row are stored in an array, and the coordinates of all consecutive zero points in the array are connected to form the detected curve.

2. The method for correcting ripple distortion in nematode images according to claim 1, characterized in that, The step of detecting the ripple curve of the nematode capture area in the obtained second processed image using a local detection method based on the row direction includes: Set a maximum search step threshold for the second processed image; When the number of rows searched downwards from the target row exceeds the maximum search step threshold, the search continues downwards from the zero point corresponding to the last row as the new base point.

3. The method for correcting ripple distortion in nematode images according to claim 2, characterized in that, The step of detecting the ripple curve of the nematode capture area in the obtained second processed image using a local detection method based on the row direction includes: Set a threshold for the width of the number of search pixels in each row for the second processed image; When the total number of pixels searched in the row direction is greater than the width threshold, the search for pixels in the current row is terminated to determine whether there are zero-value points in the current row.

4. The method for correcting ripple distortion in nematode images according to claim 3, characterized in that, The step of subtracting the edge curve from the oblique line in the horizontal direction to obtain the positional deviation, and then performing ripple curve correction on the target image row by row based on the positional deviation between the edge curve and the oblique line, includes: Obtain the coordinates of all zero points on the edge curve. Obtain the oblique line y obtained by straight-line fitting of the edge curve; use This represents the difference in horizontal coordinates between a point on the edge curve and a point on the diagonal line y, which are located in the same row in the horizontal direction. Constructing the corrective formula: ;in, The coordinates in the target image Pixels at that location, The coordinates in the output image The pixel at the location, i is the x-coordinate of the target image, j is the y-coordinate of the target image, width is the threshold for the width of the target image in the horizontal direction, and height is the threshold for the maximum number of search steps in the target image in the vertical direction. The target image is corrected by row-by-row using a correction formula based on the horizontal positional deviation between the edge curve and the oblique line.

5. A device for correcting the ripple distortion in nematode images, characterized in that, The apparatus for implementing the nematode image ripple distortion correction method according to any one of claims 1 to 4 comprises: The wavy curve detection module is used to detect wavy curves in the target image based on the row direction using a local detection method, perform edge detection on the detected curves to obtain edge curves, and perform straight line fitting on the edge curves to obtain oblique lines; The ripple curve correction module is used to subtract the horizontal position of the edge curve from that of the oblique line to obtain the position deviation, and to perform ripple curve correction on the target image line by line based on the horizontal position deviation of the edge curve and the oblique line.

6. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Lane line reservation and detection algorithm based on binary image

    CN104573627A

  • Lane line detection method and device, computer device and storage medium

    CN109886122A

  • Image correction methods, devices and electronic equipment

    CN114936988A