Dimension detection method, device, equipment and system
By acquiring the feature information of the object to be detected in the target image area and the length of the target line segment, the problem in the prior art is solved that it is difficult to accurately judge the actual size of the object to be detected in the image, and higher detection accuracy is achieved.
Patent Information
- Application Number
- CN202411996702.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-12-31
AI Technical Summary
The prior art is difficult to accurately determine whether there is an abnormality in the actual size of the object to be detected in the image, especially during the transportation of the conveyor belt, the accuracy of the size of the foreign object is low.
By obtaining the characteristic information of the object to be detected in the target image area, determining the length of the target line segment, and determining whether there is an abnormality in the actual size of the object to be detected based on the difference between the length of the target line segment and the image size of the object to be detected.
Accurate judgment of the actual size of the object to be detected is achieved, and the detection accuracy is reduced due to problems such as the near and far in the image.
Smart Images

Figure CN119379765B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a size detection method, device, equipment and system. Background Art
[0002] At present, coal mining has been highly mechanized, and coal can be transported from the mining area to the ground area through high-speed conveyor belts during the mining process.
[0003] However, in the process of transporting coal on the conveyor belt, foreign objects such as stones, plant roots, steel bars and anchor rods dropped by workers during operation may appear on the conveyor belt. If the size of the foreign object is large, it is easy to cause the transfer port on the conveyor belt to be blocked, causing damage to the conveyor belt. In the related art, the captured images during conveyor belt transportation are generally identified, and when a foreign object is identified, the size of the foreign object's identification frame is compared with a fixed size threshold to determine whether the size of the foreign object is large. The judgment result obtained in this way cannot accurately reflect whether the actual size of the foreign object is large, and the accuracy is low. Summary of the invention
[0004] The embodiments of the present application provide a size detection method, apparatus, device and system, which are at least used to improve the problem of difficulty in accurately determining whether there is an abnormality in the actual size of an object to be detected in an image.
[0005] To achieve the above objectives, the present application provides the following technical solutions:
[0006] In a first aspect, a size detection method is provided, comprising: obtaining feature information of an object to be detected in a target image area. The feature information is used to indicate the image size of the object to be detected. According to the vertex position of the target image area, the length of a target line segment is determined. The target line segment passes through the target position, and the two end points are respectively located on two opposite boundaries of the target image area. The target position can characterize the position of the object to be detected in the target image area. Based on the difference between the length of the target line segment and the image size of the object to be detected, a detection result of the object to be detected is determined, and the detection result is used to indicate whether there is an abnormality in the actual size of the object to be detected.
[0007] In the technical scheme, since the target position can characterize the position of the object to be detected in the target image area. Therefore, the relative position relationship between the target position and the camera corresponding to the target image area matches the relative position relationship between the camera corresponding to the object to be detected and the target image area. That is, the spacing between the target position and the camera corresponding to the target image area is the same or similar to the spacing between the camera corresponding to the target image area and the object to be detected. Then, since the target line segment passes through the target position and the two end points are respectively located on the two relative boundaries of the target image area. Therefore, the ratio of the length of the target line segment to its actual length, and the ratio of the image size of the object to be detected to its actual size are the same or similar. Then, based on the difference between the length of the target line segment and the image size of the object to be detected, the difference between the actual length of the target line segment in the actual scene and the actual size of the object to be detected can be accurately reflected, and the actual size of the object to be detected can be accurately determined to support the problem of reducing the detection accuracy caused by the influence of the near big and far small in the image. Therefore, the present application can be used to improve the problem of being difficult to accurately determine whether the actual size of the object to be detected in the image is abnormal.
[0008] In a possible embodiment, the feature information includes the length of the longest diagonal line of the polygonal identification box of the object to be detected. The difference includes at least one of the following: a ratio between the length of the diagonal line and the length of the target line segment, and a difference between the length of the diagonal line and the length of the target line segment.
[0009] In a possible embodiment, the feature information also includes the type of the object to be detected. The type of the object to be detected is one of a plurality of preset types. Objects of different preset types have different geometric features and correspond to different preset difference thresholds. Based on the difference between the length of the target line segment and the image size of the object to be detected, the detection result of the object to be detected is determined, including: determining that the actual size of the object to be detected is abnormal according to the difference being greater than the target difference threshold. The target difference threshold is a preset difference threshold corresponding to the type of the object to be detected.
[0010] In a possible embodiment, the endpoints of the target line segment are respectively located at the first boundary and the second boundary of the target image area, and the target line segment is parallel to the third boundary of the target image area. Determining the length of the target line segment according to the vertex position of the target image area includes: determining the coordinates of the endpoints of the target line segment according to the vertex coordinates of the target image area and the coordinates of the target position. Determining the length of the target line segment based on the coordinates of the endpoints of the target line segment.
[0011] In a possible embodiment, the coordinates of the endpoints of the target line segment are determined according to the vertex coordinates of the target image area and the coordinates of the target position, including: obtaining a first straight line equation for describing the first boundary, a second straight line equation for describing the second boundary, and a slope of the third boundary according to the vertex coordinates of the target image area. Based on the coordinates of the target position and the slope of the third boundary, a target straight line equation for describing the target line segment is obtained. The coordinates of the intersection of the target straight line equation with the first straight line equation and the second straight line equation are determined to obtain the coordinates of the endpoints of the target line segment.
[0012] In a possible embodiment, the target image area is an area corresponding to the conveyor belt in the target image. The first boundary and the second boundary are used to indicate the edge of the conveyor belt.
[0013] In a possible embodiment, the third boundary, the fourth boundary and the target line segment of the target image area are parallel, and the third boundary is opposite to the fourth boundary. Determining the length of the target line segment according to the vertex position of the target image area includes: determining the lengths of the third boundary and the fourth boundary according to the vertex coordinates of the target image area. Determining the length of the target line segment according to the lengths of the third boundary and the fourth boundary.
[0014] In a second aspect, a size detection device is provided, including: an acquisition unit and a processing unit.
[0015] The acquisition unit is used to acquire feature information of the object to be detected in the target image area. The feature information is used to indicate the image size of the object to be detected.
[0016] The processing unit is used to determine the length of the target line segment according to the vertex position of the target image area. The target line segment passes through the target position, and the two end points are respectively located on two opposite boundaries of the target image area. The target position can represent the position of the object to be detected in the target image area.
[0017] The processing unit is further used to determine the detection result of the object to be detected based on the difference between the length of the target line segment and the image size of the object to be detected, and the detection result is used to indicate whether there is an abnormality in the actual size of the object to be detected.
[0018] In a possible embodiment, the feature information includes the length of the longest diagonal line of the polygonal identification box of the object to be detected. The difference includes at least one of the following: a ratio between the length of the diagonal line and the length of the target line segment, and a difference between the length of the diagonal line and the length of the target line segment.
[0019] In a possible embodiment, the feature information also includes the type of the object to be detected. The type of the object to be detected is one of a plurality of preset types. Objects of different preset types have different geometric features and correspond to different preset difference thresholds. The processing unit is specifically used to: determine that the actual size of the object to be detected is abnormal according to the difference being greater than the target difference threshold. The target difference threshold is a preset difference threshold corresponding to the type of the object to be detected.
[0020] In a possible embodiment, the endpoints of the target line segment are respectively located at the first boundary and the second boundary of the target image area, and the target line segment is parallel to the third boundary of the target image area. The processing unit is specifically used to: determine the coordinates of the endpoints of the target line segment according to the vertex coordinates of the target image area and the coordinates of the target position. Based on the coordinates of the endpoints of the target line segment, determine the length of the target line segment.
[0021] In a possible embodiment, the processing unit is specifically used to: obtain a first straight line equation for describing a first boundary, a second straight line equation for describing a second boundary, and a slope of a third boundary according to the vertex coordinates of the target image area. Based on the coordinates of the target position and the slope of the third boundary, obtain a target straight line equation for describing a target line segment. Determine the coordinates of the intersection of the target straight line equation with the first straight line equation and the second straight line equation to obtain the coordinates of the endpoint of the target line segment.
[0022] In a possible embodiment, the target image area is an area corresponding to the conveyor belt in the target image. The first boundary and the second boundary are used to indicate the edge of the conveyor belt.
[0023] In a possible embodiment, the third boundary, the fourth boundary and the target line segment of the target image area are parallel, and the third boundary is opposite to the fourth boundary. The processing unit is specifically used to: determine the lengths of the third boundary and the fourth boundary according to the vertex coordinates of the target image area. Determine the length of the target line segment according to the lengths of the third boundary and the fourth boundary.
[0024] In a third aspect, a computer device is provided, comprising: a processor and a memory. The processor is connected to the memory, the memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory, thereby implementing any one of the methods provided in the first aspect.
[0025] In a fourth aspect, a readable storage medium is provided, comprising computer execution instructions, which, when executed on a computer device, causes the computer device to execute any one of the methods provided in the first aspect.
[0026] In a fifth aspect, a computer program product is provided, comprising computer execution instructions, which, when executed on a computer device, cause the computer device to execute any one of the methods provided in the first aspect.
[0027] In a sixth aspect, a size detection system is provided, comprising a computer device and a camera device. The computer device is used to execute any one of the methods provided in the first aspect. The camera device is used to collect image information of a conveyor belt.
[0028] The technical effects brought about by any implementation method in the second to sixth aspects can refer to the technical effects brought about by the corresponding implementation method in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of the structure of a size detection system provided in an embodiment of the present application;
[0030] Figure 2 A schematic diagram of the structure of a computer device provided in an embodiment of the present application;
[0031] Figure 3 A schematic diagram of a flow chart of a size detection method provided in an embodiment of the present application;
[0032] Figure 4 A schematic diagram of a target image area provided in an embodiment of the present application;
[0033] Figure 5 A schematic diagram of an object to be detected provided in an embodiment of the present application;
[0034] Figure 6 A schematic diagram of a target image provided in an embodiment of the present application;
[0035] Figure 7 A schematic diagram of a sample object provided in an embodiment of the present application;
[0036] Figure 8 A schematic diagram of a plane rectangular coordinate system provided in an embodiment of the present application;
[0037] Fig. 9 A schematic diagram of another target image provided in an embodiment of the present application;
[0038] Fig.10 A schematic diagram of a flow chart of another size detection method provided in an embodiment of the present application;
[0039] Fig.11 A schematic diagram of the structure of a size detection device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] In the description of this application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, "at least one" means one or more, and "plurality" means two or more. The words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not limit them to be different.
[0041] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0042] First of all, in order to facilitate the understanding of the present application, the relevant elements involved in the present application are described.
[0043] The conveyor belt is an important part of the conveyor, which is used to carry materials to achieve efficient material transportation. The materials used to make the conveyor belt generally include rubber and synthetic fibers, etc., which have properties such as wear resistance, tension resistance, and high temperature resistance. The main application scenarios include coal mines, metallurgy, chemicals, power plants, docks, etc. It should be understood that the conveyor belt involved in the embodiments of the present application can be replaced by belts, conveyor belts or other names without limitation.
[0044] Foreign matter refers to non-transportable objects that appear on the conveyor belt during the conveyor transportation process. For example, if the conveyor belt is transporting coal, the non-transportable objects can be other objects different from coal, such as bricks, wooden boards, mineral water bottles, etc.
[0045] Secondly, the application scenarios involved in this application are briefly introduced.
[0046] The coal mining process has achieved a high degree of mechanization, and the method of transporting coal by conveyor belts has been widely used. At the same time, in order to timely identify and predict safety hazards in the coal mining process, it is considered to identify and detect on-site images of coal production and conveyor belt transportation processes based on intelligent visual recognition technology.
[0047] For example, when conveyor belts are used to transport coal, foreign objects such as stones, plant roots, steel bars and anchor rods dropped by workers during operation may appear on the conveyor belts. If the foreign objects are large in size, especially those that are oversized or long, they can easily cause jams at the transfer port of the conveyor belt. If such foreign objects are not handled in a timely manner, they may further cause damage to the conveyor belt, such as tearing or breaking, which poses a major safety hazard.
[0048] In this case, the captured images during conveyor belt transportation can generally be identified based on intelligent visual recognition technology, and when a foreign object is identified, the long side length of the foreign object identification box is compared with the fixed length threshold to determine whether the size of the foreign object is large, and further issue an early warning.
[0049] However, the size of foreign objects identified by this method is prone to the problem of being larger when closer and smaller when farther away. That is, for the same foreign object, the size of the foreign object identified is larger when the foreign object is closer to the camera device, and smaller when the foreign object is farther away from the camera device, making it difficult to accurately determine whether the foreign object is abnormal.
[0050] Next, the implementation environment (implementation architecture) involved in this application is briefly introduced.
[0051] The embodiment of the present application provides a size detection method, which can be applied to a computer device in a size detection system. Figure 1 , which is a schematic diagram of a size detection system provided in an embodiment of the present application. The size detection system may include a computer device 101 and a camera device 102. The computer device 101 may be connected to the camera device 102 via a wired network or a wireless network.
[0052] In practical applications, there may be multiple computer devices 101 and multiple camera devices 102. For ease of understanding, the present embodiment of the application is described by taking the case where both the computer device 101 and the camera device 102 are one.
[0053] The computer device 101 may be used to manage the camera device 102 and perform size detection based on image information captured by the camera device 102 .
[0054] Optionally, the computer device 101 may be a terminal, a server, or other device used for size detection. Figure 1 The figure is merely an example of a device form of the computer device 101 and is not intended to limit the device form of the computer device 101 .
[0055] The terminal may be an access terminal, a terminal unit, a user terminal (TE), a mobile device, a tablet computer (pad), a handheld device with wireless communication function, a computing device, or other processing device connected to a wireless modem. The present application embodiment does not limit this.
[0056] The server can be a single physical or logical server, or it can be a server cluster. A server cluster can realize various functions of the server by two or more physical or logical servers sharing different responsibilities and cooperating with each other. Optionally, a server cluster can also be referred to as a computing device cluster. In some implementations, the server cluster can also be a distributed cluster. This application does not limit the form of the computer device 101.
[0057] The camera device 102 can be used to capture image information of the deployed detection area and send the captured image information to the computer device 101. For example, the camera device 102 can be deployed above the conveyor belt to capture image information of a portion of the conveyor belt.
[0058] Optionally, the video camera 102 may be a camera, a ball camera or other types of video cameras. The camera has functions such as high-definition shooting and precise focusing. Figure 1 The figure is merely an example of a device form of the camera device 102 , and is not intended to limit the device form of the camera device 102 .
[0059] In terms of hardware implementation, the above-mentioned computer device can be implemented as follows: Figure 2 The computer device 20 shown is implemented. Figure 2 , which is a schematic diagram of the structure of a computer device 20 provided in an embodiment of the present application. The computer device 20 can be used to implement the functions of the above-mentioned computer devices.
[0060] Figure 2 The computer device 20 shown may include: a processor 201 , a memory 202 , a communication interface 203 , and a bus 204 . The processor 201 , the memory 202 , and the communication interface 203 may be connected via the bus 204 .
[0061] The processor 201 is the control center of the computer device 20, and may be a general-purpose central processing unit (CPU) or other general-purpose processors, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0062] As an example, the processor 201 may include one or more CPUs, such as Figure 2 CPU 0 and CPU 1 are shown in .
[0063] The memory 202 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0064] In a possible implementation, the memory 202 may exist independently of the processor 201. The memory 202 may be connected to the processor 201 via a bus 204 and used to store data, instructions, or program codes. When the processor 201 calls and executes the instructions or program codes stored in the memory 202, the size detection method provided in the embodiment of the present application can be implemented.
[0065] In another possible implementation, the memory 202 may also be integrated with the processor 201 .
[0066] The communication interface 203 is used for connecting the computer device 20 with other devices through a communication network, which may be Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 203 may include a receiving unit for receiving data and a sending unit for sending data.
[0067] The bus 204 may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 2 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0068] It should be pointed out that Figure 2 The structure shown in the figure does not constitute a limitation on the computer device 20, except Figure 2In addition to the components shown, computer device 20 may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0069] For ease of understanding, the size detection method provided by the present application is specifically introduced below with reference to the accompanying drawings.
[0070] like Figure 3 FIG. 1 is a flow chart of a size detection method provided by the present application. The method includes: S301-S303.
[0071] S301: Acquire feature information of the object to be detected in the target image area.
[0072] The target image area is the area corresponding to the conveyor belt in the target image. The target image refers to the image of the conveyor belt taken by the camera device.
[0073] In one possible manner, the camera device may be fixedly deployed above the conveyor belt. Also, the target image area may be a partial area on the conveyor belt in the target image. For example, Figure 4 FIG. 1 is a schematic diagram of a target image region provided in an embodiment of the present application. The target image region may be a quadrilateral region with a shape similar to a trapezoid. Figure 4 The middle line segment AC and the line segment BD can be regarded as the two sides of the quadrilateral region of the approximate trapezoid, and the line segment AB and the line segment CD can be regarded as the upper base and the lower base of the quadrilateral region of the approximate trapezoid. Figure 4 The left and right edges of the middle conveyor belt coincide, and line segments AB and CD are perpendicular to the running direction of the conveyor belt.
[0074] The characteristic information is used to indicate the image size of the object to be detected. Further, the image size of the object to be detected can be the length of the longest diagonal of the polygonal identification frame of the object to be detected, so as to accurately identify whether the actual size of the object to be detected is abnormal and avoid it from causing blockage at the conveyor belt bayonet. Or further, the polygonal identification frame of the object to be detected can be the minimum circumscribed rectangle of the object to be detected in the target image.
[0075] For example, Figure 5 As shown, it is a schematic diagram of an object to be detected provided by an embodiment of the present application. In the case where there is an object to be detected in the target image area, the computer device can calibrate the object to be detected in the target image area through a polygonal recognition frame, and can determine the length of the longest diagonal line of the polygonal recognition frame as the image size of the object to be detected. Compared with determining the long side or short side of the polygonal recognition frame as the image size of the object to be detected, the length of the longest diagonal line of the polygonal recognition frame can more accurately reflect the actual size of the object to be detected.
[0076] Optionally, the object to be detected may be a transport object that is normally transported on the conveyor belt. For example, when the transport object of the conveyor belt is coal, the object to be detected may be a lump of coal on the conveyor belt, so as to identify whether there is oversized or overlong coal on the conveyor belt to avoid it from causing blockage at the conveyor belt bayonet.
[0077] Alternatively, the object to be detected may be a foreign object on the conveyor belt that is different from the object being transported. For example, if the object being transported is coal, the object to be detected may be a brick, a wooden board, a mineral water bottle, etc. on the conveyor belt, so as to identify whether there are oversized or overlong foreign objects on the conveyor belt, and avoid them from blocking the conveyor belt at the bayonet.
[0078] In one possible implementation, the computer device can obtain the target image from the camera device in real time or periodically, and identify whether there is an object to be detected in the target image area. Furthermore, when there is an object to be detected in the target image area, the computer device can calibrate the object to be detected in the target image area through a polygonal recognition frame, and determine the image size of the object to be detected based on the polygonal recognition frame to obtain feature information of the object to be detected in the target image area.
[0079] S302: Determine the length of the target line segment according to the vertex positions of the target image area.
[0080] The target line segment passes through the target position, and its two end points are respectively located on two opposite boundaries of the target image area.
[0081] The target position can represent the position of the object to be detected in the target image area. Optionally, the target position can be the center of a polygonal recognition frame used to calibrate the object to be detected, or can be any vertex or other point on the polygonal recognition frame.
[0082] The two endpoints of the target line segment are located on two opposite boundaries of the target image area. The two boundaries are two opposite boundaries in the target image area, which are used to indicate the edges of the conveyor belt, that is, two opposite edge lines on the conveyor belt. Figure 4 The two boundaries may be a first boundary and a second boundary, respectively. The first boundary is line segment AC, and the second boundary is line segment BD.
[0083] In this way, the relative position relationship between the target position and the camera device arranged above the conveyor belt matches the relative position relationship between the object to be detected and the camera device arranged above the conveyor belt. That is, the spacing between the target position and the camera device arranged above the conveyor belt is the same or similar to the spacing between the object to be detected and the camera device arranged above the conveyor belt. Furthermore, the ratio of the length of the target line segment passing through the target position on the conveyor belt in the target image area to its actual length on the conveyor belt, and the ratio of the image size of the object to be detected to its actual size are the same or similar. Furthermore, it can support the length of the target line segment to be regarded as the actual width of the conveyor belt, and the image size of the object to be detected to be regarded as its actual size for combined judgment, so as to accurately determine whether the actual size of the object to be detected is abnormal, and avoid the problem of reduced detection accuracy caused by the influence of near big and far small in the image.
[0084] For example, Figure 6 As shown, it is a schematic diagram of a target image provided by an embodiment of the present application. The edges on both sides of the conveyor belt can be extended to point A. Assume that the target position is the center point of the polygonal identification frame of the object to be detected. When the object to be detected is located at the far end of the conveyor belt, the target line segment intersects with the boundaries on both sides of the conveyor belt at B1 and C1 respectively, and intersects with the boundaries on both sides of the polygonal identification frame of the object to be detected at E1 and F1 respectively. When the object to be detected is located at the near end of the conveyor belt, the target line segment intersects with the boundaries on both sides of the conveyor belt at B2 and C2 respectively, and intersects with the boundaries on both sides of the polygonal identification frame of the object to be detected at E2 and F2 respectively. In this case, triangle AB1C1 and triangle AB2C2 are similar triangles. Triangle AE1F1 and triangle AE2F2 are similar triangles. The ratio of line segment E1F1 to line segment B1C1 is equal to the ratio of line segment E2F2 to line segment B2C2. It can be seen that there is a relative relationship between the image size of the object to be detected and the width of the conveyor belt in the image. Therefore, when abnormality judgment is performed based on the image size of the object to be detected and the target line segment passing through the target position, the size relationship between the actual size of the object to be detected and the actual width of the conveyor belt can be accurately reflected, with high accuracy.
[0085] In one possible manner, the computer device determines the straight line equations of the first boundary and the second boundary of the target image area, and the slope of the third boundary, respectively, based on the coordinates of the four vertices of the target image area. The third boundary is the boundary of the target image area perpendicular to the moving direction of the conveyor belt. Figure 4 , the third boundary may be line segment AB or line segment CD. Then, the computer device may determine the linear equation of the line where the target line segment is located based on the slope of the third boundary and the coordinate point of the target position, so as to further determine the intersection points between the linear equation of the line where the target line segment is located and the linear equations of the first boundary and the second boundary, respectively, so as to determine the length of the target line segment.
[0086] Alternatively, the computer device may also determine the lengths of the third boundary and the fourth boundary according to the vertex coordinates of the target image area, and further determine the length of the target line segment according to the lengths of the third boundary and the fourth boundary. The third boundary and the fourth boundary are two opposite and parallel boundaries in the target image area. The implementation of this process may refer to the description in S3023-S3024 below, which will not be described in detail here.
[0087] S303: Determine a detection result of the object to be detected based on the difference between the length of the target line segment and the image size of the object to be detected.
[0088] The detection result is used to indicate whether there is any abnormality in the actual size of the object to be detected.
[0089] Optionally, the difference between the length of the target line segment and the image size of the object to be detected may include at least one of the following: a ratio between the length of the diagonal line and the length of the target line segment, and a difference between the length of the diagonal line and the length of the target line segment.
[0090] In one possible manner, the computer device may compare the ratio between the length of the diagonal line and the length of the target line segment with a difference threshold. If the ratio between the length of the diagonal line and the length of the target line segment is greater than the difference threshold, the computer device may determine that the detection result of the object to be detected is that the actual size of the object to be detected is abnormal. If the ratio between the length of the diagonal line and the length of the target line segment is less than or equal to the difference threshold, the computer device may determine that the detection result of the object to be detected is that the actual size of the object to be detected is not abnormal.
[0091] Alternatively, the computer device may compare the difference between the length of the diagonal line and the length of the target line segment with a difference threshold. If the difference between the length of the diagonal line and the length of the target line segment is greater than the difference threshold, the computer device may determine that the detection result of the object to be detected is that the actual size of the object to be detected is abnormal. If the difference between the length of the diagonal line and the length of the target line segment is less than or equal to the difference threshold, the computer device may determine that the detection result of the object to be detected is that the actual size of the object to be detected is not abnormal.
[0092] In one embodiment, in the above S303, that is, when the computer device determines the detection result of the object to be detected based on the difference between the length of the target line segment and the image size of the object to be detected, the embodiment of the present application provides an optional implementation method, including: S3031.
[0093] S3031: Determine that an actual size of the object to be detected is abnormal based on the difference being greater than the target difference threshold.
[0094] The target difference threshold is a preset difference threshold corresponding to the type of the object to be detected.
[0095] Considering that objects with different geometric features in the actual application of conveyor belts may cause different anomalies, the way to judge the size anomalies of objects with different geometric features may be different. For example, when judging objects with longer lengths and larger volumes in the coal transportation scenario, different difference thresholds can be used. Based on this, the type of the object to be detected is further identified, and the corresponding difference threshold is selected based on the type of the object to be detected for anomaly judgment.
[0096] For example, an object recognition model trained based on multiple types of sample images may be preset in the computer device. In this way, after the computer device acquires the target image, it can identify whether there is an object to be detected in the target image area through the object recognition model, and identify the type of the object to be detected when there is an object to be detected in the target image area. Different types of sample images include different types of sample objects. The sample objects may be block-type sample objects, strip-type sample objects, or other types of sample objects.
[0097] like Figure 7 Shown is a schematic diagram of a sample object provided in an embodiment of the present application. Figure 7 (a) in the figure is a block-type sample object, whose geometric features are square or round, and the size difference between adjacent boundaries (such as length and width) is small. Figure 7 (b) in the figure is a strip-type sample object, whose geometric features are long and thin, and the size difference between adjacent boundaries (such as length and width) is large. Figure 7 (c) in the figure is other types of sample objects, whose geometric features are not obvious, and generally have irregular boundaries and small sizes, such as plastic bags, beverage bottles, etc.
[0098] Based on this, in the embodiment of the present application, the feature information of the object to be detected may also include the type of the object to be detected. The type of the object to be detected is one of a plurality of preset types. Objects of different preset types have different geometric features and correspond to different preset difference thresholds. In this way, different thresholds can be set for different types of objects according to actual needs, thereby effectively meeting the personalized needs of actual scenes.
[0099] Furthermore, the computer device may determine a preset difference threshold value corresponding to the type of the object to be detected among a plurality of preset difference threshold values as a target difference threshold value. Further, the computer device may determine that there is an abnormality in the actual size of the object to be detected based on the difference between the length of the target line segment and the image size of the object to be detected being greater than the target difference threshold value. Alternatively, the computer device may determine that there is no abnormality in the actual size of the object to be detected based on the difference between the length of the target line segment and the image size of the object to be detected being less than or equal to the target difference threshold value.
[0100] In one embodiment, in the above S302, that is, when the computer device determines the length of the target line segment according to the vertex position of the target image area, the embodiment of the present application provides an optional implementation method, including: S3021-S3022.
[0101] S3021: Determine the coordinates of the endpoints of the target line segment according to the vertex coordinates of the target image area and the coordinates of the target position.
[0102] Considering that the camera is tilted at a certain angle relative to the conveyor belt when capturing the target image, the size of the object to be detected in the target image when it is at the far end of the conveyor belt is different from the size when it is at the near end of the conveyor belt. In real scenes, the conveyor belt can be regarded as a rectangular parallelepiped with equal width. Based on the perspective method, the conveyor belt image in the target image is mostly trapezoidal.
[0103] For example, Figure 8 The figure is a schematic diagram of a plane rectangular coordinate system provided by an embodiment of the present application. The computer device can convert the target image area into Figure 8 The computer device can determine the coordinates of the four vertices of the target image area in the plane rectangular coordinate system and the coordinates of the target position in the plane rectangular coordinate system. Further, the computer device can determine the straight line equations of the first boundary and the second boundary of the target image area in the plane rectangular coordinate system, and the slope of the third boundary of the target image area in the plane rectangular coordinate system.
[0104] Furthermore, the computer device can determine the linear equation of the straight line where the target line segment is located based on the slope of the third boundary in the plane rectangular coordinate system and the coordinates of the target position, so as to further determine the intersection between the linear equation of the straight line where the target line segment is located and the linear equation of the first boundary and the linear equation of the second boundary, respectively, to obtain the coordinates of the endpoint of the target line segment.
[0105] S3022: Determine the length of the target line segment based on the coordinates of the endpoints of the target line segment.
[0106] In one embodiment, in the above S3021, that is, when the computer device determines the coordinates of the endpoints of the target line segment based on the vertex coordinates of the target image area and the coordinates of the target position, the embodiment of the present application provides an optional implementation method, including: S30211-S30213.
[0107] S30211: According to the vertex coordinates of the target image area, obtain a first straight line equation for describing the first boundary, a second straight line equation for describing the second boundary, and a slope of the third boundary.
[0108] For example, Fig. 9FIG. 1 is a schematic diagram of another target image provided by an embodiment of the present application. Fig. 9 The four vertices of the target image area are A, B, C and D, and the coordinates of the four vertices are A (XA, YA), B (XB, YB), C (XC, YC) and D (XD, YD). Based on this, the computer device can determine the straight line L according to the coordinates of vertex A and vertex C. AC The equation of the straight line is the same as the equation of the straight line L. BD Furthermore, the computer device can determine the equation of the straight line L according to the coordinates of vertex A and vertex B. AB The slope k AB .
[0109] S30212: Based on the coordinates of the target position and the slope of the third boundary, obtain a target straight line equation for describing the target line segment.
[0110] In the case where the target position is the center point of the polygonal identification frame of the object to be detected, the computer device may determine the coordinates of the target position based on the vertex coordinates of the polygonal identification frame of the object to be detected. Fig. 9 , assuming Fig. 9 The coordinates of the upper left vertex a of the polygonal identification box of the object to be detected are (Xa, Ya), and the coordinates of the lower right vertex b of the polygonal identification box of the object to be detected are (Xb, Yb). Then the computer device can determine the coordinates of the target position as (Xa-Xb, Ya-Yb). Further, if the polygonal identification box of the object to be detected is the minimum circumscribed rectangle of the object to be detected, then the longest diagonal line of the object to be detected is line segment ab.
[0111] Then, the computer device determines the slope k AB The straight line passing through the center point of the polygonal recognition frame of the object to be detected intersects the boundary AC at point H and the boundary BD at point K. Then the two endpoints of the target line segment are points H and K respectively. Straight line L HK is the target line equation used to describe the target line segment.
[0112] S30213: Determine the coordinates of the intersection of the target straight line equation, the first straight line equation, and the second straight line equation to obtain the coordinates of the endpoints of the target line segment.
[0113] For example, combining the above Fig. 9 , the computer device can be AB The straight line L HK With straight line L AC The intersection of AB The straight line L HK With straight line L BDThe intersection of , determines the coordinates of point K. Then, the computer device can determine that the length of line segment HK is the length of the target line segment.
[0114] In one embodiment, in the above S302, that is, when the computer device determines the length of the target line segment according to the vertex position of the target image area, the embodiment of the present application provides an optional implementation method, including: S3023-S3024.
[0115] S3023: Determine the lengths of the third boundary and the fourth boundary according to the vertex coordinates of the target image area.
[0116] The third boundary, the fourth boundary and the target line segment of the target image area are parallel, and the third boundary is opposite to the fourth boundary. Figure 4 , the third boundary and the fourth boundary can be line segment AB and line segment CD respectively.
[0117] S3024: Determine the length of the target line segment according to the lengths of the third boundary and the fourth boundary.
[0118] For example, after the computer device determines the length of the third boundary and the fourth boundary, it can determine the linear equation of the straight line where the target line segment is located based on the slope of the third boundary and the coordinate point of the target position, so as to further determine the intersection between the linear equation of the straight line where the target line segment is located and the linear equation of the first boundary, thereby determining the ratio between the length of the line segment between the intersection and the first boundary and the length of the first boundary. Furthermore, the computer device can determine the length of the target line segment based on the ratio and the lengths of the third boundary and the fourth boundary.
[0119] In one embodiment, Fig.10 As shown, it is a flow chart of another size detection method provided in an embodiment of the present application. Fig.10 The size detection method shown includes: S401-S408.
[0120] S401: Acquire a target image.
[0121] S402: Processing the target image through the object recognition model.
[0122] S403: Determine whether there is an object to be detected.
[0123] If there is an object to be detected in the target image area of the target image, S404 is executed. If there is no object to be detected in the target image area of the target image, S401 is executed again to identify other target images.
[0124] S404: Obtain the image size of the object to be detected in the target image area.
[0125] S405: Determine the target image area.
[0126] For example, the computer device may determine, in response to the area editing operation of the staff, that the area in the target image corresponding to the area editing operation of the staff is the target image area.
[0127] S406: Determine the straight lines of the left and right edges of the conveyor belt, and the slope of the transverse line.
[0128] S407: Determine the difference between the length of the target line segment and the image size of the object to be detected.
[0129] S408: If the difference is greater than the target difference threshold, it is determined that there is an abnormality in the actual size of the object to be detected.
[0130] It should be understood that the implementation of the above S401-S408 can be understood by referring to the relevant description of the above S301-S303, and will not be repeated here.
[0131] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the method. It is understandable that in order to realize the above functions, the computer device includes at least one of the hardware structure and software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0132] The embodiment of the present application can divide the computer device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0133] For example, Fig.11 The schematic diagram of the structure of a size detection device is shown. The size detection device 30 can be used to execute the method involved in the above embodiment. The size detection device 30 includes: an acquisition unit 501 and a processing unit 502.
[0134] The acquisition unit 501 is used to acquire feature information of the object to be detected in the target image area. The feature information is used to indicate the image size of the object to be detected.
[0135] The processing unit 502 is used to determine the length of the target line segment according to the vertex position of the target image area. The target line segment passes through the target position, and the two end points are respectively located on two opposite boundaries of the target image area. The target position can represent the position of the object to be detected in the target image area.
[0136] The processing unit 502 is further used to determine a detection result of the object to be detected based on the difference between the length of the target line segment and the image size of the object to be detected, and the detection result is used to indicate whether there is an abnormality in the actual size of the object to be detected.
[0137] In a possible embodiment, the feature information includes the length of the longest diagonal line of the polygonal identification box of the object to be detected. The difference includes at least one of the following: a ratio between the length of the diagonal line and the length of the target line segment, and a difference between the length of the diagonal line and the length of the target line segment.
[0138] In a possible embodiment, the feature information also includes the type of the object to be detected. The type of the object to be detected is one of a plurality of preset types. Objects of different preset types have different geometric features and correspond to different preset difference thresholds. The processing unit 502 is specifically used to: determine that the actual size of the object to be detected is abnormal according to the difference being greater than the target difference threshold. The target difference threshold is a preset difference threshold corresponding to the type of the object to be detected.
[0139] In a possible embodiment, the endpoints of the target line segment are respectively located at the first boundary and the second boundary of the target image area, and the target line segment is parallel to the third boundary of the target image area. The processing unit 502 is specifically used to: determine the coordinates of the endpoints of the target line segment according to the vertex coordinates of the target image area and the coordinates of the target position. Based on the coordinates of the endpoints of the target line segment, determine the length of the target line segment.
[0140] In a possible embodiment, the processing unit 502 is specifically used to: obtain a first straight line equation for describing a first boundary, a second straight line equation for describing a second boundary, and a slope of a third boundary according to the vertex coordinates of the target image area. Based on the coordinates of the target position and the slope of the third boundary, obtain a target straight line equation for describing a target line segment. Determine the coordinates of the intersection of the target straight line equation with the first straight line equation and the second straight line equation to obtain the coordinates of the endpoint of the target line segment.
[0141] In a possible embodiment, the target image area is an area corresponding to the conveyor belt in the target image. The first boundary and the second boundary are used to indicate the edge of the conveyor belt.
[0142] In a possible embodiment, the third boundary, the fourth boundary and the target line segment of the target image region are parallel, and the third boundary is opposite to the fourth boundary. The processing unit 502 is specifically used to: determine the lengths of the third boundary and the fourth boundary according to the vertex coordinates of the target image region. Determine the length of the target line segment according to the lengths of the third boundary and the fourth boundary.
[0143] For the specific description of the above optional manner, please refer to the above method embodiment, which will not be repeated here. In addition, the explanation of any of the above computer devices and the description of the beneficial effects can refer to the above corresponding method embodiment, which will not be repeated here.
[0144] As an example, combining Figure 2 , the functions partially or completely implemented by the acquisition unit 501 and the processing unit 502 in the size detection device 30 can be Figure 2 Processor 201 in the Figure 2 The program code in the memory 202 is implemented.
[0145] An embodiment of the present application further provides a readable storage medium having a computer program stored thereon. When the computer program is executed on a computer device, the computer device executes any of the methods executed by the computer devices provided above.
[0146] For the explanation of the relevant contents and description of the beneficial effects of any of the readable storage media provided above, reference may be made to the corresponding embodiments above, which will not be repeated here.
[0147] The embodiment of the present application also provides a computer program product including instructions, and when the instructions are run on a computer device, the computer device executes any one of the methods in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer device, the process or function according to the embodiment of the present application is generated in whole or in part. The computer device may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a readable storage medium, or transmitted from one readable storage medium to another readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center to another website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The readable storage medium may be any available medium that can be accessed by the computer device or a data storage device such as a server, a data center, etc. that includes one or more servers that can be integrated with the medium. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), etc.
[0148] It should be noted that the above-mentioned devices for storing computer instructions or computer programs provided in the embodiments of the present application, such as but not limited to the above-mentioned memories, readable storage media, etc., are all non-transitory.
[0149] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer device, the process or function according to the embodiment of the present application is generated in whole or in part. The computer device may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a readable storage medium, or transmitted from one readable storage medium to another readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The readable storage medium may be any available medium that a computer device can access or a data storage device such as a server, a data center, etc. that contains one or more servers that can be integrated with the medium. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), etc.
[0150] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other changes to the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in a claim. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0151] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A size detection method, characterized in that: include: Acquire feature information of the object to be detected in the target image area; The feature information includes the length of the longest diagonal line of the polygonal identification frame of the object to be detected; Determine the length of a target line segment according to the vertex position of the target image area; the target line segment passes through the target position, and the two end points are respectively located on two opposite boundaries of the target image area; the target position can represent the position of the object to be detected in the target image area; The endpoints of the target line segment are respectively located at the first boundary and the second boundary of the target image area, and the target line segment is parallel to the third boundary of the target image area; determining the length of the target line segment according to the vertex position of the target image area includes: obtaining a first straight line equation for describing the first boundary, a second straight line equation for describing the second boundary, and a slope of the third boundary according to the vertex coordinates of the target image area; obtaining a target straight line equation for describing the target line segment based on the coordinates of the target position and the slope of the third boundary; determining the coordinates of the intersection of the target straight line equation with the first straight line equation and the second straight line equation to obtain the coordinates of the endpoint of the target line segment; determining the length of the target line segment based on the coordinates of the endpoint of the target line segment; or, The third boundary, the fourth boundary and the target line segment of the target image area are parallel, and the third boundary is opposite to the fourth boundary; determining the length of the target line segment according to the vertex position of the target image area comprises: determining the lengths of the third boundary and the fourth boundary according to the vertex coordinates of the target image area; determining the length of the target line segment according to the lengths of the third boundary and the fourth boundary; Based on the difference between the length of the target line segment and the length of the longest diagonal line, a detection result of the object to be detected is determined, and the detection result is used to indicate whether there is an abnormality in the actual size of the object to be detected.
2. The method according to claim 1, characterized in that: The difference includes at least one of the following: a ratio between the length of the diagonal line and the length of the target line segment, and a difference between the length of the diagonal line and the length of the target line segment.
3. The method according to claim 1, characterized in that The feature information also includes the type of the object to be detected; the type of the object to be detected is one of multiple preset types; objects of different preset types have different geometric features and correspond to different preset difference thresholds; the detection result of the object to be detected based on the difference between the length of the target line segment and the length of the longest diagonal line is determined, including: According to the difference being greater than a target difference threshold, it is determined that an actual size of the object to be detected is abnormal; the target difference threshold is a preset difference threshold corresponding to the type of the object to be detected.
4. The method according to claim 1, characterized in that: The target image area is an area in the target image corresponding to the conveyor belt; the first boundary and the second boundary are used to indicate the edge of the conveyor belt.
5. A size detection device, characterized in that: include: Acquisition unit and processing unit; The acquisition unit is used to acquire feature information of the object to be detected in the target image area; The feature information includes the length of the longest diagonal line of the polygonal identification frame of the object to be detected; The processing unit is used to determine the length of a target line segment according to the vertex position of the target image area; the target line segment passes through the target position, and the two end points are respectively located on two opposite boundaries of the target image area; the target position can represent the position of the object to be detected in the target image area; The endpoints of the target line segment are respectively located at the first boundary and the second boundary of the target image area, and the target line segment is parallel to the third boundary of the target image area; determining the length of the target line segment according to the vertex position of the target image area includes: obtaining a first straight line equation for describing the first boundary, a second straight line equation for describing the second boundary, and a slope of the third boundary according to the vertex coordinates of the target image area; obtaining a target straight line equation for describing the target line segment based on the coordinates of the target position and the slope of the third boundary; determining the coordinates of the intersection of the target straight line equation with the first straight line equation and the second straight line equation to obtain the coordinates of the endpoint of the target line segment; determining the length of the target line segment based on the coordinates of the endpoint of the target line segment; or, The third boundary, the fourth boundary and the target line segment of the target image area are parallel, and the third boundary is opposite to the fourth boundary; determining the length of the target line segment according to the vertex position of the target image area comprises: determining the lengths of the third boundary and the fourth boundary according to the vertex coordinates of the target image area; determining the length of the target line segment according to the lengths of the third boundary and the fourth boundary; The processing unit is further used to determine a detection result of the object to be detected based on the difference between the length of the target line segment and the length of the longest diagonal line, wherein the detection result is used to indicate whether there is an abnormality in the actual size of the object to be detected.
6. A computer device, characterized in that: include: processor; The processor is connected to a memory, the memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory, so that the computer device implements the method according to any one of claims 1 to 4.
7. A size detection system, characterized in that: It comprises a computer device and a camera device; the computer device is used to execute the method as described in any one of claims 1 to 4; the camera device is used to collect image information of the conveyor belt.
Citation Information
Patent Citations
Visual detection method for material blockage of belt conveyor in silk making process
CN110033439A
Method for detecting lump coal on coal conveying belt in combination with virtual sample
CN118115919A