A method and system for reducing visual detection offset in variable speed sports
By calculating the judgment variable of the operating status of the device and detecting the offset compensation coefficient K, the offset of visual detection in variable speed motion is calculated and compensated, which solves the problem of visual detection offset in variable speed motion, and improves the detection accuracy and positioning accuracy.
Patent Information
- Application Number
- CN202210489743.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-06
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2042-05-06
AI Technical Summary
In variable speed movement, visual inspection results in visual deviation due to changes in the operating speed of the equipment, which easily leads to missed detection or reduced detection, reducing the accuracy of visual inspection.
By collecting the encoder value, calculating the operating state of the device, obtaining the detection offset compensation coefficient K, and calculates the detection offset based on the operating state of the device and the reference coordinates, and adds it to the reference coordinates to obtain a new reference coordinate for detection.
The offset fluctuation of visual detection during variable speed motion is reduced, the detection positioning accuracy is improved, the time error is reduced, and the detection accuracy is improved.
Smart Images

Figure CN114782393B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of visual detection technology and cigarette equipment, and in particular relates to a method and system for reducing the offset of visual detection in variable speed motion. Background Art
[0002] Mature visual inspection technology is widely used in industrial production. The triggering of visual inspection is divided into external trigger (hard trigger) and internal trigger (soft trigger). In practical applications, when hard trigger is used for visual inspection, there is a certain time difference between the sum of the external optical fiber detection time and the camera shooting time; if soft trigger is used, the encoder signal of the acquisition device is generally used as the soft trigger signal. At this time, there is also a certain time difference between the acquisition encoder signal, program execution time and camera shooting time. Whether hard trigger or soft trigger is used, there is a time difference. Although the time difference is very short, the device is in motion and the speed of the object being detected is fast, which leads to position offset when the object is photographed. When the device is running at a constant speed, the effects of hard trigger and soft trigger are basically the same, and the visual inspection offset of the object being detected is basically the same and small; when the device is in variable speed motion, the visual inspection of the two trigger detections will have a certain offset. In variable speed motion, due to the change in the running speed of the equipment, the product images taken have a certain degree of visual offset, which is easy to cause false rejection or missed detection, greatly reducing the accuracy of visual inspection, especially in the frequent variable speed motion of the equipment, this offset phenomenon of visual inspection is more obvious.
[0003] At present, the most mature positioning technology in visual detection is image matching technology. Image matching often uses correlation coefficient template matching algorithm. Its algorithm logic is as follows Figure 3 shown.
[0004] Disadvantages of existing technology:
[0005] (1) The image matching algorithm performs binary processing on the image in the target area and normalizes the image feature template, so the image matching calculation is large and the matching time is long. During the detection, if there are too many detection windows for image matching, the detection processing time will be increased, which may easily lead to problems such as the detection processing controller freezing and detection stuck.
[0006] (2) During variable speed motion, the detection offset fluctuates dramatically, and the image matching operation time increases, which can easily lead to a decrease in image matching accuracy and reduce the effect of visual inspection, thereby increasing product quality risks. Summary of the invention
[0007] In order to solve the above technical problems, the present invention proposes a method and system for reducing the visual detection offset in variable speed motion to solve the above technical problems.
[0008] A first aspect of the present invention discloses a method for reducing visual detection offset in variable speed motion, the method comprising:
[0009] Step S1, collecting the encoder value A0 in one cycle and the value A1 in the next cycle;
[0010] Step S2, using the value A0 of the set encoder in one cycle and the value A1 in the next cycle to calculate the judgment variable of the running state of the equipment;
[0011] Step S3, applying the judgment variable and the value A0 within the one cycle to calculate a detection offset compensation coefficient K;
[0012] Step S4, judging the operating state of the equipment according to the judgment variable;
[0013] Step S5, according to the running state of the device, applying the detection offset compensation coefficient K and the reference coordinates (X0, Y0) to calculate the detection offset;
[0014] Step S6: Add the reference coordinate to the detection offset to obtain a new reference coordinate.
[0015] According to the method of the first aspect of the present invention, in step S2, the method of applying the value A0 of the set encoder in one cycle and the value A1 in the next cycle to calculate the judgment variable of the operating state of the device includes:
[0016] The value A0 in the one cycle is subtracted from the value A1 in the next cycle to obtain a judgment variable ΔA of the operating state of the device, that is, ΔA=A1-A0.
[0017] According to the method of the first aspect of the present invention, in step S3, the method of calculating the detection offset compensation coefficient K by applying the judgment variable and the value A0 within one cycle includes:
[0018] The determination variable ΔA is divided by the value A0 within the period, and then the result is negative to obtain the detection offset compensation coefficient K, that is, K=-ΔA / A0.
[0019] According to the method of the first aspect of the present invention, in step S4, the method of judging the operating state of the device according to the judgment variable includes:
[0020] If △A=0, it means A1=A0, and the device is in uniform motion;
[0021] If △A>0, it means A1>A0, and the device is in an accelerated motion state;
[0022] If △A<0, it means A1<A0, and the device is in a deceleration motion state.
[0023] According to the method of the first aspect of the present invention, in step S5, in the accelerated motion state, the method for calculating the detection offset includes:
[0024] The captured image is offset backward relative to the standard image, the detection offset compensation coefficient K is less than 0, and the detection offset is: △X=X0*K.
[0025] According to the method of the first aspect of the present invention, in step S5, in the deceleration motion state, the method for calculating the detection offset includes:
[0026] The captured image is shifted forward relative to the standard image, the detection shift compensation coefficient K>0, and the detection shift amount is: △X=X0*K.
[0027] According to the method of the first aspect of the present invention, in step S5, since the image only has an offset in the X-axis direction, the offset in the Y-axis direction is not calculated.
[0028] A second aspect of the present invention discloses a system for reducing visual detection offset in variable speed motion, the system comprising:
[0029] The first processing module is configured to collect the value A0 of the encoder in one cycle and the value A1 in the next cycle;
[0030] A second processing module is configured to calculate a judgment variable of the running state of the device by applying the value A0 of the set encoder in one cycle and the value A1 in the next cycle;
[0031] A third processing module is configured to calculate a detection offset compensation coefficient K by applying the judgment variable and the value A0 within the one cycle;
[0032] A fourth processing module is configured to determine the operating state of the device according to the determination variable;
[0033] A fifth processing module is configured to calculate a detection offset by applying the detection offset compensation coefficient K and the reference coordinates (X0, Y0) according to the operating state of the device;
[0034] The sixth processing module is configured to add the reference coordinate and the detection offset to obtain a new reference coordinate.
[0035] The third aspect of the present invention discloses an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps in any one of the methods for reducing visual detection offset in variable speed motion in the first aspect of the present disclosure are implemented.
[0036] The fourth aspect of the present invention discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the methods for reducing visual detection offset in variable speed motion in the first aspect of the present disclosure.
[0037] The solution proposed in the present invention performs detection offset compensation calculation based on the judgment of the equipment operation status, and according to the image feature matching tracking and positioning method, locates the feature pattern, and uses this coordinate as the reference coordinate, and performs offset calculation according to the calculated offset coefficient. The remaining detection frames are tracked and positioned according to the feature image coordinates, thereby reducing offset fluctuations and improving the detection and positioning accuracy of visual detection in variable speed motion. At the same time, an interrupt triggering signal for photographing is added to reduce the time error generated from triggering to completion of photographing. The shorter the time error, the less influence it is affected by the equipment operation speed, and the smaller the image offset is, which has a certain improvement and promotion effect on the detection accuracy of visual detection in variable speed motion. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A flowchart of a method for reducing visual detection offset in variable speed motion according to an embodiment of the present invention;
[0040] Figure 2 A logic diagram for determining the motion state and offset coefficient of a device according to an embodiment of the present invention;
[0041] Figure 3 A basic logic diagram of an image template matching algorithm according to background technology;
[0042] Figure 4 A structural diagram of a system for reducing visual detection offset in variable speed motion according to an embodiment of the present invention;
[0043] Figure 5 The figure is a structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0045] A first aspect of the present invention discloses a method for reducing visual detection offset in variable speed motion. Figure 1 FIG. 4 is a flow chart of a method for reducing visual detection offset in variable speed motion according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0046] Step S1, collecting the value A0 of the encoder in one cycle and the value A1 in the next cycle;
[0047] Step S2, using the value A0 of the set encoder in one cycle and the value A1 in the next cycle to calculate the judgment variable of the running state of the equipment;
[0048] Step S3, applying the judgment variable and the value A0 within the one cycle to calculate a detection offset compensation coefficient K;
[0049] Step S4, judging the operating state of the equipment according to the judgment variable;
[0050] Step S5, according to the running state of the device, applying the detection offset compensation coefficient K and the reference coordinates (X0, Y0) to calculate the detection offset;
[0051] Step S6: Add the reference coordinate to the detection offset to obtain a new reference coordinate.
[0052] In step S2, the value A0 of the set encoder in one cycle and the value A1 in the next cycle are used to calculate the judgment variable of the running state of the equipment.
[0053] In some embodiments, Figure 2 As shown, in the step S2, the method of applying the value A0 of the set encoder in one cycle and the value A1 in the next cycle to calculate the judgment variable of the running state of the device includes:
[0054] The value A0 in the one cycle is subtracted from the value A1 in the next cycle to obtain a judgment variable ΔA of the operating state of the device, that is, ΔA=A1-A0.
[0055] In step S3, the detection offset compensation coefficient K is calculated by applying the judgment variable and the value A0 within the one cycle.
[0056] In some embodiments, Figure 2 As shown, in the step S3, the method of applying the judgment variable and the value A0 within one cycle to calculate the detection offset compensation coefficient K includes:
[0057] The determination variable ΔA is divided by the value A0 within the period, and then the result is negative to obtain the detection offset compensation coefficient K, that is, K=-ΔA / A0.
[0058] In step S4, the operating state of the device is determined based on the determination variable.
[0059] In some embodiments, Figure 2 As shown, in the step S4, the method for judging the operating state of the device according to the judgment variable includes:
[0060] If △A=0, it means A1=A0, and the device is in uniform motion;
[0061] If △A>0, it means A1>A0, and the device is in an accelerated motion state;
[0062] If △A<0, it means A1<A0, and the device is in a deceleration motion state.
[0063] In step S5, according to the operating state of the device, the detection offset compensation coefficient K and the reference coordinates (X0, Y0) are applied to calculate the detection offset.
[0064] In some embodiments, in step S5, in order to reduce the offset of visual detection in variable speed motion, the offset △X in the acceleration and deceleration motion of the device is compensated by a proportional coefficient, and the characteristic image coordinates of the image are used as the reference coordinates (X0, Y0). Since the image only has an offset in the X direction, the offset in the Y direction is not calculated;
[0065] In the accelerated motion state, the method for calculating the detection offset includes:
[0066] The captured image is offset backward relative to the standard image, the detection offset compensation coefficient K is less than 0, and the detection offset is: △X=X0*K.
[0067] In the deceleration motion state, the method for calculating the detection offset includes:
[0068] The captured image is shifted forward relative to the standard image, the detection shift compensation coefficient K>0, and the detection shift amount is: △X=X0*K.
[0069] In step S6, the reference coordinate is added to the detection offset to obtain the reference coordinate.
[0070] Specifically, the pattern feature position coordinates are used as reference coordinates (X0, Y0), and the reference coordinates (X0+△X, Y0) are calculated for detection offset compensation according to the motion state of the device. Other detection frames are tracked and positioned with the pattern feature position coordinates as reference coordinates. By following the position coordinates, the fluctuation of detection offset under variable speed motion is reduced, thereby improving the accuracy of detection. At the same time, an interrupt trigger photography pulse signal is added. This signal will not be affected by the program scanning time, thereby reducing the time error from triggering to completion of photography. The shorter the time error, the less influence it is affected by the running speed of the device and the smaller the image offset.
[0071] In summary, the scheme proposed in the present invention can perform detection offset compensation calculation based on the judgment of the equipment operation status. According to the image feature matching tracking and positioning method, the feature pattern is positioned, and this coordinate is used as the reference coordinate, and the offset calculation is performed according to the calculated offset coefficient. The remaining detection frames are tracked and positioned according to the feature image coordinates, thereby reducing the offset fluctuation and improving the detection and positioning accuracy of visual detection in variable speed motion; at the same time, an interrupt trigger photo signal is added to reduce the time error generated from triggering to completion of photo taking. The shorter the time error, the less influence it is affected by the equipment operation speed, and the smaller the image offset is, which has a certain improvement and promotion effect on the detection accuracy of visual detection in variable speed motion.
[0072] A second aspect of the present invention discloses a system for reducing visual detection offset during variable speed motion. Figure 4 FIG. 4 is a structural diagram of a system for reducing visual detection offset in variable speed motion according to an embodiment of the present invention; Figure 4 As shown, the system 100 includes:
[0073] The first processing module 101 is configured to collect the value A0 of the encoder in one cycle and the value A1 in the next cycle;
[0074] The second processing module 102 is configured to calculate the judgment variable of the running state of the device by applying the value A0 of the set encoder in one cycle and the value A1 in the next cycle;
[0075] The third processing module 103 is configured to calculate a detection offset compensation coefficient K by applying the judgment variable and the value A0 within the one cycle;
[0076] The fourth processing module 104 is configured to determine the operating state of the device according to the determination variable;
[0077] The fifth processing module 105 is configured to calculate the detection offset by applying the detection offset compensation coefficient K and the reference coordinates (X0, Y0) according to the operating state of the device;
[0078] The sixth processing module 106 is configured to add the reference coordinate and the detection offset to obtain a new reference coordinate.
[0079] According to the system of the second aspect of the present invention, the second processing module 102 is specifically configured as follows: Figure 2 As shown, the method of calculating the judgment variable of the running state of the device by applying the value A0 of the set encoder in one cycle and the value A1 in the next cycle includes:
[0080] The value A0 in the one cycle is subtracted from the value A1 in the next cycle to obtain a judgment variable ΔA of the operating state of the device, that is, ΔA=A1-A0.
[0081] According to the system of the second aspect of the present invention, the third processing module 103 is specifically configured as follows: Figure 2 As shown, the method of calculating the detection offset compensation coefficient K by applying the judgment variable and the value A0 within one cycle includes:
[0082] The determination variable ΔA is divided by the value A0 within the period, and then the result is negative to obtain the detection offset compensation coefficient K, that is, K=-ΔA / A0.
[0083] According to the system of the second aspect of the present invention, the fourth processing module 104 is specifically configured as follows: Figure 2 As shown, the method for judging the operating state of the device according to the judgment variable includes:
[0084] If △A=0, it means A1=A0, and the device is in uniform motion;
[0085] If △A>0, it means A1>A0, and the device is in an accelerated motion state;
[0086] If △A<0, it means A1<A0, and the device is in a deceleration motion state.
[0087] According to the system of the second aspect of the present invention, the fifth processing module 105 is specifically configured to perform proportional coefficient compensation on the offset △X in the acceleration and deceleration of the device in order to reduce the offset of the visual detection in the variable speed movement, and take the characteristic image coordinates of the image as the reference coordinates (X0, Y0). Since the image only has an offset in the X direction, the offset in the Y direction is not calculated;
[0088] In the accelerated motion state, the method for calculating the detection offset includes:
[0089] The captured image is offset backward relative to the standard image, the detection offset compensation coefficient K is less than 0, and the detection offset is: △X=X0*K.
[0090] In the deceleration motion state, the method for calculating the detection offset includes:
[0091] The captured image is shifted forward relative to the standard image, the detection shift compensation coefficient K>0, and the detection shift amount is: △X=X0*K.
[0092] According to the system of the second aspect of the present invention, the sixth processing module 106 is specifically configured to use the pattern feature position coordinates as the reference coordinates (X0, Y0), and calculate the reference coordinates (X0+△X, Y0) for detection offset compensation according to the motion state of the device. Other detection frames are tracked and positioned with the pattern feature position coordinates as the reference coordinates. By following the position coordinates, the fluctuation of the detection offset under variable speed motion is reduced, thereby improving the accuracy of detection. At the same time, an interrupt trigger photography pulse signal is added. This signal may not be affected by the program scanning time, thereby reducing the time error generated from triggering to completion of photography. The shorter the time error, the less it is affected by the device running speed and the smaller the image offset.
[0093] The third aspect of the present invention discloses an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of any one of the methods for reducing visual detection offset in variable speed motion disclosed in the first aspect of the present invention are implemented.
[0094] Figure 5 is a structural diagram of an electronic device according to an embodiment of the present invention, such as Figure 5 As shown, the electronic device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, near field communication (NFC) or other technologies. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covered on the display screen, or a button, a trackball or a touch pad set on the housing of the electronic device, or an external keyboard, touch pad or mouse, etc.
[0095] Those skilled in the art will understand that Figure 5The structure shown in the figure is only a structural diagram of the part related to the technical solution of the present disclosure, and does not constitute a limitation on the electronic device to which the technical solution of the present application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0096] The fourth aspect of the present invention discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the methods for reducing visual detection offset in variable speed motion disclosed in the first aspect of the present invention.
[0097] Please note that the technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification. The above embodiments only express several implementation methods of the present application, and their descriptions are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, without departing from the concept of the present application, several variations and improvements can be made, which all belong to the scope of protection of the present application. Therefore, the scope of protection of the patent in this application shall be based on the attached claims.
Claims
1. A method for reducing the offset of visual detection in variable speed motion, characterized in that: The method comprises: Step S1, the value of the acquisition encoder in one cycle is A0, and the value in the next cycle is A1; Step S2, using the value A0 of the acquisition encoder in one cycle and the value A1 in the next cycle to calculate a judgment variable of the operating state of the device; Step S3, using the judgment variable and a value A0 within a period to calculate and obtain a detection offset compensation coefficient K; Step S4, judging the operating state of the equipment according to the judgment variable; Step S5, according to the running state of the device, applying the detection offset compensation coefficient K and the reference coordinates (X0, Y0) to calculate the detection offset; Step S6, adding the reference coordinate to the detection offset to obtain a new reference coordinate; The method of calculating the judgment variable of the running state of the device by applying the value A0 of the set encoder in one cycle and the value A1 in the next cycle includes: Subtract the value A0 in one cycle from the value A1 in the next cycle to obtain the judgment variable △A of the operating state of the equipment, that is, △A=A1-A0; The method of calculating the detection offset compensation coefficient K by applying the judgment variable and the value A0 within a period includes: The detection offset compensation coefficient K is obtained by dividing the judgment variable △A by the value A0 within one cycle and then taking the negative value, that is, K=-△A / A0; The method for judging the operating state of the device according to the judgment variable includes: If △A=0, it means A1=A0, and the device is in uniform motion; If △A>0, it means A1>A0, and the device is in an accelerated motion state; If △A<0, it means A1<A0, and the device is in a deceleration motion state; In the accelerated motion state, the method for calculating the detection offset includes: The captured image is offset backward relative to the standard image, the detection offset compensation coefficient K is less than 0, and the detection offset is: △X = X0*K; In the deceleration motion state, the method for calculating the detection offset includes: The captured image is offset forward relative to the standard image, the detection offset compensation coefficient K>0, and the detection offset is: △X=X0*K; Since the image only has an offset in the X-axis direction, the offset in the Y-axis direction is not calculated.
2. A system for reducing visual detection offset in variable speed motion, the system adopting the method of claim 1, characterized in that: The system comprises: The first processing module is configured to collect the value A0 of the encoder in one cycle and the value A1 in the next cycle; A second processing module is configured to calculate a judgment variable of the running state of the device by applying the value A0 of the acquisition encoder in one cycle and the value A1 in the next cycle; A third processing module is configured to calculate a detection offset compensation coefficient K by applying the judgment variable and a value A0 within a period; A fourth processing module is configured to determine the operating state of the device according to the determination variable; A fifth processing module is configured to calculate a detection offset by applying the detection offset compensation coefficient K and the reference coordinates (X0, Y0) according to the operating state of the device; The sixth processing module is configured to add the reference coordinate and the detection offset to obtain a new reference coordinate.
Citation Information
Patent Citations
Image compensation method and apparatus, electronic device, and computer-readable storage medium
CN109035308A
Linear CCD two-dimensional variable speed imaging method based on image segmentation
CN110220475A