Abnormal scanning state recognition method and device
Patent Information
- Application Number
- CN202410157720.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-02
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2044-02-02
AI Technical Summary
[0002]行业已有的CCD线扫相机,在实际运转时当出现丢帧或者软件卡顿时,会造成取图异常,从而使得CCD线扫设备对生产过程中的缺陷产生漏检、误检等异常,并且随着误差逐步累加,当长度达到一定程度时则会出现在进行正反面图片统一时错位的问题
[0013] As can be seen, in this embodiment, the detection device sets a preset pattern on the roller of the line scanning camera, and determines the abnormal situation of the line scanning camera stuttering or losing frames based on the reference slope of the reference slope of the preset pattern on the roller and the reference slope of the corresponding reference slope on the stitched image acquired by the line scanning camera. Since this application detects the abnormal scanning state of the line scanning camera by photographing the preset pattern on the roller and based on the reference slope in the obtained first slope image, compared with the existing mechanism that mainly judges the abnormal scanning state of the line scanning device by observing or detecting the abnormal state of the image output by the line scanning device, it can identify the abnormal scanning state of the line scanning camera during the scanning process, thereby improving the accuracy and convenience of identifying abnormal scanning states.
Smart Images

Figure CN118823555B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of line scan CCD detection, specifically to a method and apparatus for identifying abnormal scan states. Background Technology
[0002] Existing CCD line scan cameras in the industry can cause image capture abnormalities when frames are dropped or software lags during actual operation. This can lead to missed or false detections of defects in the production process by the CCD line scan equipment. Furthermore, as the errors accumulate, misalignment can occur when unifying front and back images when the length reaches a certain level.
[0003] The existing solution mainly judges the abnormal scanning state of the line scanning camera by observing or detecting the abnormal state of the image output by the line scanning device. It cannot quickly and accurately identify the abnormal scanning state of the line scanning camera during the scanning process, which is difficult to meet the detection requirements of the scanning state of the line scanning camera in the production process. Summary of the Invention
[0004] This application provides a method and apparatus for identifying abnormal scanning states. The detection device detects abnormal scanning states of the line scanning camera by setting a preset pattern on the roller and by using the slope of the first reference inclined edge in the first inclined edge image acquired by the line scanning camera. This enables rapid and accurate identification of abnormal scanning states of the line scanning camera during the scanning process, which is beneficial to improving the recognition rate of abnormal scanning states of the line scanning camera.
[0005] In a first aspect, embodiments of this application provide a method for identifying abnormal scan states, the method comprising the following steps:
[0006] A first stitched image is obtained, which is obtained by stitching together multiple first detection images. The multiple first detection images are images obtained by continuously capturing images of the first roller performing the first rotation process by the first line scan camera. The first outer circular surface of the first roller is provided with a first preset pattern. The planar pattern of the first preset pattern includes a first reference inclined edge.
[0007] The abnormal working state of the first line scan camera is detected based on the first diagonal image in the first stitched image. The abnormal working state includes stuttering or frame dropping. The first diagonal image is used to characterize part or all of the image features of the first reference diagonal.
[0008] Secondly, embodiments of this application provide an abnormal scanning state identification device, the device comprising:
[0009] An image acquisition unit is used to acquire a first stitched image, which is obtained by stitching together multiple first detection images. The multiple first detection images are images obtained by continuously capturing images of the first roller performing a first rotation process by a first line scan camera. The first outer circular surface of the first roller is provided with a first preset pattern. The planar pattern of the first preset pattern includes a first reference inclined side.
[0010] The detection unit is used to detect abnormal working states of the first line scan camera based on the first oblique edge image in the first stitched image. The abnormal working states include stuttering or frame dropping. The first oblique edge image is used to characterize part or all of the image features of the first reference oblique edge.
[0011] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and one or more programs, the one or more programs being stored in the memory and configured to be executed by the processor, the programs including instructions for performing the steps in the first aspect of embodiments of this application.
[0012] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program / instructions stored thereon, which is executed by a processor to implement the steps of the method described in the first aspect above.
[0013] As can be seen, in this embodiment, the detection device sets a preset pattern on the roller of the line scanning camera, and determines the abnormal situation of the line scanning camera stuttering or losing frames based on the reference slope of the reference slope of the preset pattern on the roller and the reference slope of the corresponding reference slope on the stitched image acquired by the line scanning camera. Since this application detects the abnormal scanning state of the line scanning camera by photographing the preset pattern on the roller and based on the reference slope in the obtained first slope image, compared with the existing mechanism that mainly judges the abnormal scanning state of the line scanning device by observing or detecting the abnormal state of the image output by the line scanning device, it can identify the abnormal scanning state of the line scanning camera during the scanning process, thereby improving the accuracy and convenience of identifying abnormal scanning states. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 This is an architectural diagram of an abnormal scanning status recognition device provided in an embodiment of this application;
[0016] Figure 2 This is a structural block diagram of an electronic device provided in an embodiment of this application;
[0017] Figure 3 This is a flowchart illustrating the steps of an abnormal scan state recognition method provided in an embodiment of this application;
[0018] Figure 4 This is a schematic diagram of the first oblique edge image under different scanning states provided in the embodiments of this application;
[0019] Figure 5 This is an example diagram of a first preset pattern provided in an embodiment of this application;
[0020] Figure 6 This is an overall flowchart of an abnormal scanning state recognition method provided in an embodiment of this application;
[0021] Figure 7 This is a schematic diagram illustrating the working principle of a line scan camera provided in an embodiment of this application;
[0022] Figure 8 This is a block diagram of the functional units of an abnormal scanning status recognition device provided in an embodiment of this application. Detailed Implementation
[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0024] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0025] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0026] Currently, existing abnormal scanning status recognition solutions mainly determine the abnormal scanning status of the line scanning camera by observing or detecting the abnormal status of the image output by the line scanning device. However, these solutions cannot identify the abnormal scanning status of the CCD line scanning device in a timely, fast, and accurate manner during the scanning process, and thus cannot meet the detection requirements for the scanning status of the line scanning device in the production process.
[0027] To address the aforementioned issues, this application provides a method and apparatus for identifying abnormal scan states. The embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0028] Please see Figure 1 , Figure 1 This is an architectural diagram of an abnormal scanning state recognition device provided in an embodiment of this application, such as... Figure 1 As shown, the abnormal scanning status recognition device includes an image processor 100 and a scanning device 200 at the scanning site. The scanning device 200 includes a camera 201, an image sensor 202, etc.
[0029] The scanning device 200 includes a camera 201, an image sensor 202, etc., for acquiring image frames of a first stitched image composed of multiple first oblique edge images and multiple first detection images contained in the viewfinder area.
[0030] The image processor 100 is used to receive image frames from the scanning device, process the first inclined edge image information contained in the image frame, calculate the slope of the first reference inclined edge in the first inclined edge image, determine the abnormal image acquisition state of the line scanning camera that has lost frames or lags based on the reference slope of the preset pattern on the roller, calculate the offset based on the number of lost frames to correct the position of the front and back images, and mark the target area of lag for re-detection when lag occurs.
[0031] As can be seen, in this embodiment, the detection device uses the camera 201, image sensor 202, etc. included in the scanning device 200 to capture images of the object to be detected and the preset pattern on the roller within the viewing area, obtaining a first stitched image containing multiple first detection images and multiple first oblique edge images. Subsequently, the image processor 100 processes the first oblique edge image information in the acquired first stitched image to obtain the reference slope of the first reference oblique edge, and judges the abnormal image capture state of the line scanning camera based on the absolute value of the difference between the reference slope and the reference slope of the preset pattern, and corrects the position of the front and back images based on the frame loss or stuttering state of the line scanning camera, thereby realizing the rapid identification of abnormal scanning state of the line scanning camera and the function of front and back unification during the scanning process.
[0032] Please see Figure 2 , Figure 2 This is a structural block diagram of an electronic device provided in an embodiment of this application, such as... Figure 2 As shown, the electronic device 300 may include one or more of the following components: a processor 310 and a memory 320 coupled to the processor 310, wherein the memory 320 may store one or more computer programs, which may be configured to implement the methods described in the above embodiments when executed by one or more processors 310.
[0033] Processor 310 may include one or more processing cores. Processor 310 connects to various parts within the electronic device 300 using various interfaces and lines, and performs various functions and processes data of the electronic device 300 by running or executing instructions, programs, code sets, or instruction sets stored in memory 320, and by calling data stored in memory 320. Optionally, processor 310 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 310 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 310 and may be implemented separately using a communication chip.
[0034] The memory 320 may include random access memory (RAM) or read-only memory (ROM). The memory 320 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 320 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described above. The data storage area may also store data created by the electronic device 300 during use.
[0035] It is understood that the electronic device 300 may include more or fewer structural elements than those shown in the above block diagram, such as a power module, physical buttons, a Wi-Fi module, a speaker, a Bluetooth module, sensors, etc., without limitation.
[0036] Please see Figure 3 , Figure 3 This is a flowchart illustrating the steps of an abnormal scan state recognition method provided in an embodiment of this application, which is applied to... Figure 1 Image processor 100, such as Figure 3 As shown, the method includes the following steps:
[0037] Step S10: Obtain a first stitched image. The first stitched image is obtained by stitching together multiple first detection images. The multiple first detection images are images obtained by continuously capturing images of the first roller performing the first rotation process by the first line scan camera. The first outer circular surface of the first roller is provided with a first preset pattern. The planar pattern of the first preset pattern includes a first reference inclined edge.
[0038] The first preset pattern is set on the first outer circular surface of the first roller by pasting or engraving.
[0039] Wherein, the rotation length of the first roller in one revolution is an integer multiple of the first unit output length, and the first unit output length is the rotation length of the first roller in performing the first rotation process.
[0040] For example, the first unit output length can be a preset value n, and the rotation length of the first roller in one revolution can be an integer multiple of n. Then, it can be obtained that the number of output images corresponding to the first roller rotating one revolution is n.
[0041] As can be seen, in this embodiment, when the first roller performs the first rotation process, the line scan camera continuously captures images to obtain a first stitched image composed of first inclined edge images corresponding to multiple preset patterns and first detection images corresponding to multiple objects to be detected. Based on the difference between the slope of the first reference inclined edge in the first inclined edge image and the preset reference slope of the first reference inclined edge in the preset pattern, the abnormal scanning state of the line scan camera, such as stuttering or frame loss, is determined, thus realizing the function of quickly identifying the abnormal scanning state of the line scan camera during the scanning process.
[0042] Step S20: Detect the abnormal working state of the first line scan camera based on the first oblique edge image in the first stitched image. The abnormal working state includes stuttering or frame dropping. The first oblique edge image is used to characterize part or all of the image features of the first reference oblique edge.
[0043] In one possible embodiment, detecting the abnormal operating state of the first line scan camera based on the first oblique edge image in the first stitched image includes:
[0044] If at least one group of pixels with a slope of zero is detected in the first inclined edge image, it is determined that the first line scan camera has lag. The single group of pixels includes two pixels on the first inclined edge image.
[0045] If at least one group of pixels in the first inclined edge image is detected where the absolute value of the slope difference is greater than a preset value, it is determined that the first line scan camera has dropped a frame. The slope difference refers to the difference between the reference slope and the baseline slope of the first reference inclined edge. The reference slope is the slope of the line connecting the two pixels in the pixel group.
[0046] Wherein, the reference slopes of the first reference hypotenuse are continuous and equal.
[0047] Wherein, the first preset pattern includes at least one first reference inclined side in the planar unfolded state, and the reference slope of any two points on each first reference inclined side in the first reference coordinate system is a preset slope other than zero. The first coordinate axis of the first reference coordinate system is parallel to the rotation axis of the first roller, and the second coordinate axis of the first reference coordinate system is parallel to the planar unfolding direction of the first preset pattern.
[0048] For example, the reference slope of the first reference hypotenuse can be a preset value m, and a coordinate system can be established in the first hypotenuse image. The coordinates of a pixel in the first hypotenuse image can be (a, b) and the coordinates of a pixel can be (c, d). Then the slope of the line connecting the two pixels can be obtained as k = (ac) / (bd), and the slope difference q = km. If k = 0, it can be determined that parallel lines appear in the first hypotenuse image, thereby determining that the line scan camera is stuttering. If |q| is greater than a preset value, it can be determined that the first reference hypotenuse in the first hypotenuse image has a sudden change, thereby determining that the line scan camera is dropping frames.
[0049] The preset value is an empirical value generated under normal and frame-dropping conditions of the line scan camera, based on the difference between the slope of the line connecting two pixels in the first hypotenuse image and the reference slope of the first reference hypotenuse in the first preset pattern.
[0050] In one possible embodiment, the framing area of the first line scan camera includes a first first linear area and a second first linear area of the first roller, wherein the first first linear area is used to detect the first end face of the object to be detected, and the second first linear area corresponds to the first outer circular surface.
[0051] The method further includes:
[0052] A second stitched image is obtained, which is obtained by stitching together multiple second detection images. The multiple second detection images are images obtained by continuously capturing images of the second roller performing a second rotation process by a second line scan camera. The second outer circular surface of the second roller is provided with a second preset pattern. The planar pattern of the second preset pattern includes a second reference inclined edge. The viewing area of the second line scan camera includes a first second linear area and a second second linear area of the second roller. The first second linear area is used to detect the second end face of the object to be detected, which corresponds to the first end face. The second second linear area corresponds to the second outer circular surface.
[0053] Based on the second oblique edge image, it was determined that the second line scan camera did not exhibit the aforementioned abnormal working state;
[0054] Determine a first reference image region that characterizes the dropped frames of the first line scan camera based on the first stitched image;
[0055] The front and back positioning operations for the upper camera position are performed based on the first reference image area.
[0056] The second preset pattern is set on the second outer circular surface of the second roller by means of pasting or engraving.
[0057] Wherein, the rotation length of the second roller in one revolution is an integer multiple of the second unit output length, and the second unit output length is the rotation length of the second roller in performing the second rotation process.
[0058] For example, the second unit output length can be a preset value r, and the rotation length of the second roller in one revolution can be an integer multiple of r. Then, the output number of images corresponding to the second roller rotating one revolution is r sheets.
[0059] The first stitched image can be a frontal image of the object to be detected, and the second stitched image can be a back image of the object to be detected.
[0060] In one possible embodiment, detecting that the second line scan camera has not experienced the abnormal operating state based on the second bevel image in the second stitched image includes:
[0061] If the absolute value of the slope difference corresponding to any pixel group in the second inclined edge image is detected to be zero or less than the second preset value, it is determined that the second line scan camera has not experienced the abnormal working state. The slope difference refers to the difference between the second reference slope and the reference slope of the second reference inclined edge. A single pixel group includes two pixels on the second inclined edge image, and the second reference slope is the slope of the line connecting the two pixels in the pixel group.
[0062] Wherein, the reference slopes of the second reference hypotenuse are continuous and equal.
[0063] The second preset pattern, in its planar unfolded state, includes at least one second reference inclined side. The reference slope of any two points on each of the at least one second reference inclined side in the second reference coordinate system is a preset slope other than zero. The first coordinate axis of the second reference coordinate system is parallel to the rotation axis of the second roller, and the second axis of the second reference coordinate system is parallel to the planar unfolding direction of the second preset pattern.
[0064] For example, the reference slope of the second reference hypotenuse can be a preset value s, and a coordinate system is established in the second hypotenuse image. The coordinates of any pixel in the second hypotenuse image can be (t, u), and the coordinates of any pixel can be (v, w). Then the slope of the line connecting the two pixels can be obtained as l = (tv) / (uw), and the slope difference is f = ls. If |f| = 0 or |f| is less than the preset value, it can be determined that the second hypotenuse image is the same as the second preset pattern or that an error within the allowable range occurs, thereby determining that the line scan camera has not experienced the abnormal scanning situation of lag or frame loss.
[0065] The second preset value is an empirical value generated under normal and frame-dropping conditions of the line scan camera, based on the difference between the slope of the line connecting two pixels in the second hypotenuse image and the reference slope of the second reference hypotenuse in the second preset pattern.
[0066] In one possible embodiment, the front and back positioning operation for image output from the upper camera position based on the first reference image region includes:
[0067] The number of frames lost is determined based on the first reference image region;
[0068] Determine the offset corresponding to the frame number;
[0069] The positional correspondence between the stitched image of the first end face and the stitched image of the second end face of the object to be detected in the upper position output image is adjusted according to the offset.
[0070] The front and back positioning operation requires adjusting the positional relationship between the stitched image of each first end face and the corresponding stitched image of each second end face in the multiple first stitched images and multiple second stitched images, so as to achieve a unified adjustment and correspondence of the front and back images in the output image.
[0071] In one possible embodiment, the abnormal working state is the lag, and the method further includes:
[0072] Determine the second reference image region in the second stitched image that corresponds to the first reference image region;
[0073] The first target location region of the first end face of the object to be detected, corresponding to the first reference image region, is marked as the waiting area for re-detection.
[0074] As can be seen, in this embodiment, the slope of the first reference slope represented by the first slope image in the first stitched image is used to determine that the line scan camera experienced a stutter or frame loss when scanning the front of the object under test. The slope of the second reference slope represented by the second slope image in the second stitched image is used to determine that the line scan camera did not experience an abnormal working state when scanning the back of the object under test. Furthermore, the offset corresponding to the number of frames lost or the target location area where the stutter occurred is marked and re-detected to correct the misalignment of the front and back images. This achieves the functions of rapid identification of abnormal scanning states of the line scan camera and unified front and back images during the scanning process.
[0075] Please see Figure 4 , Figure 4This is a schematic diagram of the first hypotenuse image under different states provided in the embodiments of this application, such as... Figure 4 As shown, the image of the first oblique edge changed when the line scan camera performed scanning operations under different states.
[0076] Among them, the first oblique edge image 4-1 is the first oblique edge image obtained by the line scan camera in normal scanning state, the first oblique edge image 4-2 is the first oblique edge image obtained by the line scan camera in stuttering state, and the first oblique edge image 4-3 is the first oblique edge image obtained by the line scan camera in frame dropping state.
[0077] Understandably, when the line scan camera performs scanning operations under normal conditions, its viewfinder includes the outer circular surface of the roller and the end face of the object to be inspected, thus obtaining a stitched image composed of multiple first oblique edge images and multiple first detection images. The slope of the first oblique edge image in the stitched image acquired by the line scan camera under normal conditions is equal to or within an acceptable range of the slope of the preset pattern set on the roller; and...
[0078] When the line scan camera lags during scanning, parallel lines appear on the first reference hypotenuse of the first hypotenuse image in the stitched image acquired during the lag. Consequently, the slope of the line connecting two pixels on the first reference hypotenuse of the first hypotenuse image is zero, which is not equal to the slope of the preset pattern set on the roller.
[0079] When a frame is lost during the scanning operation of the line scan camera, the first reference slope of the first slope image in the stitched image obtained by the line scan camera in the frame loss state undergoes a sudden change. As a result, the absolute value of the difference between the slope of the connecting line of two pixels in the first reference slope of the first slope image and the reference slope is greater than a preset value, and is not equal to the slope of the preset pattern set on the roller.
[0080] It is understood that this application achieves the function of quickly identifying abnormal scanning status of the line scanning camera during the scanning process by setting a preset pattern on the roller and acquiring a first stitched image composed of multiple first inclined edge images and multiple first detection images through a line scanning camera, and judging the abnormal scanning status of the line scanning camera based on the difference between the slope of the first reference inclined edge in the first inclined edge image and the preset reference slope of the first reference inclined edge in the preset pattern.
[0081] Please see Figure 5 , Figure 5 This is an example diagram of a first preset pattern provided in the embodiments of this application, such as... Figure 5As shown, the example diagram of the first preset pattern includes first preset pattern 5-1, first preset pattern 5-2, first preset pattern 5-3, first preset pattern 5-4, first preset pattern 5-5 and first preset pattern 5-6.
[0082] The first preset pattern 5-1 includes a first reference hypotenuse group, the first preset pattern 5-2 includes two first reference hypotenuse groups, and the first preset pattern 5-3 includes three first reference hypotenuse groups. The first preset patterns 5-1, 5-2, and 5-3 are each a closed figure, and each first reference hypotenuse group includes two first reference hypotenuses that are symmetrically arranged vertically.
[0083] It is understood that either the upper or lower side of the first preset pattern 5-1 includes a hypotenuse; and either the upper or lower side of the first preset pattern 5-2 includes two first reference hypotenuses, the absolute values of the reference slopes of the two first reference hypotenuses being equal. Correspondingly, the specific implementation of detecting the abnormal working state of the first line scan camera based on the first hypotenuse image in the first stitched image can be as follows:
[0084] If it is detected that there is at least one pixel group with a slope of zero on both sides of any one of the two first reference hypotenuse groups in the first hypotenuse image, then it is determined that the first line scan camera has lag. A single pixel group includes two pixels on the first hypotenuse image.
[0085] If it is detected that at least one group of pixels exists on both sides of any first reference hypotenuse in the first hypotenuse image where the absolute value of the slope difference is greater than a preset value, then it is determined that the first line scan camera has dropped a frame. The slope difference refers to the difference between the reference slope and the baseline slope of the first reference hypotenuse. The reference slope is the slope of the line connecting the pixels of the next frame and the pixels of the previous frame in two consecutive frames of the first hypotenuse image.
[0086] It is understood that either the upper or lower side of the first preset pattern 5-3 includes three first reference inclined sides, each with a continuous and equal reference slope, and any two first reference inclined sides have unequal reference slopes. Correspondingly, the specific implementation of detecting the abnormal working state of the first line scan camera based on the first inclined side image in the first stitched image can be as follows:
[0087] If it is detected that at least one pixel group with a slope of zero exists on both sides of any one of the three first reference hypotenuse groups in the first hypotenuse image, then it is determined that the first line scan camera has lag. A single pixel group includes two pixels on the first hypotenuse image.
[0088] If it is detected that at least one group of pixels exists on both sides of any group of first reference hypotenuses in the first hypotenuse image where the absolute value of the slope difference is greater than a preset value, then it is determined that the first line scan camera has dropped a frame. The slope difference refers to the difference between the reference slope and the baseline slope of the first reference hypotenuse. The reference slope is the slope of the line connecting the pixel of the next frame and the pixel of the previous frame in two consecutive frames of the first hypotenuse image. The pixel of the next frame and the pixel of the previous frame are located on the same first reference hypotenuse.
[0089] In one possible embodiment, the pixels of the subsequent frame and the pixels of the previous frame are located on a first reference hypotenuse, including:
[0090] Obtain the image frame corresponding to the first hypotenuse image;
[0091] The three first reference hypotenuses in the image frame are labeled, and the position of the pixel on each first reference hypotenuse is determined;
[0092] Obtain the pixel points of the next frame and the pixel points of the previous frame in two consecutive frames of the first oblique edge image. The pixel points of the previous frame include the first first frame pixel point, the second first frame pixel point, and the third first frame pixel point. The pixel points of the next frame include the first second frame pixel point, the second second frame pixel point, and the third second frame pixel point.
[0093] The first second frame pixel and the first first frame pixel are located on the first reference hypotenuse based on their positions; the second second frame pixel and the second first frame pixel are located on the second reference hypotenuse based on their positions; and the third second frame pixel and the third first frame pixel are located on the third reference hypotenuse based on their positions.
[0094] The first preset pattern 5-4 is a hollow closed shape formed by splicing together multiple identical patterns. Each of the identical patterns includes a first reference hypotenuse group. The first preset pattern 5-5 and the first preset pattern 5-6 are respectively formed by splicing together multiple identical patterns end to end. The connecting parts are connection points and vertical connecting lines, respectively. Each of the identical patterns includes a first reference hypotenuse group.
[0095] It is understood that any one of the first preset patterns 5-4, 5-5, and 5-6 includes multiple first reference hypotenuses on its upper or lower side, each with an equal base slope, and that in the first preset patterns 5-5 and 5-6, there are connection points or vertical connecting lines where multiple identical patterns are connected. Correspondingly, the specific implementation of detecting the abnormal working state of the first line scan camera based on the first hypotenuse image in the first stitched image can be as follows:
[0096] If it is detected that at least one pixel with a slope of zero exists on both sides of any one of the multiple first reference hypotenuse groups corresponding to the first hypotenuse image, then it is determined that the first line scan camera has lag. A single pixel group includes two pixels on the first hypotenuse image.
[0097] If it is detected that at least one group of pixels exists on both sides of any first reference hypotenuse group in the first hypotenuse image where the absolute value of the slope difference is greater than a preset value, then it is determined that the first line scan camera has dropped a frame. The slope difference refers to the difference between the reference slope and the baseline slope of the first reference hypotenuse. The reference slope is the slope of the line connecting the pixel of the next frame and the pixel of the previous frame in two consecutive frames of the first hypotenuse image. The pixel of the next frame and the pixel of the previous frame are two adjacent pixels.
[0098] In one possible embodiment, the pixels in the subsequent frame and the pixels in the previous frame are two adjacent pixels, including:
[0099] Obtain the pixel points of the next frame and the pixel points of the previous frame in two consecutive frames of the first oblique edge image. The pixel points of the previous frame include the first pixel point of the previous frame and the second pixel point of the previous frame, and the pixel points of the next frame include the first pixel point of the next frame.
[0100] Determine the first distance between the first subsequent frame pixel and the first preceding frame pixel, and determine the second distance between the first subsequent frame pixel and the second preceding frame pixel;
[0101] Based on the fact that the first distance is greater than the second distance, the first subsequent frame pixel and the second preceding frame pixel are determined to be two adjacent pixels.
[0102] In one possible embodiment, the pixel in the subsequent frame and the pixel in the previous frame are two adjacent pixels, and the method further includes:
[0103] Obtain the image frame corresponding to the first hypotenuse image;
[0104] Each first reference hypotenuse in the image frame is labeled, and the position of the pixel on each first reference hypotenuse is determined;
[0105] Obtain the pixel points of the next frame and the pixel points of the previous frame in two consecutive frames of the first oblique edge image. The pixel points of the previous frame include the first pixel point of the previous frame and the second pixel point of the previous frame, and the pixel points of the next frame include the first pixel point of the next frame.
[0106] Based on the fact that the first subsequent frame pixel and the second subsequent frame pixel are located on the same first reference hypotenuse, the first second frame pixel and the second first frame pixel are determined to be two adjacent pixels.
[0107] As can be seen, in this embodiment, by setting a first preset pattern with symmetrical characteristics on the upper and lower slopes, the error in identifying abnormal scanning states caused by parallel lines or abrupt changes on one side of the slope can be avoided. Furthermore, by setting a first preset pattern composed of multiple identical patterns, the threshold of the slope difference can be increased, thereby improving the recognition rate of abnormal scanning states of the line scanning camera, increasing the detection accuracy, and reducing errors.
[0108] Please see Figure 6 , Figure 6 This is an overall flowchart of an abnormal scanning state recognition method provided in an embodiment of this application, as follows: Figure 6 As shown, the method includes the following steps:
[0109] S600, the testing equipment is started.
[0110] The S610 uses a line scan camera to acquire the first and second stitched images.
[0111] Wherein, the first stitched image is obtained by stitching together multiple first detection images, wherein the multiple first detection images are images obtained by a first line scan camera continuously capturing images of the first roller performing a first rotation process, and the first outer circular surface of the first roller is provided with a first preset pattern, the planar pattern of the first preset pattern including a first reference inclined edge. And,
[0112] The second stitched image is obtained by stitching together multiple second detection images. The multiple second detection images are images obtained by continuously capturing images of the second roller performing the second rotation process by the second line scan camera. The second outer circular surface of the second roller is provided with a second preset pattern. The planar pattern of the second preset pattern includes a second reference inclined edge.
[0113] S620 stores the first stitched image into cache A.
[0114] S621, Detect whether parallel lines appear in the first hypotenuse image.
[0115] If no parallel lines are detected in the first stitched image, then S622 is executed; and if parallel lines are detected in the first stitched image, then S624 is executed.
[0116] S622, detect whether the slope of the first hypotenuse image changes abruptly.
[0117] If no mutation is detected in the first stitched image, S623 is executed; if a mutation is detected in the first stitched image, S624 is executed.
[0118] S623, scan line by line until storage area A is full.
[0119] S624, scan line by line until the graphic boundary area.
[0120] S640, outputs images from the upper camera position.
[0121] The first hypotenuse image is used to characterize some or all of the image features of the first reference hypotenuse.
[0122] In one possible embodiment, detecting whether parallel lines appear in the first oblique edge image includes:
[0123] If at least one group of pixels with a slope of zero is detected in the first slanted image, then parallel lines are detected in the first slanted image, thereby determining that the first line scan camera is stuck. The single group of pixels includes two pixels on the first slanted image.
[0124] In one possible embodiment, detecting whether the slope of the first hypotenuse image changes abruptly includes:
[0125] If at least one group of pixels in the first inclined edge image is detected to have a slope difference greater than a preset value, it is determined that the slope of the first inclined edge image has changed abruptly, thereby determining that the first line scan camera has dropped frames. The slope difference refers to the difference between the reference slope and the baseline slope of the first reference inclined edge. The reference slope is the slope of the line connecting the two pixels in the pixel group.
[0126] Wherein, the reference slopes of the first reference hypotenuse are continuous and equal.
[0127] Specifically, after executing S610, where the line scan camera acquires the first stitched image and the second stitched image, the method further includes,
[0128] S630 stores the second stitched image into the B buffer.
[0129] S631, Detect whether parallel lines appear in the second hypotenuse image.
[0130] The second hypotenuse image is used to characterize some or all of the image features of the second reference hypotenuse.
[0131] If no parallel lines are detected in the second stitched image, then S632 is executed; and if parallel lines are detected in the second stitched image, then S634 is executed.
[0132] S632, detect whether the slope of the second hypotenuse image changes abruptly.
[0133] If no mutation is detected in the second stitched image, S633 is executed; if a mutation is detected in the second stitched image, S634 is executed.
[0134] S633, scan line by line until storage area B is full.
[0135] S634, scan line by line until the graphic boundary area.
[0136] S640, outputs images from the upper camera position.
[0137] S620 and S630 can occur simultaneously or sequentially.
[0138] For example, the first stitched image may be a frontal image of the object to be detected, and the second stitched image may be a back image of the object to be detected.
[0139] As can be seen, in this embodiment, the detection device can detect the front and back images of the object to be detected simultaneously or sequentially. It identifies abnormal scanning states of the line scan camera when acquiring the front image based on the absolute value of the difference between the reference slope of the first inclined image and the reference slope of the first reference inclined side in the first pre-planned pattern, and identifies abnormal scanning states of the line scan camera when acquiring the back image based on the absolute value of the difference between the reference slope of the second inclined image and the reference slope of the second reference inclined side in the second pre-planned pattern. This achieves the function of quickly identifying abnormal scanning states of the line scan camera during the scanning process.
[0140] Please see Figure 7 , Figure 7 This is a schematic diagram illustrating the working principle of a line scan camera provided in an embodiment of this application, such as... Figure 7 As shown, the working principle diagram of the line scan camera includes a first roller 701 and a first preset pattern 702 on the first roller, a line scan camera 703, and an object to be detected 704.
[0141] When the line scan camera 703 scans the image, the first roller 701 performs a first rotation process. A first preset pattern 702 is provided on the first outer circular surface of the first roller 701. The line scan camera 703, located in a fixed position, continuously captures images to obtain a first stitched image composed of multiple first detection images. The viewing area of the line scan camera 703 includes a first first linear area and a second first linear area of the first roller 701. The first first linear area is used to detect the first end face of the object to be detected 704, and the second first linear area corresponds to the first outer circular surface.
[0142] For example, the object to be tested 704 may be a battery film and a battery electrode plate.
[0143] Understandably, when the roller rotates, the line scan camera performs a scanning operation on the object to be detected. The viewfinder of the line scan camera includes the first preset pattern on the roller and the object to be detected. The line scan camera acquires a first stitched image composed of multiple first detection images. Subsequently, the first inclined edge image information is processed. Based on the difference between the slope of the first reference inclined edge represented by the first inclined edge image and the reference slope of the first reference inclined edge on the first preset pattern, the abnormal situation of frame loss or stuttering during the scanning process of the line scan camera is detected. This application helps to improve the accuracy and convenience of identifying abnormal scanning states of line scan cameras.
[0144] Please see Figure 8 , Figure 8 This is a functional unit block diagram of an abnormal scanning status recognition device provided in an embodiment of this application, such as... Figure 8 As shown, the abnormal scan status recognition device 800 includes the following units:
[0145] Image acquisition unit 810 is used to acquire a first stitched image, which is obtained by stitching together multiple first detection images. The multiple first detection images are images obtained by continuously capturing images of the first roller performing a first rotation process by a first line scan camera. The first outer circular surface of the first roller is provided with a first preset pattern. The planar pattern of the first preset pattern includes a first reference inclined side.
[0146] The detection unit 820 is used to detect abnormal working status of the first line scan camera based on the first oblique edge image in the first stitched image. The abnormal working status includes stuttering or frame dropping. The first oblique edge image is used to characterize part or all of the image features of the first reference oblique edge.
[0147] In one possible embodiment, detecting the abnormal operating state of the first line scan camera based on the first oblique edge image in the first stitched image includes:
[0148] If at least one group of pixels with a slope of zero is detected in the first inclined edge image, it is determined that the first line scan camera has lag. The single group of pixels includes two pixels on the first inclined edge image.
[0149] If at least one group of pixels in the first inclined edge image is detected where the absolute value of the slope difference is greater than a preset value, it is determined that the first line scan camera has dropped a frame. The slope difference refers to the difference between the reference slope and the baseline slope of the first reference inclined edge. The reference slope is the slope of the line connecting the two pixels in the pixel group.
[0150] In one possible embodiment, the reference slopes of the first reference hypotenuse are continuous and equal.
[0151] In one possible embodiment, the rotation length of one revolution of the first roller is an integer multiple of the first unit output length, and the first unit output length is the rotation length of the first roller performing the first rotation process.
[0152] In one possible embodiment, the framing area of the first line scan camera includes a first first linear region and a second first linear region of the first roller, wherein the first first linear region is used to detect the first end face of the object to be detected, and the second first linear region corresponds to the first outer circular surface.
[0153] In one possible embodiment, the image acquisition unit 810 is further configured to acquire a second stitched image, which is obtained by stitching together multiple second detection images. The multiple second detection images are images obtained by the second line scan camera continuously capturing images of the second roller performing a second rotation process. The second outer circular surface of the second roller is provided with a second preset pattern, and the planar pattern of the second preset pattern includes a second reference bevel. The viewing area of the second line scan camera includes a first second linear area and a second second linear area of the second roller. The first second linear area is used to detect the second end face of the object to be detected, which corresponds to the first end face. The second second linear area corresponds to the second outer circular surface. The detection unit 820 is further configured to detect that the second line scan camera has not experienced the abnormal working state based on the second bevel image in the second stitched image.
[0154] In one possible embodiment, the device further includes a processing unit; in performing the front and back positioning operation for image output from the upper camera position, the processing unit is specifically configured to: determine a first reference image region representing the lost frame of the first line scan camera in the first stitched image; determine the number of the lost frame based on the first reference image region; and determine an offset corresponding to the number of frames; and adjust the positional correspondence between the stitched image of the first end face of the object to be detected and the stitched image of the second end face of the object to be detected in the upper camera position output image based on the offset. When the abnormal working state is a lag, the processing unit is further configured to determine a second reference image region in the second stitched image corresponding to the first reference image region; and mark the first target position region of the first end face of the object to be detected corresponding to the first reference image region as a waiting area that needs to be re-detected.
[0155] It is understood that since the method embodiments and the device embodiments are different presentations of the same technical concept, the content of the method embodiment section in this application should be adapted to the device embodiment section in a synchronous manner, and will not be repeated here.
[0156] As can be seen, the device acquires a first stitched image composed of multiple first detection images through an image acquisition unit. The first stitched image includes multiple first detection images and multiple first inclined edge images. Then, the detection unit determines that the stitched image is abnormal based on the difference between the slope of the first reference inclined edge in the first inclined edge image and the preset reference slope of the first reference inclined edge in the preset pattern on the roller. Based on the specific situation of the difference, it determines that the line scan camera is experiencing frame loss or stuttering during image scanning. After determining the abnormal state of the line scan camera, it re-detects and corrects the misalignment of the front and back images by marking the offset corresponding to the number of frames lost or the target position area where stuttering occurs. This achieves the function of quickly identifying the abnormal scanning state of the line scan camera and the function of unifying the front and back images during the scanning process of the line scan camera, improving the accuracy and speed of identifying the abnormal state of the line scan camera.
[0157] Furthermore, this application embodiment also provides a computer storage medium that stores a computer program that can be loaded by a processor and executed as described above in the abnormal scanning state identification method. The computer-readable storage medium includes, for example, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0158] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and units involved are not necessarily essential to this application.
[0159] This is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interface, device, or unit, and may be electrical, mechanical, or other forms.
[0160] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0161] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can be physically comprised separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or in the form of hardware plus software functional units.
[0162] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, volatile memory, or non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM), etc., which are various media capable of storing program code.
[0163] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0164] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
[0165] While this application discloses the above information, it is not limited thereto. Any person skilled in the art can easily conceive of variations or substitutions without departing from the spirit and scope of this application, and can make various alterations and modifications, including combinations of the different functions and implementation steps described above, as well as software and hardware implementation methods, all of which are within the protection scope of this application.
Claims
1. A method for identifying abnormal scan states, characterized in that, include: A first stitched image is obtained, which is obtained by stitching together multiple first detection images. The multiple first detection images are images obtained by continuously capturing images of the first roller performing the first rotation process by the first line scan camera. The first outer circular surface of the first roller is provided with a first preset pattern. The planar pattern of the first preset pattern includes a first reference inclined edge. Detecting abnormal operating states of the first line scan camera based on the first diagonal image in the first stitched image, wherein the abnormal operating states include stuttering or frame dropping, and the first diagonal image is used to characterize part or all of the image features of the first reference diagonal; wherein, the step of detecting abnormal operating states of the first line scan camera based on the first diagonal image in the first stitched image includes: If at least one group of pixels with a slope of zero is detected in the first inclined edge image, it is determined that the first line scan camera has lag. The single group of pixels includes two pixels on the first inclined edge image. If at least one group of pixels in the first inclined edge image is detected where the absolute value of the slope difference is greater than a preset value, it is determined that the first line scan camera has dropped a frame. The slope difference refers to the difference between the reference slope and the baseline slope of the first reference inclined edge. The reference slope is the slope of the line connecting the two pixels in the pixel group.
2. The method according to claim 1, characterized in that, The reference slopes of the first reference hypotenuse are continuous and equal.
3. The method according to claim 1 or 2, characterized in that, The rotation length of the first roller in one revolution is an integer multiple of the first unit output length, and the first unit output length is the rotation length of the first roller in the first rotation process. When the first roller rotates one revolution, the number of output images is n.
4. The method according to claim 1 or 2, characterized in that, The viewfinder of the first line scan camera includes a first linear region and a second linear region on the first roller. The first linear region is used to detect the first end face of the object to be detected, and the second linear region corresponds to the first outer circular surface. The method further includes: A second stitched image is obtained, which is obtained by stitching together multiple second detection images. The multiple second detection images are images obtained by continuously capturing images of the second roller performing a second rotation process by a second line scan camera. The second outer circular surface of the second roller is provided with a second preset pattern. The planar pattern of the second preset pattern includes a second reference inclined edge. The viewing area of the second line scan camera includes a first second linear area and a second second linear area of the second roller. The first second linear area is used to detect the second end face of the object to be detected, which corresponds to the first end face. The second second linear area corresponds to the second outer circular surface. The second line scan camera was found not to be in the abnormal working state based on the second stitched image. Determine a first reference image region that characterizes the dropped frames of the first line scan camera based on the first stitched image; The front and back positioning operations for the upper camera position are performed based on the first reference image area.
5. The method according to claim 4, characterized in that, The step of positioning the front and back sides of the image for output from the upper camera position based on the first reference image area includes: The number of frames lost is determined based on the first reference image region; Determine the offset corresponding to the frame number; The positional correspondence between the stitched image of the first end face and the stitched image of the second end face of the object to be detected in the upper position output image is adjusted according to the offset.
6. The method according to claim 4, characterized in that, The abnormal working state is the lag, and the method further includes: Determine the second reference image region in the second stitched image that corresponds to the first reference image region; The first target location region of the first end face of the object to be detected, corresponding to the first reference image region, is marked as the candidate region that needs to be re-detected.
7. An abnormal scanning status recognition device, characterized in that, The device includes: An image acquisition unit is used to acquire a first stitched image, which is obtained by stitching together multiple first detection images. The multiple first detection images are images obtained by continuously capturing images of the first roller performing a first rotation process by a first line scan camera. The first outer circular surface of the first roller is provided with a first preset pattern. The planar pattern of the first preset pattern includes a first reference inclined side. The detection unit is configured to detect abnormal operating states of the first line scan camera based on the first oblique edge image in the first stitched image. The abnormal operating states include stuttering or frame dropping. The first oblique edge image is used to characterize some or all image features of the first reference oblique edge. The detection of abnormal operating states of the first line scan camera based on the first oblique edge image in the first stitched image includes: if at least one pixel group with a slope of zero is detected in the first oblique edge image, it is determined that the first line scan camera is stuttering, where a single pixel group includes two pixels on the first oblique edge image; if at least one pixel group with a slope difference greater than a preset value is detected in the first oblique edge image, it is determined that the first line scan camera is dropping frames, where the slope difference refers to the difference between the reference slope and the baseline slope of the first reference oblique edge, and the reference slope is the slope of the line connecting the two pixels in the pixel group.
8. An electronic device, characterized in that, The method includes a processor, a memory, and one or more programs stored in the memory and configured to be executed by the processor, the programs including instructions for performing the steps of the method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, The computer program / instructions are executed by the processor to implement the steps of the method according to any one of claims 1-6.
Citation Information
Patent Citations
Method for automatically detecting the lost line of optical scanner
CN1245321A
Method of judging whether to have missing scan line in the scanned image
CN1362694A