Macro camera imaging system, method and macro camera
By introducing FPGA preprocessing unit and image processing unit into the macro camera imaging system, preprocessing and synthesis processing of image information acquired by the image acquisition unit, the problems of delay and inefficiency of data processing in traditional macro cameras are solved, and more efficient real-time detection and analysis are achieved.
Patent Information
- Application Number
- CN202411472111.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2044-10-22
AI Technical Summary
In industrial inspection, traditional macro cameras need to transmit image data to the PC for processing, resulting in data processing delays and inefficiency, which cannot meet the needs of real-time detection and analysis.
A macro camera imaging system is designed, including an image acquisition unit, an FPGA preprocessing unit and an image processing unit. The image information collected by the image acquisition unit under the current light source brightness is preprocessed through the FPGA preprocessing unit, and the preprocessed images under the brightness of different light sources are synthesized based on the preset algorithm to realize automatic processing of the image.
By realizing automatic image processing on the macro camera, the real-time and accuracy of industrial detection are improved, the impact of light source changes is reduced, the image processing quality is improved, and data processing efficiency is improved.
Smart Images

Figure CN119011993B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a macro camera imaging system, method and macro camera. Background Art
[0002] A macro camera is a high-resolution imaging device used to capture details of close objects. It can present the microscopic structure and details of objects at a very small shooting distance. In the field of industrial inspection, macro cameras are widely used to detect the welding quality, defects and contamination of tiny components such as electronic circuit boards and semiconductor chips. Traditional methods usually rely on the image data captured by the macro camera to be transmitted to the PC to process the image data on the PC to obtain the target image. With the increasing requirements for image processing, this method of transmitting the captured image data to the PC for analysis has data processing delays and low efficiency, and cannot meet the needs of real-time detection and analysis. Summary of the invention
[0003] The present application provides a macro camera imaging system, method and macro camera, which can realize automatic processing of captured images in macro distance to improve the real-time performance and accuracy of industrial detection.
[0004] In a first aspect, the present application provides a macro camera imaging system, which includes an image acquisition unit, a field programmable gate array FPGA preprocessing unit and an image processing unit; the FPGA preprocessing unit is communicatively connected to the image acquisition unit and the image processing unit respectively.
[0005] Among them, the FPGA preprocessing unit is used to control the image acquisition unit to acquire image information under the current light source brightness according to the pulse signal when a pulse signal generated by the object to be measured is detected, and send the image information to the FPGA preprocessing unit.
[0006] The image information includes the pixel value corresponding to each pixel point under the current light source brightness; the FPGA preprocessing unit is used to preprocess the pixel value corresponding to each pixel point according to a preset processing method to obtain a preprocessed image after the processing is completed, and send the preprocessed image to the image processing unit. The preprocessed image corresponding to the object under test includes at least two, and the light source brightness corresponding to each preprocessed image is different.
[0007] The image processing unit is used to receive the pre-processed images corresponding to the object under test under at least two light source brightnesses, and synthesize the pre-processed images corresponding to the at least two light source brightnesses based on a preset algorithm to obtain a target image.
[0008] Optionally, the preset processing method at least includes flat field correction processing and pixel compensation processing; the pixel value corresponding to each pixel point is preprocessed according to the preset processing method to obtain a preprocessed image after the processing is completed, including: in the flat field correction processing, the corresponding pixel points are calibrated based on the pixel threshold and fitting parameter value corresponding to each pixel point under the quadratic function and the current light source brightness to obtain a first processed image; in the pixel compensation processing, the area to be compensated in the first processed image is determined according to the sensor stitching array, and the pixel values of the area to be compensated are processed according to the number of pixels in the area to be compensated, the initial pixel value corresponding to the current sensor and the end pixel value corresponding to the previous sensor to obtain the preprocessed image.
[0009] Optionally, before calibrating the corresponding pixel points based on the quadratic function and the pixel threshold and fitting parameter value corresponding to each pixel point under the current light source brightness to obtain the first processed image, the FPGA preprocessing unit is also used to: determine the pixel threshold corresponding to each of the pixel points, and divide the pixel value corresponding to each pixel point into two pixel intervals based on the pixel threshold; determine the fitting parameter value corresponding to each of the pixel intervals, and store the pixel threshold corresponding to each pixel point and the fitting parameter value corresponding to each of the pixel intervals.
[0010] Optionally, the corresponding pixel points are calibrated based on the quadratic function and the pixel threshold and fitting parameter value corresponding to each pixel point under the current light source brightness to obtain a first processed image, including: determining the fitting parameter values corresponding to two pixel intervals in the current pixel point; solving the quadratic function according to the fitting parameter values corresponding to each of the two pixel intervals to obtain the calibrated pixel value of the current pixel point; after each of the pixel points is calibrated, obtaining the first processed image according to the calibrated pixel values corresponding to each of the pixel points.
[0011] Optionally, when the target image is a defect image, the preprocessed images corresponding to at least two light source brightnesses are synthesized based on a preset algorithm to obtain the target image, including: extracting features from the preprocessed images under at least two light source brightnesses to obtain feature information corresponding to each preprocessed image; fusing the feature information corresponding to each preprocessed image based on a fusion strategy to obtain a fused image; and inputting the fused image into a defect detection model to obtain a defect image related to the object under test.
[0012] Optionally, the image acquisition unit includes at least one light emitting diode, a diode driving circuit, a rod lens and an image sensor array; the diode driving circuit is respectively connected to at least one of the light emitting diodes and the FPGA preprocessing unit, and the image sensor array is respectively connected to the rod lens and the FPGA preprocessing unit, wherein: the FPGA preprocessing unit is used to control at least one of the light emitting diodes to emit light through the diode driving circuit when receiving the pulse signal to generate the current light source brightness; the FPGA preprocessing unit is also used to control the rod lens through the image sensor array to collect image information of the object under test at the current light source brightness.
[0013] Optionally, the FPGA preprocessing unit and the image processing unit are connected via a high-speed serial computer expansion bus PCIE, and the FPGA preprocessing unit is connected to a host computer via a 10 Gigabit Ethernet interface, wherein: the image processing unit is also used to send the target image to the FPGA preprocessing unit via the PCIE; the FPGA preprocessing unit is also used to transmit the target image to the host computer via the 10 Gigabit Ethernet interface.
[0014] Optionally, the macro camera imaging system further includes: a storage unit and at least one functional interface unit; the storage unit and at least one functional interface unit are respectively communicatively connected to the image processing unit, wherein: the storage unit is used to store information related to the target image; and at least one functional interface unit is used to provide at least one functional interface for the image processing unit.
[0015] In a second aspect, the present application provides a macro camera imaging method, which is applied to a macro camera imaging system, including an image acquisition unit, a field programmable gate array FPGA preprocessing unit and an image processing unit; the FPGA preprocessing unit is communicatively connected to the image acquisition unit and the image processing unit respectively.
[0016] The method includes: when the pulse signal generated by the object to be measured is detected by the FPGA preprocessing unit, the image acquisition unit is controlled according to the pulse signal to acquire image information under the current light source brightness, and the image information is sent to the FPGA preprocessing unit; the image information includes the pixel value corresponding to each pixel point under the current light source brightness; the pixel value corresponding to each pixel point is preprocessed by the FPGA preprocessing unit according to a preset processing method to obtain a preprocessed image after the processing is completed, and the preprocessed image is sent to the image processing unit, and the preprocessed image corresponding to one of the object to be measured includes at least two, and the light source brightness corresponding to each of the preprocessed images is different; the preprocessed images corresponding to the object to be measured under at least two light source brightnesses are received by the image processing unit, and at least two preprocessed images are synthesized based on a preset algorithm to obtain a target image.
[0017] In a third aspect, the present application further provides a macro camera, comprising: at least one processor; and a memory communicatively connected to the at least one processor.
[0018] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the macro camera imaging method described in the embodiment of the present application.
[0019] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the macro camera imaging method described in the embodiment of the present application when executed.
[0020] In a fifth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the macro camera imaging method described in the embodiment of the present application.
[0021] The macro camera imaging system provided in the embodiment of the present application integrates an image acquisition unit, an FPGA preprocessing unit and an image processing unit, so that the image information collected by the image acquisition unit under the current light source brightness is preprocessed by the FPGA preprocessing unit, specifically, the FPGA preprocessing unit preprocesses the pixel value corresponding to each pixel point, so as to improve the image quality by accurately processing the pixel value of each pixel point; finally, the image processing unit synthesizes the preprocessed images corresponding to at least two light source brightnesses based on a preset algorithm, so that the obtained target image reduces the influence caused by the change of the light source and improves the image processing quality. This solution can obtain the processed image at the macro camera end. Compared with the existing solution, there is no need to transmit the captured image data to the PC end, which improves the data processing efficiency. And the method of automatically processing the captured image in the macro camera has achieved the beneficial effect of improving the real-time and accuracy of industrial detection.
[0022] It should be noted that the above-mentioned computer instructions may be stored in whole or in part on a computer-readable storage medium. The computer-readable storage medium may be packaged together with the processor of the macro camera imaging device, or may be packaged separately from the processor of the macro camera imaging device, and this application does not limit this.
[0023] The description of the second, third, fourth and fifth aspects of the present application can refer to the detailed description of the first aspect; and the beneficial effects of the description of the second, third, fourth and fifth aspects can refer to the beneficial effect analysis of the first aspect, which will not be repeated here.
[0024] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description.
[0025] It is understandable that before using the technical solutions disclosed in the embodiments of this application, the type, scope of use, and usage scenarios of the personal information involved in this application should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1It is a structural schematic diagram of the macro camera imaging system provided in an embodiment of the present application.
[0028] Figure 2 is another structural schematic diagram of the macro camera imaging system provided in an embodiment of the present application.
[0029] Figure 3 It is a flow chart of the macro camera imaging method provided in an embodiment of the present application.
[0030] Figure 4 It is a structural schematic diagram of a macro camera provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the present application will be clearly and completely described below in conjunction with the drawings in the present embodiment. Obviously, the described embodiment is only a part of the embodiment of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only the parts related to the present application, rather than all structures, are shown in the accompanying drawings.
[0034] Figure 1 This is a schematic diagram of a macro camera imaging system provided in an embodiment of the present application. This embodiment is applicable to the case where the image data captured in the macro camera is automatically processed. For details, please refer to Figure 1The macro camera imaging system 100 of the present embodiment includes an image acquisition unit 110, a field programmable gate array (FPGA) preprocessing unit 120 and an image processing unit 130; the FPGA preprocessing unit 120 is respectively connected to the image acquisition unit 110 and the image processing unit 130 for communication.
[0035] The FPGA preprocessing unit 120 is used to control the image acquisition unit 110 to acquire image information under the current light source brightness according to the pulse signal when a pulse signal generated by the object under test is detected, and send the image information to the FPGA preprocessing unit 120; the image information includes the pixel value corresponding to each pixel point under the current light source brightness.
[0036] In this embodiment, the measured object can be different types of objects due to different usage scenarios of the macro camera. Taking industrial application as an example, the measured object can be electronic components, semiconductor chips or mechanical parts, etc.; taking medical application as an example, the measured object can be pathological sections, medical equipment or medicines, etc. The specific application scenarios of the macro camera and the objects that can be photographed in the corresponding scenarios are not limited here.
[0037] In this embodiment, taking the use of the object to be measured for industrial inspection as an example, in order to improve the inspection efficiency in industrial inspection, a general scenario is set up in which a product integrated with a macro camera imaging system is fixed at a preset position, and the object to be measured is placed on a conveyor belt, so that when the FPGA pre-processing unit 120 detects a pulse signal generated by the movement of the object to be measured, it controls the image acquisition unit 110 to collect image information under the current light source brightness.
[0038] Optionally, in order to achieve the purpose of accurate shooting, the FPGA pre-processing unit 120 can determine the moving distance of the object to be measured based on the pulse signal generated by the movement of the object to be measured. When it is detected that the object to be measured moves to a preset point (such as a position convenient for shooting), the image acquisition unit 110 can be controlled to collect image information under the current light source brightness.
[0039] In this embodiment, the purpose of collecting image information at the current light source brightness is to highlight different features of the object under test through different brightness. For example, a darker light source may make some shadow parts of the object more obvious, thereby highlighting its outline and three-dimensional sense; while a brighter light source can make the surface texture and color of the object clearer, which is conducive to better defect detection of the object under test through image information obtained by different light source brightness in subsequent steps. Among them, the above-mentioned light source brightness can be generated by an external light source in the actual shooting environment, or a built-in light source can be generated by an electronic component such as a built-in diode in the image acquisition unit 110, and the specific method of generating the light source is not limited here.
[0040] In this embodiment, the captured image information includes the pixel value corresponding to each pixel under the current light source brightness. The current pixel value indicates the pixel grayscale value corresponding to each pixel, and the value of the pixel value corresponding to each pixel is [0,255]. The pixel grayscale value is used to represent the brightness of each pixel under the current light source brightness.
[0041] Please refer to Figure 2 , Figure 2 1 is another structural diagram of the macro camera imaging system provided by an embodiment of the present application. In this embodiment, the image acquisition unit 110 includes at least one light emitting diode 111, a diode driving circuit 112, a rod lens 113 and an image sensor array 114; wherein the diode driving circuit 112 is respectively connected to the at least one light emitting diode 111 and the FPGA pre-processing unit 120, and the image sensor array 114 is respectively connected to the rod lens 113 and the FPGA pre-processing unit 120.
[0042] The FPGA preprocessing unit 120 is used to control at least one light-emitting diode 111 to emit light through the diode driving circuit 112 when a pulse signal is received to generate the current light source brightness; the FPGA preprocessing unit 120 is also used to control the rod lens 113 through the image sensor array 114 to collect image information of the object under test under the current light source brightness.
[0043] The diode driving circuit 112 at least includes a processing unit and a driving unit. The processing unit may include an amplification unit, a shaping unit, and a filtering unit to ensure the stability and accuracy of the signal output; the driving unit may include one or more drivers, each driver corresponding to a light-emitting diode 111; the driver controls the conduction and cutoff of the corresponding light-emitting diode 111 according to the control signal sent by the internal logic of the FPGA, thereby realizing the light-emitting diode 111. The brightness of the light-emitting diode 111 can be adjusted by adjusting the size of the driving signal. Optionally, this embodiment can also adjust the brightness of the light-emitting diode 111, and by accurately adjusting the brightness of the light source, it is possible to collect image information under different light source brightness.
[0044] While the light emitting diode 111 generates the current light source brightness, the FPGA pre-processing unit 120 controls the rod lens 113 to collect image information of the object under test under the current light source brightness through the image sensor array 114. The specific operation may be: the image sensor array 114 adjusts the focal length and aperture size of the rod lens 113 according to the control signal sent by the internal logic of the FPGA to adapt to different light source brightness and the distance of the object under test; the image sensor array 114 is also responsible for adjusting the exposure time of the image sensor to ensure the image quality; the collected image information is sent to the FPGA for further processing and analysis.
[0045] The FPGA preprocessing unit 120 is also used to preprocess the pixel value corresponding to each pixel point according to a preset processing method to obtain a preprocessed image after the processing is completed, and send the preprocessed image to the image processing unit 130. The preprocessed images corresponding to a measured object include at least two, and the light source brightness corresponding to each preprocessed image is different. In this embodiment, the FPGA preprocessing unit 120 preprocesses the received image information collected by the measured object under different light source brightness, which helps to highlight the detailed characteristics of different aspects of the measured object and can reduce the subsequent processing complexity in the image processing unit 130.
[0046] Specifically, the preprocessing method adopted in this embodiment at least includes flat field correction processing and pixel compensation processing. The processing speed of pixel-level imaging quality optimization can be greatly improved through FPGA to meet the performance requirements of real-time processing.
[0047] Flat field correction refers to compensating for the non-uniform response of CMOS. Due to the differences in the optical characteristics of each pixel of the sensor, the imaging module of the system may have some non-uniformity, such as inconsistent sensor pixel response and uneven lens light transmission. These non-uniformities will lead to uneven brightness distribution in the image, and the grayscale of each pixel needs to be adjusted independently to ensure that each pixel of the image outputs the same value under uniform illumination, thereby eliminating the uneven brightness caused by the sensor or optical system.
[0048] In another preferred embodiment, before performing flat field correction processing on the collected image information, the present embodiment needs to control the FPGA preprocessing unit 120 to perform the following operations: determine the pixel threshold corresponding to each pixel point, and divide the pixel value corresponding to each pixel point into two pixel intervals based on the pixel threshold; determine the fitting parameter value corresponding to each pixel interval, and store the pixel threshold corresponding to each pixel point and the fitting parameter value corresponding to each pixel interval. For each pixel point, the present embodiment can use different fitting parameter values for different pixel intervals for fitting processing by dynamically determining the pixel threshold, which helps to enhance the image contrast. By determining the fitting parameter value corresponding to each pixel interval, it helps to better display the defective parts or defect features in the image and improve the accuracy of detection.
[0049] Specifically, in determining the pixel threshold corresponding to each pixel point, the present solution adopts the segmented threshold least square method, and the dynamic programming is automatically determined to find the threshold that can minimize the overall error in a more efficient way. The following process will be explained by the process of determining the pixel threshold corresponding to a pixel point.
[0050] First, divide multiple possible threshold candidate intervals , these thresholds correspond to different values of pixel values. Each candidate threshold Divide the pixel value into two parts: and .
[0051] Then, the fitting error is calculated in each interval. For each possible threshold , respectively calculate the left pixel interval and right pixel interval The error can be calculated by fitting the function using the least squares method to obtain the sum of squared errors.
[0052] (1)
[0053] (2)
[0054] in, is the actual observed value, is the fitting function of the left pixel interval The value at is the right pixel interval fitting function in The value at .
[0055] Finally, dynamic programming recursively calculates the optimal error combination for each interval. For example, assuming the current threshold Divide the data into two parts, then the overall error can be quickly determined using the calculated optimal errors on both sides. The overall error is:
[0056] (3)
[0057] Iterate through all possible thresholds , find the threshold that minimizes the total error, The threshold t corresponding to the minimum is the pixel threshold corresponding to the current pixel.
[0058] For any pixel point A, its corresponding pixel grayscale interval is [0,255]. If its corresponding pixel threshold is determined to be t through the above process, two pixel intervals [0,t] and (t,255] can be obtained according to the pixel threshold.
[0059] Furthermore, for the two pixel intervals corresponding to each pixel threshold, when the FPGA actually performs pixel processing, it is necessary to predetermine the fitting parameter value corresponding to each pixel interval, so as to implement processing of each pixel point based on the fitting parameter value.
[0060] In this embodiment, the image quality can be significantly improved by segmented quadratic function calibration, and pixel-level imaging quality optimization can be achieved. However, since each pixel has a unique quadratic polynomial coefficient and segmented threshold, using a CPU to implement execution will be very time-consuming and cannot meet performance requirements. In order to solve this problem, this embodiment uses the high-bandwidth parallel processing capability of FPGA to achieve efficient image processing performance that matches the input rate. In the following process, the process of determining the fitting parameter values in two pixel intervals corresponding to a pixel point will be explained.
[0061] First, under uniform lighting, such as using a uniform light source or a white board, collect several images at different exposure values, and calculate the average value of each pixel as the reference value for flat field correction. After collecting image data at different exposure values, use the least squares method to find the best fitting curve. The optimal fitting function should minimize the sum of the squares of the vertical distances between all pixels and the fitting curve. The expression for this error sum is:
[0062] (4)
[0063] in, is the actual observed value, is the fitting function in We need to find the parameters of the fitting function so that the sum of squared errors S is minimized.
[0064] The model to be fitted is a quadratic function , the goal is to determine the a, b and c corresponding to each pixel interval; for each pixel point, the error is , then the sum of squared errors is:
[0065] (5)
[0066] Furthermore, we take partial derivatives of a, b, and c and set them equal to zero, and obtain a set of linear equations:
[0067] ; ; (6)
[0068] Solving the above equation group (6) can obtain the optimal fitting parameters a, b and c.
[0069] Since each pixel point corresponds to two pixel intervals in this embodiment, and one pixel interval corresponds to one fitting parameter value, when determining the fitting value corresponding to each pixel interval, the above formula (4) to formula (6) are executed for each pixel interval, so that for one pixel interval The corresponding fitting parameter values are a1, b1 and c1. For another pixel interval , the corresponding fitting parameter values are a2, b2 and c2. After determining the pixel threshold corresponding to each pixel point and the fitting parameter value corresponding to each pixel interval, a1, b1, c1, a2, b2 and c2 of each pixel and the threshold t can be written into the Block Random Access Memory (BRAM) of the FPGA for subsequent use.
[0070] Furthermore, when performing the flat field correction process, the present embodiment can perform calibration processing on the corresponding pixel points based on the quadratic function and the pixel threshold and fitting parameter value corresponding to each pixel point under the current light source brightness to obtain a first processed image. The quadratic function in the present embodiment indicates a quadratic polynomial function, and the fitting parameter value indicates a quadratic polynomial coefficient corresponding to the quadratic polynomial function. After the data stream enters the flat field correction function module, the corresponding pixels can be respectively subjected to grayscale calibration processing based on the quadratic polynomial coefficients and thresholds corresponding to multiple pixels stored in the address of the BRAM.
[0071] Specifically, in this embodiment, the corresponding pixel points are calibrated based on the pixel threshold and fitting parameter value corresponding to each pixel point under the current light source brightness, and the method for obtaining the first processed image includes: determining the fitting parameter values corresponding to the two pixel intervals in the current pixel point; solving the quadratic function according to the fitting parameter values corresponding to each of the two pixel intervals to obtain the calibrated pixel value of the current pixel point; after each pixel point is calibrated, the first processed image is obtained according to the calibrated pixel value corresponding to each pixel point. This embodiment can clearly distinguish the areas with different characteristics in the image by determining the fitting parameter values corresponding to the two pixel intervals in the current pixel point. Different pixel intervals may represent different brightness ranges, color distributions or texture features, etc.; and solving the quadratic function according to the fitting parameter values of different pixel intervals can achieve flexible and diverse pixel calibration and effectively improve the overall quality of the image.
[0072] Furthermore, in the process of processing each pixel in the image information, in order to improve the processing speed, the polynomial calculation process can be pipelined. When implementing polynomial calculations on FPGA, pipelining technology is a very effective way to improve the parallelism of operations and reduce calculation delays. Pipelining decomposes complex calculation processes into multiple independent stages, and each stage completes a part of the calculation within one clock cycle. Through pipeline design, multiple data can be processed simultaneously at different stages, thereby achieving parallel calculation. For example, in the first clock cycle, the input data x enters the pipeline and calculates ax 2 and bx. In the second clock cycle, the second stage is entered to calculate ax2 , calculate ax in the third clock cycle 2 +bx+c. Registers are inserted between each pipeline stage, which are used to store the intermediate results of each clock cycle. In the subsequent stage, a new batch of data can be processed before the previous stage is completed, thereby improving efficiency. Compared with the data processing method on the PC side, it is easy to reduce computing performance in high concurrency situations. FPGA can flexibly configure data paths and caches to improve such problems.
[0073] In the present embodiment, the reason for performing pixel compensation processing is that, in order to adapt to the shooting requirements of wide-frame scenes, the present embodiment needs to perform stitching based on multiple image sensors to generate an image sensor array. After stitching, due to the inherent defects of the processing technology, there are blind areas of a certain length between the sensors, and the imaging stitching effect has obvious traces. In this process scenario, in order to further improve the imaging quality, the stitching traces of the blind areas need to be compensated.
[0074] Specifically, the pixel compensation processing method provided in this embodiment is: determine the area to be compensated in the first processed image according to the sensor stitching array, process the pixel value of the area to be compensated according to the number of pixel points in the area to be compensated, the initial pixel value corresponding to the current sensor and the end pixel value corresponding to the previous sensor, and obtain a preprocessed image.
[0075] Inserting a pixel point in the blind area between the first pixel of the current sensor and the last pixel of the previous sensor can be calculated as follows:
[0076] (7)
[0077] Where n is the number of pixels in the blind area. is the last pixel value of the previous sensor, Is the initial pixel value of the current sensor.
[0078] Inserting evenly distributed intermediate values between two known pixels forms a smooth grayscale transition, thereby filling the image breaks caused by the sensor blind area. Its calculation is simple and efficient, and is particularly suitable for real-time processing on FPGAs. It effectively avoids breaks when stitching images and ensures the integrity and continuity of the image.
[0079] The calibrated and compensated pixel values are combined and output to form calibrated and compensated image data. The calibrated and compensated image data is output to the buffer of the FPGA for subsequent processing or direct display.
[0080] On the basis of this processing method, the preset processing method may preferably include black level correction, flat field correction, cross-pixel intelligent interpolation compensation, gamma correction, gain adjustment, horizontal flipping and region of interest (ROI) setting, etc. in order to achieve the purpose of improving image quality and enhancing image usability through the current processing flow.
[0081] In a conventional shooting environment, even in a completely dark environment, the image acquisition unit 110 may still generate some noise, which may cause the dark pixel value of the image to be not zero but an offset value. The purpose of black level correction is to eliminate this offset and restore the real dark information of the image. Therefore, black level correction refers to adjusting the black level output by the image sensor to ensure that the dark pixel value of the image is zero or a fixed value when there is no light. The specific implementation method is: under completely dark conditions, such as when the light source is blocked, several frames of images are collected, and the average value of each pixel is calculated as the black level offset value. In the actual shooting process, the corresponding black level offset value is subtracted from each pixel value to obtain the corrected pixel value, that is, the corrected pixel value = original pixel value - black level offset value. Black level correction can significantly reduce image noise, remove fixed noise in the dark part, and improve image quality. It can also improve contrast so that the dark part of the image is closer to real black; gamma correction is a nonlinear operation used to adjust the output of an image or display to improve the display effect or simulate the human eye's perception of light. Through gamma correction, the visual effect of the image of this system is improved, and the distribution of light and dark in the image is more in line with the visual characteristics of the human eye. The overall brightness of the image is adjusted to make the details of the dark and bright parts clearer. The contrast of the image is optimized to make the image look more vivid; the gain adjustment is the digital gain. Increasing the digital gain can increase the overall brightness of the image and make the details of the dark parts clearer. Especially for images taken under low light conditions, increasing the digital gain can make the image brighter and easier to observe. The gain value range of this system is 0-16, with a step of 0.0625; horizontal flipping is to flip the image symmetrically along the vertical axis. In many application scenarios, horizontal flipping has important uses and values. For example, in some tasks that require the analysis of image symmetry, horizontal flipping can help verify and process symmetry characteristics; ROI setting can effectively reduce the amount of calculation. By processing only the region of interest in the image instead of the entire image, the amount of data that needs to be processed is significantly reduced, thereby improving the processing speed. At the same time, it can also reduce the use of memory and processors, and reduce the resource consumption of the system. This is especially important for embedded systems with limited resources and real-time processing applications. The FPGA of this system crops the data before performing image processing and data transmission, which effectively saves resources and improves the transmission rate.
[0082] The above is a specific function of the FPGA preprocessing unit 120 to preprocess the pixel value corresponding to each pixel point according to a preset processing method. The FPGA preprocessing unit 120 in this embodiment can be used with the fourth-generation double data rate synchronous dynamic random access memory (Double Data Rate 4, referred to as DDR4) to complete image caching under high bandwidth, and can perform wide-frame image processing. The processed data is transmitted to the image processing unit 130 via PCIE (peripheral component interconnect express, a high-speed serial computer expansion bus standard).
[0083] The image processing unit 130 is used to receive pre-processed images corresponding to the object under test under at least two light source brightnesses, and synthesize the pre-processed images corresponding to the at least two light source brightnesses based on a preset algorithm to obtain a target image.
[0084] The above-mentioned image processing unit 130 can be implemented based on the Orin processor, so that when the pre-processed images corresponding to at least two light source brightnesses are synthesized based on a preset algorithm, the obtained target image has rich detail expression, can improve contrast and color saturation, reduce noise and interference, adapt to different environments and needs, and efficiently process large amounts of data images by utilizing the high-performance computing resources of the Orin processor to meet the needs of real-time data processing and analysis.
[0085] In another preferred implementation, when the target image is a defect image, synthesizing the preprocessed images corresponding to at least two light source brightnesses based on a preset algorithm to obtain the target image includes:
[0086] Feature extraction is performed on preprocessed images under at least two light source brightnesses to obtain feature information corresponding to each preprocessed image; the feature information corresponding to each preprocessed image is fused based on a fusion strategy to obtain a fused image; the fused image is input into a defect detection model to obtain a defect image related to the object under test.
[0087] The above-mentioned method of obtaining the feature information corresponding to each preprocessed image can use edge detection algorithms, texture analysis methods, and / or deep learning models to extract the feature information of each preprocessed image under different light source brightness; further, when the weighted average method can be used, different weights are assigned to the features according to the importance of the image under different light source brightness, and then the weighted sum is performed to obtain the fused image; finally, a large number of annotated defect images are used for training so that the model learns the feature pattern of the defect. The fused image is input into the trained defect detection model to output the prediction result of the defect image. Among them, the defects described in this embodiment include but are not limited to surface scratches, internal cracks, and color differences.
[0088] In practical applications, due to changes in lighting conditions or reflections from the surface of an object, images under a single light source may appear partially too bright or too dark, making it difficult to detect defects. In this embodiment, when the image processing unit 130 is provided for defect detection, the fusion of pre-processed images under multiple light source brightnesses can reduce this effect, making the detected defect results more accurate. Feature fusion can also integrate the advantages of pre-processed images under different light source brightnesses, thereby improving the robustness of the detection system to environmental changes and noise.
[0089] Please continue to refer to Figure 2 In this embodiment, the FPGA preprocessing unit 120 and the image processing unit 130 are connected through a high-speed serial computer expansion bus PCIE, and the FPGA preprocessing unit 120 is connected to the host computer through a 10 Gigabit Ethernet interface, wherein: the image processing unit 130 is also used to send the target image to the FPGA preprocessing unit 120 through PCIE; the FPGA preprocessing unit 120 is also used to transmit the target image to the host computer through the 10 Gigabit Ethernet interface 140. The system architecture provided in this embodiment uses the PCIE interface to transmit the data preprocessed by the FPGA preprocessing unit 120 to the image processing unit 130. The image processing unit 130 can perform efficient image processing on these data by utilizing the high-performance computing resources of ORIN. After the processing is completed, the target image transmission (or, data related to the target image) is returned to the FPGA target image transmission again through the image processing unit 130. Then, the FPGA target image transmission uses its large-bandwidth 10 Gigabit network capability to efficiently transmit the processed data to the remote host computer. This design not only fully utilizes the computing power of the ORIN platform, but also solves the bottleneck problem of remote communication through the high-speed network transmission capability of FPGA, thereby achieving efficient data processing and transmission.
[0090] For details, please refer to Figure 2 In this embodiment, the macro camera imaging system 100 further includes: a storage unit 150 and at least one functional interface unit 160; the storage unit 150 and the at least one functional interface unit 160 are respectively connected to the image processing unit 130 for communication, wherein: the storage unit 150 is used to store information related to the target image; the at least one functional interface unit 160 is used to provide at least one functional interface for the image processing unit 130.
[0091] In the process of synthesizing the pre-processed images corresponding to at least two light source brightnesses, the image processing unit 130 can generate various types of files according to different processing requirements, such as hardware drivers, image files (which may include shape maps, reflectivity maps, and high exposure maps, etc.) and other temporary files stored in the storage unit 150.
[0092] In this embodiment, at least one functional interface unit 160 may include a general input / output (Input / Output Module, ie, I / O) unit, a universal serial bus interface (Type-C or USB) unit, a high-definition digital display interface (DisplayPort, referred to as DP) unit, a 10 Gigabit network interface unit, etc. Specifically, the general IO interface can access a hard trigger signal to trigger the image acquisition unit 110 to acquire an image, and can also output other control logics to facilitate the integration of the entire system; the USB interface can be connected to a mouse and keyboard to facilitate debugging by developers; the Type-C interface can be connected to other external devices; the DP video interface can use a DP cable to output video; through the 10 Gigabit network interface unit, the rapid transmission of large amounts of data images can be achieved to meet the needs of real-time data processing and analysis.
[0093] The macro camera imaging system provided in this embodiment integrates an image acquisition unit, an FPGA preprocessing unit and an image processing unit, so that the image information collected by the image acquisition unit under the current light source brightness is preprocessed by the FPGA preprocessing unit. Specifically, the FPGA preprocessing unit preprocesses the pixel value corresponding to each pixel point, so as to improve the image quality by accurately processing the pixel value of each pixel point; finally, the image processing unit synthesizes the preprocessed images corresponding to at least two light source brightnesses based on a preset algorithm, so that the obtained target image reduces the influence caused by the change of the light source and improves the image processing quality. Compared with the existing solution, this solution does not need to transmit the captured image data to the PC for processing, which improves the data processing efficiency. And the method of automatically processing the captured image in the macro camera has achieved the beneficial effect of improving the real-time and accuracy of industrial detection.
[0094] Figure 3 It is a flow chart of the macro camera imaging method provided by an embodiment of the present application. This embodiment can be applied to the case where the captured image data is automatically processed in a macro camera. The method can be executed by a macro camera imaging device, which can be implemented in the form of hardware and / or software, and the macro camera imaging device can be applied to the macro camera imaging system provided by this embodiment. The macro camera imaging system provided by this embodiment includes an image acquisition unit, a field programmable gate array FPGA preprocessing unit and an image processing unit; the FPGA preprocessing unit is respectively connected to the image acquisition unit and the image processing unit in communication.
[0095] Specifically, Figure 3 As shown, the macro camera imaging method provided in this embodiment includes the following steps:
[0096] S310. When a pulse signal generated by the object to be measured is detected by the FPGA preprocessing unit, the image acquisition unit is controlled according to the pulse signal to acquire image information under the current light source brightness, and the image information is sent to the FPGA preprocessing unit. The image information includes the pixel value corresponding to each pixel point under the current light source brightness.
[0097] In this embodiment, taking the use of the object to be measured for industrial inspection as an example, in order to improve the inspection efficiency in industrial inspection, the general scenario is to fix the product integrated with the macro camera imaging system at a preset position, and place the object to be measured on the conveyor belt, so that when the FPGA pre-processing unit detects the pulse signal generated by the movement of the object to be measured, it will control the image acquisition unit to collect image information under the current light source brightness.
[0098] The purpose of collecting image information at the current light source brightness is to highlight different features of the object under test through different brightness. For example, a darker light source may make some shadow parts of the object more obvious, thereby highlighting its outline and three-dimensional sense; while a brighter light source can make the surface texture and color of the object clearer, which is conducive to better defect detection of the object under test through image information obtained by different light source brightness in subsequent steps. Among them, the above-mentioned light source brightness can be generated by an external light source in the actual shooting environment, or a built-in light source can be generated by electronic components such as built-in diodes in the image acquisition unit, etc. The specific method of generating the light source is not limited here.
[0099] In this embodiment, the captured image information includes the pixel value corresponding to each pixel under the current light source brightness. The current pixel value indicates the pixel grayscale value corresponding to each pixel, and the value of the pixel value corresponding to each pixel is [0,255]. The pixel grayscale value is used to represent the brightness of each pixel under the current light source brightness.
[0100] S320, preprocessing the pixel value corresponding to each pixel point according to a preset processing method through the FPGA preprocessing unit to obtain a preprocessed image after the processing is completed, and sending the preprocessed image to the image processing unit. The preprocessed image corresponding to a measured object includes at least two, and the light source brightness corresponding to each preprocessed image is different.
[0101] The preprocessing method adopted in this embodiment at least includes flat field correction processing and pixel compensation processing. The processing speed of pixel-level imaging quality optimization can be greatly improved through FPGA to meet the performance requirements of real-time processing.
[0102] Flat field correction refers to compensating for the non-uniform response of CMOS. Due to the differences in the optical characteristics of each pixel of the sensor, the imaging module of the system may have some non-uniformity, such as inconsistent sensor pixel response and uneven lens light transmission. These non-uniformities will lead to uneven brightness distribution in the image, and the grayscale of each pixel needs to be adjusted independently. To ensure that each pixel of the image outputs the same value under uniform illumination, thus eliminating the uneven brightness caused by the sensor or optical system.
[0103] In another preferred embodiment, before performing flat field correction processing on the collected image information, the present embodiment needs to control the FPGA preprocessing unit to perform the following operations: determine the pixel threshold corresponding to each pixel point, and divide the pixel value corresponding to each pixel point into two pixel intervals based on the pixel threshold; determine the fitting parameter value corresponding to each pixel interval, and store the pixel threshold corresponding to each pixel point and the fitting parameter value corresponding to each pixel interval. For each pixel point, the present embodiment can use different fitting parameter values for different pixel intervals for fitting processing by dynamically determining the pixel threshold, which helps to enhance the image contrast. By determining the fitting parameter value corresponding to each pixel interval, it helps to better display the defective parts or defect features in the image and improve the accuracy of detection.
[0104] Furthermore, when performing the flat field correction process, the present embodiment can perform calibration processing on the corresponding pixel points based on the quadratic function and the pixel threshold and fitting parameter value corresponding to each pixel point under the current light source brightness to obtain a first processed image. The quadratic function in the present embodiment indicates a quadratic polynomial function, and the fitting parameter value indicates a quadratic polynomial coefficient corresponding to the quadratic polynomial function. After the data stream enters the flat field correction function module, the corresponding pixels can be respectively subjected to grayscale calibration processing based on the quadratic polynomial coefficients and thresholds corresponding to multiple pixels stored in the address of the BRAM.
[0105] In the present embodiment, the reason for performing pixel compensation processing is that, in order to adapt to the shooting requirements of wide-frame scenes, the present embodiment needs to perform stitching based on multiple image sensors to produce a stitching array. After stitching, due to the inherent defects of the processing technology, there are blind areas of a certain length between the sensors, and the imaging stitching effect has obvious traces. In this process scenario, in order to further improve the imaging quality, the stitching traces of the blind areas need to be compensated.
[0106] Specifically, the pixel compensation processing method provided in this embodiment is as follows: the area to be compensated in the first processed image is determined according to the sensor stitching array, and the pixel value of the area to be compensated is processed according to the number of pixels in the area to be compensated, the initial pixel value corresponding to the current sensor, and the final pixel value corresponding to the previous sensor to obtain a preprocessed image. An evenly distributed intermediate value is inserted between two known pixels to form a smooth grayscale transition, thereby filling the image break caused by the sensor blind area. The calculation is simple and efficient, and is particularly suitable for real-time processing on FPGA, which effectively avoids breakage when stitching images and ensures the integrity and continuity of the image.
[0107] S330, receiving, through an image processing unit, preprocessed images corresponding to the object under test under at least two light source brightnesses, and synthesizing the at least two preprocessed images based on a preset algorithm to obtain a target image.
[0108] The above-mentioned image processing unit can be implemented based on the Orin processor, so that when the pre-processed images corresponding to at least two light source brightnesses are synthesized based on a preset algorithm, the obtained target image has rich detail expression, can improve contrast and color saturation, reduce noise and interference, adapt to different environments and needs, and efficiently process large amounts of data images by utilizing the high-performance computing resources of the Orin processor to meet the needs of real-time data processing and analysis.
[0109] The macro camera imaging method provided in this embodiment integrates an image acquisition unit, an FPGA preprocessing unit and an image processing unit, so that the image information collected by the image acquisition unit under the current light source brightness is preprocessed by the FPGA preprocessing unit. Specifically, the FPGA preprocessing unit preprocesses the pixel value corresponding to each pixel point, so as to improve the image quality by accurately processing the pixel value of each pixel point; finally, the image processing unit synthesizes the preprocessed images corresponding to at least two light source brightnesses based on a preset algorithm, so that the obtained target image reduces the influence caused by the change of the light source and improves the image processing quality. Compared with the existing scheme, this scheme does not need to transmit the captured image data to the PC for processing, which improves the data processing efficiency. And the method of automatically processing the captured image in the macro camera has achieved the beneficial effect of improving the real-time and accuracy of industrial detection.
[0110] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0111] An embodiment of the present application also provides a macro camera, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the macro camera imaging method described in any embodiment of the present application.
[0112] An embodiment of the present application further provides a computer-readable medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the macro camera imaging method described in any embodiment of the present application when executed.
[0113] Reference below Figure 4 , Figure 4 1 is a schematic diagram of the structure of the macro camera provided in the embodiment of the present application, which shows a schematic diagram of the structure of a computer system 500 suitable for implementing the macro camera in the embodiment of the present application. Figure 4 The macro camera shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0114] like Figure 4 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0115] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0116] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present application are executed.
[0117] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, etc., or any suitable combination of the above.
[0118] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0119] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A macro camera imaging system, characterized in that: The macro camera imaging system comprises an image acquisition unit, a field programmable gate array FPGA preprocessing unit and an image processing unit; the FPGA preprocessing unit is communicatively connected with the image acquisition unit and the image processing unit respectively, wherein: The FPGA preprocessing unit is used to control the image acquisition unit to acquire image information under the current light source brightness according to the pulse signal when the pulse signal generated by the measured object is detected, and send the image information to the FPGA preprocessing unit; the image information includes the pixel value corresponding to each pixel point under the current light source brightness; The FPGA preprocessing unit is used to preprocess the pixel value corresponding to each pixel point according to the flat field correction processing and the pixel compensation processing to obtain a preprocessed image, and send the preprocessed image to the image processing unit. The preprocessed images corresponding to the object under test include at least two, and the light source brightness corresponding to each preprocessed image is different; The image processing unit is used to extract features from preprocessed images under at least two light source brightnesses to obtain feature information corresponding to each preprocessed image; assign different weights to the feature information corresponding to each preprocessed image based on the weighted average method and the importance of the images under different light source brightnesses, and perform weighted summation to obtain a fused image; and input the fused image into a defect detection model to obtain a defect image related to the object to be detected; The step of preprocessing the pixel value corresponding to each pixel point according to the flat field correction processing and the pixel compensation processing to obtain the preprocessed image includes: In the flat field correction process, the corresponding pixel points are calibrated based on the pixel threshold and the fitting parameter value corresponding to each pixel point under the current light source brightness to obtain a first processed image; In the pixel compensation processing, the area to be compensated in the first processed image is determined according to the sensor stitching array, and the pixel values of the area to be compensated are processed according to the number of pixel points in the area to be compensated, the initial pixel value corresponding to the current sensor and the end pixel value corresponding to the previous sensor to obtain the preprocessed image.
2. The macro camera imaging system according to claim 1, characterized in that: Before calibrating the corresponding pixel points based on the pixel threshold and the fitting parameter value corresponding to each pixel point under the quadratic function and the current light source brightness to obtain the first processed image, the FPGA pre-processing unit is further used to: Determine a pixel threshold corresponding to each pixel point based on a segmented threshold least squares method, and divide the pixel value corresponding to each pixel point into two pixel intervals based on the pixel threshold; Determine the fitting parameter value corresponding to each of the pixel intervals, and store the pixel threshold corresponding to each of the pixel points and the fitting parameter value corresponding to each of the pixel intervals.
3. The macro camera imaging system according to claim 2, characterized in that: The step of calibrating the corresponding pixel points based on the pixel threshold and the fitting parameter value corresponding to each pixel point under the quadratic function and the current light source brightness to obtain a first processed image includes: Determine the fitting parameter values corresponding to the two pixel intervals in the current pixel point; Solving the quadratic function according to the fitting parameter values corresponding to each of the two pixel intervals to obtain a calibrated pixel value of the current pixel point; After each pixel point is calibrated, the first processed image is obtained according to the calibrated pixel value corresponding to each pixel point.
4. The macro camera imaging system according to claim 1, characterized in that: The image acquisition unit includes at least one light emitting diode, a diode driving circuit, a rod-shaped lens and an image sensor array; the diode driving circuit is respectively connected to at least one of the light emitting diodes and the FPGA preprocessing unit, and the image sensor array is respectively connected to the rod-shaped lens and the FPGA preprocessing unit, wherein: The FPGA pre-processing unit is used to control at least one of the light-emitting diodes to emit light through the diode driving circuit when receiving the pulse signal, so as to generate the current light source brightness; The FPGA preprocessing unit is also used to control the rod lens to collect image information of the object under test at the current brightness of the light source through the image sensor array.
5. The macro camera imaging system according to claim 1, characterized in that: The FPGA preprocessing unit and the image processing unit are connected via a high-speed serial computer expansion bus PCIE, and the FPGA preprocessing unit is connected to a host computer via a 10 Gigabit Ethernet interface, wherein: The image processing unit is further used to send the defect image to the FPGA pre-processing unit through the PCIE; The FPGA preprocessing unit is also used to transmit the defect image to the host computer through the 10 Gigabit Ethernet interface.
6. The macro camera imaging system according to claim 1, characterized in that: The macro camera imaging system further includes: a storage unit and at least one functional interface unit; the storage unit and at least one functional interface unit are respectively connected to the image processing unit for communication, wherein: The storage unit is used to store information related to the defect image; At least one of the functional interface units is used to provide at least one functional interface for the image processing unit.
7. A macro camera imaging method, characterized in that: Applied to macro camera imaging system, including image acquisition unit, field programmable gate array FPGA pre-processing unit and image processing unit; The FPGA pre-processing unit is respectively connected to the image acquisition unit and the image processing unit for communication; the method comprises: When the pulse signal generated by the object to be measured is detected by the FPGA preprocessing unit, the image acquisition unit is controlled according to the pulse signal to acquire image information under the current light source brightness, and the image information is sent to the FPGA preprocessing unit; the image information includes the pixel value corresponding to each pixel point under the current light source brightness; The FPGA preprocessing unit preprocesses the pixel value corresponding to each pixel point according to the flat field correction processing and the pixel compensation processing to obtain a preprocessed image, and sends the preprocessed image to the image processing unit, wherein the preprocessed images corresponding to the object under test include at least two, and the light source brightness corresponding to each preprocessed image is different; The image processing unit extracts features from preprocessed images under at least two light source brightnesses to obtain feature information corresponding to each preprocessed image; based on the weighted average method and the importance of images under different light source brightnesses, different weights are assigned to the feature information corresponding to each preprocessed image, and weighted summation is performed to obtain a fused image; the fused image is input into a defect detection model to obtain a defect image related to the object to be detected; The step of preprocessing the pixel value corresponding to each pixel point according to the flat field correction processing and the pixel compensation processing to obtain the preprocessed image includes: In the flat field correction process, the corresponding pixel points are calibrated based on the pixel threshold and the fitting parameter value corresponding to each pixel point under the current light source brightness to obtain a first processed image; In the pixel compensation processing, the area to be compensated in the first processed image is determined according to the sensor stitching array, and the pixel values of the area to be compensated are processed according to the number of pixel points in the area to be compensated, the initial pixel value corresponding to the current sensor and the end pixel value corresponding to the previous sensor to obtain the preprocessed image.
8. A macro camera, characterized in that: The macro camera includes: at least one processor; and a memory communicatively connected to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the macro camera imaging method described in claim 7.
Citation Information
Patent Citations
Cell slide imaging system, method and device and computer equipment
CN116297038A
Visible light shimmer imaging system
CN208754410U
System and Method For Lens Shading Correction Of An Image Sensor Using Splines
US20090268053A1