Key frame detection method and device, and online detection system

Through the key frame detection method, the key frames in the image frame are quickly screened, which solves the problem that the detection system in the existing technology cannot achieve real-time performance, improves the detection efficiency and accuracy, and meets the needs of rapid internal inspection of the entire machine section.

CN111739045BActive Publication Date: 2024-09-27BOE TECHNOLOGY GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010568305.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-19
Publication Date
2024-09-27
Estimated Expiration
2040-09-27

AI Technical Summary

Technical Problem

The existing inspection system cannot achieve real-time performance, resulting in a large amount of image processing data and a long time-consuming process, which cannot meet the needs of rapid internal inspection of the entire machine section.

Method used

Through the key frame detection method, the image frame to be processed is received, detects whether it contains the target image, obtains the edge detection area corresponding to the target image, and detects the target edge in this area. If detected, it is determined to be a key frame, thereby achieving rapid Filtering and accurate keyframe detection.

Benefits of technology

It achieves fast and accurate key frame detection, reduces the time-consuming of subsequent image processing, meets real-time requirements, and improves detection efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111739045B
    Figure CN111739045B
Patent Text Reader

Abstract

The present disclosure relates to the technical field of image processing, and proposes a key frame detection method and device, and an online detection system. The key frame detection method includes: receiving an image frame to be processed; detecting whether the image frame contains a target image, if the image frame contains a target image, marking it as a target frame, otherwise marking it as a common frame; obtaining an edge detection area corresponding to the target image on the target frame; detecting the target edge in the edge detection area, and determining that the target frame is a key frame if the target edge is detected in the edge detection area. The target frame is detected from the image frame through the target image, and the key frame is detected from the target frame through the target edge. The accuracy of the key frame detection is ensured through two screenings; after obtaining an accurate key frame, the subsequent image processing is faster, time-consuming, and real-time requirements are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of image processing, and in particular to a key frame detection method and a key frame detection device, and an online detection system. Background Art

[0002] At present, the assembly lines of consumer electronic products such as televisions and computers are mainly operated manually, so there are irregular operations or errors and omissions, and the installed products need to be inspected. Most production lines use manual inspections, which result in missed inspections and false inspections, which in turn cause a decrease in product yield and increase labor costs. Manufacturers also urgently need to adopt a computer vision-based inspection system to automatically perform a rapid internal inspection of the entire machine, including whether the port insertion, motherboard screws, and tape attachment are intact, and replace manual inspections with automated equipment to achieve the purpose of saving manpower, improving quality, and increasing automation. In addition, it can automatically record information such as the time and batch of defects, which facilitates the production line to discover potential problems and improve yield and efficiency. Therefore, the demand for internal inspection is becoming increasingly urgent.

[0003] However, the existing detection system does not perform key frame detection, which makes the subsequent image processing data huge and time-consuming, and fails to meet the real-time requirements.

[0004] Therefore, it is necessary to study a key frame detection method and a key frame detection device and an online detection system.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0006] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art that cannot meet the real-time requirements, and to provide a key frame detection method and a key frame detection device, and an online detection system that meet the real-time requirements.

[0007] According to one aspect of the present disclosure, a key frame detection method is provided, comprising:

[0008] receiving an image frame to be processed;

[0009] Detecting whether the image frame contains a target image, if the image frame contains the target image, marking it as a target frame, otherwise marking it as a common frame;

[0010] Acquire an edge detection region corresponding to the target image on the target frame;

[0011] The target edge is detected in the edge detection area, and if the target edge is detected in the edge detection area, the target frame is determined to be a key frame.

[0012] In an exemplary embodiment of the present disclosure, acquiring an edge detection area corresponding to the target image in the target frame includes:

[0013] Acquire a target point on the target image, and acquire a target distance from the target point to the target edge in a first direction;

[0014] Obtaining the maximum allowable rotation angle of the product to be inspected in the second direction;

[0015] Determine a determination point of the edge detection area according to the target point, the target distance and the maximum allowable rotation angle;

[0016] Determine a determination straight line of the edge detection area according to the determination point and the maximum allowable rotation angle;

[0017] Determine the edge detection area according to the determined straight line and the target frame;

[0018] The first direction is perpendicular to the second direction.

[0019] In an exemplary embodiment of the present disclosure, determining a determination point of the edge detection area according to the target point, the target distance and the maximum allowable rotation angle includes:

[0020] The distance between the determined point and the target point in the first direction is L / cosθ, where L is the target distance, θ is the maximum allowable rotation angle, and the determined point is located on a side of the target point close to the target edge.

[0021] In an exemplary embodiment of the present disclosure, determining the determination straight line of the edge detection area according to the determination point and the maximum allowable rotation angle includes:

[0022] The determined straight lines are two straight lines that pass through the determined points and have the maximum allowable rotation angle with the second direction.

[0023] In an exemplary embodiment of the present disclosure, determining the edge detection area according to the determined straight line and the target frame includes:

[0024] Obtaining four intersection points of the determined straight line and the boundary of the target frame;

[0025] Determine a point of the four intersection points that has the shortest distance from the target point in the first direction as a first intersection point, and determine a straight line that passes through the first intersection point and is parallel to the second direction as a first boundary line;

[0026] Determine the point of the four intersection points that has the largest distance from the target point in the first direction as a second intersection point, and determine a straight line that passes through the second intersection point and is parallel to the second direction as a second boundary line;

[0027] An area enclosed by the first boundary line, the second boundary line, and a boundary of the target frame in a first direction is marked as the edge detection area.

[0028] In an exemplary embodiment of the present disclosure, the target edge is the edge of the product to be detected; the target point is the center point of the target image, any point on the center axis, or a corner point.

[0029] In an exemplary embodiment of the present disclosure, detecting an edge of a target in the edge detection area includes:

[0030] Performing edge detection using a canny operator in the edge detection area to obtain an edge image;

[0031] Performing Hough transform on the edge image to obtain a plurality of straight lines;

[0032] A straight line whose angle with the second direction is less than or equal to the maximum allowable rotation angle is determined as a target edge.

[0033] In an exemplary embodiment of the present disclosure, before detecting whether the image frame contains the target image, the key frame detection method further includes:

[0034] Selecting a target area in the image frame;

[0035] It is detected whether the target area contains a target image.

[0036] According to one aspect of the present disclosure, a key frame detection device is provided, comprising:

[0037] A receiving subcircuit, used for receiving an image frame to be processed;

[0038] A target frame determination subcircuit is used to detect whether the image frame contains a target image, and if the image frame contains the target image, it is marked as a target frame, otherwise it is marked as a common frame;

[0039] An edge detection region determination subcircuit, used for acquiring an edge detection region corresponding to the target image on the target frame;

[0040] The key frame determination subcircuit is used to detect the target edge in the edge detection area, and if the target edge is detected in the edge detection area, determine that the target frame is a key frame.

[0041] According to one aspect of the present disclosure, there is provided an online detection system, comprising:

[0042] An image acquisition device, used for acquiring the original image of the product to be inspected in real time;

[0043] A processor is electrically connected to the image acquisition device, and the processor is used to detect key frames according to any one of the key frame detection methods described above, and process the key frames.

[0044] The key frame detection method disclosed in the present invention marks an image frame containing a target image as a target frame, obtains an edge detection area corresponding to the target image on the target frame, detects the target edge in the edge detection area, and determines that the target frame is a key frame if the target edge is detected in the edge detection area. On the one hand, the target frame is detected from the image frame through the target image, and the key frame is detected from the target frame through the target edge. The accuracy of the key frame detection is ensured through two screenings; on the other hand, after obtaining an accurate key frame, the subsequent image processing is faster, time-consuming, and real-time requirements are met.

[0045] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0047] Figure 1 A flowchart of an example implementation of a key frame detection method is schematically shown.

[0048] Figure 2 A schematic diagram schematically shows an example implementation of obtaining an edge detection area in a key frame detection method.

[0049] Figure 3 A principle diagram schematically illustrates another example implementation of obtaining an edge detection area in a key frame detection method.

[0050] Figure 4 A principle diagram schematically illustrates another example implementation of obtaining an edge detection area in a key frame detection method.

[0051] Figure 5 The result diagram obtained by edge detection using the Canny operator is schematically shown.

[0052] Figure 6 Schematically showing the corresponding Figure 5 Detection result diagram of the straight line where the target edge is located.

[0053] Figure 7 A photograph schematically shows an example implementation of obtaining an edge detection area in a key frame detection method.

[0054] Figure 8 Schematically showing the corresponding Figure 7 The result image obtained by edge detection using the canny operator.

[0055] Fig. 9 Schematically showing the corresponding Figure 7 Detection result diagram of the straight line where the target edge is located.

[0056] Fig.10 A photograph schematically shows another example implementation of obtaining an edge detection area in a key frame detection method.

[0057] Fig.11 Schematically showing the corresponding Fig.10 The result image obtained by edge detection using the canny operator.

[0058] Fig.12 Schematically showing the corresponding Fig.10 Detection result diagram of the straight line where the target edge is located.

[0059] Fig.13 A block diagram schematically shows an example implementation of a key frame detection device.

[0060] Fig.14 A structural diagram of an example implementation of an online detection system is schematically shown. DETAILED DESCRIPTION

[0061] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0062] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0063] In the process of introspection inspection based on computer vision technology, if each frame is fully processed, the subsequent image processing is very time-consuming and cannot meet the real-time requirements. Therefore, the first step is to detect the key frame, that is, the product is located in a specific position range of the image before subsequent image processing is required. Because key frame detection is performed on each frame of the image, the speed of key frame detection is very high.

[0064] At the same time, if a key frame is missed, the product may have left the specific position range in the next frame image, which will cause the product to flow without internal inspection. If a non-key frame is treated as a key frame and subsequent image processing is performed, not only will error information be generated, but the real key frame will also be missed, causing the product to flow without internal inspection. Therefore, as an important part of internal inspection, key frame detection requires not only high speed but also high accuracy.

[0065] In this example implementation, a key frame detection method is first provided. Figure 1 As shown, the key frame detection method may include the following steps:

[0066] Step S10, receiving an image frame to be processed.

[0067] Step S20, detecting whether the image frame contains the target image RT, if the image frame 1 contains the target image RT, it is marked as the target frame 1, otherwise it is marked as a common frame.

[0068] Step S30 , obtaining an edge detection region ROI corresponding to the target image RT on the target frame 1 .

[0069] Step S40 , detecting a target edge M in the edge detection region ROI. If a target edge is detected in the edge detection region ROI, determining the target frame 1 as a key frame.

[0070] According to the key frame detection method in this example embodiment, on the one hand, the target frame 1 is detected from the image frame through the target image RT, and the key frame is detected from the target frame 1 through the target edge M, thereby ensuring the accuracy of the key frame detection; on the other hand, after obtaining the accurate key frame, the subsequent image processing is faster, the time consumption is reduced, and the real-time requirements are met.

[0071] The key frame detection method in this example implementation will be further described below.

[0072] Step S10, receiving an image frame to be processed.

[0073] In this example implementation, the image frame may be a photo taken by a camera or an image taken by a video camera. Both the photo and the image are not processed in any way. That is, the photo taken by a camera or the image taken by a video camera is received.

[0074] In this example implementation, photos can be directly received without the need to split the photos. In other example implementations of the present invention, images taken by a camera can also be used, in which case the images need to be split. That is, the original image is split into independent image frames in a preset order. The preset order can be a time sequence, with the first shot placed in front and the later shot placed in the back, and subsequent processing is also in time sequence. The time sequence includes multiple moments, and the interval time between two adjacent moments can be in the millisecond level, and the image at each moment is an independent image frame. That is, the original image is split into independent image frames in time sequence.

[0075] In addition, in this example implementation, in order to improve the processing speed and reduce the unmatched rate, before detecting whether the target image RT is included in the image frame, a target area can be selected in the image frame; and whether the target image RT is included in the target area is detected. The process of selecting the target area is: first obtain the lower edge of the product 13 to be detected in the image frame, and the lower edge of the product 13 to be detected is less than 100 pixels from the edge of the image frame; then take the lower edge as the starting position and move the target distance in the first direction toward the center of the image frame to form the center line of the target area. The area within the set distance on both sides of the center line is the target area, and the set distance is greater than the length of the target image RT in the first direction. Of course, it is also possible not to set the target area, but to match the target image RT in the entire image frame. The target area can also be determined by the left edge, the right edge or the upper edge.

[0076] Step S20 , detecting whether the image frame includes a target image RT, if the image frame includes the target image RT, marking it as a target frame 1 , otherwise marking it as a common frame.

[0077] In this example embodiment, the shape of the target image RT may be a square. The color or texture of the target image RT and its adjacent parts may be different, and there may be a large difference. For example, the color of the target image RT may be black, and the color of the part adjacent to the target image RT may be white or light gray, etc.; the color of the target image RT may be red, and the color of the part adjacent to the target image RT may be green or blue, etc. The material of the target image RT may be metal, and the material of the part adjacent to the target image RT may be plastic, etc. Metal has the property of reflecting light, while plastic does not, and the target image RT is easily identified from the image frame. In addition, it can be understood that in other example embodiments of the present invention, the shape of the target image RT may also be circular, elliptical, etc.

[0078] The target image RT can be manually selected from the standard image, and the process of acquiring the standard image may include: placing the product 13 to be inspected on the conveyor belt 14, and making the edge of the product 13 to be inspected parallel to the edge of the conveyor belt 14; taking a standard image of the product 13 to be inspected directly above the product 13 to be inspected, and the standard image contains not only the target image RT but also at least one edge of the product 13 to be inspected; the staff selects the target image RT and an edge in the standard image as the target edge M. In this example embodiment, the lower edge can be selected as the target edge M.

[0079] The specific process of detecting whether the target image RT is included in the image frame can be: the image frame can be divided into multiple overlapping sub-images, and the interval between two adjacent overlapping sub-images is 1, 2 or 3 pixels. The intervals between the upper and lower adjacent or the left and right adjacent can be the same, or of course different. Then, on the image frame, the matching degree between the target image RT and each overlapping sub-image is calculated from left to right and from top to bottom. The greater the matching degree, the greater the possibility that the two are the same. A matching degree threshold can be set. If the matching degree between the target image RT and the overlapping sub-image is greater than or equal to the matching degree threshold, the overlapping sub-image is considered to be the target image RT; conversely, if the matching degree between the target image RT and the overlapping sub-image is less than the matching degree threshold, the overlapping sub-image is considered not to be the target image RT. However, if the threshold is set too small, it is easy to obtain multiple target images RT; if the threshold is set too large, it is easy to miss the image frame that originally includes the target image RT, thereby causing misjudgment.

[0080] Detecting whether the target image RT is included in the image frame is to detect whether there is an overlapping sub-image in the image frame whose matching degree with the target image RT exceeds the matching degree threshold. If yes, it is determined that the image frame contains the target image RT; if not, it is determined that the image frame does not contain the target image RT. If the image frame contains the target image RT, it is marked as target frame 1 and the next step of processing is performed; otherwise, it is marked as a normal frame and the next step of image processing is not performed on the image frame.

[0081] Step S30 , obtaining an edge detection region ROI corresponding to the target image RT on the target frame 1 .

[0082] Reference Figure 2 , Figure 3 and Figure 4 shown.

[0083] In this example embodiment, first, a target point C may be acquired on the target image RT, and a target distance L from the target point C to the target edge M in the first direction may be acquired.

[0084] The target point C can be the center point of the target image RT, and the target edge M can be the edge of the frame of the product 13 to be detected that is away from the target image RT, for example, the lower edge, of course, it can also be the upper edge, or the left edge or the right edge. The lower edge has the same maximum allowable rotation angle as the upper edge, and the left edge and the right edge also have the same maximum allowable rotation angle as the lower edge, but the directions are perpendicular to each other. The first direction can be a direction perpendicular to the lower edge, that is, the first direction can be the up and down direction of the target image RT. In addition, it can be understood that the target point C can be a corner point of the target image RT or any point on the center line, etc., as long as it is easy to identify from the target image RT.

[0085] The center point of the target image RT can be obtained on the target image RT, and then the target distance L from the target point C to the lower edge in the first direction can be obtained. The target distance L can be stored in advance. After the above-mentioned staff selects the target image RT and the target edge M in the standard image, the target distance L from the target point C to the target edge M in the first direction can be calculated and stored in advance. It can be directly called when used.

[0086] Then obtain the maximum allowable rotation angle θ of the product to be tested 13 in the second direction. The maximum allowable rotation angle θ is determined by the requirements of the conveyor belt 14. Since the product to be tested is placed on the conveyor belt 14 during the product production process, the edge of the product to be tested cannot be completely parallel to the edge of the assembly line, but is slightly inclined at a certain angle, and the conveyor belt 14 has a limit on the angle. The conveyor belt 14 requires that the maximum allowable angle between the edge of the product to be tested 13 and the edge of the conveyor belt 14 is the maximum allowable rotation angle θ, and the maximum allowable rotation angle θ is less than or equal to 10 degrees.

[0087] The first direction is perpendicular to the second direction. That is, the second direction can be the left and right direction of the target image RT, such as Figure 2 Of course, the first direction and the second direction can also be set oppositely.

[0088] Then, the determination point P of the edge detection area ROI is determined according to the target point C, the target distance and the maximum allowable rotation angle θ.

[0089] In this example embodiment, the distance between the determination point P and the target point C in the first direction is L / cosθ, where L is the target distance and θ is the maximum allowable rotation angle, and the determination point P is located on the side of the target point C close to the target edge M. After the product to be tested is placed tilted, the target edge M will be tilted instead of being parallel to the second direction.

[0090] Next, a determination straight line of the edge detection region ROI is determined according to the determination point P and the maximum allowable rotation angle θ.

[0091] In this example embodiment, the determined straight lines are two straight lines passing through the determined point P and having a maximum allowable rotation angle θ with the second direction. That is, the determined straight lines are two, namely the first determined straight line Q1 and the second determined straight line Q2. The first determined straight line Q1 is obtained by rotating the straight line extending along the second direction from the determined point P by an angle of θ, and the second determined straight line Q2 is obtained by rotating the straight line extending along the second direction from the determined point P by an angle of -θ. Counterclockwise rotation is a positive angle, and clockwise rotation is a negative angle. Since the conveyor belt 14 requires the maximum allowable rotation angle between the edge of the product 13 to be detected and the edge of the conveyor belt 14 to be θ, the edge of the product 13 to be detected must be within the range of -θ to θ.

[0092] Thirdly, the edge detection region ROI is determined according to the determined straight line and the target frame 1 .

[0093] In this example embodiment, four intersection points of the determined straight line and the edge of the target frame 1 can be obtained; the point among the four intersection points that has the shortest distance from the target point C in the first direction can be determined as the first intersection point J1, and the straight line passing through the first intersection point J1 and parallel to the second direction can be determined as the first boundary line B1.

[0094] The point of the four intersection points that is the farthest from the target point C in the first direction may be determined as the second intersection point J2, and a straight line passing through the second intersection point J2 and parallel to the second direction may be determined as the second boundary line B2.

[0095] The area enclosed by the first boundary line B1, the second boundary line B2 and the boundary of the target frame 1 in the first direction is marked as an edge detection area ROI.

[0096] Since the target image RT may be in any area of ​​the target frame 1 , the determination of the edge detection area ROI is specifically described below through three exemplary implementations.

[0097] Reference Figure 2As shown, the first determined straight line Q1 has two intersections with the edge of the target frame 1, which are respectively the intersections formed by the intersection with the lower edge and the right edge of the target frame 1. The second determined straight line Q2 also has two intersections with the edge of the target frame 1, which are respectively the intersections formed by the intersection with the lower edge and the left edge of the target frame 1. Among the four intersections, the intersection formed by the intersection of the second determined straight line Q2 and the left edge of the target frame 1 has the smallest distance from the target point C in the first direction, so this point is determined to be the first intersection J1. Since both the first determined straight line Q1 and the second determined straight line Q2 intersect with the lower edge of the target frame 1, the distance between the intersection of the first determined straight line Q1 and the lower edge of the target frame 1 and the intersection of the second determined straight line Q2 and the lower edge of the target frame 1 and the target point C in the first direction is the same, both of which are the largest, and any one of them can be selected as the second intersection J2.

[0098] The first boundary line B1 is a straight line passing through the first intersection J1 and parallel to the second direction. Since the second intersection J2 is located on the lower edge of the target frame 1, the lower edge of the target frame 1 is parallel to the second direction, and therefore, the second boundary line B2 is the lower edge of the target frame 1. The area enclosed by the first boundary line B1, the second boundary line B2 and the boundary of the target frame 1 in the first direction is determined to be the edge detection area ROI, that is, the area occupied by the dotted shadow in the figure is the edge detection area ROI.

[0099] Reference Figure 3 As shown, the first determined straight line Q1 has two intersections with the edge of the target frame 1, which are respectively the intersections formed by the intersection with the left edge and the right edge of the target frame 1. The second determined straight line Q2 also has two intersections with the edge of the target frame 1, which are respectively the intersections formed by the intersection with the lower edge and the left edge of the target frame 1. Among the four intersections, the intersection formed by the intersection of the first determined straight line Q1 and the right edge of the target frame 1 has the smallest distance from the target point C in the first direction, so this point is determined to be the first intersection J1. The intersection formed by the intersection of the second determined straight line Q2 and the lower edge of the target frame 1 has the largest distance from the target point C in the first direction, so this point is determined to be the second intersection J2.

[0100] The first boundary line B1 is a straight line passing through the first intersection J1 and parallel to the second direction. Since the second intersection J2 is located on the lower edge of the target frame 1, the lower edge of the target frame 1 is parallel to the second direction, and therefore, the second boundary line B2 is the lower edge of the target frame 1. The area enclosed by the first boundary line B1, the second boundary line B2 and the boundary of the target frame 1 in the first direction is determined to be the edge detection area ROI, that is, the area occupied by the dotted shadow in the figure is the edge detection area ROI.

[0101] Reference Figure 4As shown, the first determined straight line Q1 has two intersections with the edge of the target frame 1, which are respectively the intersections formed by the intersection with the left edge and the right edge of the target frame 1. The second determined straight line Q2 also has two intersections with the edge of the target frame 1, which are respectively the intersections formed by the intersection with the right edge and the left edge of the target frame 1. Among the four intersections, the intersection formed by the intersection of the first determined straight line Q1 and the right edge of the target frame 1 has the smallest distance from the target point C in the first direction, so this point is determined to be the first intersection J1. The intersection formed by the intersection of the second determined straight line Q2 and the right edge of the target frame 1 has the largest distance from the target point C in the first direction, so this point is determined to be the second intersection J2.

[0102] The first boundary line B1 is a straight line passing through the first intersection J1 and parallel to the second direction. The second boundary line B2 is a straight line passing through the second intersection J2 and parallel to the second direction. The area enclosed by the first boundary line B1, the second boundary line B2 and the boundary of the target frame 1 in the first direction is determined as the edge detection area ROI, that is, the area occupied by the dotted shadow in the figure is the edge detection area ROI.

[0103] Step S40 , detecting a target edge M in the edge detection region ROI. If the target edge M is detected in the edge detection region ROI, determining that the target frame 1 is a key frame.

[0104] In this example implementation, detecting the target edge M in the edge detection region ROI may include: first, performing edge detection in the edge detection region ROI using a canny operator to obtain an edge image; referring to Figure 5 The result of edge detection using the Canny operator is shown in the figure. Then, the edge image is subjected to Hough transform to obtain multiple straight lines. The idea of ​​using Hough transform to detect straight lines is: assume n directions of straight lines for each point, usually n = 180, and the angle accuracy of the detected straight line is 1°. Calculate the (r, theta) coordinates of these n straight lines respectively; where r is the distance from the straight line to the origin, and theta is the angle between the perpendicular line of the straight line and the x-axis. Finally, refer to Figure 6 The corresponding Figure 5 Detection result diagram of the straight line where the target edge is located. The straight line whose angle with the second direction is between -θ and θ is determined as the target edge M, that is, the straight line whose angle with the second direction is less than or equal to the maximum allowable rotation angle is determined as the target edge M.

[0105] If the target edge M is detected in the edge detection region ROI, the target frame 1 is determined to be a key frame. Otherwise, if the target edge M is not detected in the edge detection region ROI, the target frame 1 is determined not to be a key frame, and subsequent image processing is not performed on the target frame 1.

[0106] Figure 7-9 shows an example of successful keyframe detection, in Figure 7 The edge detection region ROI is marked in Figure 8 The Figure 7 The edge detection area ROI in the image is obtained by using the canny operator to perform edge detection. Figure 8 It can be seen that the target edge M can be detected. Fig. 9 The detection result diagram of the straight line where the target edge M is located can be seen in the figure.

[0107] Figure 10-12 shows an example of a keyframe failure detection in Fig.10 The edge detection region ROI is marked in Fig.11 The Fig.10 The edge detection area ROI in the image is obtained by using the canny operator to perform edge detection. Fig.11 It can be seen that no target edge M is detected. Therefore, in Fig.12 The detection result graph of the straight line where the target edge M is located cannot be seen.

[0108] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0109] Furthermore, this exemplary embodiment also provides a key frame detection device corresponding to the above key frame detection method. Fig.13 As shown, the key frame detection device may include a receiving subcircuit 5, a target frame determination subcircuit 7, an edge detection area determination subcircuit 8 and a key frame determination subcircuit 9; the receiving subcircuit 5 can be used to receive an image frame to be processed; the target frame determination subcircuit 7 can be used to detect whether the image frame contains a target image RT, if the image frame contains the target image RT, it is marked as a target frame 1, otherwise it is marked as an ordinary frame; the edge detection area determination subcircuit 8 can be used to obtain an edge detection area ROI corresponding to the target image RT on the target frame 1; the key frame determination subcircuit 9 can be used to detect a target edge M in the edge detection area ROI, if the target edge M is detected in the edge detection area ROI, the target frame 1 is determined to be a key frame.

[0110] The specific details of each module in the above key frame detection device have been described in detail in the corresponding key frame detection method, so they will not be repeated here.

[0111] Compared with the prior art, the beneficial effects of the key frame detection device provided by the embodiment of the present invention are the same as the beneficial effects of the key frame detection method provided by the above embodiment, which will not be described in detail here.

[0112] Furthermore, this exemplary embodiment also provides an online detection system, referring to Fig.14 As shown, the online detection system may include a light source 10, an image acquisition device 11 and a processor 12; the light source 10 may be a surface light source, which is arranged around the image acquisition device 11 to provide a uniform light source for the image acquisition device 11. The image acquisition device 11 may be an industrial camera, an industrial video camera, etc. The image acquisition device 11 may be used to collect the original image of the product to be detected 13 in real time. The processor 12 may be a device with an image processing function such as an industrial computer and a workstation, and the processor 12 is electrically connected to the image acquisition device 11. The processor 12 may be used to detect key frames according to any of the key frame detection methods described above and process the key frames.

[0113] Compared with the prior art, the beneficial effects of the online detection system provided by the embodiment of the present invention are the same as the beneficial effects of the key frame detection method provided by the above embodiment, which will not be described in detail here.

[0114] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0115] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0116] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.

Claims

1. A key frame detection method, It is characterized in that include: receiving an image frame to be processed; Detecting whether the image frame contains a target image, if the image frame contains the target image, marking it as a target frame, otherwise marking it as a common frame; Acquire an edge detection region corresponding to the target image on the target frame; Detecting a target edge in the edge detection area, and if the target edge is detected in the edge detection area, determining the target frame as a key frame; Acquiring an edge detection region corresponding to the target image on the target frame includes: Acquire a target point on the target image, and acquire a target distance from the target point to the target edge in a first direction; Obtaining the maximum allowable rotation angle of the product to be inspected in the second direction; Determine a determination point of the edge detection area according to the target point, the target distance and the maximum allowable rotation angle; Determine a determination straight line of the edge detection area according to the determination point and the maximum allowable rotation angle; Determine the edge detection area according to the determined straight line and the target frame; The first direction is perpendicular to the second direction.

2. The key frame detection method according to claim 1, It is characterized in that Determining a determination point of the edge detection area according to the target point, the target distance and the maximum allowable rotation angle includes: The distance between the determined point and the target point in the first direction is L / cosθ, where L is the target distance, θ is the maximum allowable rotation angle, and the determined point is located on a side of the target point close to the target edge.

3. The key frame detection method according to claim 2, It is characterized in that Determining the determination straight line of the edge detection area according to the determination point and the maximum allowable rotation angle includes: The determined straight lines are two straight lines that pass through the determined points and have the maximum allowable rotation angle with the second direction.

4. The key frame detection method according to claim 3, It is characterized in that Determining the edge detection area according to the determined straight line and the target frame includes: Obtaining four intersection points of the determined straight line and the boundary of the target frame; Determine a point of the four intersection points that has the shortest distance from the target point in the first direction as a first intersection point, and determine a straight line that passes through the first intersection point and is parallel to the second direction as a first boundary line; Determine the point of the four intersection points that has the largest distance from the target point in the first direction as a second intersection point, and determine a straight line passing through the second intersection point and parallel to the second direction as a second boundary line; An area enclosed by the first boundary line, the second boundary line, and a boundary of the target frame in a first direction is marked as the edge detection area.

5. The key frame detection method according to claim 1, It is characterized in that The target edge is the edge of the product to be detected; the target point is the center point of the target image, any point on the center axis, or a corner point.

6. The key frame detection method according to claim 1, It is characterized in that Detecting the edge of the target in the edge detection area includes: Performing edge detection in the edge detection area using a canny operator to obtain an edge image; Performing Hough transform on the edge image to obtain a plurality of straight lines; A straight line whose angle with the second direction is less than or equal to the maximum allowable rotation angle is determined as a target edge.

7. The key frame detection method according to claim 1, It is characterized in that Before detecting whether the image frame contains the target image, the key frame detection method further includes: Selecting a target area in the image frame; It is detected whether the target area contains a target image.

8. An online detection system, It is characterized in that include: An image acquisition device, used for acquiring the original image of the product to be inspected in real time; A processor is electrically connected to the image acquisition device, and is used to detect key frames according to the key frame detection method according to any one of claims 1 to 7, and process the key frames.