Industrial image sensor correction method and industrial image scanning device
By setting multiple grayscale blocks on the reference sheet, selecting the target grayscale block that is most similar to the grayscale value of the detected item to be corrected, the working parameters of the image sensor are solved, and the problem of deterioration in image quality caused by changes in the working conditions of the image sensor is improved, and the scanning image quality is reduced and the data processing amount is reduced.
Patent Information
- Application Number
- CN202410044353.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-10
- Publication Date
- 2025-07-11
AI Technical Summary
In the prior art, changes in the working conditions of the image sensor affect image quality, resulting in poor quality of the scanned image, and the existing correction method increases the data processing volume of the controller, affecting scanning efficiency.
By setting a plurality of grayscale blocks on the reference sheet, selecting the target grayscale block that is most similar to the grayscale value of the detected item as a reference, correcting the operating parameters of the image sensor, including the operating current or line emission time of the light emitter.
The data processing volume is reduced, the scanned image quality is improved, the correction effect is improved, and the image quality deterioration caused by changes in the working conditions of the image sensor is solved.
Smart Images

Figure CN120302176A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image scanning, and in particular, to a calibration method for an industrial image sensor and an industrial image scanning device. Background Art
[0002] In recent years, image sensors have been gradually applied to the industrial field for defect detection of items such as printed matter, textiles, tiles, solar panels, displays, and battery coatings. For example, in the process of manufacturing lithium batteries, an image sensor is usually used to collect images of battery coatings in real time and detect defects such as coating breakage, indentation, and bubbles in the collected images. It has been found through research that the working conditions of the image sensor, such as the working voltage, working ambient temperature, and working duration, all affect the quality of the images collected by the image sensor. For example, the brightness of the images collected at low temperatures will be too low, the brightness of the images collected at high temperatures will be too high, and the brightness of the images collected after long-term work will become low, etc., that is, the image quality deteriorates, thereby affecting the accuracy of defect recognition.
[0003] In order to reduce the influence of changes in working conditions on the quality of the images collected by the image sensor, in the related art, an image gray-scale calibration method is used to calibrate the gray-scale values of the medium images collected by the image sensor. The image gray-scale calibration method in the related art includes: Step 1, scanning a white substrate set on the image sensor, comparing the gray-scale value of the scanned image of the white substrate with the reference value stored in the non-volatile memory, and calculating a gray-scale value calibration coefficient; Step 2, scanning the medium, and calibrating the image data of the scanned medium according to the calibration coefficient.
[0004] The above calibration method has the following deficiencies: According to the calibration coefficient, calibration calculations are performed on each image data of the scanned medium, increasing the data processing volume of the controller in the image scanning device, occupying the computing power of the controller, and affecting the efficiency of the scanning operation. And there is a problem of poor calibration effect in the above calibration method, that is, it is difficult to ensure better scanned image quality. Summary of the Invention
[0005] The purpose of the present application includes providing a calibration method for an industrial image sensor and an industrial image scanning device, which have better scanned image quality, smaller data processing volume, and lower load on the controller.
[0006] The embodiments of the present application can be implemented as follows:
[0007] In a first aspect, the present application provides a calibration method for an industrial image sensor, which is applied to an industrial image scanning device. The industrial image scanning device includes an image sensor, and the image sensor is used to scan a detected item and a reference sheet. The reference sheet includes at least two gray-scale blocks with different gray-scale values. The calibration method for the industrial image sensor includes:
[0008] Obtain the gray values of each gray block in the reference sheet and the gray value of the item to be detected;
[0009] Determine the target gray block that is most similar to the gray value of the item to be detected according to the gray value of the item to be detected and the gray values of each gray block;
[0010] Obtain the reference gray value of the target gray block;
[0011] Correct the operating parameters of the image sensor according to the gray value of at least one of the item to be detected and the target gray block and the reference gray value of the target gray block.
[0012] In an optional embodiment, the step of determining the target gray block that is most similar to the gray value of the item to be detected according to the gray value of the item to be detected and the gray values of each gray block includes:
[0013] Calculate the difference between the gray value of the item to be detected and the gray values of each gray block, and determine the gray block corresponding to the smallest absolute value of the difference as the target gray block.
[0014] In an optional embodiment, each gray block has a unique ID, and the ID of each gray block corresponds to a reference gray value and the corresponding relationship is pre-stored; the step of obtaining the reference gray value of the target gray block includes:
[0015] Determine the ID of the target gray block;
[0016] Obtain the reference gray value corresponding to the ID of the target gray block from the pre-stored corresponding relationship between the ID of the gray block and the reference gray value as the reference gray value of the target gray block.
[0017] In an optional embodiment, the image sensor includes a light emitter and a light sensor, and the operating parameter of the image sensor is the operating current or the line emission time of the light emitter.
[0018] In an optional embodiment, the operating parameter of the image sensor is the operating current of the light emitter. The step of correcting the operating parameter of the image sensor according to the gray value of at least one of the item to be detected and the target gray block and the reference gray value of the target gray block includes:
[0019] According to the formula I x =(A set / A)*I p Correct the operating current of the light emitter of the image sensor, where I x is the corrected operating current of the light emitter, I p is the current operating current of the light emitter, A set is the reference gray value of the target gray block, and A is the gray value of the target gray block;
[0020] Alternatively, according to formula I x =(A set / B)*I p correct the working current of the light emitter for image sensing, where I x is the working current of the corrected light emitter, I p is the current working current of the light emitter, A set is the reference gray value of the target gray block, and B is the gray value of the item to be detected.
[0021] In an alternative embodiment, the working parameter of the image sensor is the row emission time of the light emitter. According to the gray value of at least one of the item to be detected and the target gray block and the reference gray value of the target gray block, the steps of correcting the working parameter of the image sensor include:
[0022] According to formula T x =(A set / A)*T p correct the row emission time of the light emitter for image sensing, where T x is the row emission time of the corrected light emitter, T p is the current row emission time of the light emitter, A set is the reference gray value of the target gray block, and A is the gray value of the target gray block;
[0023] Alternatively, according to formula T x =(A set / B)*T p correct the row emission time of the light emitter for image sensing, where T x is the row emission time of the corrected light emitter, T p is the current row emission time of the light emitter, A set is the reference gray value of the target gray block, and B is the gray value of the item to be detected.
[0024] In a second aspect, the present application provides an industrial image scanning device, including an image sensor, a reference chip, and a controller. The reference chip includes at least two gray blocks with different gray values. The controller is electrically connected to the image sensor and is configured to:
[0025] Obtain the gray value of each gray block in the reference chip and the gray value of the item to be detected; determine the target gray block most similar to the gray value of the item to be detected according to the gray value of the item to be detected and the gray value of each gray block; obtain the reference gray value of the target gray block; correct the working parameter of the image sensor according to the gray value of at least one of the item to be detected and the target gray block and the reference gray value of the target gray block.
[0026] In an alternative embodiment, the industrial image scanning device further includes a first memory. Each gray block has a unique ID, and the ID of each gray block corresponds to a reference gray value, and the corresponding relationship is pre-stored in the first memory. The controller is configured to obtain the reference gray value of the target gray block in the following manner:
[0027] Determine the ID of the target gray block; obtain the reference gray value corresponding to the ID of the target gray block from the corresponding relationship between the ID of the gray block stored in the first memory and the reference gray value, as the reference gray value of the target gray block.
[0028] In an alternative embodiment, the image sensor includes a light emitter and a light sensor. The operating parameter of the image sensor is the operating current or the line emission time of the light emitter. The controller is configured to correct the operating parameter of the image sensor by one of the following methods:
[0029] According to the formula I x =(A set / A)*I p correct the operating current of the light emitter of the image sensor, where I x is the corrected operating current of the light emitter, I p is the current operating current of the light emitter, A set is the reference gray value of the target gray block, and A is the gray value of the target gray block;
[0030] Or, according to the formula I x =(A set / B)*I p correct the operating current of the light emitter of the image sensor, where I x is the corrected operating current of the light emitter, I p is the current operating current of the light emitter, A set is the reference gray value of the target gray block, and B is the gray value of the detected item;
[0031] Or, according to the formula T x =(A set / A)*T p correct the line emission time of the light emitter of the image sensor, where T x is the corrected line emission time of the light emitter, T p is the current line emission time of the light emitter, A set is the reference gray value of the target gray block, and A is the gray value of the target gray block;
[0032] Or, according to the formula T x =(A set / B)*T pCalibrate the line emission time of the light emitter for image sensing, where T x is the line emission time of the calibrated light emitter, and T p is the current line emission time of the light emitter, A set is the reference gray value of the target gray block, and B is the gray value of the item to be detected.
[0033] In an optional embodiment, the industrial image scanning device further includes an amplifier, an A / D converter, and a second memory; the amplifier is electrically connected to the image sensor, and the amplifier is configured to amplify the analog signal output by the image sensor; the A / D converter is electrically connected to the second memory, and the A / D converter is configured to convert the analog signal output by the amplifier into digital image data; the second memory is electrically connected to the controller, and the second memory is configured to store the image data from the A / D converter and the gray values generated by the controller processing the image data.
[0034] The beneficial effects of the embodiments of the present application include, for example:
[0035] The calibration method of the industrial image sensor provided by the embodiments of the present application includes: obtaining the gray value of each gray block in the reference sheet and the gray value of the item to be detected; determining the target gray block most similar to the gray value of the item to be detected according to the gray value of the item to be detected and the gray value of each gray block; obtaining the reference gray value of the target gray block; and calibrating the working parameters of the image sensor according to the gray value of at least one of the item to be detected and the target gray block and the reference gray value of the target gray block. The calibration method provided by the embodiments of the present application performs corresponding adjustments to the working parameters of the image sensor. Therefore, it is not necessary to perform calibration calculations on the image data of the item to be detected scanned subsequently, and the data processing amount of the controller is not increased. Moreover, using the reference gray value of the target gray block similar to the gray value of the item to be detected as a reference to perform corresponding adjustments to the working parameters of the image sensor can ensure the parameter calibration accuracy of the image sensor and improve the problem of poor calibration effect caused by determining the calibration coefficient using the change of the scanned image data of the white substrate in the related art. Using the reference gray value of the target gray block with the gray value closest to the item to be detected as a reference to adjust the working parameters of the image sensor can significantly reduce the calibration deviation caused by the gray difference between the item to be detected and the gray block, and effectively solve the problem of poor image quality caused by changes in the working conditions of the image sensor.
[0036] The industrial image scanning device provided by the embodiments of the present application can be used to implement the above calibration method of the industrial image sensor. Therefore, when calibrating the image sensor, the data processing amount is small, the calibration effect is good, and the scanned image quality is excellent. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] To more clearly illustrate the technical solutions of the embodiments of the present application, the accompanying drawings required for the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0038] Figure 1 It is a schematic diagram of the composition of an industrial image scanning device in an embodiment of the present application;
[0039] Figure 2 It is a schematic diagram of the structure of an industrial image sensor of an industrial image scanning device in an embodiment of the present application;
[0040] Figure 3 It is a flowchart of a calibration method for an industrial image sensor in an embodiment of the present application;
[0041] Figure 4 It is a schematic diagram of the relationship between the image gray value of an industrial image sensor and the operating current of the light emitter in an embodiment of the present application;
[0042] Figure 5 It is a schematic diagram of calibrating the operating current of the light emitter of an industrial image sensor in an embodiment of the present application;
[0043] Figure 6 It is a schematic diagram of calibrating the operating current of the light emitter of an industrial image sensor in another embodiment of the present application.
[0044] Icon: 10 - Controller; 21 - First memory; 22 - Second memory; 30 - Image sensor; 31 - Light emitter; 32 - Light sensor; 33 - Reference plate; 331 - First gray block; 332 - Second gray block; 333 - Third gray block; 334 - Fourth gray block; 335 - Fifth gray block; 34 - Frame; 35 - Transparent plate; 40 - Amplifier; 50 - A / D converter. Detailed implementation manners
[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Usually, the components of the embodiments of the present application described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations.
[0046] Accordingly, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed present application, but merely represents selected embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the scope of protection of the present application.
[0047] It should be noted that: Similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0048] In the description of the present application, it should be noted that if terms such as "upper", "lower", "inner", "outer", etc. indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the inventive product is habitually placed during use, it is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present application.
[0049] In addition, terms such as "first", "second", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0050] It should be noted that, without conflict, the features in the embodiments of the present application can be combined with each other.
[0051] In the related art, the method for calibrating an image sensor includes performing calibration calculations on each scanned image data according to calibration coefficients. This method has a large amount of data processing and a heavy burden on the controller. Moreover, the inventor found that in industrial applications, the gray values of different detected objects vary significantly. For example, the gray values of battery smears and battery diaphragms vary significantly. In the related art, a single white substrate is used as a reference, and the calibration coefficients obtained by scanning the white substrate are used to calibrate the scanned images of the detected objects. However, since the gray values of different detected objects have different degrees of difference from the gray value of the white substrate, when the gray value difference is large, using the white substrate as a reference to calibrate the image sensor will obviously have a certain calibration deviation. Therefore, it is difficult to ensure better scanned image quality even after calibrating the scanned image data by the calibration method in the related art.
[0052] In order to improve the calibration effect and reduce the amount of data processing, the embodiments of the present application provide a calibration method for an industrial image sensor and an industrial image scanning device. By selecting the gray block closest to the gray value of the detected object from multiple gray blocks as a reference to calibrate the working parameters of the image sensor, a large amount of data processing is avoided and the calibration effect is improved.
[0053] Figure 1 This is a schematic diagram of the composition of an industrial image scanning device in an embodiment of the present application. For the sake of convenience of description, only the parts related to the embodiment of the present application are shown; Figure 2 This is a schematic diagram of the structure of an industrial image sensor 30 of an industrial image scanning device for heavy industry in an embodiment of the present application. Combining Figure 1 and Figure 2 , the industrial image scanning device in the embodiment of the present application includes a controller 10, a first memory 21, a second memory 22, an image sensor 30, an amplifier 40, and an A / D converter 50.
[0054] Among them, the image sensor 30 is electrically connected to the controller 10 and is used to acquire image data of the item to be detected. The image sensor 30 can be a Contact Image Sensor (CIS) or a Charge Coupled Device (CCD).
[0055] As Figure 2 shown, the image sensor 30 of this embodiment includes a light emitter 31, a light sensor 32, a frame 34, and a transparent plate 35. Among them, the frame 34 includes a receiving cavity with an opening, and the light emitter 31 and the light sensor 32 are installed in the receiving cavity, and the transparent plate 35 is used to close the opening. The industrial image scanning device further includes a reference plate 33 disposed on the surface of the transparent plate 35. The reference plate 33 includes at least two gray blocks with different gray values. The image sensor 30 is also used to acquire the image data of the reference plate 33. In this embodiment, along the main scanning direction of the image sensor 30, the reference plate 33 is located at one end of the transparent plate 35. The reference plate 33 includes five gray blocks with different gray values, namely a first gray block 331, a second gray block 332, a third gray block 333, a fourth gray block 334, and a fifth gray block 335. The five gray blocks are arranged in sequence along the main scanning direction, and the size of each gray block is the same. The reference plate 33 can be pasted on the outer surface of the transparent plate 35 or on the inner surface of the transparent plate 35. The gray blocks of the reference plate 33 are arranged opposite to the light sensor 32. Optionally, the number of gray blocks and the gray values of the gray blocks are set according to the type and reflective characteristics of the item to be detected, which is beneficial to improving the accuracy of calibration of the image sensor 30.
[0056] It can be understood that in other embodiments, the setting position of the reference plate 33 is not limited to one end of the transparent plate 35, and it can also be set at other positions as long as it can be scanned by the image sensor 30.
[0057] The amplifier 40 is electrically connected to the image sensor 30, specifically electrically connected to the light sensor 32 of the image sensor 30, and is used to amplify the analog signal output by the light sensor 32.
[0058] The A / D converter 50 is electrically connected to the amplifier 40. The A / D converter 50 is configured to perform analog / digital conversion on the analog signal output by the amplifier 40, convert the analog signal into digital image data, and be used for the controller 10 to read and process.
[0059] The first memory 21 is electrically connected to the controller 10. The first memory 21 is used to store the reference gray values corresponding to each gray block on the reference chip 33, so that the controller 10 can correct the operating parameters of the image sensor 30 according to the reference gray values. Specifically, each gray block has a unique ID different from other gray blocks, and the ID of each gray block corresponds to a reference gray value, and the correspondence between the ID of each gray block and its corresponding reference gray value is pre-stored in the first memory 21. Optionally, the first memory 21 is a non-volatile storage medium, such as a Flash memory.
[0060] The second memory 22 is electrically connected to the controller 10 and the A / D converter 50. The second memory 22 is used to store the image data from the A / D converter 50 and the gray values generated by the controller 10 for processing the image data, etc. The second memory 22 can be a RAM memory.
[0061] Table 1 is a correspondence table between gray blocks and reference gray values. Table 1 stores the correspondence between the ID of each gray block and the reference gray value. Among them, the reference gray value of each gray block is the gray value of the image data of each gray block obtained by the image sensor 30 scanning the reference chip 33 under the reference working conditions. The reference working conditions include that the reference working current of the light emitter 31 is I set , and the reference light emission time (hereinafter referred to as the reference line light emission time) T of the light emitter 31 when scanning one row of items set . In this embodiment, the reference chip 33 includes five gray blocks. The reference gray value of the first gray block 331 is A 1set , the reference gray value of the second gray block 332 is A 2set , the reference gray value of the third gray block 333 is A 3set , the reference gray value of the fourth gray block 334 is A 4set , and the reference gray value of the fifth gray block 335 is A 5set .
[0062] The number of gray blocks and the gray values of the gray blocks in Table 1 can be set according to the type and reflective characteristics of the item to be detected. As shown in Table 1, one item to be detected can correspond to one gray block, such as setting the first gray block 331 with ID 01 for battery separator 1; or multiple items to be detected with similar gray levels and reflective characteristics can correspond to one gray block, such as setting the fifth gray block 335 with ID 05 for battery coating 2 and battery coating 3.
[0063] According to the ID of each gray block, the reference gray value corresponding to the ID of the gray block can be found in Table 1. For example, if it is determined that the ID of the third gray block 333 is 03, by looking up the table, the reference gray value corresponding to the gray block with the ID number 03 is A 3set , then the reference gray value of the third gray block 333 can be determined as A 3set .
[0064] Table 1 Correspondence Table between Gray Blocks and Reference Gray Values
[0065]
[0066]
[0067] The controller 10 can set the operating parameters of the image sensor 30, such as setting the operating current I of the light emitter 31 and setting the light emission time T of the light emitter 31 when the image sensor 30 scans an item in a row (hereinafter referred to as the row light emission time). The controller 10 is also used to control the image sensor 30 to perform scanning, that is, at regular intervals, control the light emitter 31 to emit light, control the amplifier 40 to amplify the analog signal generated by the light sensor 32, and control the A / D converter 50 to output a row of image data. The controller 10 is also used to process the image data and execute the steps of the calibration method for industrial image sensors. Further, the controller 10 is also used to receive external scanning control instructions and send image data to the outside, etc.
[0068] In the embodiment of the present application, the controller 10 is configured to:[[]]
[0069] Obtain the gray value of each gray block in the reference chip 33 and the gray value of the item to be detected; determine the target gray block that is most similar to the gray value of the item to be detected according to the gray value of the item to be detected and the gray value of each gray block; obtain the reference gray value of the target gray block; correct the operating parameters of the image sensor 30 according to the gray value of at least one of the item to be detected and the target gray block and the reference gray value of the target gray block.
[0070] For the specific implementation manner of the controller 10 to correct the operating parameters of the image sensor 30, reference can be made to the introduction of the calibration method for industrial image sensors below.
[0071] Figure 3 is a flowchart of the calibration method for industrial image sensors in an embodiment of the present application. In combination with Figure 1 and Figure 2 , the calibration method for industrial image sensors in the embodiment of the present application includes the following steps.
[0072] Step S11: Obtain the gray values of each gray block in the reference slice and the gray value of the item to be detected.
[0073] Taking the industrial image scanning device provided in the embodiment of the present application as an example, the image sensor 30 scans the item to be detected with a set length. While scanning the item to be detected, it also scans the reference slice 33, so as to obtain the image data of the item to be detected and the image data of each gray block on the reference slice 33. Specifically, the controller 10 controls the light emitter 31 to be powered on and emit light. The emitted light irradiates the item to be detected, such as a battery coating or a battery separator, and the reference slice 33. The light sensor 32 receives the light reflected or transmitted by the item to be detected and each gray block on the reference slice 33. The analog signal output by the light sensor 32 after receiving the light is amplified by the amplifier 40, and then is subjected to analog / digital conversion by the A / D converter 50. The A / D converter 50 outputs a digital signal corresponding to the amount of light received by the light sensor 32, that is, the image data of the item to be detected and the image data of the gray block.
[0074] The controller 10 processes the image data of the item to be detected and the image data of each gray block to obtain the gray value of the item to be detected and the gray value of each gray block. For example, in this embodiment, the reference slice 33 includes five gray blocks. The controller 10 processes the image of the item to be detected to obtain the gray value B of the item to be detected. The controller 10 processes the image data of the five gray blocks to obtain the gray value A1 of the first gray block 331, the gray value A2 of the second gray block 332, the gray value A3 of the third gray block 333, the gray value A4 of the fourth gray block 334, and the gray value A5 of the fifth gray block 335. The gray value can be calculated by the arithmetic mean method.
[0075] Step S12: Determine the target gray block that is most similar to the gray value of the item to be detected according to the gray value of the item to be detected and the gray value of each gray block.
[0076] The controller 10 calculates the difference between the gray value B of the item to be detected and the gray value of each gray block, and determines the gray block corresponding to the smallest absolute value of the difference as the target gray block. In this embodiment, the controller 10 calculates the difference between the gray value B of the image of the item to be detected and the gray value A1 of the first gray block 331, the gray value A2 of the second gray block 332, the gray value A3 of the third gray block 333, the gray value A4 of the fourth gray block 334, and the gray value A5 of the fifth gray block 335 one by one. The gray block with the smallest absolute value of the difference is the target gray block that is most similar to the gray value of the item to be detected.
[0077] Step S13: Obtain the reference gray value of the target gray block.
[0078] In this embodiment, each gray block has a unique ID different from other gray blocks. The ID of each gray block corresponds to a reference gray value, and the corresponding relationship is stored in advance. The ID of the target gray block is the ID of the gray block whose gray value is similar to that of the detected item. For example, when the difference between the gray value of the detected item image and the gray value of the second gray block 332 is the smallest, the second gray block 332 is the target gray block, and the ID of the target gray block is the ID of the second gray block 332. It should be noted that the ID of each gray block is preset and stored in the first memory 21, as shown in Table 1 above. Figure 2 The ID of the first gray block 331 in [reference to something not clear] is 01, the ID of the second gray block 332 is 02, the ID of the third gray block 333 is 03, the ID of the fourth gray block 334 is 04, and the ID of the fifth gray block 335 is 05.
[0079] Therefore, in this embodiment, the steps of obtaining the reference gray value of the target gray block may include: determining the ID of the target gray block; obtaining the reference gray value corresponding to the ID of the target gray block from the pre-stored corresponding relationship between the ID of the gray block and the reference gray value, as the reference gray value of the target gray block.
[0080] The controller 10 searches for the reference gray value corresponding to the ID of the target gray block in the gray block and reference gray value correspondence table shown in Table 1 above according to the ID of the target gray block, and takes the reference gray value obtained by looking up the table corresponding to the ID of the target gray block as the reference gray value of the target gray block. For example, in this embodiment, the ID of the second gray block 332 is the ID of the target gray block, the ID of the second gray block 332 is 02, and the reference gray value obtained by looking up the table for ID 02 is A 2set then the reference gray value of the target gray block is A 2set .
[0081] Step S14, correct the working parameters of the image sensor according to the gray value of at least one of the detected item and the target gray block and the reference gray value of the target gray block.
[0082] The controller 10 corrects the working parameters of the image sensor 30 according to the gray value of the detected item and / or the target gray block and the reference gray value of the target gray block. Optionally, the working parameter of the image sensor 30 is the working current or the row emission time of the light emitter 31, that is, correct one of the working current and the row emission time of the light emitter 31.
[0083] Figure 4 is a schematic diagram of the relationship between the image gray value of the industrial image sensor 30 and the working current of the light emitter 31 in an embodiment of the present application. As Figure 4As shown, the inventor has verified through experiments that when only the working current of the light emitter 31 changes among the working parameters of the image sensor 30, the relationship between the image gray value A of the item to be detected and the working current I of the light emitter 31 is basically a linear relationship, that is, A = C * I, where C is the slope and the slope C is basically stable within a certain time period. As shown in the figure, the oblique line L0 represents the change relationship between the image gray value and the working current of the light emitter 31 when the image sensor 30 scans a certain reference medium (such as the second gray block 332) under the reference working conditions, that is, A = C0 * I, and C0 = A set / I set ; after the image sensor 30 works for a period of time, such as 1000 hours, the change relationship between the image gray value and the working current of the light emitter 31 will change, as shown by the oblique line L1, that is, A = C1 * I; as can be seen from the figure, under the reference working conditions, as shown by the oblique line L0, when the working current of the light emitter 31 is I set the gray value obtained by scanning the gray block 332 is A set , and after working for 1000 hours, as shown by the oblique line L1, when the working current of the light emitter 31 is I set the gray value obtained by scanning the second gray block 332 is A', and A' is significantly less than A set , indicating that after the image sensor 30 works for 1000 hours, when scanning the second gray block 332 with the working current of the light emitter 31 unchanged, the gray value of the obtained image becomes smaller.
[0084] In this embodiment, in order to improve the attenuation of the gray value of the scanned image caused by the increase in working time, the working parameters of the image sensor 30 are corrected. The specific methods include:
[0085] According to the formula I x =(A set / A)*I p correct the working current of the light emitter 31 in the image sensor, where I x is the corrected working current of the light emitter 31, I p is the current working current of the light emitter 31, A set is the reference gray value of the target gray block, and A is the gray value of the target gray block.
[0086] Figure 5 This is a schematic diagram of correcting the working current of the light emitter 31 of the industrial image sensor 30 in an embodiment of the present application. The horizontal axis is the working current of the light emitter 31 and the vertical axis is the gray value. As shown in the figure, the relationship between the working current and the gray value conforms to Figure 4 the shown change relationship. The oblique line La represents the relationship between the two when the scanned medium is the second gray block 332, that is, A = C a*I (Formula 1). As described above, when the operating current of the optical transmitter 31 is I p , the gray value of the detected item is B, the gray value of the second gray block 332 that is most similar to the gray value of the detected item is A2, and the reference gray value of the second gray block 332 is the reference gray value of the target gray block, which is A 2set . Substituting the above parameters into Formula 1, we get A2 = C a *I p , A 2set = C a *I x , where I x is the corrected operating current
[0087] It can be understood that the above correction targets the gray value of the second gray block 332, that is, through correction, the gray value of the second gray block 332 is corrected to A x when the operating current is I 2set . Therefore, the corrected operating current of the optical transmitter 31 is I x = (A 2set / A2)*I p .
[0088] Since there is a difference between the gray value B of the detected item and the gray value of the second gray block 332, to improve the accuracy of correction, in an alternative embodiment, the gray value of the detected item can be used as the target Figure 6 This is a schematic diagram of correcting the operating current of the optical transmitter 31 of the industrial image sensor 30 in another embodiment of the present application. As Figure 6 shown, the specific method of correcting the operating parameters of the image sensor 30 with the gray value of the detected item as the target includes
[0089] According to the formula I x = (A set / B)*I p , correct the operating current of the optical transmitter 31 of the image sensor, where I x is the corrected operating current of the optical transmitter 31, I p is the current operating current of the optical transmitter 31, A set is the reference gray value of the target gray block, and B is the gray value of the detected item
[0090] It can be seen from this embodiment that the corrected operating current of the image sensor 30 is I x = (A set / B)*I p , which is the same as Figure 5The difference in the illustrated embodiment is that the gray value of the target gray block is replaced with the gray value of the detected article, the slope of the oblique line La changes, and the working current I after correction x has a certain degree of change compared with the previous embodiment. Specifically, when B < A2, the working current I x increases, and when B > A2, the working current I x decreases.
[0091] As introduced in the above two embodiments, when the working parameter to be corrected is the working current, correcting the working parameter of the image sensor 30 includes setting the working current I after correction x = K * I p , where K is the correction coefficient, K = the reference gray value A of the detected article set / the gray value B of the detected article, or, K = the reference gray value A of the detected article set / the gray value A of the target gray block.
[0092] The inventor also learned through experimental verification that when only the row emission time of the light emitter 31 changes among the working parameters of the image sensor 30, the relationship between the image gray value A of the detected article and the row emission time T is also basically a linear relationship. When the working parameter to be corrected is the row emission time, its correction method is similar to the working current correction method. The steps of correcting the working parameter of the image sensor 30 specifically include:
[0093] According to the formula T x = (A set / A) * T p correct the row emission time of the light emitter 31 of the image sensor, where T x is the row emission time of the light emitter 31 after correction, T p is the current row emission time of the light emitter 31, A set is the reference gray value of the target gray block, and A is the gray value of the target gray block;
[0094] Or, according to the formula T x = (A set / B) * T p correct the row emission time of the light emitter 31 of the image sensor, where T x is the row emission time of the light emitter 31 after correction, T p is the current row emission time of the light emitter 31, A set is the reference gray value of the target gray block, and B is the gray value of the detected article.
[0095] It can be seen that correcting the working parameter of the image sensor 30 includes setting the row emission time T after correction x = K * Tp The correction coefficient K is the same as the correction coefficient during the correction of the working current, and K = the reference gray value A of the item to be detected set / the gray value B of the item to be detected, or K = the reference gray value A of the item to be detected set / the gray value A of the target gray block.
[0096] In the above embodiments, either the gray value of the target gray block is corrected or the gray value of the item to be detected is corrected, that is, K = (A set / A) or K = (A set / B). In alternative other embodiments, the value of K can be determined based on the gray value of the item to be detected, the gray value of the target gray block, and the reference gray value of the target gray block. For example, K = [(A set / A) + (A set / B)] / 2.
[0097] The correction method for the industrial image sensor provided by the embodiments of the present application includes: obtaining the gray value of each gray block in the reference sheet 33 and the gray value of the item to be detected; determining the target gray block most similar to the gray value of the item to be detected according to the gray value of the item to be detected and the gray value of each gray block; obtaining the reference gray value of the target gray block; and correcting the working parameters of the image sensor 30 according to the gray value of at least one of the item to be detected and the target gray block and the reference gray value of the target gray block. The correction method provided by the embodiments of the present application adjusts the working parameters of the image sensor 30 accordingly. Therefore, it is not necessary to perform correction calculations on the image data of the item to be detected scanned subsequently, and the data processing amount of the controller 10 is not increased too much. Moreover, by using the reference gray value of the target gray block similar to the gray value of the item to be detected as a reference to adjust the working parameters of the image sensor 30, the parameter correction accuracy of the image sensor 30 can be ensured, and the problem of poor correction effect caused by determining the correction coefficient using the change of the scanned image data of the white reference sheet in the related art is improved. By using the reference gray value of the target gray block with the gray value closest to the item to be detected as a reference to adjust the working parameters of the image sensor 30, the correction deviation caused by the gray difference between the item to be detected and the gray block can be significantly reduced, and the problem of poor image quality caused by the change of the working conditions of the image sensor 30 can be effectively solved.
[0098] The industrial image scanning device provided by the embodiments of the present application can be used to implement the above correction method for the industrial image sensor. Therefore, when correcting the image sensor 30, the data processing amount is small, the correction effect is good, and the scanned image quality is excellent.
[0099] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present application should be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A calibration method for an industrial image sensor, which is applied to an industrial image scanning device, characterized in that, The industrial image scanning device includes an image sensor for scanning a detected item and a reference sheet, where the reference sheet includes at least two gray blocks with different gray values. The calibration method of the industrial image sensor includes: Obtaining the gray value of each gray block in the reference sheet and the gray value of the detected item; Determining a target gray block that is most similar to the gray value of the detected item according to the gray value of the detected item and the gray value of each gray block; Obtaining the reference gray value of the target gray block; Calibrating the working parameters of the image sensor according to the gray value of at least one of the detected item and the target gray block and the reference gray value of the target gray block.
2. The calibration method of the industrial image sensor according to claim 1, characterized in that, The step of determining a target gray block that is most similar to the gray value of the detected item according to the gray value of the detected item and the gray value of each gray block includes: Calculating the difference between the gray value of the detected item and the gray value of each gray block, and determining the gray block corresponding to the smallest absolute value of the difference as the target gray block.
3. The calibration method of the industrial image sensor according to claim 1, characterized in that Each gray block has a unique ID, and the ID of each gray block corresponds to a reference gray value, and the corresponding relationship is pre-stored; The step of obtaining the reference gray value of the target gray block includes: Determining the ID of the target gray block; Obtaining the reference gray value corresponding to the ID of the target gray block from the pre-stored corresponding relationship between the ID of the gray block and the reference gray value as the reference gray value of the target gray block.
4. The calibration method of the industrial image sensor according to claim 1, wherein The image sensor includes a light emitter and a light sensor, and the working parameter of the image sensor is the working current or the line emission time of the light emitter.
5. The calibration method of the industrial image sensor according to claim 4, wherein, When the working parameter of the image sensor is the working current of the light emitter, the step of calibrating the working parameters of the image sensor according to the gray value of at least one of the detected item and the target gray block and the reference gray value of the target gray block includes: According to formula I x = (A set / A) * I p Calibrate the working current of the optical transmitter for the image sensing, where I x is the working current of the optical transmitter after calibration, I p is the current working current of the optical transmitter, A set is the reference gray value of the target gray block, and A is the gray value of the target gray block; Alternatively, according to Formula I x = (A set / B) * I p correct the operating current of the light emitter for the image sensing, where I x is the operating current of the light emitter after correction, I p is the current operating current of the light emitter, A set is the reference gray value of the target gray block, and B is the gray value of the item to be detected.
6. The calibration method of the industrial image sensor according to claim 4, characterized in that, When the working parameter of the image sensor is the line emission time of the light emitter, the step of calibrating the working parameters of the image sensor according to the gray value of at least one of the detected item and the target gray block and the reference gray value of the target gray block includes: According to the formula T x =(A set / A)*T p correct the line emission time of the light emitter for the image sensing, where T x is the line emission time of the light emitter after correction, T p is the current line emission time of the light emitter, A set is the reference gray value of the target gray block, and A is the gray value of the target gray block; Alternatively, according to the formula T x =(A set / B)*T p correct the row emission time of the light emitter for the image sensing, where T x is the row emission time of the corrected light emitter, T p is the current row emission time of the light emitter, A set is the reference gray value of the target gray block, and B is the gray value of the detected item.
7. An industrial image scanning device, characterized in that, Including an image sensor, a reference sheet and a controller, where the reference sheet includes at least two gray blocks with different gray values, the controller is electrically connected to the image sensor, and the controller is configured to: Obtain the gray value of each gray block in the reference sheet and the gray value of the detected item; determine a target gray block that is most similar to the gray value of the detected item according to the gray value of the detected item and the gray value of each gray block; obtain the reference gray value of the target gray block; calibrate the working parameters of the image sensor according to the gray value of at least one of the detected item and the target gray block and the reference gray value of the target gray block.
8. The industrial image scanning device according to claim 7, wherein The industrial image scanning device further includes a first memory. Each of the grayscale blocks has a unique ID, and the ID of each grayscale block corresponds to a reference grayscale value, and the corresponding relationship is pre-stored in the first memory. The controller is configured to obtain the reference grayscale value of the target grayscale block in the following manner: Determine the ID of the target grayscale block; obtain the reference grayscale value corresponding to the ID of the target grayscale block from the corresponding relationship between the ID of the grayscale block stored in the first memory and the reference grayscale value, and use it as the reference grayscale value of the target grayscale block.
9. The industrial image scanning device according to claim 7, wherein The image sensor includes a light emitter and a light sensor. The operating parameter of the image sensor is the operating current or the row light emission time of the light emitter. The controller is configured to correct the operating parameter of the image sensor by one of the following methods: According to formula I x = (A set / A) * I p Calibrate the operating current of the light emitter for the image sensing, where I x is the operating current of the light emitter after calibration, I p is the current operating current of the light emitter, A set is the reference gray value of the target gray block, and A is the gray value of the target gray block; Alternatively, according to Equation I x = (A set / B) * I p correct the operating current of the optical transmitter for the image sensing, where I x is the operating current of the optical transmitter after correction, and I p is the current operating current of the optical transmitter, A set is the reference gray value of the target gray block, and B is the gray value of the detected item; Alternatively, according to the formula T x =(A set / A)*T p correct the row emission time of the light emitter for the image sensing, where T x is the row emission time of the light emitter after correction, T p is the current row emission time of the light emitter, A set is the reference gray value of the target gray block, and A is the gray value of the target gray block; Alternatively, according to the formula T x =(A set / B)*T p correct the row emission time of the light emitter for the image sensing, where T x is the row emission time of the corrected light emitter, T p is the current row emission time of the light emitter, A set is the reference gray value of the target gray block, and B is the gray value of the detected item.
10. The industrial image scanning device according to claim 7, characterized in that, The industrial image scanning device further includes an amplifier, an A / D converter, and a second memory. The amplifier is electrically connected to the image sensor, and the amplifier is used to amplify the analog signal output by the image sensor. The A / D converter is electrically connected to the second memory, and the A / D converter is used to convert the analog signal output by the amplifier into digital image data. The second memory is electrically connected to the controller, and the second memory is used to store the image data from the A / D converter and the grayscale values generated by the controller processing the image data.