A Python-based scroll recognition algorithm

By using a Python-based scroll recognition algorithm, the circular end face of the material scroll is identified in real time and dynamically corrected, solving the problem of docking failure caused by deformation and deviation during the docking process of the cantilever shaft AGV, and achieving high-precision and stable docking results.

CN119648794BActive Publication Date: 2025-10-31ZHUHAI MAKERWIT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411791249.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-10-31
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

When docking with material shafts, the traditional static docking method is easily affected by the deformation of mechanical parts and material deviation, which increases the risk of docking failure and cannot adapt to docking of material shafts at different height positions.

Method used

A Python-based roll recognition algorithm is used to identify the circular end face of the roll, calculate the center position, and perform dynamic correction through real-time image processing technology, thereby improving docking accuracy and stability.

Benefits of technology

It achieves high precision and stability when docking material shafts of different heights and types, flexibility and robustness in the docking process, and has good cross-platform compatibility and portability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648794B_ABST
    Figure CN119648794B_ABST
Patent Text Reader

Abstract

This invention provides a Python-based scroll recognition algorithm, which includes: an image preprocessing step; a preliminary screening step; a secondary screening step: performing secondary screening on the list of circular objects after the preliminary screening, and further screening based on the relative positions between the circular objects; an intersection detection step; an overlap detection step: performing overlap detection on the circular objects after intersection detection, creating a binary mask image for each circular object, and then superimposing these mask images to find overlapping areas; an outlier handling step: performing outlier handling on the circular objects after overlap detection to obtain a final filtered list of circular objects; and identifying scroll features based on the final filtered list of circular objects. This invention can accurately identify the circular end face of the scroll and provide key data for subsequent dynamic correction, improving the accuracy and stability of the docking process, and is applicable to the docking of scrolls of different heights and types.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer vision and image processing technology, and specifically to a scroll recognition algorithm based on Python. Background Technology

[0002] In the modern new energy industry, cantilever AGVs are widely used for material handling and docking. During docking of material shafts, because the shafts are hollow, the AGV's connecting rod needs to be precisely inserted into the center of the shaft. Traditional docking techniques rely on preset fixed parameters. This static method is easily affected by deformation of mechanical parts and changes in material deviation, increasing the risk of docking failure and making it impossible to dock shafts at different heights.

[0003] Therefore, a technology is needed that can identify roll deviations in real time and adjust the docking position to improve the accuracy and stability of docking. Summary of the Invention

[0004] To address the aforementioned problems in existing technologies, the present invention aims to provide a Python-based reel recognition algorithm. This method uses real-time image processing technology to accurately identify the circular end face of the reel and calculate the center position, providing crucial data for subsequent dynamic correction. This improves the accuracy and stability of the docking process and is applicable to reel docking of different heights and types, thus possessing significant application value.

[0005] The present invention achieves the above objectives through the following technical solutions:

[0006] A Python-based scroll recognition algorithm, comprising the following steps:

[0007] Image preprocessing steps: Preprocess the received raw input image;

[0008] Preliminary screening steps: Apply a circular detection algorithm to the preprocessed image to identify and preliminarily screen out circular objects in the image;

[0009] Secondary filtering step: Perform secondary filtering on the list of circular objects after the initial filtering, calculate the distance from the center point of each circular object to the average position of the center points of all circular objects, evaluate the positional relationship of each circular object, and perform additional filtering based on the relative positions between the circular objects;

[0010] Intersection detection steps: Perform intersection detection on the circular objects after secondary filtering, detect the intersection points of the lines and the circular objects, determine whether there is an intersection between the circular objects, and determine whether an intersection point is located inside a given circle;

[0011] Overlap detection steps: Perform overlap detection on the circular objects after intersection detection, create a binary mask image for each circular object, and then superimpose these mask images to find overlapping areas;

[0012] Outlier handling steps: Outlier handling is performed on the circular objects after overlap detection. The MAD and three Sigma criteria are used to remove outliers from the dataset to obtain the final filtered list of circular objects.

[0013] The scroll features are identified based on the final filtered list of circular objects and their location information.

[0014] According to the Python-based scroll recognition algorithm provided by the present invention, during the initial screening, a minimum radius threshold (minRadius) and a maximum eccentricity threshold (maxEccent) are set. For each detected possible circular object, it is first determined whether the circular object is located within the image boundary. If the circular object is located within the image boundary, its size is further checked to see if it is greater than the minimum radius threshold (minRadius). Next, the eccentricity of the circular object is calculated and compared with the maximum eccentricity threshold (maxEccent) to determine its degree of approximation to a circle. Only when the circular object simultaneously meets the conditions of being located within the image boundary, having a radius greater than the minimum radius threshold, and having an eccentricity less than the maximum eccentricity threshold, it is added to the candidate list. Circular objects that meet the conditions are then drawn on the debugging image according to debugging requirements.

[0015] According to the Python-based scroll recognition algorithm provided by the present invention, when calculating the distance from the center point of each circular object to the average position of the center points of all circular objects, the coordinates of the center point of each circular object are calculated, and the average position of these center points is calculated based on the coordinates of the center points of all circular objects. For each circular object, the distance from its center point to the average position is calculated.

[0016] Set a distance threshold; compare the calculated distance with the distance threshold, and exclude circular objects whose distance exceeds the distance threshold.

[0017] According to the Python-based scroll recognition algorithm provided by the present invention, when performing additional filtering based on the relative positions between circular objects, for each pair of circular objects in the list of circular objects, the coordinates of their center points are calculated; based on the coordinates of the center points of each pair of circular objects, the midpoint position of the line connecting their center points is calculated; it is determined whether the midpoint position is simultaneously located inside the pair of circular objects; if the midpoint position is located outside the two circular objects, one or both of the pair of circular objects are marked as possible outliers; based on the marking results, the circular objects marked as outliers are excluded from the list of circular objects or further processed.

[0018] According to the Python-based scroll recognition algorithm provided by the present invention, when performing overlap detection on circular objects after intersection detection, a corresponding binary mask image is created for each circular object after secondary screening, based on its position and radius, wherein the area where the circular object is located is marked with one value, and the remaining area is marked with another value.

[0019] For each pair of binary mask images of circular objects, logical operations are performed to compare the overlap between them; based on the comparison results, it is determined which circular objects intersect with other circular objects, and a list of intersecting circular objects is output or further processing is performed, including labeling, classifying or removing intersecting objects.

[0020] According to the Python-based scroll recognition algorithm provided by the present invention, the average value and standard deviation of the center point coordinates of all circular objects are calculated for a list of circular objects that have undergone overlap detection.

[0021] By applying the three sigma criterion, the absolute value of the difference between the center point coordinates of each circular object and the average value is calculated and compared with three times the standard deviation. Circular objects whose center point coordinates deviate from the average value by more than three times the standard deviation are deleted.

[0022] Calculate the median and median absolute deviation (MAD) of the center point coordinates of the remaining circular objects;

[0023] Based on the MAD, set an outlier threshold and delete circular objects whose absolute deviation between the center point coordinates and the median exceeds the threshold.

[0024] Output the final list of filtered circular objects.

[0025] According to the Python-based scroll recognition algorithm provided by the present invention, when only two circular objects remain in the image, the position information of the two circular objects in the current frame image is obtained;

[0026] Get the position information of the circular object in the previous frame image;

[0027] For each circular object in the current frame, calculate its positional distance from each circular object in the previous frame;

[0028] Based on the calculated positional distance, the circular object in the current frame that is closest to a certain circular object in the previous frame is selected as the valid circular object in the current frame.

[0029] Output or further process the valid circular object in the current frame.

[0030] According to the Python-based scroll recognition algorithm provided by the present invention, the following is also performed:

[0031] For each identified circular object, calculate its center position coordinates, and check whether there are multiple circular objects with the same center position or whether the center positions are considered the same if they are within a predetermined tolerance range.

[0032] When multiple circular objects with the same center are detected, the coordinates of the center are output, and the actual correction value is calculated based on the output center coordinates.

[0033] The calculated correction value is transmitted to the control mechanism to achieve precise dynamic adjustment.

[0034] According to the Python-based scroll recognition algorithm provided by the present invention, the following is also performed:

[0035] Receive external control signals to control the camera's movement in real time, including searching in the up, down, left, and right directions, to locate and mate with the reel;

[0036] The scroll recognition function is started or stopped according to external control signals or preset conditions;

[0037] During the recognition function activation, camera images are continuously captured and image processing is performed on the images to identify the features of the scroll.

[0038] Based on the identified scroll features, the deviation between the actual position and the expected position of the scroll is calculated;

[0039] Based on the calculated deviation, a correction control command is generated and transmitted to the actuator to adjust the position of the reel, ensuring the accuracy and stability of the docking.

[0040] During the period when the recognition function is stopped, maintain the current state or perform a preset stop operation.

[0041] According to the Python-based scroll recognition algorithm provided by the present invention, the image preprocessing step specifically includes:

[0042] Preprocessing of the original input image includes:

[0043] Call the resizeImage function to resize the image;

[0044] Create an edge detection object ED3job and set the edge detection parameters edParams, including minimum line segment length, minimum path length and gradient threshold;

[0045] Convert the resized image to a grayscale image (gray3d).

[0046] Perform edge detection on the grayscale image gray3d using the edge detection object ED3job and the set parameter edParams;

[0047] Ellipse detection is performed on the image after edge detection by calling the detectEllipses function;

[0048] Store the detected ellipse information dEllip.

[0049] Therefore, the present invention has the following beneficial effects:

[0050] 1. This invention uses real-time image processing technology and advanced circle detection algorithms to accurately identify the circular end face of the material shaft, ensuring high precision in the docking process.

[0051] 2. This invention employs multi-circle recognition technology and image preprocessing technology to effectively cope with complex backgrounds and environmental changes, thereby improving the robustness and stability of recognition.

[0052] 3. This invention can adapt to material shafts of different heights and types, without the need for strict control of the material shaft height, thus improving the flexibility of docking.

[0053] 4. This invention is developed based on the Python language, has good cross-platform compatibility and portability, and is easy to integrate with other systems.

[0054] 5. This invention utilizes MAD and the three Sigma criterion to effectively remove outliers from the dataset, further enhancing the robustness of the algorithm.

[0055] 6. This invention, through a combination of preliminary and secondary screening steps using a circular detection algorithm and positional relationship evaluation, can accurately identify and filter circular objects in images, reducing the possibility of false positives and false negatives. Furthermore, intersection and overlap detection steps further refine the relationships between circular objects, ensuring accurate identification of scroll features.

[0056] 7. The algorithm of this invention proceeds step-by-step from image preprocessing to scroll feature recognition, with each step having a clear objective and output, forming a systematic processing flow. Furthermore, the Python-based implementation of this invention makes the algorithm easily integrated with other image processing libraries (such as OpenCV, PIL, etc.) and machine learning frameworks (such as TensorFlow, PyTorch, etc.). Each step of the algorithm can be extended or replaced as needed to meet different application requirements.

[0057] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. Attached Figure Description

[0058] Figure 1 This is a flowchart of an embodiment of a scroll recognition algorithm based on Python according to the present invention. Detailed Implementation

[0059] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0060] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0061] See Figure 1 This embodiment provides a scroll recognition algorithm based on Python, which includes the following steps:

[0062] Image preprocessing step S1: Preprocess the received raw input image;

[0063] Preliminary screening step S2: Apply a circular detection algorithm to the preprocessed image to identify and preliminarily screen out circular objects in the image;

[0064] Secondary filtering step S3: Perform secondary filtering on the list of circular objects after the initial filtering, calculate the distance from the center point of each circular object to the average position of the center points of all circular objects, evaluate the positional relationship of each circular object, and perform additional filtering based on the relative positions between the circular objects;

[0065] Intersection detection step S4: Perform intersection detection on the circular objects after secondary filtering, detect the intersection points of the lines and the circular objects, determine whether there is an intersection between the circular objects, and determine whether an intersection point is located inside a given circle;

[0066] Overlap detection step S5: Perform overlap detection on the circular objects after intersection detection, create a binary mask image for each circular object, and then superimpose these mask images to find overlapping areas;

[0067] Outlier handling step S6: Perform outlier handling on the circular objects after overlap detection, and remove outliers in the dataset using MAD and the three sigma criterion to obtain the final filtered list of circular objects;

[0068] Step S7: Identify scroll features based on the final filtered list of circular objects and their location information.

[0069] In step S1 above, this embodiment uses the resizeImage function to adjust the size of the input image to ensure that the image can be adapted to the needs of subsequent processing.

[0070] In step S2 above, during the initial screening, a minimum radius threshold (minRadius) and a maximum eccentricity threshold (maxEccent) are set. For each detected possible circular object, it is first determined whether the circular object is located within the image boundary. If the circular object is located within the image boundary, its size is further checked to see if it is greater than the minimum radius threshold (minRadius). Next, the eccentricity of the circular object is calculated and compared with the maximum eccentricity threshold (maxEccent) to determine its degree of approximation to a circle. Only when a circular object simultaneously meets the conditions of being located within the image boundary, having a radius greater than the minimum radius threshold, and having an eccentricity less than the maximum eccentricity threshold, is it added to the candidate list. Circular objects that meet the conditions are then drawn on the debugging image according to debugging requirements. It can be seen that this embodiment, when screening by size and shape, excludes excessively small objects by setting a minimum radius threshold, avoiding mistaking small noise points for circles; it calculates the eccentricity of each suspected circle, retaining only those objects that are close to a perfect circle. The closer the eccentricity is to 0, the closer the object is to a circle.

[0071] In this embodiment, a minimum radius threshold and a maximum eccentricity threshold are set using `minRadius` and `maxEccent`, respectively, to filter out circular objects that are too small or have irregular shapes. For each detected possible circular object, it is first checked whether it is within the image boundary; then, its size is checked whether it is greater than the minimum radius, and the eccentricity is calculated to determine how close it is to a circle. If the conditions are met, it is added to the candidate list and plotted on the debug image as needed.

[0072] In step S3 above, when calculating the distance from the center point of each circular object to the average position of all circular object center points, the coordinates of the center point of each circular object are calculated. Based on the coordinates of the center points of all circular objects, the average position of these center points is calculated. For each circular object, the distance from its center point to the average position is calculated. A distance threshold is set. The calculated distance is compared with the distance threshold, and circular objects whose distance exceeds the distance threshold are excluded. It can be seen that this embodiment also implements a center point distance limit: calculating the distance from the center point of each circular object to the average position of all circular object center points, and excluding objects whose distance exceeds a certain threshold, helps to remove circular objects that are significantly deviated from the group.

[0073] In step S3 above, this embodiment further processes the initially filtered list of circular objects using the `locateHoughtSgCC` function, evaluating the positional relationship of each object by calculating the average position of the centers of all circular objects. This embodiment also performs additional filtering based on the relative positions between the circular objects, such as checking whether one circular object is completely inside another circular object.

[0074] In step S3 above, during the additional filtering based on the relative positions of the circular objects, for each pair of circular objects in the list, the coordinates of their center points are calculated; based on the coordinates of the center points of each pair of circular objects, the midpoint of the line connecting their center points is calculated; it is determined whether the midpoint is simultaneously located inside the pair of circular objects; if the midpoint is located outside the two circular objects, one or both of the pair of circular objects are marked as possible outliers; based on the marking results, the circular objects marked as outliers are excluded from the list or further processed. Therefore, this embodiment also performs midpoint position filtering: for each pair of circular objects, the midpoint of the line connecting their center points is calculated, and it is determined whether the midpoint is located inside the two circular objects. If the midpoint is located outside the two circular objects, it may indicate that one of the circular objects is an outlier.

[0075] In step S4 above, this embodiment uses the `line_circle_intersection` and `lineIntersectCircle` functions to detect the intersection points of lines and circles, which is crucial for determining whether circular objects intersect. The `judgePntInnerCicle` function is used to determine whether a point lies within a given circle, which is one of the essential functions for detecting intersections between circular objects.

[0076] In step S5 above, when performing overlap detection on the circular objects after intersection detection, for each circular object that has undergone secondary screening, a corresponding binary mask image is created based on its position and radius. The region containing the circular object is marked with one value, and the remaining regions are marked with another value. For each pair of binary mask images of circular objects, logical operations are performed to compare the overlap between them. Based on the comparison results, it is determined which circular objects intersect with other circular objects, and a list of intersecting circular objects is output or further processing is performed, including marking, classifying, or removing intersecting objects. Therefore, this embodiment creates a binary mask image for each circular object and then detects whether circular objects intersect by comparing the overlap between different mask images. This method can effectively identify objects that overlap with other circular objects.

[0077] In step S6 above, for the list of circular objects that have undergone overlap detection, the mean and standard deviation of the center point coordinates of all circular objects are calculated; the three sigma criterion is applied, by calculating the absolute value of the difference between the center point coordinates of each circular object and the mean, and comparing it with 3 times the standard deviation, circular objects whose center point coordinates deviate from the mean by more than 3 times the standard deviation are deleted; the median and median absolute deviation (MAD) of the center point coordinates of the remaining circular objects are calculated; an outlier threshold is set based on the MAD, and circular objects whose absolute deviation between the center point coordinates and the median exceeds the threshold are deleted; the final filtered list of circular objects is output.

[0078] Among them, the Three-Sigma Rule uses the statistical principle of Three-Sigma to detect and eliminate outliers in a collection of circular objects. Specifically, it calculates the mean and standard deviation of the center point coordinates of all circular objects, and then deletes those objects that deviate from the mean by more than three times the standard deviation.

[0079] Median Absolute Deviation (MAD): MAD is a robust statistic that is better able to handle outliers in a dataset than standard deviation. Standard deviation uses the squared distance from the mean, so larger deviations have greater weight, and outliers can significantly impact the results. With MAD, a small number of outliers will not affect the final result.

[0080] As can be seen, the MAD and threeSigma functions provide two different methods to remove outliers from a dataset, which is very useful when processing real images, as noise in the image can lead to incorrect detection of circular objects.

[0081] In this embodiment, when only two circular objects remain in the image, the positional information of the two circular objects in the current frame is obtained; the positional information of the circular objects in the previous frame is also obtained; for each circular object in the current frame, the positional distance between it and each circular object in the previous frame is calculated; based on the calculated positional distance, the circular object in the current frame that is closest in position to a certain circular object in the previous frame is selected as the valid circular object of the current frame; the valid circular object of the current frame is then output or further processed. It can be seen that this embodiment also performs a comparison between the previous and next frames: when only two circular objects remain in the image, by comparing their positions with those of the circular objects in the previous frame, the object that is closer in position to the circular object in the previous frame is selected as the valid circular object of the current frame, which helps maintain the consistency of the tracked object.

[0082] This embodiment provides a Python-based scroll recognition algorithm, which also performs:

[0083] For each identified circular object, calculate its center position coordinates, and detect whether there are multiple circular objects with the same center position or whose center positions are within a predetermined tolerance range. When multiple circular objects with the same center are detected, output the center position coordinates. Based on the output center position coordinates, calculate the actual correction value. Transmit the calculated correction value to the control mechanism to achieve precise dynamic adjustment.

[0084] This embodiment provides a Python-based scroll recognition algorithm, which also performs:

[0085] It receives external control signals to control the camera's movement in real time, including searching in the up, down, left, and right directions, to locate and mate with the reel; it starts or stops the reel recognition function according to external control signals or preset conditions; during the recognition function, it continuously captures camera images and performs image processing to identify the features of the reel; based on the identified reel features, it calculates the deviation between the actual position and the desired position of the reel; based on the calculated deviation, it generates a correction control command and transmits it to the actuator to adjust the position of the reel, ensuring the accuracy and stability of the mating; during the recognition function's shutdown, it maintains the current state or executes a preset stop operation.

[0086] In this embodiment, the original input image is preprocessed, specifically including: calling the resizeImage function to adjust the image size; creating an edge detection object ED3job and setting the edge detection parameters edParams, including minimum line segment length, minimum path length, and gradient threshold; converting the resized image into a grayscale image gray3d; performing edge detection on the grayscale image gray3d using the edge detection object ED3job and the set parameters edParams; performing ellipse detection on the edge-detected image by calling the detectEllipses function to detect ellipses in the image; and storing the detected ellipse information dEllip.

[0087] In the scroll recognition step, based on the final filtered list of circular objects and their positional information, geometric analysis or pattern recognition techniques are applied to identify the scroll. This includes, but is not limited to: analyzing the arrangement pattern of the circular objects, such as whether they form straight lines or specific shapes, to identify the scroll's outline; calculating the spacing and angles between the circular objects to verify whether they conform to the physical characteristics of a scroll; constructing a geometric model of the scroll using the center position or boundary information of the circular objects; and combining other image features, such as texture, color, or edge information, to enhance the accuracy and robustness of scroll recognition.

[0088] Finally, the identified scroll information, including position, orientation, and length, is output in an appropriate data format for subsequent processing or display.

[0089] In the ellipse detection step, the detectEllipses function uses ellipse fitting algorithms or Hough transform algorithms to detect ellipse shapes in the image.

[0090] The initial screening and secondary screening steps also include screening based on features such as the shape, size, position, or color of circular objects to improve the accuracy and robustness of the identification.

[0091] In the intersection detection step, the creation process of mask3d also includes operations such as dilation, erosion, or morphological transformation of circular objects to better detect the intersection between circular objects.

[0092] In the outlier detection step, the selection and application of the MAD function and the threeSigma function are determined based on the actual image data and noise levels to improve the accuracy and reliability of outlier detection.

[0093] Furthermore, the Python-based roll recognition algorithm in this embodiment utilizes visual recognition technology to achieve real-time dynamic correction, enabling flexible and accurate handling of solid or hollow circular cut fabric roll docking at various heights.

[0094] Furthermore, in this embodiment, the dynamic roll recognition and correction process is controlled by an external camera in real time to search for and dock with the roll in all directions. The recognition function can be flexibly started or stopped as needed to ensure the accuracy and stability of the docking.

[0095] Furthermore, the visual recognition technology in this embodiment is developed based on the Python language, and has good cross-platform compatibility and portability.

[0096] Furthermore, the visual recognition logic of this embodiment includes capturing circles in the camera frame in real time and calculating the center position of the circles. When multiple circles with the same center are detected, the center coordinates are output and converted into actual correction values, which are then transmitted to the control mechanism to achieve precise dynamic adjustment. The control mechanism of this embodiment includes, but is not limited to, a robotic arm, a motor, a servo system, an automatic adjustment device, or other devices capable of dynamically adjusting in response to the correction values.

[0097] This embodiment also provides a Python-based scroll recognition system, including:

[0098] Image preprocessing module:

[0099] (1) Input image: Original input image.

[0100] (2) resizeImage function: Adjusts the image size to ensure that the image is suitable for subsequent processing.

[0101] (3) Output image: The image after resizing.

[0102] Edge detection module:

[0103] (1)ED3job: Create an edge detection object.

[0104] (2) edParams: Sets the edge detection parameters, including minimum line segment length, minimum path length and gradient threshold.

[0105] (3) gray3d: Converts a color image to a grayscale image.

[0106] (4) detectEdges: Detects edges in an image.

[0107] Ellipse detection module:

[0108] (1) detectEllipses: Detects ellipses in an image.

[0109] (2)dEllip: Stores the detected ellipse information, including the center coordinates, radius, axis length and rotation angle.

[0110] Preliminary screening module:

[0111] (1) minRadius: minimum radius threshold.

[0112] (2)maxEccent: Maximum eccentricity threshold.

[0113] (3) clist: Stores information about circular objects after initial filtering.

[0114] (4) Filtering conditions: The center of the circle is not outside the image boundary; the radius is greater than the minimum radius; the eccentricity is less than the maximum eccentricity.

[0115] Secondary filtering module:

[0116] (1) The locateHoughtSgCC function further filters circular objects.

[0117] (2) aveCenter: The average position of the center point of all circular objects.

[0118] (3)ccInList: Stores information about the filtered circular objects.

[0119] (4) Filtering criteria: The distance between the center of the circle and the average center point is less than the threshold, and the center of the circle is inside or outside other circular objects.

[0120] Intersection detection module:

[0121] (1) mask3d: A binary mask image created for each circular object.

[0122] (2) flagOverlapList: Records whether each circular object intersects with other circular objects.

[0123] (3) Intersection detection: Determine whether circular objects intersect by the overlap of the mask images. If they intersect, mark the corresponding circular objects.

[0124] Outlier detection module:

[0125] (1) MAD function: Uses the median absolute deviation method to detect outliers.

[0126] (2) ThreeSigma function: Uses the three Sigma criterion to detect outliers.

[0127] (3) Outlier handling: Delete circular objects that deviate from the median or average value by more than the threshold.

[0128] Output module:

[0129] (1) sgCCList: The final list of circular objects after filtering.

[0130] (2) Output image: Draw the final filtered circular object on the original image.

[0131] In summary, this invention accurately identifies the circular end face of the material shaft through real-time image processing technology and advanced circle detection algorithms, ensuring high precision in the docking process. This invention employs multi-circle recognition technology and image preprocessing technology to effectively handle complex backgrounds and environmental changes, improving the robustness and stability of the recognition. This invention can adapt to material shafts of different heights and types, eliminating the need for strict control of the shaft height and increasing docking flexibility. Developed using the Python language, this invention possesses good cross-platform compatibility and portability, making it easy to integrate with other systems.

[0132] Furthermore, this invention utilizes MAD and the three Sigma criterion to effectively remove outliers from the dataset, further enhancing the robustness of the algorithm.

[0133] Furthermore, this invention combines preliminary and secondary screening steps with a circular detection algorithm and positional relationship evaluation, enabling accurate identification and screening of circular objects in images, reducing the possibility of false positives and false negatives. Additionally, intersection and overlap detection steps further refine the relationships between circular objects, ensuring accurate identification of scroll features.

[0134] Furthermore, the algorithm of this invention proceeds step by step from image preprocessing to scroll feature recognition, with each step having a clear objective and output, forming a systematic processing flow.

[0135] Furthermore, the Python implementation of this invention makes the algorithm easily integrated with other image processing libraries (such as OpenCV, PIL, etc.) and machine learning frameworks (such as TensorFlow, PyTorch, etc.). Each step of the algorithm can be extended or replaced as needed to meet different application requirements.

[0136] The above embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Any non-substantial changes and substitutions made by those skilled in the art based on the present invention shall fall within the scope of protection claimed by the present invention.

Claims

1. A scroll recognition algorithm based on Python, characterized in that, The method includes the following steps: Image preprocessing steps: Preprocess the received raw input image; Preliminary screening steps: Apply a circular detection algorithm to the preprocessed image to identify and preliminarily screen out circular objects in the image; Secondary filtering step: Perform secondary filtering on the list of circular objects after the initial filtering, calculate the distance from the center point of each circular object to the average position of the center points of all circular objects, evaluate the positional relationship of each circular object, and perform additional filtering based on the relative positions between the circular objects; Intersection detection steps: Perform intersection detection on the circular objects after secondary filtering, detect the intersection points of the lines and the circular objects, determine whether there is an intersection between the circular objects, and determine whether an intersection point is located inside a given circle; Overlap detection steps: Perform overlap detection on the circular objects after intersection detection, create a binary mask image for each circular object, and then superimpose these mask images to find overlapping areas; Outlier handling steps: Outlier handling is performed on the circular objects after overlap detection. The MAD and three Sigma criteria are used to remove outliers from the dataset to obtain the final filtered list of circular objects. The scroll features are identified based on the final filtered list of circular objects and their location information.

2. The scroll recognition algorithm according to claim 1, characterized in that: During the initial screening, a minimum radius threshold (minRadius) and a maximum eccentricity threshold (maxEccent) are set. For each detected possible circular object, it is first determined whether the circular object is located within the image boundary. If the circular object is located within the image boundary, its size is further checked to see if it is greater than the minimum radius threshold (minRadius). Next, the eccentricity of the circular object is calculated and compared with the maximum eccentricity threshold (maxEccent) to determine its degree of approximation to a circle. Only when the circular object simultaneously meets the conditions of being located within the image boundary, having a radius greater than the minimum radius threshold, and having an eccentricity less than the maximum eccentricity threshold, it is added to the candidate list. Circular objects that meet the conditions are then drawn on the debugging image according to debugging requirements.

3. The scroll recognition algorithm according to claim 1, characterized in that: When calculating the distance from the center point of each circular object to the average position of the center points of all circular objects, the coordinates of the center point of each circular object are calculated, and the average position of these center points is calculated based on the coordinates of the center points of all circular objects. For each circular object, the distance from its center point to the average position is calculated. Set a distance threshold; compare the calculated distance with the distance threshold, and exclude circular objects whose distance exceeds the distance threshold.

4. The scroll recognition algorithm according to claim 1, characterized in that: When performing additional filtering based on the relative positions of circular objects, for each pair of circular objects in the list of circular objects, the coordinates of their center points are calculated; based on the coordinates of the center points of each pair of circular objects, the midpoint of the line connecting their center points is calculated; it is determined whether the midpoint is simultaneously located inside the pair of circular objects; if the midpoint is located outside the two circular objects, one or both of the pair of circular objects are marked as possible outliers; based on the marking results, the circular objects marked as outliers are excluded from the list of circular objects or further processed.

5. The scroll recognition algorithm according to claim 1, characterized in that: When performing overlap detection on circular objects after intersection detection, for each circular object that has undergone secondary screening, a corresponding binary mask image is created based on its position and radius, where the area where the circular object is located is marked with one value and the remaining area is marked with another value. For each pair of binary mask images of circular objects, perform logical operations to compare the overlap between them; based on the comparison results, determine which circular objects overlap with other circular objects, output a list of overlapping circular objects or perform further processing, including marking, classifying or removing overlapping objects.

6. The scroll recognition algorithm according to claim 1, characterized in that: For the list of circular objects that have passed the overlap detection, calculate the mean and standard deviation of the coordinates of the center points of all circular objects; By applying the three sigma criterion, the absolute value of the difference between the center point coordinates of each circular object and the average value is calculated and compared with three times the standard deviation. Circular objects whose center point coordinates deviate from the average value by more than three times the standard deviation are deleted. Calculate the median and median absolute deviation (MAD) of the center point coordinates of the remaining circular objects; Based on the MAD, set an outlier threshold and delete circular objects whose absolute deviation between the center point coordinates and the median exceeds the threshold. Output the final list of filtered circular objects.

7. The scroll recognition algorithm according to any one of claims 1 to 6, characterized in that: When only two circular objects remain in the image, obtain the position information of the two circular objects in the current frame image; Get the position information of the circular object in the previous frame image; For each circular object in the current frame, calculate its positional distance from each circular object in the previous frame; Based on the calculated positional distance, the circular object in the current frame that is closest to a certain circular object in the previous frame is selected as the valid circular object in the current frame. Output or further process the valid circular object in the current frame.

8. The scroll recognition algorithm according to any one of claims 1 to 6, characterized in that, Also execute: For each identified circular object, calculate its center position coordinates, and check whether there are multiple circular objects with the same center position or whether the center positions are considered the same if they are within a predetermined tolerance range. When multiple circular objects with the same center are detected, the coordinates of the center are output, and the actual correction value is calculated based on the output center coordinates. The calculated correction value is transmitted to the control mechanism to achieve precise dynamic adjustment.

9. The scroll recognition algorithm according to any one of claims 1 to 6, characterized in that, Also execute: Receive external control signals to control the camera's movement in real time, including searching in the up, down, left, and right directions, to locate and mate with the reel; The scroll recognition function is started or stopped according to external control signals or preset conditions; During the recognition function activation, camera images are continuously captured and image processing is performed on the images to identify the features of the scroll. Based on the identified scroll features, the deviation between the actual position and the expected position of the scroll is calculated; Based on the calculated deviation, a correction control command is generated and transmitted to the actuator to adjust the position of the reel, ensuring the accuracy and stability of the docking. During the period when the recognition function is stopped, maintain the current state or perform a preset stop operation.

10. The scroll recognition algorithm according to any one of claims 1 to 6, characterized in that, The image preprocessing steps specifically include: Preprocessing of the original input image includes: Call the resizeImage function to resize the image; Create an edge detection object ED3job and set the edge detection parameters edParams, including minimum line segment length, minimum path length and gradient threshold; Convert the resized image to a grayscale image (gray3d). Perform edge detection on the grayscale image gray3d using the edge detection object ED3job and the set parameter edParams; Ellipse detection is performed on the image after edge detection by calling the detectEllipses function; Store the detected ellipse information dEllip.

Citation Information

Patent Citations

  • Method for detecting central position of cold-rolled strip reel hole based on machine vision

    CN112634344A

  • Circle detection method and device, equipment and storage medium

    CN114627057A