Image detection method and device, electronic device and storage medium

By performing projection grayscale feature analysis on the image data collected by the linear array camera, real-time detection of whether it meets the standard grayscale range, the problem of untimely detection of image acquisition failure of linear array cameras is solved and the accuracy of product detection is improved.

CN119295408APending Publication Date: 2025-01-10ZHEJIANG GEELY HLDG GRP CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411417266.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

In the prior art, the failure detection of linear array camera image acquisition is not timely, which affects the accuracy of product detection, and is due to high professionalism and difficulty in retrieving and positioning of failure factors.

Method used

By acquiring the original image data, projecting based on the preset projection area, calculating the projected grayscale characteristics, and comparing it with the standard grayscale range, image detection results are generated, and whether the image is invalid in real time.

Benefits of technology

It effectively solves the problem of untimely image acquisition failure detection, improves the accuracy of product detection, and avoids lag processing caused by high professionalism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295408A_ABST
    Figure CN119295408A_ABST
Patent Text Reader

Abstract

The invention relates to an image detection method and device, an electronic device and a storage medium, and the image detection method comprises the steps: obtaining collected original image data; projecting the original image data based on a preset projection area, and calculating a projection gray feature; determining a standard gray scale range corresponding to the projection area; and generating an image detection result based on a comparison result between the projection gray scale feature and the standard gray scale range. According to the invention, the problem that the detection of the image acquisition failure is not timely is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image detection method, system, electronic device and storage medium. Background Art

[0002] Industrial cameras are imaging devices for visual measurement. According to the sensor type, they can be divided into line array cameras and area array cameras. The sensor of a line array camera usually has only one or several rows of imaging units (pixels), which can be regarded as a special case of an area array camera. Unlike an area array camera, a line array camera generates continuous images through motion push scanning. The field of view in the direction of motion is not restricted, and a larger single-direction measurement range can be obtained. While alleviating the range-accuracy contradiction, it is easier to achieve continuous measurement, which can effectively meet the characteristics of continuous operation on the production line. Therefore, in the lithium battery manufacturing process, line array cameras are used in the three major processes of film making, welding assembly, and cell forming and coating.

[0003] Linear scan cameras have relatively strict requirements for both structural installation and camera driver software development kit (SDK) debugging, which places very high demands on the professional ability and experience of application implementation technicians. In addition, during the normal operation of the linear scan camera in the later stage, the camera mounting bracket angle changes caused by equipment vibration, external light source attenuation, normal angle changes between the line light source and the camera, SDK control, cutting and pulling, and other external factors during the conversion process will cause the camera image acquisition to fail, thereby affecting the accuracy of product inspection.

[0004] Currently, no effective solution has been proposed for the problem of untimely detection of image acquisition failure in related technologies. Summary of the invention

[0005] The embodiments of the present application provide an image detection method, system, electronic device and storage medium to at least solve the problem of untimely detection of image acquisition failure in the related art.

[0006] In a first aspect, an embodiment of the present application provides an image detection method, the method comprising:

[0007] Obtaining the collected original image data;

[0008] Projecting the original image data based on a preset projection area and calculating projection grayscale features;

[0009] Determine a standard grayscale range corresponding to the projection area; and generate an image detection result based on a comparison result between the projection grayscale feature and the standard grayscale range.

[0010] In some embodiments, projecting the original image data based on a preset projection area and calculating the projection grayscale feature includes:

[0011] The original image data is vertically projected under the projection area to calculate a vertical projection grayscale curve; based on the vertical projection grayscale curve, the projection grayscale feature is obtained; or,

[0012] The original image data is horizontally projected under the projection area to calculate a horizontal projection grayscale curve; and the projection grayscale feature is obtained based on the horizontal projection grayscale curve.

[0013] In some embodiments, vertically projecting the original image data under the projection area and calculating the vertical projection grayscale curve includes:

[0014] Acquire the grayscale value in the vertical direction of the original image data under the projection area; calculate the mean of the grayscale value in the vertical direction to obtain the vertical projection grayscale curve;

[0015] The original image data is horizontally projected under the projection area to calculate a horizontal projection grayscale curve, including:

[0016] The grayscale values ​​in the horizontal direction of the original image data under the projection area are obtained; and the mean of the grayscale values ​​in the horizontal direction is calculated to obtain the horizontal projection grayscale curve.

[0017] In some embodiments, obtaining the projection area includes:

[0018] Acquire preset standard image data, and extract a region of interest in the standard image data;

[0019] Based on the region of interest, the projection region is determined.

[0020] In some embodiments, determining the standard grayscale range corresponding to the projection area includes:

[0021] Obtaining preset standard image data;

[0022] The standard image data is projected based on the projection area, and the standard grayscale range is calculated.

[0023] In some embodiments, the generating of the image detection result based on the comparison result between the projection grayscale feature and the standard grayscale range includes:

[0024] If the projection grayscale feature falls within the standard grayscale range, generating a first image detection result indicating that the original image data is qualified;

[0025] If the projected grayscale feature is outside the standard grayscale range, a second image detection result indicating that the original image data is invalid is generated.

[0026] In some embodiments, after generating the image detection result, the method further includes:

[0027] Determining qualified image data from multiple frames of original image data according to the image detection result;

[0028] The object to be tested is tested based on the qualified image data, and a product testing result is generated.

[0029] In a second aspect, an embodiment of the present application provides an image detection device, the device comprising:

[0030] An acquisition module, used to acquire the collected original image data;

[0031] A projection module, used to project the original image data based on a preset projection area and calculate projection grayscale features;

[0032] The detection module is used to determine the standard grayscale range corresponding to the projection area; and generate an image detection result based on the comparison result between the projection grayscale feature and the standard grayscale range.

[0033] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the image detection method as described in the first aspect above is implemented.

[0034] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the image detection method as described in the first aspect above.

[0035] Compared with the related art, the image detection method, device, electronic device and storage medium provided in the embodiments of the present application obtain the collected original image data; project the original image data based on the preset projection area and calculate the projection grayscale features; determine the standard grayscale range corresponding to the projection area; and generate image detection results based on the comparison result between the projection grayscale features and the standard grayscale range. Through the above method, it is possible to detect in real time whether the current collected image is invalid, which solves the problem of untimely detection of image acquisition failure caused by the difficulty in retrieving and locating the failure factor and the high degree of professionalism, thereby effectively improving the accuracy of product detection based on image processing.

[0036] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0038] Figure 1 is a hardware structure block diagram of a terminal of an image detection method according to an embodiment of the present application;

[0039] Figure 2 is a flow chart of an image detection method according to an embodiment of the present application;

[0040] Figure 3 is a schematic diagram of a projection area according to an embodiment of the present application;

[0041] Figure 4A is a schematic diagram of an OK image according to an embodiment of the present application;

[0042] Figure 4B is a schematic diagram of a vertical projection grayscale curve of an OK image according to an embodiment of the present application;

[0043] Figure 4C is a schematic diagram of an NG image according to an embodiment of the present application;

[0044] Figure 4D is a schematic diagram of a horizontal projection grayscale curve of an NG image according to an embodiment of the present application;

[0045] Figure 5A is a schematic diagram of a vertical projection according to an embodiment of the present application;

[0046] Figure 5B is a schematic diagram of a horizontal projection according to an embodiment of the present application;

[0047] Figure 6 It is a structural block diagram of an image detection device according to an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.

[0049] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0050] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.

[0051] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, Figure 1 is a hardware structure block diagram of a terminal of an image detection method according to an embodiment of the present application. Figure 1 As shown, the terminal 10 may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0052] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to an image detection in an embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0053] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by the communication provider of the terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0054] This embodiment provides an image detection method. Figure 2 is a flow chart of an image detection method according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:

[0055] Step S210, acquiring the collected original image data.

[0056] The raw image data is the raw data obtained by scanning and photographing the object to be tested line by line with a linear array camera. The object to be tested may be a lithium battery product to be tested for quality in the process of film making, welding assembly, battery cell forming and coating. Specifically, the camera sensor of the linear array camera, such as a complementary metal oxide semiconductor (CMOS) image sensor or a charge coupled device (CCD) image sensor, generates a photoelectric effect after exposure, and the light signal is converted into an electrical signal. After a series of signal coupling, analog-to-digital conversion, signal amplification, integration and other processing, the raw data in RAW format is generated. RAW data contains all the original information of the image, such as exposure value, white balance, color information, etc., but has not been compressed, adjusted or optimized in any form.

[0057] Step S220, projecting the original image data based on a preset projection area, and calculating projection grayscale features.

[0058] The above-mentioned projection area can be set according to the actual application before image acquisition, for example, it can be pre-set to an area with a height of H and a width of W that includes the same target of the object to be measured. It should be understood that the shape of the area can be rectangular, circular, elliptical or other irregular shapes.

[0059] In this step, the target to be detected contained in the original image data can be detected first to obtain the region of interest in the original image data, and the region of interest is unified to the same size as the preset projection area, and the original image data is cropped based on the region. Next, the cropped image is grayscale projected to calculate the grayscale sum of each pixel column (or row). Figure 3 , the rectangular box in the figure shows the projection area, and the arrow indicates the projection direction. The edge of the projection area is the edge of the region of interest. According to this projection direction, the projection area in the image is grayscale projected, and the two-dimensional image data is compressed into one-dimensional data along a certain direction to obtain the projection image. Then, based on the projection results, useful grayscale features can be extracted, such as the peak value, valley value, width, etc. of the projection curve.

[0060] Step S230, determining a standard grayscale range corresponding to the projection area; and generating an image detection result based on a comparison result between the projection grayscale feature and the standard grayscale range.

[0061] The standard grayscale range can be calculated by preset standard image data. The standard image data refers to image data with qualified imaging. Specifically, target detection can be performed on the object to be measured contained in the standard image data to obtain the region of interest in the standard image data. At this time, the size of the region of interest can be specified as the size of the projection area, or a reasonable size value can be manually set in advance, and the size value is used as the size value of the projection area, and the region of interest is unified to the size value. After that, the standard image data is cropped based on the area, the cropped image is projected and the grayscale sum of each pixel column (or row) is calculated to obtain the projection result, and the grayscale feature value obtained after the projection calculation, including the maximum value and the minimum value, is used to determine the above-mentioned standard grayscale range. Among them, the object to be measured contained in the standard image data is the same object as the object to be measured contained in the above-mentioned original image data, for example, both are lithium battery products.

[0062] It should be understood that since both the standard image data and the original image data are calculated based on the grayscale projection of the projection area, the number of pixels in the original image data and the number of pixels in the standard image data are consistent. When screening a specific projection area, it is helpful to find the linear relationship of the grayscale projection curve. Please refer to Figure 4A and Figure 4B , respectively, are the qualified OK images and the projection grayscale curve corresponding to the OK images, and please refer to Figure 4C and Figure 4D , respectively, are the NG images with failed acquisition and the projection grayscale curve corresponding to the NG images; wherein, the NG images shown in the figure are failed images when the camera exposure is too low or the linear light source lamp beads are attenuated. It can be seen that regardless of whether the image acquisition fails, the grayscale projection curve can be fitted into a linear relationship, and the degree of discreteness is low, which is conducive to data convergence. Based on the above analysis, the grayscale values ​​of all pixels in the projection grayscale features calculated from the original image data to be tested can be compared with the standard grayscale range calculated from the standard image data, so as to determine whether the current original image data has failed acquisition and generate the corresponding image detection results.

[0063] In the related art, the line array camera may be affected by hardware factors such as the camera shooting angle, light source changes, lens changes, external trigger device signal interference, manual adjustment of physical structure changes, or software factors such as exposure parameter setting changes, frequency division parameter setting changes, and image signal processor (ISP) acquisition parameter settings. It is difficult to timely detect failures in the line array camera acquisition process and issue warnings, resulting in a lag in the handling of line array camera failures in the current inspection of products such as lithium batteries.

[0064] In the embodiment of the present application, the projection grayscale features calculated by the projection of the original image data are compared with the preset standard grayscale range through the above-mentioned image detection method, so that it is possible to detect in real time whether the current acquired image is invalid, thereby avoiding the problem of untimely detection of image acquisition failure caused by the difficulty and high professionalism in retrieving and locating the failure factor, thereby effectively improving the accuracy of product detection based on image processing.

[0065] In some embodiments, the projecting of the original image data based on the preset projection area and calculating the projection grayscale features may further include the following steps:

[0066] The original image data is vertically projected under the projection area to calculate the vertical projection grayscale curve; based on the vertical projection grayscale curve, the projection grayscale feature is obtained. Figure 5A , vertical projection refers to projection along the vertical direction (i.e., column direction) of the image, calculating the sum (or average) of the grayscale values ​​of all pixels in each row, thereby obtaining a curve representing the total grayscale of the column. This curve can reveal the grayscale distribution characteristics of the image in the vertical direction, such as the width and position of the target. The fitted vertical projection grayscale curve can be shown as Figure 4B or Figure 4D shown.

[0067] More specifically, the grayscale projection process in the vertical direction may further include the following steps: obtaining the grayscale value in the vertical direction of the original image data under the projection area; calculating the mean of the grayscale value in the vertical direction to obtain a vertical projection grayscale curve. One of the mathematical expressions of the vertical projection is as follows:

[0068]

[0069] In the above formula, vertProjecition(c) is used to represent the vertical projection value. n is used to represent the number of rows. Region is used to represent the projection area. (r', c') represents the coordinates of the first vertex of the projection area, and (r, c) represents the coordinates of the second vertex of the projection area; taking the projection area as a rectangular area as an example, (r', c') can represent the coordinates of the upper left corner of the area, and (r, c) can represent the coordinates of the lower right corner of the area. Based on the above formula, the vertical grayscale projection curve can be obtained in the screened projection area according to the .bmp / jpeg format image captured by the line array camera.

[0070] gray_projection(Region,Image::Mode:Horpre,HorizontalProjecition,VertProjecition)

[0071] Alternatively, in another embodiment, the above-mentioned projecting the original image data based on the preset projection area and calculating the projection grayscale feature may further include the following steps:

[0072] The original image data is horizontally projected under the projection area, and the horizontal projection grayscale curve is calculated; based on the horizontal projection grayscale curve, the projection grayscale feature is obtained. Figure 5B Horizontal projection refers to projecting along the horizontal direction (i.e. row direction) of the image, calculating the sum (or average) of the grayscale values ​​of all pixels in each column, and thus obtaining a curve representing the total grayscale of the row. This curve can reveal the grayscale distribution characteristics of the image in the horizontal direction, such as the width and position of the target.

[0073] More specifically, the grayscale projection process in the horizontal direction may further include the following steps:

[0074] Get the grayscale value in the horizontal direction of the original image data under the projection area; calculate the mean of the grayscale value in the horizontal direction to obtain the horizontal projection grayscale curve. One of the mathematical expressions of the horizontal projection is as follows:

[0075]

[0076] Among them, HorizontalProjecition(r) is used to indicate the horizontal projection value, and m is used to indicate the number of columns.

[0077] For example, in the Halcon image processing software, the gray projection of a specified region (Region) in the image can be calculated by the gray_projection operator; the code is as follows:

[0078] gray_projection(Region,Image::Mode:Horpre,HorizontalProjecition,VertProjecition)

[0079] In the above code example, the input parameter Region specifies the image region on which the grayscale projection is to be calculated. The input parameter Image contains the grayscale image to be processed. The input control parameter Mode specifies the direction of the projection. The output parameter HorizontalProjection contains the grayscale projection result calculated along the horizontal direction. The output parameter VerticalProjection contains the grayscale projection result calculated along the vertical direction.

[0080] In addition, if the selected area is not rotated by a certain angle with respect to its rows and columns, an interpolation algorithm can be used to calculate the grayscale value of each area in turn, and then project it in the direction of the angle. At this time, the image detection method is similar to the above-mentioned image detection method based on vertical projection or horizontal projection, and will not be repeated here.

[0081] Through the above-mentioned embodiment, a curve template and a corresponding grayscale value law are established to detect whether the collected image is invalid, which is beneficial to improving the accuracy of image detection.

[0082] It should be noted that, for ease of understanding, the above embodiments only show the failure of imaging affected by changes in exposure size, and the image as a whole is an ideal model of grayscale compression and stretching. For other single failure factors, the above method can also be used to detect whether the image is invalid. In addition, nonlinear grayscale compression and stretching of the image may occur when physical changes are involved (such as light source angle, local circuit damage, camera angle change); at this time, according to the position of the image coordinates (X / Y coordinates), the image grayscale will have obvious gradient characteristics, not obvious linear relationship; the imaging effect will appear light and dark, and the grayscale brightness and darkness will radiate from the middle area to the edge position; such more complex grayscale curves may have various situations, and need to be used in a comprehensive manner with horizontal projection or vertical projection. It should be understood that no matter how complex the application environment is, as long as the projection area screened by the standard image data, the detection target is reasonable, the fitted curve is regular, and in special cases, it can be bound to the corresponding relationship with the pixel coordinates, the grayscale spot inspection function can be realized.

[0083] In some embodiments, obtaining the projection area comprises the following steps:

[0084] Acquire preset standard image data, and extract the region of interest in the standard image data; and determine the projection area based on the region of interest.

[0085] The standard image data can be manually prepared by the staff in advance, or can also be the image data of the experiment or test obtained before the image acquisition detection, as long as it is determined that the image is qualified and can be used as a template. The standard image data format can be bmp, jpeg, etc.

[0086] Specifically, the region of interest in the standard image data can be extracted by manual or automatic detection; for example, gen_rectangle1 (or other shape generation functions) can be used to create a region of interest, or the region of interest can be automatically detected by threshold segmentation, edge detection, etc. The projection region is usually the region of interest itself, or a region further defined based on the region of interest. In some cases, you may want to scale, translate, or crop the region of interest to obtain a region that is more suitable for projection analysis, which is not limited here.

[0087] In the above embodiment, directly using the region of interest as the projection area can ensure the pertinence of the analysis results and reduce unnecessary background noise or interference. In addition, by projecting the region of interest instead of the entire image, the amount of calculation can be significantly reduced and the processing efficiency can be improved.

[0088] In some embodiments, the above-mentioned determination of the standard grayscale range corresponding to the projection area may further include the following steps:

[0089] Obtain preset standard image data; project the standard image data based on the projection area, and calculate the standard grayscale range. Specifically, by grayscale projection of the projection area intercepted from the standard image data, a set of projection data or a fitted projection curve can be obtained. Then, the grayscale range can be calculated based on the projection result. The standard grayscale range usually refers to the minimum and maximum values ​​in the projection value, or a reasonable range is determined by calculating specific statistics (such as mean, median, standard deviation, etc.); or, the extreme values ​​in the projection value can be grayscale expanded, and the standard grayscale range is determined based on the expanded range. For example, grayscale projection is performed based on the standard image data, and it is determined that the grayscale value on its fitting curve fluctuates between 240 grayscale and 242 grayscale. In order to ensure the matching accuracy and success rate, the maximum value can be increased, and the increase area is determined according to the preset rising expansion range; and the minimum value can be reduced, and the reduction area is determined according to the preset descending expansion range. At this time, the standard grayscale range set after expansion is between 235 and 247 grayscale values. It can be seen that this method directly operates on the projection area specified in the standard image data without the need for complex image preprocessing steps, and effectively ensures the accuracy of the standard grayscale range, thereby further improving the accuracy of image detection.

[0090] In some embodiments, the above-mentioned method of generating an image detection result based on the comparison result between the projection grayscale feature and the standard grayscale range includes the following steps:

[0091] If the projection grayscale feature falls within the standard grayscale range, a first image detection result indicating that the original image data is qualified is generated; if the projection grayscale feature is outside the standard grayscale range, a second image detection result indicating that the original image data is invalid is generated. Specifically, the grayscale values ​​of all pixels under the projection area in the original image data are matched with the standard grayscale range. If the grayscale values ​​of all pixels fall within this standard grayscale range, since the grayscale curves fitted are linear relationship curves regardless of whether the captured image is qualified or not, and the discreteness is low; based on this, the image acquisition can be considered OK under the premise of low grayscale discreteness and good enough linear convergence. For example, the standard grayscale range is 235 to 247 grayscale values; vertical grayscale projection is performed according to the current captured image to obtain a vertical projection grayscale curve a; as long as the grayscale values ​​of all random pixels in curve a are between 235 and 247, the match is considered successful, and then an image detection result indicating that the image acquisition is OK can be obtained. Otherwise, the image acquisition can be considered to have failed.

[0092] Based on the above analysis, if during the image acquisition process, the projection grayscale curve of the current acquired image is matched with the projection curve of the standard image data each time, a real-time warning can be provided.

[0093] In some embodiments, after generating the image detection result, the method further includes the following steps:

[0094] According to the image detection results, qualified image data is determined from multiple frames of original image data; the object to be tested is detected based on the qualified image data, and the product detection results are generated. Specifically, each frame of image data collected by the linear array camera is detected using the above-mentioned image detection method to screen out qualified image data; NG images indicating image acquisition failure can be deleted or re-captured. Then, based on the qualified image data, product inspection, such as lithium batteries, is carried out, and finally the inspection results in each frame of qualified images are summarized to form a complete product inspection result, including identifying and marking products that do not meet the standards or have defects, or generating a detailed inspection report based on the inspection results.

[0095] Through the above-mentioned embodiments, the adverse consequences caused by failure lag in the camera acquisition application process are effectively avoided, and the problem of errors in batch detection of products such as lithium batteries when the image fails is solved, thereby greatly improving the accuracy of product detection based on image processing.

[0096] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0097] The present embodiment also provides an image detection device, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the terms "module", "unit", "subunit" and the like can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0098] Figure 6 is a structural block diagram of an image detection device according to an embodiment of the present application, such as Figure 6 As shown, the device comprises:

[0099] The acquisition module 61 is used to acquire the collected original image data; the projection module 62 is used to project the original image data based on a preset projection area and calculate the projection grayscale characteristics; the detection module 63 is used to determine the standard grayscale range corresponding to the projection area; the detection module 63 generates an image detection result based on the comparison result between the projection grayscale characteristics and the standard grayscale range.

[0100] In some embodiments, the projection module 62 is further used to vertically project the original image data under the projection area and calculate a vertical projection grayscale curve; the projection module 62 obtains the projection grayscale feature based on the vertical projection grayscale curve.

[0101] Alternatively, the projection module 62 is further configured to perform horizontal projection on the original image data under the projection area, calculate a horizontal projection grayscale curve, and obtain a projection grayscale feature based on the horizontal projection grayscale curve.

[0102] In some embodiments, the projection module 62 is also used to obtain the grayscale value in the vertical direction of the original image data in the projection area; the average of the grayscale values ​​in the vertical direction is calculated to obtain a vertical projection grayscale curve; the projection module 62 is also used to obtain the grayscale value in the horizontal direction of the original image data in the projection area; the average of the grayscale values ​​in the horizontal direction is calculated to obtain a horizontal projection grayscale curve.

[0103] In some embodiments, the detection module 63 is further used to obtain preset standard image data; the detection module projects the standard image data based on the projection area and calculates the standard grayscale range.

[0104] In some embodiments, the detection module 63 is also used to generate a first image detection result indicating that the original image data is qualified if the projection grayscale feature falls within the standard grayscale range; if the projection grayscale feature is outside the standard grayscale range, the detection module 63 generates a second image detection result indicating that the original image data is invalid.

[0105] In some embodiments, the above-mentioned image detection device also includes a product detection module; the product detection module is used to determine qualified image data from multiple frames of original image data based on the image detection results; the product detection module detects the object to be detected based on the qualified image data and generates a product detection result.

[0106] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0107] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0108] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0109] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0110] S1, obtaining the collected original image data.

[0111] S2, projecting the original image data based on a preset projection area, and calculating the projection grayscale features.

[0112] S3, determining a standard grayscale range corresponding to the projection area; and generating an image detection result based on a comparison result between the projection grayscale feature and the standard grayscale range.

[0113] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0114] In addition, in combination with the image detection method in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any one of the image detection methods in the above embodiment is implemented.

[0115] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are 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.

[0116] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof 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 a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. An image detection method, characterized in that: The method comprises: Obtaining the collected original image data; Projecting the original image data based on a preset projection area and calculating projection grayscale features; Determine a standard grayscale range corresponding to the projection area; and generate an image detection result based on a comparison result between the projection grayscale feature and the standard grayscale range.

2. The image detection method according to claim 1, characterized in that: The projecting the original image data based on a preset projection area and calculating the projection grayscale feature includes: The original image data is vertically projected under the projection area to calculate a vertical projection grayscale curve; based on the vertical projection grayscale curve, the projection grayscale feature is obtained; or, The original image data is horizontally projected under the projection area to calculate a horizontal projection grayscale curve; and the projection grayscale feature is obtained based on the horizontal projection grayscale curve.

3. The image detection method according to claim 2, characterized in that: The original image data is vertically projected under the projection area to calculate a vertical projection grayscale curve, including: Acquire the grayscale value in the vertical direction of the original image data under the projection area; calculate the mean of the grayscale value in the vertical direction to obtain the vertical projection grayscale curve; The original image data is horizontally projected under the projection area to calculate a horizontal projection grayscale curve, including: The grayscale values ​​in the horizontal direction of the original image data under the projection area are obtained; and the mean of the grayscale values ​​in the horizontal direction is calculated to obtain the horizontal projection grayscale curve.

4. The image detection method according to claim 1, characterized in that: Acquiring the projection area includes: Acquire preset standard image data, and extract a region of interest in the standard image data; Based on the region of interest, the projection region is determined.

5. The image detection method according to claim 1, characterized in that: The determining of the standard grayscale range corresponding to the projection area includes: Obtaining preset standard image data; The standard image data is projected based on the projection area, and the standard grayscale range is calculated.

6. The image detection method according to claim 1, characterized in that: The generating of the image detection result based on the comparison result between the projection grayscale feature and the standard grayscale range comprises: If the projection grayscale feature falls within the standard grayscale range, generating a first image detection result indicating that the original image data is qualified; If the projected grayscale feature is outside the standard grayscale range, a second image detection result indicating that the original image data is invalid is generated.

7. The image detection method according to any one of claims 1 to 6, characterized in that: After generating the image detection result, the method further includes: Determining qualified image data from multiple frames of original image data according to the image detection result; The object to be tested is tested based on the qualified image data, and a product testing result is generated.

8. An image detection device, characterized in that: The device comprises: An acquisition module, used to acquire the collected original image data; A projection module, used to project the original image data based on a preset projection area and calculate projection grayscale features; The detection module is used to determine the standard grayscale range corresponding to the projection area; and generate an image detection result based on the comparison result between the projection grayscale feature and the standard grayscale range.

9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the image detection method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the image detection method according to any one of claims 1 to 7 when executed.