A conveyor belt electronic fence detection method, device, equipment and storage medium
By using optical flow segmentation and edge detection technologies, the electronic fence area is dynamically adjusted, solving the problems of misjudgment and missed judgment in complex environments in traditional systems, and achieving high-precision and real-time security monitoring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 山东浪潮智能生产技术有限公司
- Filing Date
- 2024-10-30
- Publication Date
- 2026-07-21
AI Technical Summary
Traditional electronic fence systems, when faced with the complex and ever-changing coal mine environment, may encounter problems such as the boundary lines failing to accurately reflect the actual situation due to environmental changes, leading to misjudgments or omissions.
By employing optical flow segmentation algorithm and edge detection technology, the position and trajectory of the conveyor belt are dynamically determined by calculating the velocity vector of each pixel in the image. Combined with the edge detection algorithm, the boundary of the conveyor belt is identified, thereby dynamically adjusting the electronic fence area.
It improves the adaptability and accuracy of the electronic fence system, reduces false alarms and missed alarms, ensures the real-time performance and robustness of the system, and reduces the cost of manual intervention and maintenance.
Smart Images

Figure CN119359689B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of coal production automation management technology, specifically relating to a method, device, equipment, and storage medium for detecting electronic fences on conveyor belts. Background Technology
[0002] In the daily operation of coal mines, the main and auxiliary conveyor belts are critical transportation facilities, and their safety and orderliness are of paramount importance. However, in practice, there are frequent instances of miners illegally crossing the conveyor belts, which not only violates safety production regulations but also poses potential safety hazards to mining operations.
[0003] To effectively curb such violations, the introduction of an electronic fence system is particularly important. This system utilizes advanced image recognition and algorithmic analysis capabilities to monitor and issue real-time warnings of dangerous behaviors by miners approaching or crossing conveyor belts, thereby significantly improving the safety management level of coal mines.
[0004] However, traditional electronic fence technology also has certain limitations in its application, especially when facing complex and ever-changing coal mine environments. Specifically, the electronic fence area is determined by preset boundary lines or rules. This method is not very adaptable to environmental changes. Once the environment changes (such as changes in lighting, camera angle, or conveyor belt shutdown for maintenance), the preset boundary lines may not accurately reflect the actual situation, leading to misjudgment or omission of the fence area. Summary of the Invention
[0005] To address the problem that traditional electronic fence systems are poorly adaptable to environmental changes, and that preset boundary lines may not accurately reflect the actual situation once the environment changes, leading to misjudgment or omission of fenced areas, this invention provides a method, device, equipment, and storage medium for detecting electronic fences on conveyor belts.
[0006] In a first aspect, the present invention provides a method for detecting electronic fences on conveyor belts, comprising the following steps:
[0007] Acquire image or video data containing the target area and preprocess the acquired data; the target area includes a conveyor belt;
[0008] The velocity vector of each pixel in the image is calculated using an optical flow segmentation algorithm to preliminarily determine the position and trajectory of the conveyor belt;
[0009] Based on the initially determined image of the conveyor belt, the boundary of the conveyor belt is identified using an edge detection algorithm;
[0010] The area of the electronic fence is dynamically determined based on the identified boundaries of the conveyor belt.
[0011] As a preferred embodiment of the technical solution of the present invention, the steps of acquiring image or video data containing the target area and preprocessing the acquired data include:
[0012] Acquire image or video data containing the target area;
[0013] The acquired data is denoised using a mean filter.
[0014] The denoised data is then converted from a color image to a grayscale image using a weighted average method.
[0015] As a preferred embodiment of the technical solution of the present invention, the step of denoising the acquired data using mean filtering includes:
[0016] Define a search neighborhood. For a pixel with coordinates (i,j) in the image, obtain a new pixel value by calculating the weighted average value g(i,j) of the pixels in its neighborhood.
[0017] Replace the value of the pixel at coordinates (i,j) in the image with the new pixel value.
[0018] in, , The coordinates in the original image are The pixel value is N, where N is the neighborhood and m is the number of pixels in the neighborhood.
[0019] As a preferred embodiment of the technical solution of the present invention, the step of calculating the velocity vector of each pixel in the image using an optical flow segmentation algorithm to initially determine the position and motion trajectory of the conveyor belt includes:
[0020] The velocity vector of each pixel in the image is calculated using an optical flow segmentation algorithm to form the image motion field;
[0021] By comparing the velocity vector differences between the conveyor belt area and the background area, the position and trajectory of the conveyor belt are initially determined for each pixel, thus segmenting the moving conveyor belt from the background.
[0022] As a preferred embodiment of the technical solution of the present invention, the step of segmenting the moving conveyor belt from the background by comparing the velocity vector difference between the conveyor belt area and the background area, and preliminarily determining the position and trajectory of the conveyor belt for each pixel, includes:
[0023] If the velocity vector component in the direction of the conveyor belt's movement is greater than the set value and the difference between it and the velocity vector in the background area exceeds the difference threshold, or if the angle between the pixel's velocity vector and the known direction of the conveyor belt's movement is within the set range and the magnitude of the velocity vector meets the preset value, the position and trajectory of the conveyor belt are initially determined, and the moving conveyor belt is separated from the background.
[0024] As a preferred embodiment of the technical solution of the present invention, the step of identifying the boundary of the conveyor belt based on the initially determined conveyor belt image using an edge detection algorithm includes:
[0025] Set high and low thresholds for edge detection;
[0026] In this step, an initial threshold is set, the gradient operator of the image is calculated to obtain the gradient image, and the gradient image is binary processed using the initial threshold to generate a binary image as a mask template.
[0027] When a pixel value of 1 is found in a binary image, the corresponding pixel is identified as a valid pixel, and histogram distribution is calculated. Using the histogram distribution, the threshold is calculated using the Otsu algorithm and set as the high threshold. Half of the high threshold is set as the low threshold.
[0028] Calculate the grayscale gradient magnitude and direction of the initially determined conveyor belt image;
[0029] Determine whether the gradient magnitude of a pixel is the maximum value among the surrounding pixels in the same gradient direction;
[0030] If not, then set the grayscale value of that pixel to zero;
[0031] If so, retain that pixel as a candidate edge point;
[0032] Determine whether the gray-level gradient magnitude of the candidate edge point is higher than the high threshold;
[0033] If so, determine the candidate edge point as the edge point of the transmission belt;
[0034] If not, determine whether the gray-level gradient magnitude of the candidate edge point is lower than the low threshold.
[0035] If so, discard the candidate edge point;
[0036] Otherwise, determine whether there are other pixels with grayscale gradients higher than the high threshold within the defined neighborhood of the candidate edge point;
[0037] If a candidate edge point exists, retain it; otherwise, delete it.
[0038] As a preferred embodiment of the technical solution of the present invention, the steps of calculating the grayscale gradient magnitude and direction of the preliminarily determined conveyor belt image include:
[0039] Set gradient calculation templates for the horizontal, vertical, 45°, and 135° directions respectively;
[0040] The horizontal gradient components are obtained by performing convolution operations between the initially determined conveyor belt image and the gradient calculation template. Vertical gradient components 45° gradient component and gradient components in the 135° direction ;
[0041] horizontal gradient component Vertical gradient components 45° gradient component and gradient components in the 135° direction Synthesized to obtain the horizontal gradient magnitude and vertical gradient magnitude ;
[0042]
[0043] ;
[0044] Based on the horizontal gradient magnitude and vertical gradient magnitude Calculate grayscale gradient magnitude and direction ;
[0045] , .
[0046] Secondly, the present invention provides a conveyor belt electronic fence detection device, including a preprocessing module, an optical flow calculation module, a boundary calculation module, and an electronic fence area determination module;
[0047] The preprocessing module is used to acquire image or video data containing a target area and preprocess the acquired data; the target area includes a conveyor belt;
[0048] The optical flow calculation module is used to calculate the velocity vector of each pixel in the image using the optical flow segmentation algorithm, and to initially determine the position and motion trajectory of the conveyor belt.
[0049] The boundary calculation module is used to identify the boundary of the conveyor belt based on the initially determined image of the conveyor belt using an edge detection algorithm.
[0050] The electronic fence area determination module is used to dynamically determine the area of the electronic fence based on the identified boundaries of the conveyor belt.
[0051] As a preferred embodiment of the technical solution of the present invention, the preprocessing module includes a data acquisition unit, a filtering unit, and a grayscale conversion unit;
[0052] The acquisition unit is used to acquire image or video data containing the target area;
[0053] The filtering unit is used to denoise the acquired data using a mean filtering algorithm;
[0054] The grayscale conversion unit is used to convert the denoised data into a grayscale image by using a weighted average method.
[0055] As a preferred embodiment of the technical solution of the present invention, the filtering unit is specifically used to set the search neighborhood. For a pixel with coordinates (i,j) in the image, a new pixel value is obtained by calculating the weighted average value g(i,j) of the pixels in its neighborhood. The obtained new pixel value replaces the value of the pixel with coordinates (i,j) in the image.
[0056] in, , The coordinates in the original image are The pixel value is N, where N is the neighborhood and m is the number of pixels in the neighborhood.
[0057] As a preferred embodiment of the technical solution of the present invention, the optical flow calculation module is specifically used to calculate the velocity vector of each pixel in the image using an optical flow segmentation algorithm to form an image motion field; by comparing the velocity vector difference between the conveyor belt area and the background area, the position and trajectory of the conveyor belt are initially determined for each pixel, and the moving conveyor belt is segmented from the background; if the velocity vector component in the direction of the conveyor belt's movement is greater than a set value and the difference between the velocity vector in the background area and the velocity vector in the background area exceeds a difference threshold, or if the angle between the pixel's velocity vector and the known direction of the conveyor belt's movement is within a set range and the magnitude of the velocity vector meets a preset value, the position and trajectory of the conveyor belt are initially determined, and the moving conveyor belt is segmented from the background.
[0058] As a preferred embodiment of the technical solution of the present invention, the boundary calculation module includes a threshold setting unit, a first calculation unit, and an edge judgment unit;
[0059] The threshold setting unit is used to set the high and low thresholds for edge detection.
[0060] In this step, an initial threshold is set, the gradient operator of the image is calculated to obtain the gradient image, and the gradient image is binary processed using the initial threshold to generate a binary image as a mask template.
[0061] When a pixel value of 1 is found in a binary image, the corresponding pixel is identified as a valid pixel, and histogram distribution is calculated. Using the histogram distribution, the threshold is calculated using the Otsu algorithm and set as the high threshold. Half of the high threshold is set as the low threshold.
[0062] The first calculation unit is used to calculate the grayscale gradient magnitude and direction of the initially determined conveyor belt image;
[0063] The edge detection unit is used to determine whether the gradient magnitude of a pixel is the maximum value among the surrounding pixels in the same gradient direction; if not, the gray value of the pixel is set to zero; if yes, the pixel is retained as a candidate edge point; it then determines whether the gray gradient magnitude of the candidate edge point is higher than a high threshold; if yes, the candidate edge point is determined to be a conveyor belt edge point; if not, it determines whether the gray gradient magnitude of the candidate edge point is lower than a low threshold; if yes, the candidate edge point is discarded; otherwise, it determines whether there are other pixels with gray gradients higher than the high threshold within the defined neighborhood of the candidate edge point; if so, the candidate edge point is retained, otherwise it is deleted.
[0064] As a preferred embodiment of the technical solution of the present invention, the first calculation unit is specifically used to set gradient calculation templates in the horizontal, vertical, 45° and 135° directions respectively; and to perform convolution operations on the initially determined conveyor belt image and the gradient calculation templates respectively to obtain the horizontal gradient component. Vertical gradient components 45° gradient component and gradient components in the 135° direction ; Horizontal gradient components Vertical gradient components 45° gradient component and gradient components in the 135° direction Synthesized to obtain the horizontal gradient magnitude and vertical gradient magnitude Based on the horizontal gradient magnitude and vertical gradient magnitude Calculate grayscale gradient magnitude and direction ; ; ;
[0065] , .
[0066] Thirdly, the present invention also provides an electronic device, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; the memory storing computer program instructions executable by the at least one processor, the computer program instructions being executed by the at least one processor to enable the at least one processor to perform the conveyor belt electronic fence detection method as described in the first aspect.
[0067] Fourthly, the present invention also provides a non-transitory computer-readable storage medium that stores computer instructions that cause the computer to execute the conveyor belt electronic fence detection method as described in the first aspect.
[0068] As can be seen from the above technical solutions, this invention has the following advantages: Optical flow combined with edge detection can automatically adapt to environmental changes without manual intervention or preset rules, improving the flexibility and reliability of the electronic fence system. By calculating the velocity vector of pixels and utilizing edge detection technology, this method can accurately identify the boundaries of objects, ensuring the accuracy of the electronic fence area and reducing false alarms and missed alarms. The optical flow combined with edge detection has high computational efficiency, reducing the computing power required to detect belt movement, and can process large amounts of image data in a short time, achieving real-time tracking and detection, ensuring the timely response of the electronic fence system. This method has strong robustness to noise and interference, and can work stably in complex environments, improving the stability and reliability of the electronic fence system.
[0069] By introducing an optical flow segmentation algorithm, this invention can dynamically capture the motion information of objects in an image, forming a precise motion field. Combined with edge detection technology, it automatically identifies and tracks the boundaries of objects, thereby dynamically determining the area of the electronic fence. This method not only improves the adaptability and accuracy of the electronic fence system but also ensures its real-time performance and robustness. The algorithm itself is based on a moving conveyor belt, eliminating the need for additional algorithms to detect conveyor belt movement, thus reducing computational power consumption. This provides a more efficient, safe, and reliable electronic fence solution for fields such as industrial automation and video surveillance. Attached Figure Description
[0070] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0071] Figure 1 This is a schematic flowchart of a method according to an embodiment of the present invention.
[0072] Figure 2 This is a schematic block diagram of an apparatus according to an embodiment of the present invention. Detailed Implementation
[0073] Traditional electronic fence technology has also revealed certain limitations in its application, especially when facing the complex and ever-changing coal mine environment:
[0074] In coal mine environments, cameras may shift due to physical vibrations, dust accumulation, or human error, causing misalignment of the electronic fence area. This can lead to the failure of AI monitoring in conveyor belt areas, increasing safety hazards. In low-light conditions, traditional electronic fence systems may fail to accurately identify targets and backgrounds due to degraded image quality, resulting in frequent false alarms (such as misjudging a normally walking miner as an intruder) and missed alarms (such as failing to detect genuine unauthorized crossings in a timely manner). This not only disrupts normal production but may also weaken the effectiveness of the safety early warning system.
[0075] Camera misalignment and changes in lighting can also cause normally safe areas (such as corridors next to conveyor belts) to be mistakenly included in the geofence, resulting in unnecessary intrusion alarms and further reducing system availability and user trust.
[0076] This application describes the application of optical flow method combined with edge detection in the field of electronic fences. It solves the problem of poor adaptability of traditional electronic fences to environmental changes, and has advantages such as strong adaptability, high accuracy, good real-time performance, and strong robustness. It provides a safer, more reliable, and more efficient electronic fence solution for industrial automation, video surveillance, and other fields. To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.
[0077] like Figure 1 As shown, this embodiment of the invention provides a method for detecting electronic fences on conveyor belts, comprising the following steps:
[0078] Step 1: Acquire image or video data containing the target area and preprocess the acquired data; the target area includes a conveyor belt;
[0079] Specifically, this includes: Step 11: Acquiring image or video data containing the target area;
[0080] Using Python programming technology, a national standard platform is used to connect to a video surveillance system or directly connect to a camera to acquire image or video data containing a target area; the target area includes a conveyor belt.
[0081] Step 12: Use mean filtering to denoise the acquired data;
[0082] This step replaces the current pixel value with the average value of neighboring pixels, thereby smoothing the image and removing noise. Specifically, it includes:
[0083] Define a search neighborhood. For a pixel with coordinates (i,j) in the image, obtain a new pixel value by calculating the weighted average value g(i,j) of the pixels in its neighborhood.
[0084] Replace the value of the pixel at coordinates (i,j) in the image with the new pixel value.
[0085] in, , The coordinates in the original image are The pixel value is N, where N is the neighborhood and m is the number of pixels in the neighborhood.
[0086] Step 13: Convert the color image to a grayscale image using a weighted average method after denoising.
[0087] Based on the different sensitivities of the human eye to different colors, different weights are assigned to the three RGB channels to convert a color image into a grayscale image.
[0088] Mathematical formula: Where R, G, and B are the red, green, and blue channel values of a pixel in a color image, respectively. These are the pixel values after grayscale conversion.
[0089] Step 2: Calculate the velocity vector of each pixel in the image using the optical flow segmentation algorithm to preliminarily determine the position and trajectory of the conveyor belt;
[0090] This step specifically includes:
[0091] Step 21: Calculate the velocity vector of each pixel in the image using the optical flow segmentation algorithm to form the image motion field;
[0092] Step 22: By comparing the velocity vector differences between the conveyor belt area and the background area, the position and trajectory of the conveyor belt are initially determined for each pixel, thus segmenting the moving conveyor belt from the background. Specifically, if the velocity vector component in the direction of the conveyor belt's movement is greater than a set value and the difference between it and the velocity vector in the background area exceeds a difference threshold, or if the angle between the pixel's velocity vector and the known direction of the conveyor belt's movement is within a set range and the magnitude of the velocity vector meets a preset value, the position and trajectory of the conveyor belt are initially determined, thus segmenting the moving conveyor belt from the background.
[0093] An optical flow segmentation algorithm is used to calculate the velocity vector of each pixel in the image, forming the image motion field. By comparing the velocity vector differences between the belt region and the background region, the position and trajectory of the belt are preliminarily determined. Optical flow segmentation algorithm:
[0094] Assume two consecutive image frames are and In practical applications, it is generally assumed that the pixel value remains unchanged for an extremely short period of time, that is: Two-dimensional time-domain model;
[0095] Using Taylor series expansion ;
[0096] After sorting, we get ,in addition , Optical flow equation ,in It is the velocity vector of the pixel. This represents the gradient of the image in the x-direction. This represents the gradient of the image in the y-direction. This represents the rate of change of the image over time. 4. By calculating the velocity vector of each pixel in the image to form the image motion field, each pixel is judged based on conditions such as the velocity vector component in the direction of belt movement being large and the difference between it and the velocity vector in the background area exceeding a threshold, or the angle between the pixel's velocity vector and the known direction of belt movement being within a certain range and the magnitude of the velocity vector meeting expectations, thereby segmenting the moving conveyor belt from the background.
[0097] Step 3: Based on the initially determined conveyor belt image, the boundary of the conveyor belt is identified using an edge detection algorithm;
[0098] Based on optical flow segmentation, edge detection techniques (such as the Canny edge detection algorithm and the Sobel operator) are applied to identify the precise boundaries of the belt. By combining the results of optical flow segmentation and edge detection, accurate segmentation of the belt is achieved.
[0099] Step 4: Dynamically determine the area of the electronic fence based on the identified boundaries of the conveyor belt.
[0100] In some embodiments, the step of identifying the boundary of the conveyor belt based on the initially determined conveyor belt image using an edge detection algorithm includes:
[0101] Step 31: Set the high and low thresholds for edge detection;
[0102] Step 32: Calculate the grayscale gradient magnitude and direction of the preliminarily determined conveyor belt image;
[0103] Step 33: Determine whether the gradient magnitude of a pixel is the maximum value among the surrounding pixels in the same gradient direction;
[0104] If not, proceed to step 34; if yes, proceed to step 35.
[0105] Step 34: Set the grayscale value of the pixel to zero;
[0106] Step 35: Retain this pixel as a candidate edge point; Proceed to Step 36;
[0107] Step 36: Determine whether the gray-level gradient magnitude of the candidate edge point is higher than the high threshold;
[0108] If yes, proceed to step 37; if no, proceed to step 38.
[0109] Step 37: Determine if the candidate edge point is the edge point of the transmission belt;
[0110] Step 38: Determine whether the gray-level gradient magnitude of the candidate edge point is lower than the low threshold;
[0111] If yes, proceed to step 39; otherwise, proceed to step 40.
[0112] Step 39: Discard the candidate edge point;
[0113] Step 40: Determine whether there are other pixels with grayscale gradients higher than the high threshold within the defined neighborhood of the candidate edge point;
[0114] If it exists, proceed to step 41; otherwise, proceed to step 42.
[0115] Step 41: Preserve candidate edge points;
[0116] Step 42: Delete the candidate edge point.
[0117] In some embodiments, the step of calculating the grayscale gradient magnitude and direction of the preliminarily determined conveyor belt image includes:
[0118] Step 321: Set up gradient calculation templates for the horizontal, vertical, 45° and 135° directions respectively;
[0119] Step 322: Perform convolution operations on the initially determined conveyor belt image and the gradient calculation template to obtain the horizontal gradient components. Vertical gradient components 45° gradient component and gradient components in the 135° direction ;
[0120] Step 323: Convert the horizontal gradient components Vertical gradient components 45° gradient component and gradient components in the 135° direction Synthesized to obtain the horizontal gradient magnitude and vertical gradient magnitude ;
[0121]
[0122] ;
[0123] Step 324: Based on the horizontal gradient magnitude and vertical gradient magnitude Calculate grayscale gradient magnitude and direction ;
[0124] , .
[0125] In some embodiments, the steps of setting high and low thresholds for edge detection include:
[0126] In this step, an initial threshold is set, the gradient operator of the image is calculated to obtain the gradient image, and the gradient image is binary processed using the initial threshold to generate a binary image as a mask template.
[0127] When a pixel value of 1 is found in a binary image, the corresponding pixel is identified as a valid pixel, and histogram distribution is calculated. Using the histogram distribution, the threshold is calculated using the Otsu algorithm and set as the high threshold. Half of the high threshold is set as the low threshold.
[0128] In some embodiments, the electronic fence system designed using the methods described in the above embodiments is integrated into a video surveillance system or industrial automation system to achieve real-time monitoring and early warning functions. When personnel appear in the conveyor belt fence area, the system can automatically issue an early warning signal to remind operators to take appropriate measures. The prediction results and monitoring data of the electronic fence system are stored in a database for enterprise business access and analysis. Through data analysis, the belt movement patterns can be further understood, and production processes can be optimized.
[0129] By combining optical flow segmentation and edge detection technologies, these problems of traditional electronic fences are significantly solved. Optical flow segmentation technology can automatically identify and segment the conveyor belt area without fixing the camera angle or manually drawing the area, and can adjust the electronic fence in real time to adapt to changes in the camera. Edge detection technology further enhances the ability to identify the conveyor belt and the surrounding environment. Especially in poor lighting conditions, by detecting the edge features of objects, it can accurately distinguish between the conveyor belt and people, improving the system's recognition accuracy and robustness.
[0130] By combining these two technologies, this invention not only improves the reliability and accuracy of the system but also significantly reduces manual intervention and maintenance costs. Optical flow segmentation technology ensures real-time adjustment and accuracy of the electronic fence area, while edge detection technology enhances recognition capabilities under complex lighting conditions. The combination of these two technologies provides a safer, more efficient, and accurate solution for safety monitoring of mine conveyor belts.
[0131] like Figure 2 As shown, this embodiment of the invention provides a conveyor belt electronic fence detection device, including a preprocessing module, an optical flow calculation module, a boundary calculation module, and an electronic fence area determination module;
[0132] The preprocessing module is used to acquire image or video data containing a target area and preprocess the acquired data; the target area includes a conveyor belt;
[0133] The optical flow calculation module is used to calculate the velocity vector of each pixel in the image using the optical flow segmentation algorithm, and to initially determine the position and motion trajectory of the conveyor belt.
[0134] The boundary calculation module is used to identify the boundary of the conveyor belt based on the initially determined image of the conveyor belt using an edge detection algorithm.
[0135] The electronic fence area determination module is used to dynamically determine the area of the electronic fence based on the identified boundaries of the conveyor belt.
[0136] In some embodiments, the preprocessing module includes a data acquisition unit, a filtering unit, and a grayscale conversion unit;
[0137] The acquisition unit is used to acquire image or video data containing the target area;
[0138] The filtering unit is used to denoise the acquired data using a mean filtering algorithm;
[0139] The grayscale conversion unit is used to convert the denoised data into a grayscale image by using a weighted average method.
[0140] In some embodiments, the filtering unit is specifically used to set a search neighborhood. For a pixel with coordinates (i,j) in the image, a new pixel value is obtained by calculating the weighted average value g(i,j) of the pixels in its neighborhood. The obtained new pixel value replaces the value of the pixel with coordinates (i,j) in the image.
[0141] in, , The coordinates in the original image are The pixel value is N, where N is the neighborhood and m is the number of pixels in the neighborhood.
[0142] In some embodiments, the optical flow calculation module is specifically used to calculate the velocity vector of each pixel in the image using an optical flow segmentation algorithm to form an image motion field; by comparing the velocity vector difference between the conveyor belt area and the background area, the position and trajectory of the conveyor belt are initially determined for each pixel, and the moving conveyor belt is segmented from the background; if the velocity vector component in the direction of the conveyor belt's movement is greater than a set value and the difference between the velocity vector in the background area and the velocity vector in the background area exceeds a difference threshold, or if the angle between the pixel's velocity vector and the known direction of the conveyor belt's movement is within a set range and the magnitude of the velocity vector meets a preset value, the position and trajectory of the conveyor belt are initially determined, and the moving conveyor belt is segmented from the background.
[0143] In some embodiments, the boundary calculation module includes a threshold setting unit, a first calculation unit, and an edge judgment unit;
[0144] The threshold setting unit is used to set the high and low thresholds for edge detection.
[0145] The first calculation unit is used to calculate the grayscale gradient magnitude and direction of the initially determined conveyor belt image;
[0146] The edge detection unit is used to determine whether the gradient magnitude of a pixel is the maximum value among the surrounding pixels in the same gradient direction; if not, the gray value of the pixel is set to zero; if yes, the pixel is retained as a candidate edge point; it then determines whether the gray gradient magnitude of the candidate edge point is higher than a high threshold; if yes, the candidate edge point is determined to be a conveyor belt edge point; if not, it determines whether the gray gradient magnitude of the candidate edge point is lower than a low threshold; if yes, the candidate edge point is discarded; otherwise, it determines whether there are other pixels with gray gradients higher than the high threshold within the defined neighborhood of the candidate edge point; if so, the candidate edge point is retained, otherwise it is deleted.
[0147] In some embodiments, the first calculation unit is specifically used to set gradient calculation templates for the horizontal, vertical, 45°, and 135° directions, respectively; and to perform convolution operations on the initially determined conveyor belt image and the gradient calculation templates to obtain the horizontal gradient component. Vertical gradient components 45° gradient component and gradient components in the 135° direction ; Horizontal gradient components Vertical gradient components 45° gradient component and gradient components in the 135° direction Synthesized to obtain the horizontal gradient magnitude and vertical gradient magnitude Based on the horizontal gradient magnitude and vertical gradient magnitude Calculate grayscale gradient magnitude and direction ; ; ;
[0148] , .
[0149] This invention also provides an electronic device, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, communication interface, and memory communicate with each other via the communication bus. The communication bus can be used for information transmission between the electronic device and a sensor. The processor can call logical instructions in the memory to execute the following method: Step 1: Acquire image or video data containing a target area and preprocess the acquired data; the target area includes a conveyor belt; Step 2: Calculate the velocity vector of each pixel in the image using an optical flow segmentation algorithm to preliminarily determine the position and trajectory of the conveyor belt; Step 3: Identify the boundary of the conveyor belt using an edge detection algorithm based on the preliminarily determined conveyor belt image; Step 4: Dynamically determine the area of the electronic fence based on the identified boundary of the conveyor belt.
[0150] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0151] This invention provides a non-transitory computer-readable storage medium storing computer instructions that cause a computer to execute the method provided in the above-described method embodiments, such as: Step 1: acquiring image or video data containing a target area and preprocessing the acquired data; the target area includes a conveyor belt; Step 2: calculating the velocity vector of each pixel in the image using an optical flow segmentation algorithm to preliminarily determine the position and trajectory of the conveyor belt; Step 3: identifying the boundary of the conveyor belt based on the preliminarily determined conveyor belt image using an edge detection algorithm; Step 4: dynamically determining the area of the electronic fence based on the identified boundary of the conveyor belt.
[0152] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0153] The embodiments of the conveyor belt electronic fence detection device provided in this invention belong to the same inventive concept as the conveyor belt electronic fence detection methods in the above embodiments. For details not described in detail in the embodiments of the conveyor belt electronic fence detection device, please refer to the embodiments of the above conveyor belt electronic fence detection methods.
[0154] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the present invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the present invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should also be covered within the protection scope of the present invention.
Claims
1. A method for detecting electronic fences on conveyor belts, characterized in that, Includes the following steps: Acquire image or video data containing the target area and preprocess the acquired data; the target area includes a conveyor belt; The velocity vector of each pixel in the image is calculated using an optical flow segmentation algorithm to preliminarily determine the position and trajectory of the conveyor belt; Based on the initially determined image of the conveyor belt, the boundary of the conveyor belt is identified using an edge detection algorithm; The area of the electronic fence is dynamically determined based on the identified boundaries of the conveyor belt; The steps involved in calculating the velocity vector of each pixel in the image using an optical flow segmentation algorithm to initially determine the position and trajectory of the conveyor belt include: The velocity vector of each pixel in the image is calculated using an optical flow segmentation algorithm to form the image motion field; By comparing the velocity vector differences between the conveyor belt area and the background area, the position and trajectory of the conveyor belt are initially determined for each pixel, thus segmenting the moving conveyor belt from the background. By comparing the velocity vector differences between the conveyor belt area and the background area, the position and trajectory of the conveyor belt are initially determined for each pixel. The steps to segment the moving conveyor belt from the background include: If the velocity vector component in the direction of the conveyor belt movement is greater than the set value and the difference between it and the velocity vector in the background area exceeds the difference threshold, or if the angle between the velocity vector of the pixel and the known direction of the conveyor belt movement is within the set range and the magnitude of the velocity vector meets the preset value, the position and trajectory of the conveyor belt are initially determined, and the moving conveyor belt is separated from the background. The steps for identifying the boundaries of the conveyor belt using an edge detection algorithm based on the initially determined conveyor belt image include: Set high and low thresholds for edge detection; Calculate the grayscale gradient magnitude and direction of the initially determined conveyor belt image; Determine whether the gradient magnitude of a pixel is the maximum value among the surrounding pixels in the same gradient direction; If not, then set the grayscale value of that pixel to zero; If so, retain that pixel as a candidate edge point; Determine whether the gray-level gradient magnitude of the candidate edge point is higher than the high threshold; If so, determine the candidate edge point as the edge point of the transmission belt; If not, determine whether the gray-level gradient magnitude of the candidate edge point is lower than the low threshold. If so, discard the candidate edge point; Otherwise, determine whether there are other pixels with a grayscale gradient higher than the high threshold within the neighborhood of the candidate edge point; If a candidate edge point exists, retain it; otherwise, delete it.
2. The method for detecting electronic fences on conveyor belts according to claim 1, characterized in that, The steps for acquiring image or video data containing the target region and preprocessing the acquired data include: Acquire image or video data containing the target area; The acquired data is denoised using a mean filter. The denoised data is then converted from a color image to a grayscale image using a weighted average method.
3. The method for detecting electronic fences on conveyor belts according to claim 2, characterized in that, The steps for denoising the acquired data using mean filtering include: Define a search neighborhood. For a pixel with coordinates (i,j) in the image, obtain a new pixel value by calculating the weighted average value g(i,j) of the pixels in its neighborhood. Replace the value of the pixel at coordinates (i,j) in the image with the new pixel value; in, , The coordinates in the original image are The pixel value is N, where N is the neighborhood and m is the number of pixels in the neighborhood.
4. The method for detecting electronic fences on conveyor belts according to claim 3, characterized in that, The steps for calculating the grayscale gradient magnitude and direction of the preliminarily determined conveyor belt image include: Set gradient calculation templates for the horizontal, vertical, 45°, and 135° directions respectively; The horizontal gradient components are obtained by performing convolution operations between the initially determined conveyor belt image and the gradient calculation template. Vertical gradient components 45° gradient component and gradient components in the 135° direction ; horizontal gradient component Vertical gradient components 45° gradient component and gradient components in the 135° direction Synthesized to obtain the horizontal gradient magnitude and vertical gradient magnitude ; Based on the horizontal gradient magnitude and vertical gradient magnitude Calculate grayscale gradient magnitude and direction ; in, ; ; , 。 5. A conveyor belt electronic fence detection device, characterized in that, It includes a preprocessing module, an optical flow calculation module, a boundary calculation module, and an electronic fence area determination module; The preprocessing module is used to acquire image or video data containing the target area and preprocess the acquired data; The target area includes a conveyor belt; The optical flow calculation module is used to calculate the velocity vector of each pixel in the image using the optical flow segmentation algorithm, and to initially determine the position and motion trajectory of the conveyor belt. The boundary calculation module is used to identify the boundary of the conveyor belt based on the initially determined image of the conveyor belt using an edge detection algorithm. The electronic fence area determination module is used to dynamically determine the area of the electronic fence based on the identified boundaries of the conveyor belt. The step of using an optical flow segmentation algorithm to calculate the velocity vector of each pixel in the image and preliminarily determine the position and trajectory of the conveyor belt includes: The velocity vector of each pixel in the image is calculated using an optical flow segmentation algorithm to form the image motion field; By comparing the velocity vector differences between the conveyor belt area and the background area, the position and trajectory of the conveyor belt are initially determined for each pixel, thus segmenting the moving conveyor belt from the background. The step of comparing the velocity vector difference between the conveyor belt area and the background area to preliminarily determine the position and trajectory of the conveyor belt for each pixel, thereby segmenting the moving conveyor belt from the background, includes: If the velocity vector component in the direction of the conveyor belt movement is greater than the set value and the difference between it and the velocity vector in the background area exceeds the difference threshold, or if the angle between the velocity vector of the pixel and the known direction of the conveyor belt movement is within the set range and the magnitude of the velocity vector meets the preset value, the position and trajectory of the conveyor belt are initially determined, and the moving conveyor belt is separated from the background. The process of identifying the boundaries of the conveyor belt based on the initially determined image using an edge detection algorithm includes: Set high and low thresholds for edge detection; Calculate the grayscale gradient magnitude and direction of the initially determined conveyor belt image; Determine whether the gradient magnitude of a pixel is the maximum value among the surrounding pixels in the same gradient direction; If not, then set the grayscale value of that pixel to zero; If so, retain that pixel as a candidate edge point; Determine whether the gray-level gradient magnitude of the candidate edge point is higher than the high threshold; If so, determine the candidate edge point as the edge point of the transmission belt; If not, determine whether the gray-level gradient magnitude of the candidate edge point is lower than the low threshold. If so, discard the candidate edge point; Otherwise, determine whether there are other pixels with a grayscale gradient higher than the high threshold within the neighborhood of the candidate edge point; If a candidate edge point exists, retain it; otherwise, delete it.
6. An electronic device, characterized in that, The electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; the memory stores computer program instructions executable by the at least one processor, the computer program instructions being executed by the at least one processor to enable the at least one processor to perform the conveyor belt electronic fence detection method as described in any one of claims 1 to 4.
7. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium stores computer instructions that cause the computer to perform the conveyor belt electronic fence detection method as described in any one of claims 1 to 4.