A method and system for enhancing bright and dark parts of X-ray images
Through steps such as Gamma transformation, color space conversion and Gaussian filtering, the X-ray image is dynamically and finely adjusted in local areas, which solves the problem of poor detail highlighting in bright and dark areas, improves image contrast and detail highlighting effects, and meets the requirements for detecting defects in observed devices.
Patent Information
- Application Number
- CN202311016049.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-10
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2043-08-10
AI Technical Summary
The existing technology has a poor effect in highlighting the details of bright and dark parts of X-ray images, resulting in reduced image spatial resolution and contrast, and inability to effectively detect tiny device defects.
Through steps such as gamma transformation, color space conversion, normalization, Gaussian filtering and color space inverse conversion, combined with bright and dark adjustment factors, dynamic and subtle adjustments are made to local areas of the image to improve the contrast between bright and dark areas.
It effectively enhances the highlighting and enhancement effect of the bright and dark details of the image, meets the effective detection of defects in the observed device, and avoids the problem of bright areas being too bright or dark areas being too dark.
Smart Images

Figure CN117058029B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method and system for enhancing bright and dark parts of an X-ray image. Background Art
[0002] In existing image formation processes, factors such as the angle of illumination and the dynamic range of the imaging device can easily lead to uneven illumination distribution in the final image. To address this issue, existing technologies typically utilize classic grayscale image enhancement algorithms such as contrast stretching, gamma transformation, and histogram equalization. However, these methods can easily result in the processed image having bright areas that are too bright or dark areas that are too dark.
[0003] Especially for X-ray images, the random fluctuations in image grayscale due to changes in spatial position cause a decrease in image spatial resolution and contrast, making it impossible to effectively detect defects in tiny devices based on X-ray images.
[0004] Therefore, there is an urgent need for a method for enhancing the bright and dark parts of X-ray images to highlight and enhance the details of the bright and dark parts in the image. Summary of the Invention
[0005] (1) Technical problems solved
[0006] In view of the shortcomings of the existing technology, the present invention provides a method and system for enhancing the bright and dark parts of an X-ray image, which solves the technical problem in the existing technology of poor highlighting effect of the bright and dark details in the image.
[0007] (2) Technical solution
[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0009] In a first aspect of the present invention, a method for enhancing bright and dark parts of an X-ray image is provided, the method comprising:
[0010] S1. Performing Gamma transformation, color space conversion, and normalization on the first image to be processed to obtain a second image to be processed, and performing Gamma transformation, Gaussian filtering, color space conversion, and normalization on the first image to be processed to obtain a third image to be processed;
[0011] S2, based on the pixel value B of the third image to be processed ij , preset bright adjustment factor h and dark adjustment factor s, respectively obtain the first adjustment variable R and the second adjustment variable X ij ;
[0012] The process of obtaining the first adjustment variable R is as follows: ij>0.5 is true? If so, then R=4 2 If not, then R = 4s 2 ; Get the second manipulated variable X ij The formula is: X ij =(1-2*B ij )*(1-2*B ij ); i represents the horizontal coordinate of the pixel point in the image, and j represents the vertical coordinate of the pixel point in the image;
[0013] S3, determine whether R>0 is true, if so, go to S4; if not, go to S5;
[0014] S4, based on the pixel value B of the third image to be processed ij and the second manipulated variable X ij The pixel value L of the second image to be processed ij Update and set R = R-1, go to S3;
[0015] Among them, the pixel value L of the second image to be processed ij The update process is:
[0016] Judgment 0≤L ij ≤0.5 is true, if so, then L ij =L ij *(1-X ij )+2*L ij *B ij *X ij ;
[0017] If not, then L ij =L ij *(1-X ij )+[1-2*(1-L ij )*(1-B ij )]*X ij ;
[0018] S5. Perform color space inverse conversion processing on the updated second image to be processed to obtain a bright and dark part enhanced image.
[0019] Optionally, before step S1, the method further includes:
[0020] An original image is acquired, and image noise reduction and normalization processing are performed on the original image to obtain a first image to be processed.
[0021] Optionally, in step S1, the process of performing gamma transformation, color space conversion, and normalization on the first image to be processed to obtain the second image to be processed includes:
[0022] Perform Gamma transformation on the first image to be processed to obtain a Gamma transformed image; wherein the process of Gamma transformation is: determine V ij >0.04045 is true, if so, then let If not, then V ij G represents the pixel value of the pixel with coordinates (i, j) in the first image to be processed; ij represents the pixel value of the pixel with coordinates (i, j) in the Gamma transformed image;
[0023] The Gamma transformed image is subjected to color space conversion and normalization processing to obtain a second image to be processed; wherein the normalization processing process is: judging Is it established? If so, let If not, then
[0024] Optionally, the process of performing Gamma transformation, Gaussian filtering, color space conversion, and normalization on the first image to be processed to obtain the third image to be processed includes:
[0025] Perform Gamma transformation on the first image to be processed to obtain a Gamma transformed image; wherein the process of Gamma transformation is: determine V ij >0.04045 is true, if so, then let If not, then V ij G represents the pixel value of the pixel with coordinates (i, j) in the first image to be processed; ij represents the pixel value of the pixel with coordinates (i, j) in the Gamma transformed image;
[0026] Performing Gaussian filtering on the Gamma transformed image to obtain a Gaussian filtered image; wherein the filter kernel in the Gaussian filtering process is: K′ represents the value of the filter kernel, σ represents the preset parameter value, Get greater than or equal to The smallest integer, Get 1 and The maximum value in ;
[0027] The Gaussian filtered image is subjected to color space conversion and normalization processing to obtain a third image to be processed; wherein the normalization processing process is: judging Is it established? If so, let If not, then G″ ij Represents the pixel values of the Gaussian filtered image.
[0028] Optionally, in step S5, the process of performing color space inverse conversion processing on the updated second image to be processed to obtain a bright and dark part enhanced image includes:
[0029] Performing initial adjustment on the updated second image to be processed to obtain a completed image; wherein the process of performing the initial adjustment is: L′ ij Represents the pixel value of the pixel in the image to be completed;
[0030] The color space reverse conversion process is performed on the image to be completed to obtain a bright and dark part enhanced image; wherein the process of the color space reverse conversion process is: judging Is it established? If so, then If not, then V ij Indicates the pixel value of the pixel in the bright and dark part enhanced image.
[0031] In a second aspect of the present invention, a system for enhancing bright and dark parts of an X-ray image is provided, the system comprising:
[0032] an initial transformation module, configured to execute S1, perform Gamma transformation, color space conversion, and normalization processing on the first image to be processed to obtain a second image to be processed, and perform Gamma transformation, Gaussian filtering, color space conversion, and normalization processing on the first image to be processed to obtain a third image to be processed;
[0033] The first acquisition module is used to execute S2, based on the pixel value B of the third image to be processed ij , preset bright adjustment factor h and dark adjustment factor s, respectively obtain the first adjustment variable R and the second adjustment variable X ij ;
[0034] The process of obtaining the first adjustment variable R is as follows: ij >0.5 is true? If so, then R=4 2 If not, then R = 4s 2 ; Get the second manipulated variable X ij The formula is: X ij =(1-2*B ij )*(1-2*B ij ); i represents the horizontal coordinate of the pixel point in the image, and j represents the vertical coordinate of the pixel point in the image;
[0035] The first judgment module is used to execute S3 and determine whether R>0 is established. If so, the process is transferred to the first update module to execute S4; if not, the process is transferred to the conversion processing module to execute S5;
[0036] The first updating module is used to execute S4, based on the pixel value B of the third image to be processed ij and the second manipulated variable X ij The pixel value L of the second image to be processed ij Update and set R=R-1, and then go to the first judgment module to execute S3;
[0037] Among them, the pixel value L of the second image to be processed ij The update process is:
[0038] Judgment 0≤L ij ≤0.5 is true, if so, then L ij =L ij *(1-X ij )+2*L ij *B ij *X ij ;
[0039] If not, then L ij =L ij *(1-X ij )+[1-2*(1-L ij )*(1-B ij )]*X ij ;
[0040] The conversion processing module is used to execute S5, perform color space inverse conversion processing on the updated second image to be processed to obtain a bright and dark part enhanced image.
[0041] Optionally, the system further includes:
[0042] The first acquisition module is used to acquire an original image before step S1, and perform image denoising and normalization processing on the original image to obtain a first image to be processed.
[0043] Optionally, in the initial transformation module, the process of performing gamma transformation, color space conversion, and normalization on the first image to be processed to obtain the second image to be processed includes:
[0044] Perform Gamma transformation on the first image to be processed to obtain a Gamma transformed image; wherein the process of Gamma transformation is: determine V ij >0.04045 is true, if so, then let If not, then V ij G represents the pixel value of the pixel with coordinates (i, j) in the first image to be processed; ij represents the pixel value of the pixel with coordinates (i, j) in the Gamma transformed image;
[0045] The Gamma transformed image is subjected to color space conversion and normalization processing to obtain a second image to be processed; wherein the normalization processing process is: judging Is it established? If so, let If not, then
[0046] Optionally, the process of performing Gamma transformation, Gaussian filtering, color space conversion, and normalization on the first image to be processed in the initial transformation module to obtain the third image to be processed includes:
[0047] Perform Gamma transformation on the first image to be processed to obtain a Gamma transformed image; wherein the process of Gamma transformation is: determine V ij >0.04045 is true, if so, then let If not, then V ij G represents the pixel value of the pixel with coordinates (i, j) in the first image to be processed; ij represents the pixel value of the pixel with coordinates (i, j) in the Gamma transformed image;
[0048] Performing Gaussian filtering on the Gamma transformed image to obtain a Gaussian filtered image; wherein the filter kernel in the Gaussian filtering process is: K′ represents the value of the filter kernel, σ represents the preset parameter value, Get greater than or equal to The smallest integer, Get 1 and The maximum value in ;
[0049] The Gaussian filtered image is subjected to color space conversion and normalization processing to obtain a third image to be processed; wherein the normalization processing process is: judging Is it established? If so, let If not, then G″ ij Represents the pixel values of the Gaussian filtered image.
[0050] Optionally, the conversion processing module includes:
[0051] The initial adjustment unit is used to perform initial adjustment on the updated second image to be processed to obtain a completed image; wherein the process of performing the initial adjustment is: L′ ij Represents the pixel value of the pixel in the image to be completed;
[0052] The conversion processing unit is used to perform color space reverse conversion processing on the image to be completed to obtain a bright and dark part enhanced image; wherein the process of color space reverse conversion processing is: judging Is it true? If so, then V ij =L′ ij 3 , if not, then V ij Indicates the pixel value of the pixel in the bright and dark part enhanced image.
[0053] (3) Beneficial effects
[0054] The present invention provides a method and system for enhancing bright and dark areas of X-ray images. Compared with the prior art, it has the following advantages:
[0055] The method comprises: S1, performing Gamma transformation, color space conversion and normalization processing on a first image to be processed to obtain a second image to be processed, and performing Gamma transformation, Gaussian filtering, color space conversion and normalization processing on the first image to be processed to obtain a third image to be processed; S2, performing pixel value B based on the third image to be processed ij , preset bright adjustment factor h and dark adjustment factor s, respectively obtain the first adjustment variable R and the second adjustment variable X ij ; Among them, the process of obtaining the first adjustment variable R is: judging B ij >0.5 is true? If so, then R=4 2 If not, then R = 4s 2 ; Get the second manipulated variable X ij The formula is: X ij =(1-2*B ij )*(1-2*B ij ); i represents the horizontal coordinate of the pixel point in the image, j represents the vertical coordinate of the pixel point in the image; S3, judge whether R>0 is established, if so, go to S4; if not, go to S5; S4, then based on the pixel value B of the third image to be processed ij and the second manipulated variable X ij The pixel value L of the second image to be processed ij Update and set R=R-1, go to S3; wherein, the pixel value L of the second image to be processed ij The updating process is: judging 0≤L ij ≤0.5 is true, if so, then L ij =L ij *(1-X ij )+2*L ij *B ij *X ij If not, then Lij =L ij *(1-X ij )+[1-2*(1-L ij )*(1-B ij )]*X ij ; S5. Perform color space reverse conversion processing on the updated second image to be processed to obtain a bright and dark part enhanced image.
[0056] Based on the above processing, through Gaussian filtering, color space conversion, comprehensive processing of bright and dark areas, color space inverse conversion and other steps, not only the contrast of bright and dark areas in the image is effectively improved, but also based on the Gaussian filtered image, it is judged whether the area corresponding to the pixel points in each local area is too bright or too dark, thereby realizing dynamic and subtle adjustment of the bright / dark areas in the local area of the image, thereby improving the highlighting and enhancement effect of the bright and dark details of the image, and can meet the effective detection of defects in the observed device. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0058] Figure 1 A flowchart of a method for enhancing bright and dark areas of an X-ray image provided by an embodiment of the present invention;
[0059] Figure 2 An image obtained by superimposing multiple X-ray images provided by an embodiment of the present invention;
[0060] Figure 3 An X-ray image provided by an embodiment of the present invention is processed by a bright and dark part enhancement method;
[0061] Figure 4 A schematic structural diagram of an image bright and dark part enhancement system provided by an embodiment of the present invention;
[0062] Figure 5 A structural diagram of an electronic device provided by an embodiment of the present invention;
[0063] Figure 6 The image is processed by the limited contrast adaptive histogram equalization method;
[0064] Figure 7 is the image processed based on the Gamma correction method;
[0065] Figure 8The image is processed based on the histogram equalization method. DETAILED DESCRIPTION
[0066] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0067] The embodiment of the present application solves the technical problem of poor highlighting effect of bright and dark details in X-ray images in the prior art by providing a method for enhancing bright and dark parts of X-ray images. After processing through steps such as Gaussian filtering, color space conversion, comprehensive processing of bright and dark parts, and color space inverse conversion, not only can the contrast of bright and dark areas in the image be effectively improved, but also based on the image after Gaussian filtering, it is judged whether the area corresponding to the pixel points in each local area is too bright or too dark, thereby realizing dynamic and subtle adjustment of the bright / dark parts of the local area in the image, thereby improving the highlighting and enhancement effect of the bright and dark details of the image, and can meet the effective detection of defects in the observed device.
[0068] The technical solution in the embodiments of the present application is to solve the above technical problems, and the overall idea is as follows:
[0069] According to the principles of X-ray imaging, differences in density, thickness, material, and penetrating properties among different parts of the object being observed lead to varying degrees of X-ray absorption, resulting in varying X-ray doses reaching the detector, which are then converted into a grayscale image with distinct hierarchies. The X-ray imaging process is influenced by a variety of factors, including the X-ray angle and intensity, the object's material, penetrating properties, and the dynamic range of the imaging detector, which can easily lead to uneven illumination distribution in the X-ray image.
[0070] Existing grayscale image enhancement methods, such as contrast stretching, gamma transformation, and histogram equalization, primarily target the overall image or grayscale distribution for uniform segmentation and stretching. They fail to consider the impact of local light-dark contrast, resulting in images with enhanced bright and dark areas often appearing too bright in bright areas and too dark in dark areas. Localized light-dark contrast often represents a critical area of X-ray images, highlighting details. Therefore, the impact of local contrast between bright and dark areas in the image requires special consideration.
[0071] The present invention performs a Gamma transformation on the image, that is, adjusts the contrast of the overexposure or underexposure (too dark) of the image through nonlinear transformation, and obtains an enhanced image after preliminary processing. At the same time, a Gaussian filtering method is adopted to adjust the influence range of the bright and dark parts of each area of the image by setting the kernel size. In addition, in order to maintain the uniformity of the image format during the processing process, the images are uniformly converted to the LAB color space, and the brightness channel L is used to process the brightness and darkness of the entire image. The bright and dark part enhancement method provided by the present invention can determine whether the pixel points in each local area of the image are too bright or too dark in the corresponding area by combining the image after Gaussian filtering, and can fine-tune the bright / dark part of the corresponding pixel points in the image based on the bright / dark part adjustment factor, thereby achieving bright / dark part adjustment of the local area, and then at the end of the image processing process, the image of the required color space can be obtained by reverse conversion of the color space.
[0072] In order to better understand the above technical solution, the above technical solution will be described in detail below with reference to the accompanying drawings and specific implementation methods.
[0073] See also Figure 1 , Figure 1 A flowchart of a method for enhancing bright and dark areas of an image provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes:
[0074] S1. Performing Gamma transformation, color space conversion, and normalization on the first image to be processed to obtain a second image to be processed, and performing Gamma transformation, Gaussian filtering, color space conversion, and normalization on the first image to be processed to obtain a third image to be processed;
[0075] S2, based on the pixel value B of the third image to be processed ij , preset bright adjustment factor h and dark adjustment factor s, respectively obtain the first adjustment variable R and the second adjustment variable X ij ;
[0076] The process of obtaining the first adjustment variable R is as follows: ij >0.5 is true? If so, then R=4 2 If not, then R = 4s 2 ; Get the second manipulated variable X ij The formula is: X ij =(1-2*B ij )*(1-2*B ij ); i represents the horizontal coordinate of the pixel point in the image, and j represents the vertical coordinate of the pixel point in the image;
[0077] S3, determine whether R>0 is true, if so, go to S4; if not, go to S5;
[0078] S4, based on the pixel value B of the third image to be processed ij and the second manipulated variable X ij The pixel value L of the second image to be processed ij Update and set R = R-1, go to S3;
[0079] Among them, the pixel value L of the second image to be processed ij The update process is:
[0080] Judgment 0≤L ij ≤0.5 is true, if so, then L ij =L ij *(1-X ij )+2*L ij *B ij *X ij ;
[0081] If not, then L ij =L ij *(1-X ij )+[1-2*(1-L ij )*(1-B ij )]*X ij .
[0082] S5. Perform color space inverse conversion processing on the updated second image to be processed to obtain a bright and dark part enhanced image.
[0083] Based on the above processing, through Gaussian filtering, color space conversion, comprehensive processing of bright and dark areas, color space inverse conversion and other steps, not only can the contrast of bright and dark areas in the image be effectively improved, but also based on the Gaussian filtered image, it is judged whether the area corresponding to the pixel points in each local area is too bright or too dark, thereby realizing dynamic and subtle adjustment of the bright / dark areas in the local area of the image, thereby improving the highlighting and enhancement effect of the bright and dark details of the image, and can meet the effective detection of defects in the observed device.
[0084] In some embodiments, before step S1, the method further includes:
[0085] S6. Acquire an original image, and perform image denoising and normalization processing on the original image to obtain a first image to be processed.
[0086] For step S2 , the range of the bright part adjustment factor h is [−1, 0], and the smaller the value, the darker the bright part; the range of the dark part adjustment factor s is [0, 1], and the larger the value, the brighter the dark part.
[0087] In one implementation, multiple frames of continuous original images can be acquired by the same instrument, wherein the number of frames of the original images is generally in the range of [2, 4, 8, 16, 32, 64, 128, 256], etc.
[0088] After acquiring multiple frames of continuous original images, image noise reduction is performed on the original images through image superposition processing.
[0089] Among them, the formula for image superposition is:
[0090] V i is the i-th frame image, K is the number of superimposed frames, and the above formula means that the pixel values at the same position in multiple consecutive frames of original images are summed and averaged. Figure 2 , Figure 2 Schematic diagram of the image after superposition of multiple frames of X-ray images.
[0091] In one implementation, the normalization processing method includes but is not limited to: maximum and minimum value normalization, etc. If the maximum and minimum value normalization is adopted, the calculation formula is as follows:
[0092] Among them, N ij Represents the pixel value in the normalized image, M ij Represents the pixel value in the image before normalization, M max Represents the maximum pixel value in the image before normalization, M min Indicates the minimum pixel value in the image before normalization.
[0093] Specifically, if the original image is an X-ray image, the interference of quantum fluctuations and random noise on the image can be suppressed by superimposing multiple frames of images collected by the X-ray detector, thereby achieving image denoising, and based on normalization processing, the pixel values of the image are converted to between [0,1].
[0094] In some embodiments, in step S1, the process of performing gamma transformation, color space conversion, and normalization on the first image to be processed to obtain the second image to be processed includes the following steps:
[0095] S101, performing Gamma transformation on the first image to be processed to obtain a Gamma transformed image; wherein the process of Gamma transformation is: determining V ij >0.04045 is true, if so, then let If not, then V ij G represents the pixel value of the pixel with coordinates (i, j) in the first image to be processed; ij Represents the pixel value of the pixel with coordinates (i, j) in the Gamma transformed image.
[0096] S102, performing color space conversion and normalization processing on the Gamma transformed image to obtain a second image to be processed; wherein the normalization processing process is: judging Is it established? If so, let If not, then
[0097] The image is converted into a color space by converting the image into a single-channel grayscale value data into an image format data containing only a brightness channel.
[0098] In some embodiments, in step S1, the process of performing gamma transformation, Gaussian filtering, color space conversion, and normalization on the first image to be processed to obtain the third image to be processed includes the following steps:
[0099] S103, performing Gamma transformation on the first image to be processed to obtain a Gamma transformed image; wherein the process of Gamma transformation is: determining V ij >0.04045 is true, if so, then let If not, then V ij G represents the pixel value of the pixel with coordinates (i, j) in the first image to be processed; ij represents the pixel value of the pixel with coordinates (i, j) in the Gamma transformed image;
[0100] S104: Perform Gaussian filtering on the Gamma transformed image to obtain a Gaussian filtered image; wherein the filter kernel in the Gaussian filtering process is: K′ represents the value of the filter kernel, σ represents the preset parameter value, Get greater than or equal to The smallest integer, Get 1 and The maximum value in .
[0101] Among them, based on Gaussian filtering processing, the weight value of the center point of the image is increased, and the weight value far away from the center point is reduced, so that the sum of the different weights of each pixel value in the neighborhood can be calculated.
[0102] S105, performing color space conversion and normalization processing on the Gaussian filtered image to obtain a third image to be processed; wherein the normalization processing process is: judging Is it established? If so, let If not, then G″ ij Represents the pixel values of the Gaussian filtered image.
[0103] In some embodiments, in step S5, the process of performing color space inverse conversion processing on the updated second image to be processed to obtain a bright and dark part enhanced image includes the following steps:
[0104] S501: Perform initial adjustment on the updated second image to be processed to obtain a completed image; wherein the process of performing the initial adjustment is as follows: L′ ij Represents the pixel value of the pixel in the image to be completed.
[0105] S502, performing color space reverse conversion processing on the image to be completed to obtain a bright and dark part enhanced image; wherein the process of color space reverse conversion processing is: judging Is it established? If so, then If not, then V ij Indicates the pixel value of the pixel in the bright and dark part enhanced image.
[0106] Based on the above color space inverse conversion process, the brightness channel image can be converted into a single-channel grayscale image, thereby obtaining an image with enhanced bright and dark areas. Figure 3 , Figure 3 An embodiment of the present invention provides an X-ray image processed by a bright and dark part enhancement method.
[0107] like Figure 4 As shown, the present invention also provides an X-ray image bright and dark part enhancement system, the system comprising:
[0108] The initial transformation module 401 is configured to execute S1, perform gamma transformation, color space conversion, and normalization processing on the first image to be processed to obtain a second image to be processed, and perform gamma transformation, Gaussian filtering, color space conversion, and normalization processing on the first image to be processed to obtain a third image to be processed;
[0109] The first acquisition module 402 is configured to execute S2, based on the pixel value B of the third image to be processed. ij , preset bright adjustment factor h and dark adjustment factor s, respectively obtain the first adjustment variable R and the second adjustment variable X ij ;
[0110] The process of obtaining the first adjustment variable R is as follows: ij >0.5 is true? If so, then R=4 2 If not, then R = 4s 2 ; Get the second manipulated variable X ij The formula is: X ij =(1-2*B ij )*(1-2*B ij); i represents the horizontal coordinate of the pixel point in the image, and j represents the vertical coordinate of the pixel point in the image;
[0111] The first judgment module 403 is used to execute S3 and determine whether R>0 is established. If so, the process is transferred to the first update module 404 to execute S4; if not, the process is transferred to the conversion processing module 405 to execute S5;
[0112] The first updating module 404 is configured to execute S4, based on the pixel value B of the third image to be processed ij and the second manipulated variable X ij The pixel value L of the second image to be processed ij Update and set R=R-1, and then go to the first judgment module to execute S3;
[0113] Among them, the pixel value L of the second image to be processed ij The update process is:
[0114] Judgment 0≤L ij ≤0.5 is true, if so, then L ij =L ij *(1-X ij )+2*L ij *B ij *X ij If not, then L ij =L ij *(1-X ij )+[1-2*(1-L ij )*(1-B ij )]*X ij ;
[0115] The conversion processing module 405 is configured to execute S5, performing color space inverse conversion processing on the updated second image to be processed to obtain a bright and dark part enhanced image.
[0116] It can be understood that the X-ray image bright and dark part enhancement system provided by the embodiment of the present invention corresponds to the above-mentioned X-ray image bright and dark part enhancement method. The explanations, examples, beneficial effects, etc. of its relevant contents can refer to the corresponding contents in the X-ray image bright and dark part enhancement method, and will not be repeated here.
[0117] The embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.
[0118] Memory 503, used for storing computer programs;
[0119] The processor 501 is configured to implement any of the above-mentioned methods for enhancing bright and dark parts of X-ray images when executing the program stored in the memory 503 .
[0120] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.
[0121] The communication interface is used for communication between the above electronic device and other devices.
[0122] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0123] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0124] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, which stores a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for enhancing bright and dark parts of X-ray images are implemented.
[0125] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any one of the methods for enhancing bright and dark parts of an X-ray image in the above embodiments.
[0126] In the above embodiments, all or part of the embodiments may be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part.
[0127] The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0128] In summary, compared with the prior art, the technical solution provided by the present invention has the following beneficial effects:
[0129] 1. Through Gaussian filtering, color space conversion, comprehensive processing of bright and dark areas, and color space inverse conversion, the contrast between bright and dark areas in the image can be effectively improved, which helps to enhance the highlighting effect of the bright and dark details of the image, thereby meeting the effective detection of defects in the observed device.
[0130] 2. The image brightness and dark part enhancement method provided by the present invention is combined with the image after Gaussian filtering. Not only can the local area influence range of the image brightness and darkness be set by adjusting the size of the Gaussian kernel, but also it can be judged whether the area corresponding to the pixel points in each local area is too bright or too dark based on the image after Gaussian filtering. It can achieve dynamic and subtle adjustment of the brightness / dark part of the local area, avoiding the deficiency of other methods that only adjust the brightness and dark part based on the overall image, resulting in some image details in the image cannot be highlighted.
[0131] In addition, in order to verify the above technical effects, the present invention provides images processed by different bright and dark part processing methods, such as Figure 6-8 As shown. Among them, Figure 6 For images processed by limited contrast adaptive histogram equalization method, Figure 7is the image processed based on the Gamma correction method, Figure 8 is the image processed based on the histogram equalization method. Figure 6-8 The display effect and Figure 3 By comparing the display effects of , it can be seen that compared with the prior art, the bright part enhancement method provided by the present invention can achieve dynamic and subtle adjustment of the bright / dark parts in the local area of the image, thereby improving the highlighting and enhancement effect of the bright and dark details of the image.
[0132] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0133] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for enhancing bright and dark parts of an X-ray image, characterized in that: The method comprises: S1. Performing Gamma transformation, color space conversion, and normalization on the first image to be processed to obtain a second image to be processed, and performing Gamma transformation, Gaussian filtering, color space conversion, and normalization on the first image to be processed to obtain a third image to be processed; S2, based on the pixel value B of the third image to be processed ij , preset bright adjustment factor h and dark adjustment factor s, respectively obtain the first adjustment variable R and the second adjustment variable X ij ; The process of obtaining the first adjustment variable R is as follows: ij >0.5 is true? If so, then R=4 2 If not, then R = 4s 2 ; Get the second manipulated variable X ij The formula is: X ij =(1-2*B ij )*(1-2*B ij ); i represents the horizontal coordinate of the pixel point in the image, and j represents the vertical coordinate of the pixel point in the image; S3, determine whether R>0 is true, if so, go to S4; if not, go to S5; S4, based on the pixel value B of the third image to be processed ij and the second manipulated variable X ij The pixel value L of the second image to be processed ij Update and set R = R-1, go to S3; Among them, the pixel value L of the second image to be processed ij The update process is: Judgment 0≤L ij ≤0.5 is true, if so, then L ij =L ij *(1-X ij )+2*L ij *B ij *X ij ; If not, then L ij =L ij *(1-X ij )+[1-2*(1-L ij )*(1-B ij )]*X ij ; S5, performing color space inverse conversion processing on the updated second image to be processed to obtain a bright and dark part enhanced image; In step S1, the process of performing gamma transformation, color space conversion, and normalization on the first image to be processed to obtain the second image to be processed includes: Perform Gamma transformation on the first image to be processed to obtain a Gamma transformed image; wherein the process of Gamma transformation is: determine V ij >0.04045 is true, if so, then let If not, then V ij G represents the pixel value of the pixel with coordinates (i, j) in the first image to be processed; ij represents the pixel value of the pixel with coordinates (i, j) in the Gamma transformed image; The Gamma transformed image is subjected to color space conversion and normalization processing to obtain a second image to be processed; wherein the normalization processing process is: judging Is it established? If so, let If not, then 2. The method according to claim 1, characterized in that Before step S1, the method further includes: An original image is acquired, and image noise reduction and normalization processing are performed on the original image to obtain a first image to be processed.
3. The method according to claim 1, characterized in that The process of performing Gamma transformation, Gaussian filtering, color space conversion, and normalization on the first image to be processed to obtain the third image to be processed includes: Perform Gamma transformation on the first image to be processed to obtain a Gamma transformed image; wherein the process of Gamma transformation is: determine V ij >0.04045 is true, if so, then let If not, then V ij G represents the pixel value of the pixel with coordinates (i, j) in the first image to be processed; ij represents the pixel value of the pixel with coordinates (i, j) in the Gamma transformed image; The Gamma transform image is subjected to Gaussian filtering to obtain a Gaussian filtered image; wherein the filter kernel in the Gaussian filtering process is K ′ : K ′ Represents the value of the filter kernel, σ represents the preset parameter value, Get greater than or equal to The smallest integer, Get 1 and The maximum value in ; The Gaussian filtered image is subjected to color space conversion and normalization processing to obtain a third image to be processed; wherein the normalization processing process is: judging Is it established? If so, let If not, then G″ ij Represents the pixel values of the Gaussian filtered image.
4. The method according to claim 1, wherein In step S5, the process of performing color space inverse conversion processing on the updated second image to be processed to obtain a bright and dark part enhanced image includes: Performing initial adjustment on the updated second image to be processed to obtain a completed image; wherein the process of performing the initial adjustment is: L ′ ij Represents the pixel value of the pixel in the image to be completed; The color space reverse conversion process is performed on the image to be completed to obtain a bright and dark part enhanced image; wherein the process of the color space reverse conversion process is: judging Is it true? If so, then V ij =L ′ ij 3 , if not, then V ij Indicates the pixel value of the pixel in the bright and dark part enhanced image.
5. An X-ray image bright and dark part enhancement system, characterized in that: The system comprises: an initial transformation module, configured to execute S1, perform Gamma transformation, color space conversion, and normalization processing on the first image to be processed to obtain a second image to be processed, and perform Gamma transformation, Gaussian filtering, color space conversion, and normalization processing on the first image to be processed to obtain a third image to be processed; The first acquisition module is used to execute S2, based on the pixel value B of the third image to be processed ij , preset bright adjustment factor h and dark adjustment factor s, respectively obtain the first adjustment variable R and the second adjustment variable X ij ; The process of obtaining the first adjustment variable R is as follows: ij >0.5 is true? If so, then R=4 2 If not, then R = 4s 2 ; Get the second manipulated variable X ij The formula is: X ij =(1-2*B ij )*(1-2*B ij ); i represents the horizontal coordinate of the pixel point in the image, and j represents the vertical coordinate of the pixel point in the image; The first judgment module is used to execute S3 and determine whether R>0 is established. If so, the first update module executes S4; if not, the conversion processing module executes S5; The first updating module is used to execute S4, based on the pixel value B of the third image to be processed ij and the second manipulated variable X ij The pixel value L of the second image to be processed ij Update and set R=R-1, and then go to the first judgment module to execute S3; Among them, the pixel value L of the second image to be processed ij The update process is: Judgment 0≤L ij ≤0.5 is true, if so, then L ij =L ij *(1-X ij )+2*L ij *B ij *X ij ; If not, then L ij =L ij *(1-X ij )+[1-2*(1-L ij )*(1-B ij )]*X ij ; a conversion processing module, configured to execute S5, perform color space inverse conversion processing on the updated second image to be processed, and obtain a bright and dark part enhanced image; In the initial transformation module, the process of performing gamma transformation, color space conversion, and normalization on the first image to be processed to obtain the second image to be processed includes: Perform Gamma transformation on the first image to be processed to obtain a Gamma transformed image; wherein the process of Gamma transformation is: determine V ij >0.04045 is true, if so, then let If not, then V ij G represents the pixel value of the pixel with coordinates (i, j) in the first image to be processed; ij represents the pixel value of the pixel with coordinates (i, j) in the Gamma transformed image; The Gamma transformed image is subjected to color space conversion and normalization processing to obtain a second image to be processed; wherein the normalization processing process is: judging Is it established? If so, let If not, then 6. The system according to claim 5, characterized in that The system further comprises: The first acquisition module is used to acquire an original image before step S1, and perform image denoising and normalization processing on the original image to obtain a first image to be processed.
7. The system according to claim 5, characterized in that The process of performing Gamma transformation, Gaussian filtering, color space conversion, and normalization on the first image to be processed in the initial transformation module to obtain a third image to be processed includes: Perform Gamma transformation on the first image to be processed to obtain a Gamma transformed image; wherein the process of Gamma transformation is: determine V ij >0.04045 is true, if so, then let If not, then V ij G represents the pixel value of the pixel with coordinates (i, j) in the first image to be processed; ij represents the pixel value of the pixel with coordinates (i, j) in the Gamma transformed image; Performing Gaussian filtering on the Gamma transformed image to obtain a Gaussian filtered image; wherein the filter kernel in the Gaussian filtering process is: K ′ Represents the value of the filter kernel, σ represents the preset parameter value, Get greater than or equal to The smallest integer, Get 1 and The maximum value in ; The Gaussian filtered image is subjected to color space conversion and normalization processing to obtain a third image to be processed; wherein the normalization processing process is: judging Is it established? If so, let If not, then G″ ij Represents the pixel values of the Gaussian filtered image.
8. The system according to claim 5, wherein: The conversion processing module includes: The initial adjustment unit is used to perform initial adjustment on the updated second image to be processed to obtain a completed image; wherein the process of performing the initial adjustment is: L ′ ij Represents the pixel value of the pixel in the image to be completed; The conversion processing unit is used to perform color space reverse conversion processing on the image to be completed to obtain a bright and dark part enhanced image; wherein the process of color space reverse conversion processing is: judging Is it true? If so, then V ij =L ′ ij 3 , if not, then V ij Indicates the pixel value of the pixel in the bright and dark part enhanced image.
Citation Information
Patent Citations
Image enhancement methods and apparatus therefor
GB0110748D0