FPGA language-based rapid purple edge removal method, device and control system

By employing a fast purple fringing removal method based on FPGA language, and comparing the minimum blue value with the maximum green and red value, purple fringing can be effectively removed under low resource conditions. This method is suitable for industrial microscope image processing and reduces resource consumption and computational complexity.

CN116309120BActive Publication Date: 2025-12-12BEIJING RUIZHI AOHENG VISION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310095761.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-18
Publication Date
2025-12-12
Estimated Expiration
2043-01-18

AI Technical Summary

Technical Problem

Existing technologies lack fast and resource-efficient methods for removing purple fringing in low-cost cameras, and cannot effectively solve the purple fringing phenomenon, especially when processing images under industrial microscopes.

Method used

A fast purple edge removal method based on FPGA language is adopted. By obtaining the original data pixels, the minimum blue value Bmin is calculated. It is then determined whether the current value is greater than the maximum green value Gmax and the red value R at the same time. If the condition is met, Bmin is replaced to reduce the blue value and remove the purple edge.

Benefits of technology

It achieves effective removal of purple fringing under low resource conditions, avoids complex edge calculations, is suitable for image processing under industrial microscopes, and reduces resource consumption and computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116309120B_ABST
    Figure CN116309120B_ABST
Patent Text Reader

Abstract

This application relates to a fast purple edge removal algorithm, device, and control system based on FPGA language, which obtains raw data pixels and calculates the minimum blue value B among the raw data pixels. min ; Calculate the maximum green value G corresponding to the current value. max And the red value R corresponding to the current value; determine whether the current value is simultaneously greater than the maximum green value G. max And the red value R: If both conditions are met, then the current value is determined to be blue, which is the purple edge that needs to be removed, and the current value is replaced with B. min The algorithm used to remove purple fringing detects whether there is a purple halo around the image edges and within a certain range of surrounding pixels. It then repairs the edges based on the actual surrounding data, thus reducing the current blue value and mitigating the blue-purple fringing. This method requires minimal resources and does not involve complex edge calculations.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of image processing, in particular to a fast purple edge removal method based on FPGA language, device and control system and industrial microscope. BACKGROUND

[0002] Purple edge phenomenon is a color spot phenomenon that occurs at the junction of high light and low light parts of the subject due to large contrast of the subject during shooting with an index code camera. Generally speaking, the causes of purple edge are related to the dispersion of the camera lens, the small imaging area of the CCD (large imaging unit density), the signal processing algorithm inside the camera, etc.

[0003] To overcome such problems, a single-lens reflex camera with a large CCD / CMOS area and a lens containing a low dispersion lens plays a great role. However, this increases the overall camera cost a lot and cannot completely solve the image purple edge problem. Therefore, some purple edge correction algorithms are needed to remove the purple edge.

[0004] At present, the method for removing purple edge in the prior art usually detects the purple edge area first, and then eliminates the purple edge, reduces the saturation of the purple edge or the blue component to eliminate the purple edge. However, a large amount of resources is consumed for searching the purple edge area, and these algorithms are usually suitable for devices with relatively large resources. For low-cost cameras, in a specific use environment, there is an urgent need for a fast purple edge removal method based on FPGA language to occupy less resources and a simple purple edge removal method to solve the problem of insufficient resources, but also to remove the purple edge. SUMMARY

[0005] To solve the above problems, the present application provides a fast purple edge removal method based on FPGA language, device and control system and industrial microscope.

[0006] In one aspect of the present application, a fast purple edge removal method based on FPGA language is provided, comprising the following steps:

[0007] Obtaining original data pixel points;

[0008] Calculating the minimum value B of the blue value in the original data pixel points min ;

[0009] Calculating the maximum value G of the green value corresponding to the current value max , and the red value R corresponding to the current value;

[0010] Determining whether the current value is greater than the maximum value G of the green value max and the red value R at the same time: if both conditions are met, it is determined that the current value is blue, which is the purple edge that needs to be removed, and the current value is replaced by B min .

[0011] As an optional implementation of this application, after obtaining the raw data pixels, the method may further include:

[0012] According to the preset array conditions, the original data pixels arranged in an array are obtained to obtain a pixel matrix;

[0013] Output and save the pixel matrix.

[0014] As an optional implementation of this application, optionally, the minimum value B of the blue value among the original data pixels is calculated. min ,include:

[0015] Set the calculation range;

[0016] From the pixel matrix, a calculation matrix is ​​divided according to the calculation range, and a calculation array NxN with the blue value as the center point is obtained;

[0017] Calculate and obtain the minimum value B among all blue values ​​in the NxN calculation array. min .

[0018] As an optional implementation of this application, optionally, the maximum green value G corresponding to the current value is calculated. max ,include:

[0019] Calculate and obtain the green value G1 corresponding to the current value;

[0020] Calculate and obtain several green values ​​G2 within a range of MxM around the current value; where M < N;

[0021] Calculate and obtain the maximum green value G from the green value G1 and several green values ​​G2. max .

[0022] As an optional implementation of this application, optionally, calculating the red value R corresponding to the current value includes:

[0023] Calculate and obtain the red value R1 corresponding to the current value;

[0024] Calculate and obtain several red values ​​R2 within an MxM range around the current value;

[0025] Calculate and obtain the maximum value among the red values ​​R1 and several red values ​​R2 as the red value R.

[0026] As an optional implementation of this application, optionally, calculating the red value R corresponding to the current value includes:

[0027] Calculate and obtain several red values ​​R2 within an MxM range around the current value;

[0028] Calculate and obtain the average value of several red values ​​R2, which is taken as the red value R.

[0029] As an optional implementation of the present application, optionally, judging whether the current value is greater than the green value maximum G max and the red value R at the same time, further comprises:

[0030] If the current value is not greater than the green value maximum G max and the red value R at the same time, end;

[0031] Loop to check the purple edge to be detected region.

[0032] Another aspect of the present application, a device for implementing the FPGA language-based fast purple edge removal method is proposed, comprising:

[0033] The pixel acquisition module is configured to acquire original data pixel points.

[0034] The blue value calculation module is configured to calculate the minimum value B min of the blue value in the original data pixel points.

[0035] The judgment value calculation module is configured to calculate the green value maximum G max corresponding to the current value and the red value R corresponding to the current value.

[0036] The judgment module is configured to judge whether the current value is greater than the green value maximum G max and the red value R at the same time: if it is satisfied at the same time, it is determined that the current value is blue, which is the purple edge that needs to be removed, and the current value is replaced by B min .

[0037] Another aspect of the present application, a control system is also proposed, comprising:

[0038] A processor;

[0039] A memory for storing processor executable instructions;

[0040] Wherein, the processor is configured to execute the executable instructions to implement the FPGA language-based fast purple edge removal method.

[0041] Another aspect of the present application, an industrial microscope is also proposed, which uses the FPGA language-based fast purple edge removal method for image purple edge removal processing.

[0042] Technical effects of the present application:

[0043] The present application acquires original data pixel points, calculates the minimum value B min of the blue value in the original data pixel points, calculates the green value maximum G max corresponding to the current value and the red value R corresponding to the current value, and judges whether the current value is greater than the green value maximum Gmax And red value R: if both are satisfied, the current value is determined to be blue, which is the purple edge that needs to be removed, and the current value is replaced by B min The purple edge removal algorithm is used to detect whether the edge part of the image is a purple halo edge in a range of several rows of pixels around the edge, and then the actual edge around is repaired. This algorithm needs to cache more than 10 rows of data and perform complex calculations on the boundary (ram block) and a large number of logic resources to obtain the result. It can be used to reduce the current blue value and reduce the blue-purple edge. Here, no large resources are needed, and no complex edge calculation is needed.

[0044] Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the drawings. BRIEF DESCRIPTION OF DRAWINGS

[0045] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the present disclosure and serve to explain the principles of the present disclosure.

[0046] Figure 1 An implementation flowchart of the FPGA language-based fast purple edge removal method of the present application is shown.

[0047] Figure 2 A 9x9 pixel array of the present application is shown, with a center point being the blue value (B).

[0048] Figure 3 A 9x9 array of the present application is shown, with a center point being the blue value (B). DETAILED DESCRIPTION

[0049] Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numbers in the drawings represent the same or similar elements. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless specifically indicated.

[0050] The word "exemplary" is used herein to mean "serving as an example, instance, or illustration." Any implementation described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other implementations.

[0051] In addition, for the sake of brevity, a number of specific details are not described in detail herein. Those skilled in the art should understand that the present disclosure can be practiced without these specific details. In some instances, well-known methods, procedures, components, and circuits have not been described in detail since they can be readily understood by skilled persons in the art.

[0052] Embodiment 1

[0053] The embodiment adopts a fast small resource method to perform specific repair, takes 9x9 pixel points above, below, left and right of the current original data pixel point, performs comparison of blue pixels, and calculates red value and green value of the current point to perform judgment. When it is found that the point is a blue point through the judgment condition, the minimum value in 9x9 is replaced to reduce the current blue value and play a function of reducing blue-purple edges. Here, large resources are not needed, and complex edge calculation is not needed.

[0054] As shown in Figure 1 The embodiment adopts a fast small resource method to perform specific repair, takes 9x9 pixel points above, below, left and right of the current original data pixel point, performs comparison of blue pixels, and calculates red value and green value of the current point to perform judgment. When it is found that the point is a blue point through the judgment condition, the minimum value in 9x9 is replaced to reduce the current blue value and play a function of reducing blue-purple edges. Here, large resources are not needed, and complex edge calculation is not needed.

[0055] S1, obtaining an original data pixel point;

[0056] The image pixel point is obtained from the image processed by the FPGA image processing chip. In the embodiment, the output of the photosensitive chip is output in sequence row by row. The first row in the following figure is BGBG, and the second row is GRGR. The ram resource is used to cache 8 rows. The user obtains the image matrix constructed by the image pixel point from the matrix to perform calculation.

[0057] S2, calculating the minimum value B min of the blue value in the original data pixel point;

[0058] The user calculates the minimum value of all blue values B in the matrix in the preset inspection area, and marks the minimum value as B min . In this way, the minimum value representing the blue value in the inspection area can be known and used for blue value judgment.

[0059] S3, calculating the maximum value G max of the green value corresponding to the current value and the red value R corresponding to the current value;

[0060] The current value refers to a blue value specified by the user. Whether the blue value produces purple edges is unknown. Therefore, the size of the value needs to be calculated, and the current value and the surrounding green value and red value are compared. When the blue value is greater than the maximum green value and red value around at the same time, it is determined that the blue value is a blue color and needs to be replaced.

[0061] The maximum value G max of the green value corresponding to the current value and the red value R corresponding to the current value will be described in detail below.

[0062] S4, judging whether the current value is greater than the maximum value G max of the green value and the red value R at the same time: if both conditions are met, it is determined that the current value is a blue color and needs to be removed. The current value is replaced by B min .

[0063] The determination condition is: if the current blue value is greater than the largest green value and red value around it at the same time, then it is determined to be blue and is a purple edge that needs to be replaced.

[0064] The selection of the current value can be specified by the user or selected through smart devices such as infrared recognition technology, photosensitive chips, etc. This embodiment does not limit it.

[0065] In this embodiment, as Figure 2 As shown, a 9x9 matrix image is composed of blue (B) values, red (R) values, and green (G) values. The main implementation scheme includes the following steps:

[0066] (1) For a point whose center point is B, find the minimum value of B within a 9x9 area;

[0067] (2) Calculate the corresponding R value (red value) and G value (green value) of the current B value according to the array. The red value corresponding to the B value is the average value of the surrounding R values, and so is the G value;

[0068] (3) Add a judgment condition, that is, when the blue value is greater than the largest green value and red value of the surrounding area (the surrounding 3x3, which is the maximum G value and the maximum R value within the surrounding 3x3), it is judged as blue and is a purple edge that needs to be replaced;

[0069] (4) Replace the current value with the minimum value in 9x9.

[0070] Specifically:

[0071] As an optional implementation of this application, after obtaining the raw data pixels, the method may further include:

[0072] According to the preset array conditions, the original data pixels arranged in an array are obtained to obtain a pixel matrix;

[0073] Output and save the pixel matrix.

[0074] The image sensor outputs data line by line in sequence. In the diagram below, the first line is BGBG and the second line is GRGR. Eight lines are buffered using RAM resources. When outputting the ninth line, the data is centered on the fifth pixel of the fifth line, thus capturing all pixels within a 9x9 area.

[0075] Array configuration, such as 9x9, can be set by the user. For details... Figure 2 As shown.

[0076] As an optional implementation of this application, optionally, the minimum value B of the blue value among the original data pixels is calculated. min ,include:

[0077] Set the calculation range;

[0078] From the pixel matrix, a calculation matrix is ​​divided according to the calculation range, and a calculation array NxN with the blue value as the center point is obtained;

[0079] Calculate and obtain the minimum value B among all blue values ​​in the NxN calculation array. min .

[0080] like Figure 2 As shown, in this embodiment, the calculation range is a 9x9 pixel matrix centered on the blue value (B value), which is used as the calculation matrix to obtain a 9x9 calculation array with the blue value (B value) as the center point. The center point of the 9x9 calculation array is the blue value (B value). For the 9x9 calculation array, the minimum value among all blue values ​​(B values) is calculated and denoted as B. min .

[0081] like Figure 3 As shown, as an optional embodiment of this application, optionally, the maximum green value G corresponding to the current value is calculated. max ,include:

[0082] Calculate and obtain the green value G1 corresponding to the current value;

[0083] Calculate and obtain several green values ​​G2 within a 3x3 area surrounding the current value; where M < N;

[0084] Calculate and obtain the maximum green value G from the green value G1 and several green values ​​G2. max .

[0085] Once the current value is determined, calculate the G value corresponding to the current value and the G values ​​of the surrounding 3x3 area, for a total of 5 values. The current value corresponds to a green value—the G value. There are 4 people within its 3x3 area with G values, for a total of 5 values. Calculate the maximum value among these 5 values ​​and denote it as G. max .

[0086] As an optional implementation of this application, optionally, calculating the red value R corresponding to the current value includes:

[0087] Calculate and obtain the red value R1 corresponding to the current value;

[0088] Calculate and obtain several red values ​​R2 within a 3x3 range around the current value;

[0089] Calculate and obtain the maximum value among the red values ​​R1 and several red values ​​R2 as the red value R.

[0090] The red value (R value) can also be calculated using the G value mentioned above. max The calculation method is not directly applicable here.

[0091] The embodiment also provides a calculation method of the red value R as follows:

[0092] As an optional embodiment of the present application, the red value R corresponding to the current value is calculated, comprising:

[0093] The red values R2 within the MxM range around the current value are calculated and obtained;

[0094] The average value of the red values R2 is calculated and obtained as the red value R.

[0095] That is, the average value of the four red values R2 within the 3x3 range around the current value is calculated as the red value R.

[0096] The same calculation method as that of the G max is preferably adopted.

[0097] The B value corresponding to the current value is compared with the green value maximum value G max and the red value R, if the current value is greater than the green value maximum value G max and the red value R, it is indicated that when the blue value is greater than the maximum green value and red value around, the blue color is determined as the purple edge which needs to be replaced.

[0098] The minimum B min is adopted to replace the current value.

[0099] As an optional embodiment of the present application, when judging whether the current value is greater than the green value maximum value G max and the red value R, it also comprises:

[0100] If the condition that the current value is greater than the green value maximum value G max and the red value R is not satisfied, the process is ended;

[0101] The region to be detected of the purple edge is cyclically checked.

[0102] The current value is cyclically checked, and the region with the purple edge is processed to remove the purple edge.

[0103] Therefore, the present application compares the blue pixels, calculates the red value and the green value of the current point, and determines when the point is the blue point through the judgment condition, and then the minimum value within 9x9 is adopted to replace, so as to reduce the current blue value and reduce the blue-purple edge. Here, large resources are not needed, and complex edge calculation is not needed.

[0104] It should be noted that although the purple edge judgment and replacement of the current value as above is described by taking a 9x9 image array as an example, those skilled in the art can understand that the present disclosure should not be limited thereto. In fact, the user can flexibly set the image array region according to the actual application scene, as long as the technical function of the present application can be realized according to the above technical method.

[0105] The purple edge removal algorithm of the present application mainly detects whether the purple halo edge is in the range of several rows of pixels around the image edge, and then repairs according to the actual edge around. The algorithm needs to cache more than 10 rows of data and a large number of boundary (ram block) calculations and a large number of logic resources for complex calculations.

[0106] Obviously, those skilled in the art should understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware, and the program can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments of the control method.

[0107] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware, and the program can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments of the control method. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid state drive (SSD), etc. The storage medium can also include a combination of the above types of memories.

[0108] Embodiment 2

[0109] Based on the implementation principle of embodiment 1, another aspect of the present application proposes a device for implementing the fast purple edge removal method based on FPGA language, comprising:

[0110] A pixel acquisition module is configured to acquire original data pixels.

[0111] A blue value calculation module is configured to calculate the minimum value Bmin of the blue value in the original data pixels.

[0112] A judgment value calculation module is configured to calculate the maximum value Gmax of the green value corresponding to the current value and the red value R corresponding to the current value.

[0113] A judging module is configured to judge whether the current value is greater than the maximum green value Gmax and the red value R simultaneously; if so, the current value is determined as blue, and the current value is replaced by Bmin.

[0114] The functions of the modules are described in detail in Embodiment 1.

[0115] The modules or steps of the present application described above can be implemented by a general computing device, which can be centralized on a single computing device or distributed on a network composed of multiple computing devices. Alternatively, the modules or steps can be implemented by program codes executable by a computing device, so that the modules or steps can be stored in a storage device and executed by the computing device, or the modules or steps can be manufactured into individual integrated circuit modules or a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.

[0116] Embodiment 3

[0117] Further, another aspect of the present application provides a control system, comprising:

[0118] a processor;

[0119] a memory for storing processor-executable instructions;

[0120] wherein the processor is configured to implement the FPGA language-based fast purple edge removal method when executing the executable instructions.

[0121] The control system according to the embodiments of the present application comprises a processor and a memory for storing processor-executable instructions. The processor is configured to implement the FPGA language-based fast purple edge removal method when executing the executable instructions.

[0122] It should be noted that the number of processors can be one or more. Meanwhile, the control system according to the embodiments of the present application can further comprise an input device and an output device. The processor, the memory, the input device and the output device can be connected by a bus or other means, which is not limited here.

[0123] The memory as a computer readable storage medium can be used to store software programs, computer executable programs and various modules, such as the programs or modules corresponding to the FPGA language-based fast purple edge removal method according to the embodiments of the present application. The processor executes the software programs or modules stored in the memory, thereby performing various functional applications and data processing of the control system.

[0124] The input device can be used to receive inputted numbers or signals. Among them, the signal can be a key signal generated in relation to the user settings and function control of the device / terminal / server. The output device can include a display device such as a display screen.

[0125] Embodiment 4

[0126] Another aspect of the present application also proposes an industrial microscope which adopts the above-mentioned FPGA language-based fast purple edge removal algorithm to perform image purple edge removal processing.

[0127] The image obtained under the industrial microscope is more likely to have purple edge phenomenon, therefore, the present algorithm is used for image processing under the industrial microscope, and good effect can be obtained, the only disadvantage is that it is not recommended to be used in samples with too many real blue boundaries, and yellow problem may occur on the edge. However, the effect of using the present algorithm under the industrial microscope is obviously improved.

[0128] The algorithm itself can be stored by a configured computer, which occupies less resources, and the purple edge phenomenon can be solved without large-scale searching of the purple edge area.

[0129] The specific application configuration can be selected by the user.

[0130] The above has described the embodiments of the present disclosure, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes are obvious to those skilled in the art without departing from the scope and spirit of the described embodiments. The selection of the terms used herein is intended to best explain the principles, practical application or technical improvement of the technology in the market of the embodiments, or to enable other ordinary skilled persons in the art to understand the embodiments disclosed herein.

Claims

1. A method for fast purple edge removal based on FPGA language, characterized in that, The method comprises the following steps: obtaining an original data pixel point; calculating a minimum value B of blue values in the original data pixels min ; calculating a green value maximum G corresponding to the current value max and a red value R corresponding to the current value; determining if the current value is greater than the green value maximum G max and the red value R: if both are true, then the current value is blue and is a purple edge that needs to be removed, and the current value is replaced by B min; calculating a green value maximum G corresponding to the current value max comprising: calculating and obtaining a green value G1 corresponding to the current value; calculating and obtaining a plurality of green values G2 within an MxM range around the current value; wherein M < N; From the green value G1 and the several green values G2, the green value maximum G is calculated and obtained max; calculating a red value R corresponding to the current value, comprising: calculating and obtaining a red value R1 corresponding to the current value; calculating and obtaining a plurality of red values R2 within an MxM range around the current value; calculating and obtaining the maximum value among the red value R1 and the plurality of red values R2 as the red value R; calculating a red value R corresponding to the current value, comprising: calculating and obtaining a plurality of red values R2 within an MxM range around the current value; calculating and obtaining the average value of the plurality of red values R2 as the red value R; The current value refers to the blue value in a pixel point specified by a user.

2. The FPGA language based fast de-banding method of claim 1, wherein, After obtaining the original data pixel point, the method further comprises: obtaining the original data pixel points arranged in an array according to a preset array condition to obtain a pixel matrix; outputting and saving the pixel matrix.

3. The FPGA language based fast de-banding method of claim 2, wherein, calculating a minimum value B of blue values in the original data pixels min comprising: setting a calculation range; dividing a calculation matrix from the pixel matrix according to the calculation range, and obtaining a calculation array NxN with a center point as a blue value; calculating and obtaining the minimum value B of all blue values in the calculation array NxN min .

4. The apparatus for implementing the FPGA language based fast de-burring method according to any one of claims 1-3, characterized in that, comprising: a pixel obtaining module for obtaining an original data pixel point; a blue value calculation module configured to calculate a minimum value B of blue values in the original data pixels min ; The judgment value calculation module is configured to calculate a green value maximum G corresponding to the current value max and a red value R corresponding to the current value. a judging module, used for judging whether the current value is greater than the maximum value of the green value G and the red value R at the same time max and if so, the current value is determined to be blue, and the purple edge needs to be removed, and the current value is replaced by B min .

5. Control system, characterized in that comprising: a processor; a memory for storing processor executable instructions; wherein the processor is configured to execute the executable instructions to implement the FPGA language based fast purple edge removal method in any one of claims 1-3.

Citation Information

Patent Citations

  • System and method for eliminating purple boundary of image

    CN106657946A

  • Image purple edge elimination method and device and storage medium

    CN112887693A