Endoscope image processing method and endoscope
By using high -band light sources in the endoscope and the approximation of the approximate image processing method of mutual color, the problem of insufficient color contrast between different concentrations of the blue carmine chromosome in the blue carmine stains Essence
Patent Information
- Application Number
- CN202411568279.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-11-05
AI Technical Summary
The prior art is difficult to effectively enhance the color contrast between the different concentration areas of indigo carmine dye, especially in the problem of color shift in low concentration areas.
By using the light source with at least 580nm bands in the endoscope for lighting, it is used for lighting, and an image processing method that guides the approximate color is used until the complementary color cumulative error is less than the preset value, which enhances the boundary contrast between different concentration areas.
A more accurate boundary distinguishes different nature areas, enhance the boundaries between the blue carmine staining area, and improve the accuracy of the diagnosis.
Smart Images

Figure CN119055168B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to an endoscope image processing method and an endoscope. Background Art
[0002] With the booming development of endoscopy applications, doctors' demand for high-quality endoscopy imaging is also increasing. In endoscopy application scenarios, especially in the examination, diagnosis and treatment of digestive endoscopy (gastroenteroscopy), dyes are often used for auxiliary exploration. The most widely used dye is indigo carmine. Indigo carmine is a contrasting surface mucosal dye that can be used in the stomach and intestines. It uses gravity to deposit in the depressions on the epithelial surface, outlining the morphology of gastric grooves and innominate grooves of intestinal mucosa, and inferring the scope and gross nature of the lesion. The stronger the boundary contrast of areas containing different concentrations of indigo carmine, the more accurate it can help doctors make observations and diagnoses.
[0003] Usually, under white light or quasi-white light illumination, the area containing indigo carmine in the submucosal layer appears blue-green, and other areas appear orange-red. In the related art, RDI (Red Dichromatic Imaging) technology is used to enhance the color contrast between the submucosal and muscle layers, making the area containing indigo carmine appear dark blue. However, this method will also cause the area with low concentration of indigo carmine to shift to blue, and it cannot solve the problem of enhancing the dyeing contrast between areas with different concentrations.
[0004] Therefore, how to overcome the above-mentioned technical defects is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0005] The purpose of the present application is to provide an endoscope image processing method and an endoscope.
[0006] To achieve the above objectives, the present application provides, in a first aspect, an endoscope image processing method, the method comprising:
[0007] Under the condition that a light source with a wavelength of at least 580nm is used as an illumination light source, a target object injected with indigo carmine dye is photographed to obtain a target image; at least one round of mutual color-guided approximation is performed between a first concentration area and a second concentration area in the target image until the cumulative error of complementary colors in the target image is less than a preset value, thereby obtaining a processing result, wherein the dye concentrations in the first concentration area and the second concentration area are different.
[0008] In one embodiment, performing at least one round of mutual color-guided approximation between a first concentration area and a second concentration area in the target object image includes: when using the first concentration area for color-guided approximation, using the first concentration area as a main guiding area, and using other areas outside the first concentration area as guided areas; when using the second concentration area for color-guided approximation, using the second concentration area as a main guiding area, and using other areas outside the second concentration area as guided areas; and performing color-guided approximation on the guided area using complementary color parameters corresponding to the main guiding area.
[0009] In one embodiment, the color-guided approximation of the guided area using the complementary color parameters corresponding to the main guiding area includes: respectively obtaining a first RGB value of the main guiding area and a second RGB value of the guided area; calculating the complementary color parameters of the main guiding area based on the first RGB value; and guiding approximation of the second RGB value using the complementary color parameters and the guiding approximation parameters corresponding to the guided area to obtain a guided approximation image.
[0010] In one embodiment, the guided approximation of the second RGB value using the complementary color parameters and the guided approximation parameters corresponding to the guided area includes: calculating a first difference between the complementary color parameters and the second RGB value; adjusting the first difference using the guided approximation parameter as an adjustment coefficient; superimposing the adjusted first difference with the second RGB value, and performing grayscale compensation to obtain the guided approximation adjustment image.
[0011] In one embodiment, the guided approximation of the second RGB value using the complementary color parameter and the guided approximation parameter corresponding to the guided area is calculated using the following formula:
[0012] RGB out =RGB in +α rgb ×(RGB ci -RGB in )+β rgb ×L in
[0013] in, RGB out adjusting the RGB values of the image for the guided approximation; RGB ci is the complementary color parameter corresponding to the first RDB value; RGB inis the second RGB value, α rgb Guided approximation parameters, L in is the gray value of the guided area; β rgb Grayscale compensation parameters.
[0014] In one embodiment, the guided approximation of the second RGB value using the complementary color parameters and the guided approximation parameters corresponding to the guided area includes: converting the second RGB value into a first channel value in a preset space for representing a color channel; converting the complementary color parameters into a second channel value in the preset space for representing a color channel; wherein the preset space includes: at least one of HSV space, LAB space, and YUV space; calculating the second difference between the second channel value and the first channel value; and obtaining a guided approximation adjusted image based on the first channel value, the second difference, and the guided approximation parameters.
[0015] In one embodiment, normalizing the first channel value and the second channel value to a range of [0, 1); and obtaining a guided approximation adjusted image based on the first channel value and the second difference value and the guided approximation parameter comprises:
[0016] The guided approximation adjustment image is calculated according to the following formula:
[0017] like H c -H in >0.5 ,but ΔH=1-H c +H in ,Right now H out =H in -c r ×ΔH ,
[0018] And if H out <0 , H out = H out +1 ;
[0019] like H c -H in <0.5 ,but ΔH=H c-H in ,Right now H out =H in +c r ×ΔH ;
[0020] like H in -H c >0.5 ,but ΔH=1-H in +H c ,Right now H out =H in -c r ×ΔH ,
[0021] And if H out >1 , H out = H out -1 ;
[0022] like H in -H c <0.5 ,but ΔH=H in -H c ,Right now H out =H in -c r ×ΔH ;
[0023] H in is the first channel value; H c is the second channel value; c r To guide the approximation parameters, the range is [0,1]; one of the iterations c r The method is c r_n =c 2 r_n -1 , n is the nth iteration,H out To guide the approximation, the channel value of the image used to represent the color channel in the preset space is adjusted. ΔH Approximate data for the intermediate guide.
[0024] In one embodiment, the method for calculating the complementary color cumulative error includes: when the first concentration area is used as the main guiding area, calculating the sum of first errors between each pixel of the main guiding area and the complementary color parameters corresponding to the guided area; when the second concentration area is used as the main guiding area, calculating the sum of second errors between each pixel of the main guiding area and the complementary color parameters corresponding to the guided area; and calculating the complementary color cumulative error based on the first error sum and the second error sum.
[0025] In one embodiment, the first concentration region is a peak concentration region; and the second concentration region is a valley concentration region.
[0026] In a second aspect, the present application provides an endoscope, comprising an illumination unit, an imaging unit and an image processing unit, wherein the illumination unit comprises a light source having at least a wavelength of 580 nm or above; the imaging unit is used to acquire an image of a target object; the image processing unit comprises a memory for storing a computer program; and a processor for implementing the steps of the image processing method described in any one of the first aspects above when executing the computer program stored in the memory.
[0027] In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of image processing described in any embodiment of the first aspect are implemented.
[0028] Compared with the prior art, the image processing scheme provided in the present application proposes a method of utilizing the color contrast between high and low concentration areas based on the characteristics that abnormal tissue mucosa stained with indigo carmine dye appears blue and normal tissue mucosa appears orange-red. By guiding the colors between the high and low concentration areas, the boundary contrast between indigo carmine dyed areas of different concentrations can be enhanced as much as possible, so that areas of different properties can be distinguished through more accurate boundaries. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0030] Figure 1 A flowchart of an endoscope image processing method provided in an embodiment of the present application;
[0031] Figure 2 A flow chart of a method for determining a peak concentration area in an endoscope image processing method provided in an embodiment of the present application;
[0032] Figure 3 A flow chart of a method for determining a complementary color cumulative error in an endoscope image processing method provided in an embodiment of the present application;
[0033] Figure 4 This is a structural block diagram of an endoscope image processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments 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 this field without creative work are within the scope of protection of this application.
[0035] To facilitate understanding of the technical solution, some terms involved in the following content are explained here:
[0036] Endoscope: An endoscope is an optical instrument that consists of a cold light source lens, fiber optic wire, image transmission system, screen display system, etc. It usually enters the human body through natural channels or small incisions. When used, the doctor uses external manipulation to guide the endoscope into the location to be examined, which can directly detect changes in related parts and cooperate with surgical instruments to perform necessary diagnosis and treatment. The quality of endoscope imaging directly affects the doctor's experience, detection accuracy and efficiency, and also marks the development level of endoscope technology.
[0037] Indigo carmine stain: The normal digestive tract mucosa is smooth. When there are minor lesions, such as ulcers and cancer, the surface will change. However, in the early stage, due to the small scope of the lesion, it is difficult to detect under ordinary endoscopy. However, after the stain is sprayed on the mucosa, the indigo carmine cannot precipitate on the smooth surface and is deposited between the grooves of the mucosal folds, forming a sharp contrast with the orange-red mucosa. Under direct vision, continuous lines are formed, showing the subtle concave and convex changes of the mucosa and its three-dimensional structure. If the boundary of the lesion is unclear after spraying indigo carmine, it is mostly an inflammatory reaction; if the boundary is clear, which is what endoscopists often call the "definition line", it is necessary to get close to observe the details of the tissue of the lesion. If there are abnormal morphology of the small pits, attention should be paid. If conditions permit, confocal microendoscopy should be used to carefully observe the cell morphology and cell morphology, and a biopsy should be taken at this lesion site for pathological diagnosis.
[0038] Narrowband imaging: It is an optical imaging technology that uses one or several narrowband spectrum light sources as illumination to enhance the visibility of mucosal blood vessels, lesions, inflammation and other parts. Common narrowband imaging modes include NBI (Narrow Band Imaging), BLI (Blue Laser Imaging), LCI (Linked Color Imaging), etc. Since narrowband imaging only covers part of the visible spectrum or changes the proportion of white light spectrum, the color of the image is significantly different from that of white light imaging.
[0039] See also Figure 1 , Figure 1 A flowchart of an endoscope image processing method provided in an embodiment of the present application, comprising the following steps:
[0040] Step 101: Under the condition that a light source including at least a wavelength of 580 nm or more is used as an illumination light source, a target object injected with indigo carmine dye is photographed to obtain a target object image.
[0041] This step is intended to obtain, by an execution subject suitable for executing the image processing method provided by the present application (e.g., a local server or a cloud server for data processing and analysis), an image of a target object obtained by photographing an object injected with indigo carmine dye under illumination provided by a specific illumination light source, wherein the reflected light after the emitted light of the illumination light source is irradiated on the object injected with indigo carmine dye is passed through a lens and an image sensor to obtain the image of the target object.
[0042] Specifically, the specific lighting source is a light source that contains at least a wavelength of 580 nm or more, because light exceeding 580 nm (e.g., 595-610 nm, 620-640 nm) is more absorbable by the indigo carmine dye than light below 580 nm (520-550 nm). More specifically, the lighting source can also be composed of 5 LEDs, such as a blue-violet light source, a blue light source, a green light source, an amber light source, and a red light source. The 5 LEDs can synthesize white light or other multi-spectrum mixed light in any combination, that is, when the lighting source is a combined light source, it must contain at least one light source in a wavelength of 580 nm or more.
[0043] Step 102: Perform at least one round of mutual color guided approximation between the first concentration area and the second concentration area in the target image until the cumulative error of complementary colors in the target image is less than a preset value, and obtain a processing result. The dye concentrations of the first concentration area and the second concentration area are different. In this embodiment, the first concentration area and the second concentration area can be areas with different dye concentrations in the target image divided into multiple concentration areas according to the dye concentrations. The first concentration area and the second concentration area can be any different concentration areas. For example, the first concentration area can be a peak concentration area, the second concentration area can be a valley concentration area, the first concentration area and the second concentration area can also be other concentration areas, which are not limited in this embodiment.
[0044] In this embodiment, the dye concentration in the first concentration area is greater than the dye concentration in the second concentration area.
[0045] If the injection is indigo carmine, the color of the first concentration area, that is, the area with a higher concentration of the dye, is mainly indigo blue; the color of the second concentration area, that is, the area with a lower concentration of the dye, is mainly red-orange.
[0046] In an optional embodiment, during the process of mutual color guided approximation, higher concentration areas and lower concentration areas can be extracted from the target image respectively, and the color of the lower concentration area can be guided and approximated using the color of the higher concentration area, while the color of the lower concentration area can be guided and approximated using the color of the higher concentration area, until the cumulative error of complementary colors in the target image is less than a preset value, the guided approximation is completed, and the boundary contrast between indigo carmine dyeing areas of different concentrations is enhanced, so that areas of different properties can be distinguished through more accurate boundaries.
[0047] In another optional embodiment, in the process of mutual color guided approximation, a higher concentration area can be first extracted from the target image, and the color of the higher concentration area is used to guide the color of the lower concentration area to obtain a first adjustment image; a lower concentration area is extracted from the first adjustment image, and the color of the lower concentration area is used to guide the color of the higher concentration area to obtain a second adjustment image as a round of mutual color guided approximation. After each round, the complementary color cumulative error in the target image is calculated. When the complementary color cumulative error is greater than a preset value, a higher concentration area is extracted from the second adjustment image, and the next round of mutual color guided approximation is performed until the complementary color cumulative error in the target image is less than a preset value, and the guided approximation is completed to obtain a processing result. The boundary contrast between indigo carmine dyeing areas of different concentrations is enhanced, so that areas of different properties can be distinguished through more accurate boundaries.
[0048] In one embodiment, performing at least one round of mutual color guided approximation between the first concentration region and the second concentration region in the target image comprises:
[0049] When using the first concentration area for color guidance approximation, the first concentration area is used as the main guiding area, and other areas outside the first concentration area are used as guided areas. When using the second concentration area for color guidance approximation, the second concentration area is used as the main guiding area, and other areas outside the second concentration area are used as guided areas. Color guidance approximation is performed on the guided area using the complementary color parameters corresponding to the main guiding area.
[0050] Image processing means are used to segment an area with a higher dye concentration in the target object image as a first concentration area, the first concentration area is used as a main guiding area, and the complementary color parameters corresponding to the main guiding area are used to perform color-guided approximation on other areas (guided areas); similarly, image processing means are used to segment an area with a lower dye concentration in the target object image as a second concentration area, the second concentration area is used as the main guiding area, and the complementary color parameters corresponding to the main guiding area are used to perform color-guided approximation on other areas (guided areas).
[0051] In order to make the boundary contrast between the regions more prominent, in this embodiment, the first concentration region may be a peak concentration region, and the second concentration region may be a valley concentration region.
[0052] One way to obtain the peak concentration area can be found in Figure 2 The flowchart shown includes the following steps:
[0053] Step 201: Determine the RGB value of each pixel based on the target image;
[0054] Step 202: According to the RGB values, pixels having an actual ratio between component B and component R greater than a preset ratio are determined as pixels belonging to the peak concentration;
[0055] Step 203: determine the area where each pixel with peak concentration is located as the peak concentration area.
[0056] That is, if the ratio of the blue channel component B to the red channel component R corresponding to the current pixel value is greater than the preset threshold T H , that is, B / R>T H , the current pixel is considered to be at the peak concentration.
[0057] exist Figure 2 Based on the method of obtaining the peak concentration area shown, in order to further improve the accuracy of the determined peak concentration area, the following steps can also be specifically used in step 201:
[0058] First, the target image is denoised to eliminate the interference of the noise value of a single pixel on the RGB component, and a denoised image is obtained; then, the denoised image is smoothed and filtered (Gaussian filtering, mean filtering, etc.) to obtain a filtered image; finally, based on the filtered image, the ratio of B to R corresponding to the current pixel position is calculated, that is, B / R>T H , the current pixel is considered to be at the peak concentration.
[0059] One way to obtain the valley concentration area can be:
[0060] If the ratio of the blue channel component B to the red channel component R corresponding to the current pixel value is less than the preset threshold T L , that is, B / R <T L , the current pixel is considered to belong to the valley concentration.
[0061] On the basis of this method, in order to further improve the accuracy of the determined valley concentration area, the adjusted image can be first subjected to denoising to eliminate the interference of the noise value of a single pixel on the RGB component to obtain a denoised image; then, the denoised image is subjected to smoothing filtering (Gaussian filtering, mean filtering, etc.) to obtain a filtered image; finally, based on the filtered image, the ratio of B to R corresponding to the current pixel position is counted, that is, B / R<T H , the current pixel is considered to belong to the valley concentration.
[0062] In one embodiment, using the complementary color parameters corresponding to the main guiding area to perform color guided approximation on the guided area includes: respectively obtaining a first RGB value of the main guiding area and a second RGB value of the guided area; calculating the complementary color parameters of the main guiding area based on the first RGB value; and using the complementary color parameters and the guided approximation parameters corresponding to the guided area to perform guided approximation on the second RGB value.
[0063] When at least one round of mutual color guidance approximation is performed between the first concentration area and the second concentration area, both the first concentration area and the second concentration area can be used as the main guidance area. In this embodiment, the first concentration area is a peak concentration area and the second concentration area is a valley concentration area. It should be noted that the first concentration area and the second concentration area can be non-peak concentration areas and non-valley concentration areas, and other concentrations are also applicable in this embodiment.
[0064] The peak concentration area refers to the area with the highest dye concentration in the target image determined by image processing. If the injection is indigo carmine, the color of this area is mainly indigo. The average RGB value corresponding to the peak concentration area can be recorded as (R h ,G h ,B h ), the first complementary color parameter of the pixel numbered 1 can be recorded as (R c1 ,G c1 ,B c1 ), and the first complementary color parameters of the remaining numbered pixels are deduced in the same way; the low-concentration area refers to an area in the target image that is determined by image processing means to have a low dye concentration (for example, the concentration is lower than a first preset concentration, and the first preset concentration is used as a critical value to define whether the concentration is low, which can be obtained by relevant technical experts based on historical experience or determined with the help of other tools with relevant capabilities). If the injection is indigo carmine, the color of this area is mainly red-orange; the purpose of guided approximation is to make the color of the low-concentration area as close as possible to the first complementary color parameter.
[0065] Specifically, the first complementary color parameter may be calculated as follows:
[0066] R c1 =255-R h ,G c1 =255-G h ,B c1 =255-B h ;in, 255 It is the maximum saturation value of 8-bit width image.
[0067] The valley concentration area refers to the area with the lowest dye concentration determined by image processing. If the injection is indigo carmine, the color of this area is mainly red-orange. The average RGB value corresponding to the valley concentration area can be recorded as (R l ,G l ,B l ), the second complementary color parameter of the pixel numbered 2 can be recorded as (R c2 ,G c2 ,B c2 ), and the second complementary color parameters of the remaining numbered pixels are deduced in the same way; the high-concentration area refers to an area determined by image processing means to have a high dye concentration in an adjusted image (for example, the concentration is higher than a second preset concentration, and the second preset concentration is used as a critical value to define whether the concentration is high, which can be obtained by relevant technical experts based on historical experience or determined with the help of other tools with relevant capabilities. The second preset concentration may be the same as or different from the first preset concentration. In different cases, the second preset concentration is usually greater than the first preset concentration). If the injection is indigo carmine, the color of this area is mainly indigo blue; the purpose of guided approximation is to make the color of the high-concentration area as close to the second complementary color as possible.
[0068] Specifically, the second complementary color parameter is calculated as follows:
[0069] R c2 = 255 - R l , G c2 = 255 - G l , B c2 = 255 - B l ;in, 255 It is the maximum saturation value of 8-bit width image.
[0070] After respectively obtaining the first complementary color parameters corresponding to the peak density region and the second complementary color parameters corresponding to the valley density region, in the process of guided approximation, the complementary color parameters corresponding to the main guiding region are used to perform color guided approximation on the guided region.
[0071] Calculate the first difference between the complementary color parameter and the second RGB value; use the guided approximation parameter as an adjustment coefficient to adjust the first difference; superimpose the adjusted first difference with the second RGB value, and perform grayscale compensation to obtain the guided approximation adjustment image. In the process of guided approximation, the following calculation formula can be referred to:
[0072] RGB out =RGB in +α rgb ×(RGB ci - RGB in )+β rgb ×L in
[0073] in, RGB out Adjust the RGB values of the image to guide the approximation; RGB ci is the complementary color parameter corresponding to the first RDB value; RGB in is the second RGB value, α rgb Guided approximation parameters, L in is the gray value of the guided area; β rgb Grayscale compensation parameters.
[0074] Exemplarily, the first complementary color parameter corresponding to the peak concentration area is used to guide and approximate the color of other areas, that is, the low-concentration dyeing area, so that it is close to the hue of the first complementary color. For details, see the following calculation formula:
[0075] set up R lin , G lin , B lin is the RGB value of the pixel corresponding to the low-density area, L lin is the gray value of the pixel corresponding to the low-density area.
[0076] R lout =R lin +α lr ×(R c1 - R lin )+β lr ×L lin ;
[0077] G lout =Glin +α lg ×(G c1 - G lin )+β lg ×L lin ;
[0078] B lout =B lin +α lb ×(B c1 - B lin )+β lb ×L lin ;
[0079] in, α lr , α lg , α lb are the guided approximation parameters corresponding to the red channel, green channel, and blue channel in the low-concentration area, with a value range of [0,1], β lr , β lg , β lb They are the grayscale compensation parameters corresponding to the red channel, green channel and blue channel in the low-density area, which are used to keep the brightness value stable; R lout , G lout , B lout The RGB values of the low-concentration area after the peak concentration area is guided and approximated to the low-concentration area; R c1 , G c1 , B c1 They are the first complementary color parameters corresponding to the red channel, green channel, and blue channel in the peak concentration area respectively.
[0080] Similarly, the second complementary color parameters corresponding to the valley concentration area are used to guide and approximate the colors of other areas, that is, the high-concentration dyeing areas, so that they are close to the hue of the second complementary color. For details, please refer to the following calculation formula:
[0081] set up R hin ,G hin , B hin is the RGB value of the pixel corresponding to the high-density area, L hin is the gray value of the pixel corresponding to the high-density area.
[0082] R hout =R hin +α hr ×(R c2 - R hin )+β hr ×L hin ;
[0083] G hout =G hin +α hg ×(G c2 - G hin )+β hg ×L hin ;
[0084] B hout =B lin +α hb ×(B c2 - B hin )+β hb ×L hin ;
[0085] in, α hr , α hg , α hb are the guided approximation parameters corresponding to the red channel, green channel, and blue channel in the high-concentration area, with a value range of [0,1], β hr , β hg , β hbThey are the grayscale compensation parameters corresponding to the red channel, green channel and blue channel in the high-density area, which are used to keep the brightness value stable; R hout , G hout , B hout are the RGB values of the high-concentration area after the high-concentration area guides the low-concentration area; R c2 , G c2 , B c2 They are the second complementary color parameters corresponding to the red channel, green channel, and blue channel in the valley concentration area.
[0086] The image processing scheme provided in the present application, based on the characteristics that abnormal tissue mucosa stained with indigo carmine dye appears blue and normal tissue mucosa appears orange-red, proposes a method of utilizing the color contrast between high and low concentration areas to guide each other through the colors between high and low concentration areas, so as to enhance the boundary contrast between indigo carmine dyeing areas of different concentrations as much as possible, so as to distinguish areas of different properties through more accurate boundaries.
[0087] In the above embodiments, the specific implementation schemes for using complementary colors to guide and approximate colors are all given by taking RGB values in the RGB space as an example. It should be noted that the above purpose can be achieved not only in the RGB space, but also in other color spaces. For example, how to determine the peak concentration area is used.
[0088] The target object image originally in the RBG space can be first converted to a preset space to obtain a first converted image, and the preset space can include: any one of: HSV space, LAB space, and YUV space. Then, the peak concentration area is determined according to the unique characteristic parameters of the first converted image in the preset space, and the unique characteristic parameters include: hue parameter H and saturation parameter S corresponding to the HSV space, red-green axis parameter A and yellow-blue axis parameter B corresponding to the LAB space, and chromaticity blue parameter U and chromaticity red parameter V corresponding to the YUV space.
[0089] In LAB space, A and B represent two color parameters, which are a way to describe color. LAB space is a standard model used in digital image processing and color science. LAB space consists of three components:
[0090] L (lightness): Indicates the brightness of the color, ranging from 0 (black) to 100 (white);
[0091] a (red-green axis): represents the offset of the color between red and green. Positive values represent red (+a), negative values represent green (-a), usually between -128 and 127. When the value of a increases, the color looks more red, and when the value of a decreases, the color looks more green;
[0092] b (yellow-blue axis): Indicates the shift of color between yellow and blue. Positive values represent yellow (+b) and negative values represent blue (-b), usually between -128 and 127. When the value of b increases, the color looks more yellow, and when the value of b decreases, the color looks more blue.
[0093] In the YUV color space, U and V are two parameters used to describe color information, usually separated from Y (brightness). YUV is widely used in video compression, transmission, and processing, especially in television and video signals.
[0094] Composition of YUV space:
[0095] Y (brightness or brightness): represents the brightness information of the image, usually ranging from 0 to 255 (in 8-bit color depth). The Y component contains grayscale information and affects the brightness of the image.
[0096] U (Chroma Blue): Indicates the difference between blue and brightness. It is the difference between the blue component (B) and the brightness component (Y), that is, U = B – Y; in the 8-bit color depth, the value of U is usually between 0 and 255; when the value of U increases, it means that the color tends to be blue, and when the value decreases, it means that the color tends to be yellow.
[0097] V (chromaticity red): represents the difference between red and brightness. It is the difference between the red component (R) and the brightness component (Y), that is, V = R – Y; in the 8-bit color depth, the value of V is usually between 0 and 255; when the value of V increases, it means that the color tends to be red, and when the value decreases, it means that the color tends to be green.
[0098] The YUV space is designed so that the Y component (brightness) is independent of the U and V components (chrominance). This allows the brightness information to be prioritized when transmitting and processing video, and the chrominance information is usually downsampled in video compression to reduce the amount of data while retaining higher brightness details.
[0099] The using the complementary color parameter and the corresponding guided approximation parameter to guide the second RGB value comprises:
[0100] Convert the second RGB value into a first channel value for representing a color channel in a preset space;
[0101] Convert the complementary color parameter into a second channel value for characterizing a color channel in the preset space; wherein the preset space includes: at least one of an HSV space, a LAB space, and a YUV space;
[0102] calculating a second difference between the second channel value and the first channel value;
[0103] A guided approximation adjusted image is obtained based on the first channel value, the second difference value and the guided approximation parameter.
[0104] Specifically, the guided approximation adjustment image may be calculated according to the following formula:
[0105] like H c -H in >0.5 ,but ΔH=1-H c +H in ,Right now H out =H in -c r ×ΔH ,
[0106] And if H out <0 , H out = H out +1 ;
[0107] like H c -H in <0.5 ,but ΔH=H c -H in ,Right now H out =H in +c r ×ΔH ;
[0108] like H in -H c >0.5 ,but ΔH=1-H in +H c ,Right nowH out =H in -c r ×ΔH ,
[0109] And if H out >1 , H out = H out -1 ;
[0110] like H in -H c <0.5 ,but ΔH=H in -H c ,Right now H out =H in -c r ×ΔH ;
[0111] H in is the first channel value; H c is the second channel value; c r To guide the approximation parameters, the range is [0,1]; one of the iterations c r The method is c r_n =c 2 r_n-1 , n is the nth iteration, H out To guide the approximation, the channel value of the image used to represent the color channel in the preset space is adjusted. ΔH Approximate data for the intermediate guide.
[0112] When at least one round of mutual color guidance approximation is performed between the first concentration area and the second concentration area, both the first concentration area and the second concentration area can be used as the main guidance area. In this embodiment, the first concentration area is a peak concentration area and the second concentration area is a valley concentration area. It should be noted that the first concentration area and the second concentration area can be non-peak concentration areas and non-valley concentration areas, and other concentrations are also applicable in this embodiment.
[0113] Taking the HSV space as an example, the peak concentration can be determined by using the threshold conditions of hue H and saturation S; taking the LAB space as an example, the peak concentration can be determined by using the relationship between hues a, b and the preset threshold; taking the YUV space as an example, the peak concentration can be determined by using the relationship between color channels U, V and the preset threshold.
[0114] Exemplarily, the first complementary color parameter corresponding to the peak concentration area is used to guide and approximate the color of other areas, that is, the low-concentration dyeing area, so that it is close to the hue of the first complementary color. For details, see the following calculation formula:
[0115] set up H lin Convert the RGB value of the pixel corresponding to the low-density area to the value of the corresponding H hue channel in the HSV space. H c1 Convert the RGB value of the first complementary color parameter to the corresponding H hue channel in the HSV space, and normalize the H hue channel to a value of [0,1); H lout To guide the approximation, adjust the image in the HSV space for the value corresponding to the H hue channel, ΔH Approximate data for the intermediate guide.
[0116] like H c1 -H lin >0.5 ,but ΔH=1-H c1 +H lin ,Right now H lout =H lin -c lr ×ΔH ,
[0117] And if H lout <0 , H lout = H lout +1 ;
[0118] like H c1 -H lin <0.5 ,but ΔH=H c1 -H lin ,Right now H lout=H lin +c lr ×ΔH ,
[0119] like H lin -H c1 >0.5 ,but ΔH=1-H lin +H c1 ,Right now H lout =H lin -c lr ×ΔH ;
[0120] And if H lout >1 , H lout = H lout -1 ;
[0121] like H lin -H c1 <0.5 ,but ΔH=H lin -H c1 ,Right now H lout =H lin -c lr ×ΔH ;
[0122] γ lr is the guided approximation parameter, with a range of [0,1]; one of the iterations γ r The method is c r_n =c 2 r_n-1 , n is the nth iteration, that is, the parameter value this time is the square of the previous parameter value.
[0123] Similarly, the second complementary color parameters corresponding to the valley concentration area are used to guide and approximate the colors of other areas, that is, the high-concentration dyeing areas, so that they are close to the hue of the second complementary color. For details, please refer to the following calculation formula:
[0124] set up H hinConvert the RGB value of the pixel corresponding to the low-density area to the value of the corresponding H hue channel in the HSV space. H c1 Convert the RGB value of the first complementary color parameter to the corresponding H hue channel in the HSV space, and normalize the H hue channel to a value of [0,1); H hout To guide the approximation, adjust the image in the HSV space for the value corresponding to the H hue channel, ΔH Approximate data for the intermediate guide.
[0125] like H c2 -H hin >0.5 ,but ΔH=1-H c2 +H hin ,Right now H hout =H hin -c hr ×ΔH ,
[0126] And if H hout <0 , H hout = H hout +1 ;
[0127] like H c2 -H hin <0.5 ,but ΔH=H c2 -H hin ,Right now H hout =H hin +c hr ×ΔH ;
[0128] like H hin -H c2 >0.5 ,but ΔH=1-H hin +H c2 ,Right now H hout =H hin -c hr ×ΔH ,
[0129] And if H hout >1 , H hout = H hout -1 ;
[0130] like H hin -H c2 <0.5 ,but ΔH=H hin -H c2 ,Right now H hout =H hin -c hr ×ΔH ;
[0131] γ hr To guide the approximation parameters, the range is [0,1]; one of the iterations c r The method is c r_n =c 2 r_n-1 , n is the nth iteration, that is, the parameter value this time is the square of the previous parameter value.
[0132] In order to deepen the understanding of how to calculate the complementary color cumulative error and determine the target image, this embodiment also uses Figure 3 A specific implementation method is provided. For example, the first complementary color parameter corresponding to the peak concentration area is used to guide and approximate the color of other areas, that is, the low-concentration dyeing area, so that it is close to the hue of the first complementary color; the second complementary color parameter corresponding to the valley concentration area is used to guide and approximate the color of other areas, that is, the high-concentration dyeing area, so that it is close to the hue of the second complementary color.
[0133] Calculating the complementary color cumulative error may include the following steps:
[0134] Step 301: When the first concentration area is used as the main guiding area, the sum of the first errors between each pixel in the main guiding area and the complementary color parameters corresponding to the guided area is calculated. That is, the sum of the first errors between each pixel in the high concentration area and the second complementary color is determined ( DE h ).
[0135] Step 302: When the second concentration area is used as the main guiding area, the sum of the second errors between each pixel in the main guiding area and the complementary color parameters corresponding to the guided area is calculated; that is, the sum of the second errors between each pixel in the low concentration area and the first complementary color is determined ( DE l ).
[0136] One specific way to calculate the cumulative error is:
[0137]
[0138] in, a c2 、b c2 , is the component representing the hue corresponding to the conversion of the second complementary color parameter from the RGB space to the Lab space; a i 、b i The component representing the hue of the i-th pixel in the high-density area converted from the RGB space to the Lab space; a c1 、b c1 The first complementary color parameter is converted from the RGB space to the Lab space corresponding to the component representing the hue; a j 、b j It is the component representing the hue of the j-th pixel in the low-concentration area converted from the RGB space to the Lab space.
[0139] Another specific way to calculate the cumulative error is:
[0140]
[0141] in, R c2 , G c2 , B c2 The second complementary color parameters corresponding to the red channel, green channel and blue channel in the valley concentration area are R c1 , G c1 , B c1 are the second complementary color parameters corresponding to the red channel, green channel and blue channel in the peak concentration area respectively; R i , G i , Bi are the RGB values of the i-th pixel in the high-density area, R j , G j , B j are the RGB values of the jth pixel in the low-concentration area; N is the number of pixels in the high-concentration area, and M is the number of pixels in the low-concentration area.
[0142] Step 303: Calculate the complementary color cumulative error according to the first error sum and the second error sum.
[0143] ΔE=ΔE h +ΔE l , Assume the first preset T1, that is, when ΔE<T1 When , the processing is considered complete. A second threshold can also be added T2 and the third threshold T3, When ΔE<T1, and DE h <T1,ΔE l <T1 , the processing is considered complete.
[0144] Because the situation is complicated, it is impossible to list them one by one for explanation. Those skilled in the art should be aware that there may be many examples based on the basic method principles provided by this application combined with actual conditions, and all of them should be within the scope of protection of this application without sufficient creative work.
[0145] See below Figure 4 , Figure 4 This is a structural block diagram of an image processing device 400 provided in an embodiment of the present application. This embodiment exists as a device embodiment corresponding to the above method embodiment. The image processing device 400 may include:
[0146] The target image acquisition unit 401 is configured to obtain a target image by photographing the target injected with indigo carmine dye under the condition that a light source having at least a wavelength of 580 nm is used as an illumination light source;
[0147] A guided approximation unit 402 is configured to perform at least one round of mutual color guided approximation between a first concentration region and a second concentration region in the target object image until a complementary color cumulative error in the target object image is less than a preset value, and obtain a processing result, wherein the first concentration region and the second concentration region have different dye concentrations;
[0148] This embodiment exists as an apparatus embodiment corresponding to the above method embodiment. Compared with the prior art, the image processing apparatus provided in this embodiment, based on the characteristics that abnormal tissue mucosa stained by indigo carmine dye is blue and normal tissue mucosa is orange-red, proposes a method of using the color contrast between high and low concentration areas to guide the colors between high and low concentration areas to enhance the boundary contrast between indigo carmine dyeing areas of different concentrations as much as possible, so as to distinguish areas of different properties through more accurate boundaries.
[0149] Based on the above embodiments, the present application also provides an endoscope, characterized in that it includes a lighting unit, an imaging unit and an image processing unit, wherein the lighting unit includes a light source having at least a wavelength of 580nm or above; the image acquisition unit is used to acquire an image of a target object. The image processing unit may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiments can be implemented. Of course, the electronic device may also include various necessary network interfaces, power supplies and other components.
[0150] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by an execution terminal or a processor, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0151] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0152] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0153] Specific examples are used herein to illustrate the principles and implementation methods of the present application, and the description of the above embodiments is only used to help understand the method and core ideas of the present application. For ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0154] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or equipment including the elements.
Claims
1. An endoscope, characterized in that: The device comprises an illumination unit, an imaging unit and an image processing unit, wherein the illumination unit comprises a light source having a wavelength of at least 580 nm; the imaging unit is used to photograph a target object injected with indigo carmine dye under the condition that the illumination unit provides an illumination light source to obtain an image of the target object; The image processing unit comprises a memory for storing a computer program; A processor, configured to implement an endoscope image processing method when executing a computer program stored in the memory, the image processing method comprising: Performing at least one round of mutual color guided approximation between a first concentration region and a second concentration region in the target object image until a complementary color cumulative error in the target object image is less than a preset value, thereby obtaining a processing result, wherein the first concentration region and the second concentration region have different dye concentrations; The performing at least one round of mutual color guided approximation between the first concentration area and the second concentration area in the target image comprises: When the first concentration area is used for color guided approximation, the first concentration area is used as a main guiding area, and other areas outside the first concentration area are used as guided areas; when the second concentration area is used for color guided approximation, the second concentration area is used as a main guiding area, and other areas outside the second concentration area are used as guided areas; Using the complementary color parameters corresponding to the main guiding area to perform color guiding approximation on the guided area; The method of using the complementary color parameters corresponding to the main guiding area to perform color guiding approximation on the guided area comprises: Respectively obtaining a first RGB value of the main guide area and a second RGB value of the guided area; Calculate the complementary color parameter of the main guide area based on the first RGB value; Performing guided approximation on the second RGB value using the complementary color parameter and the guided approximation parameter corresponding to the guided area to obtain a guided approximation adjusted image; The guiding approximation of the second RGB value by using the complementary color parameter and the guiding approximation parameter corresponding to the guided area comprises: Calculating a first difference between the complementary color parameter and the second RGB value; Using the guided approximation parameter as an adjustment coefficient to adjust the first difference; Superimposing the adjusted first difference value and the second RGB value, and performing grayscale compensation to obtain the guided approximation adjustment image; The calculation method of the complementary color cumulative error includes: When the first concentration area is used as the main guiding area, a sum of first errors between complementary color parameters corresponding to each pixel in the main guiding area and the guided area is calculated; When the second concentration area is used as the main guiding area, the sum of second errors between the complementary color parameters corresponding to each pixel in the main guiding area and the guided area is calculated; The complementary color cumulative error is calculated according to the sum of the first errors and the sum of the second errors.
2. The endoscope according to claim 1, wherein: The guided approximation of the second RGB value using the complementary color parameter and the guided approximation parameter corresponding to the guided area is calculated using the following formula: RGB out =RGB in +α rgb ×(RGB ci -RGB in )+β rgb ×L in in, RGB out adjusting the RGB values of the image for the guided approximation; RGB ci is the complementary color parameter corresponding to the first RGB value; RGB in is the second RGB value, α rgb Guided approximation parameters, L in is the gray value of the guided area; β rgb Grayscale compensation parameters.
3. The endoscope according to claim 1, wherein: The guiding approximation of the second RGB value by using the complementary color parameter and the guiding approximation parameter corresponding to the guided area comprises: Convert the second RGB value into a first channel value for representing a color channel in a preset space; Convert the complementary color parameter into a second channel value for characterizing a color channel in the preset space; wherein the preset space includes: at least one of an HSV space, a LAB space, and a YUV space; calculating a second difference between the second channel value and the first channel value; A guided approximation adjusted image is obtained based on the first channel value, the second difference value and the guided approximation parameter.
4. The endoscope according to claim 3, characterized in that Normalize the first channel value and the second channel value to the range of [0, 1); Obtaining a guided approximation adjusted image based on the first channel value, the second difference value and the guided approximation parameter comprises: The guided approximation adjustment image is calculated according to the following formula: like H c -H in >0.5 ,but ΔH=1-H c +H in ,Right now H out =H in -γ r ×ΔH , And if H out <0 , H out = H out +1 ; like H c -H in <0.5 ,but ΔH=H c -H in ,Right now H out =H in +γ r ×ΔH ; like H in -H c >0.5 ,but ΔH=1-H in +H c ,Right now H out =H in -γ r ×ΔH , And if H out >1 , H out = H out -1 ; like H in -H c <0.5 ,but ΔH=H in -H c ,Right now H out =H in -γ r ×ΔH ; H in is the first channel value; H c is the second channel value; γ r To guide the approximation parameters, the range is [0,1]; one of the iterations γ r The method is γ r_n =γ 2 r_n-1 , n is the nth iteration, H out To guide the approximation, the channel value of the image used to represent the color channel in the preset space is adjusted. ΔH Approximate data for the intermediate guide.
5. The endoscope according to any one of claims 1 to 4, characterized in that: The first concentration region is a peak concentration region; the second concentration region is a valley concentration region.
Citation Information
Patent Citations
Image offset processing method and mobile terminal
CN108038889A
SONY-RGBW array color reconstruction method based on residual errors and high-frequency replacement
CN112104847A