Endoscope image color adjusting method
Technical Field
The invention relates to the technical field of photography and video shooting, in particular to an endoscope image color adjusting method.
Background
The problem of strong light is often encountered in the shooting process of the camera, and because the installation position or the shooting angle of the camera cannot be flexibly selected, the problem of solving or processing the picture brightness is an unavoidable problem.
For the existing shooting technology, when a picture is shot, the exposure degree of a lens is usually adjusted to balance the shadow and the white light of the picture, but the exposure adjusting mode can directly affect the whole picture, so that the problem of over exposure or over darkness of a local part of the picture is caused, and the color and brightness balance of the images in different color gamuts can not be realized.
Disclosure of Invention
Technical problem to be solved
Aiming at the defects of the prior art, the invention provides an endoscope image color adjusting method which has the advantages of not influencing the picture, realizing the image color brightness balance of different color gamuts and the like, and solves the problems that the whole picture is influenced, so that the local part of the picture is over-exposed or over-shaded, and the image color brightness balance of different color gamuts cannot be realized.
(II) technical scheme
In order to realize the purpose of realizing the image color brightness balance without influencing the picture and realizing different color gamuts, the invention provides the following technical scheme: an endoscopic image color adjustment method comprising the processes of:
s1, preparing, namely, installing all the tools and preparations before shooting, and placing and opening auxiliary tools such as lamplight and the like;
s2, obtaining a first color coordinate (a1, b1 and ci) of a certain pixel point in the target image, wherein r1 is an original red coordinate controlled by the current pixel point in color, b1 is an original green coordinate of the current pixel point in a color space, c1 is an original blue coordinate of the current pixel point in the color space, the r1 is a real number between 0 and 1, h belongs to [0 DEG, 360 DEG ], S1, l1 belongs to [0,1 ];
s3, image acquisition, wherein the current picture is shot through a CMOS image sensor, n pictures are required to be shot within t, wherein the time of t is extremely short, so that the obtained n pictures are extremely similar and can be processed as the same picture, and the n pictures are shot under the conditions of different exposure degrees;
s4, arranging the pictures, washing out all the shot pictures for air drying, and then putting the pictures for later use;
s5, primary screening, namely placing all photos under light for preselection, and primarily screening some defective photos;
s6, screening the shot n pictures, removing m pictures with blurred and distorted pictures, screening three pictures with strong exposure intensity, balance and weak exposure intensity from the n-m pictures, marking the three pictures as a, b and c, and processing the three pictures as follows;
s7, synthesizing images, selecting partial images with moderate brightness in abc pictures, taking parts with balanced exposure and parts with best color expression, and splicing the parts into a complete image;
s8, preparing display, namely placing tools for display, and hanging the screened pictures on the tools;
and S9, displaying the image, importing the spliced image into a display screen storage device, and displaying the spliced image as a shooting result when the program is called.
Preferably, the coordinates in S3 are converted into first HSL color coordinates (d1, e1, f1), d1 is the first hue angle of the current pixel point, e1 is the first saturation of the current pixel point, and f1 is the first brightness of the current pixel point.
Preferably, the first saturation of the current pixel point is dynamically adjusted to obtain a second saturation e2 of the current pixel point, and a second HSL color coordinate (d2, e2, f2) is obtained at the same time. And d2 is the second hue angle of the current pixel, and f2 is the second brightness of the current pixel.
Preferably, the second HSL color coordinates (d2, e2, f2) are converted into second color coordinates (a2, b2, c2), and color space conversion is performed, so as to complete dynamic color adjustment on the current pixel point.
Preferably, r2 is the original red coordinate of the current pixel point in the color, b2 is the original green coordinate of the current pixel point in the color space, and c2 is the original blue coordinate of the current pixel point in the color space, and all the above are real numbers between 0 and 1.
Preferably, the red coordinate r1 is the minimum value of min, and is the minimum value of three values of the green coordinate b1 and the blue coordinate b 1.
Preferably, the red pixel value of the target image is R, the green pixel value of the target image is G, and the blue pixel value of the target image is B.
Preferably, the numerical values of S4 are sorted so that a formula can be derived, the numerical values of S7 are sorted, data is recorded, and then a formula is derived.
(III) advantageous effects
Compared with the prior art, the invention provides an endoscope image color adjusting method, which has the following beneficial effects:
the wide dynamic color brightness adjusting method for the image comprises the steps of shooting a plurality of images on a certain picture, splicing different images, and then utilizing an endoscope, so that the optimal parts under different exposure degrees are combined in one image.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention aims to solve the problem of unbalanced picture color and brightness caused by exposure adjustment of foreground color and background color of a shot picture, and provides an endoscope image color adjustment method.
The method mainly comprises the following processes:
s1, preparing, installing all the tools and preparations before shooting, and placing and opening auxiliary tools such as endoscopes and lamplight;
s2, obtaining a first color coordinate (a1, b1 and ci) of a certain pixel point in the target image, wherein r1 is an original red coordinate controlled by the current pixel point in color, b1 is an original green coordinate of the current pixel point in a color space, c1 is an original blue coordinate of the current pixel point in the color space, the r1 is a real number between 0 and 1, h belongs to [0 DEG, 360 DEG ], S1, l1 belongs to [0,1 ];
s3, image acquisition, wherein the current picture is shot through a CMOS image sensor, n pictures are required to be shot within t, wherein the time of t is extremely short, so that the obtained n pictures are extremely similar and can be processed as the same picture, and the n pictures are shot under the conditions of different exposure degrees;
s4, arranging the pictures, washing out all the shot pictures for air drying, and then putting the pictures for later use;
s5, primary screening, namely placing all photos under light for preselection, and primarily screening some defective photos;
s6, screening the shot n pictures, removing m pictures with blurred and distorted pictures, screening three pictures with strong exposure intensity, balance and weak exposure intensity from the n-m pictures, marking the three pictures as a, b and c, and processing the three pictures as follows;
s7, synthesizing images, selecting partial images with moderate brightness in abc pictures, taking parts with balanced exposure and parts with best color expression, and splicing the parts into a complete image;
s8, preparing display, namely placing tools for display, and hanging the screened pictures on the tools;
s9, displaying the image, importing the spliced image into a display screen storage device, and displaying the spliced image as a shooting result when a program is called;
the coordinates in S3 are converted into first HSL color coordinates (d1, e1, f1), d1 is the first hue angle of the current pixel point, e1 is the first saturation of the current pixel point, and f1 is the first brightness of the current pixel point;
dynamically adjusting the first saturation of the current pixel point to obtain a second saturation e2 of the current pixel point, and simultaneously obtaining a second HSL color coordinate (d2, e2 and f 2);
wherein d2 is the second hue angle of the current pixel, and f2 is the second brightness of the current pixel;
converting the second HSL color coordinates (d2, e2, f2) into second color coordinates (a2, b2, c2), and performing color space conversion to complete dynamic color adjustment on the current pixel point;
wherein r2 is the original red coordinate of the current pixel point in the color, b2 is the original green coordinate of the current pixel point in the color space, c2 is the original blue coordinate of the current pixel point in the color space, and the above are real numbers between 0 and 1;
the red coordinate r1 is the maximum value of max and is the largest of three values, green coordinate b1 and blue coordinate b 1;
the red coordinate r1 is the minimum value of min, and is the minimum value of three values, namely a green coordinate b1 and a blue coordinate b 1;
the red pixel value of the target image is R, the green pixel value of the target image is G, and the blue pixel value of the target image is B;
the numerical values of S4 are collated so that a formula can be derived, the numerical values of S7 are collated, data is recorded, and then a formula is derived.
The first embodiment is as follows: the invention aims to solve the problem of unbalanced picture color and brightness caused by exposure adjustment of foreground color and background color of a shot picture, and provides an endoscope image color adjustment method.
The method mainly comprises the following processes:
s1, preparing, installing all the tools and preparations before shooting, and placing and opening auxiliary tools such as endoscopes and lamplight;
s2, obtaining a first color coordinate (a1, b1 and ci) of a certain pixel point in the target image, wherein r1 is an original red coordinate controlled by the current pixel point in color, b1 is an original green coordinate of the current pixel point in a color space, c1 is an original blue coordinate of the current pixel point in the color space, and the real number is 0.1, h belongs to [0 DEG, 360 DEG ], S1, l1 belongs to [0,1 ];
s3, image acquisition, namely shooting a current picture through a CMOS image sensor, wherein 10 pictures are required to be shot within 5S of time t, so that the obtained 10 pictures are extremely similar and can be processed as the same picture, and the 10 pictures are shot under the conditions of different exposure degrees;
s4, arranging the pictures, washing out all the shot pictures for air drying, and then putting the pictures for later use;
s5, primary screening, namely placing all photos under light for preselection, and primarily screening some defective photos;
s6, screening 10 shot pictures, removing 3 pictures with blurred and distorted pictures, screening three pictures with strong exposure intensity, balance and weak exposure intensity, marked as a, b and c, and processing the pictures as follows;
s7, synthesizing images, selecting partial images with moderate brightness in abc pictures, taking parts with balanced exposure and parts with best color expression, and splicing the parts into a complete image;
s8, preparing display, namely placing tools for display, and hanging the screened pictures on the tools;
s9, displaying the image, importing the spliced image into a display screen storage device, and displaying the spliced image as a shooting result when a program is called;
the coordinates in S3 are converted into first HSL color coordinates (d1, e1, f1), d1 is the first hue angle of the current pixel point, e1 is the first saturation of the current pixel point, and f1 is the first brightness of the current pixel point;
dynamically adjusting the first saturation of the current pixel point to obtain a second saturation e2 of the current pixel point, and simultaneously obtaining a second HSL color coordinate (d2, e2 and f 2);
wherein d2 is the second hue angle of the current pixel, and f2 is the second brightness of the current pixel;
converting the second HSL color coordinates (d2, e2, f2) into second color coordinates (a2, b2, c2), and performing color space conversion to complete dynamic color adjustment on the current pixel point;
wherein r2 is the original red coordinate of the current pixel point in the color, b2 is the original green coordinate of the current pixel point in the color space, c2 is the original blue coordinate of the current pixel point in the color space, and the real number is 0.1;
the red coordinate r1 is the maximum value of max and is the largest of three values, green coordinate b1 and blue coordinate b 1;
the red coordinate r1 is the minimum value of min, and is the minimum value of three values, namely a green coordinate b1 and a blue coordinate b 1;
the red pixel value of the target image is R, the green pixel value of the target image is G, and the blue pixel value of the target image is B;
the numerical values of S4 are collated so that a formula can be derived, the numerical values of S7 are collated, data is recorded, and then a formula is derived.
Example two: the method mainly comprises the following processes:
s1, preparing, installing all the tools and preparations before shooting, and placing and opening auxiliary tools such as endoscopes and lamplight;
s2, obtaining a first color coordinate (a1, b1 and ci) of a certain pixel point in the target image, wherein r1 is an original red coordinate controlled by the current pixel point in color, b1 is an original green coordinate of the current pixel point in a color space, c1 is an original blue coordinate of the current pixel point in the color space, and the real number range is 0.5, h belongs to [0 DEG, 360 DEG ], S1, l1 belongs to [0,1 ];
s3, image acquisition, wherein a current picture is shot through a CMOS image sensor, 20 pictures are required to be shot within the time t being 10, the 20 pictures obtained in the way are extremely similar and can be processed as the same picture, and meanwhile, the 20 pictures are shot under the conditions of different exposure degrees;
s4, arranging the pictures, washing out all the shot pictures for air drying, and then putting the pictures for later use;
s5, primary screening, namely placing all photos under light for preselection, and primarily screening some defective photos;
s6, screening the shot n pictures, removing 8 pictures with blurred and distorted pictures, screening three pictures with strong exposure intensity, balance and weak exposure intensity, marked as a, b and c, and processing the pictures as follows;
s7, synthesizing images, selecting partial images with moderate brightness in abc pictures, taking parts with balanced exposure and parts with best color expression, and splicing the parts into a complete image;
s8, preparing display, namely placing tools for display, and hanging the screened pictures on the tools;
s9, displaying the image, importing the spliced image into a display screen storage device, and displaying the spliced image as a shooting result when a program is called;
the coordinates in S3 are converted into first HSL color coordinates (d1, e1, f1), d1 is the first hue angle of the current pixel point, e1 is the first saturation of the current pixel point, and f1 is the first brightness of the current pixel point;
dynamically adjusting the first saturation of the current pixel point to obtain a second saturation e2 of the current pixel point, and simultaneously obtaining a second HSL color coordinate (d2, e2 and f 2);
wherein d2 is the second hue angle of the current pixel, and f2 is the second brightness of the current pixel;
converting the second HSL color coordinates (d2, e2, f2) into second color coordinates (a2, b2, c2), and performing color space conversion to complete dynamic color adjustment on the current pixel point;
wherein r2 is the original red coordinate of the current pixel point in the color, b2 is the original green coordinate of the current pixel point in the color space, c2 is the original blue coordinate of the current pixel point in the color space, and the real number is 0.5;
the red coordinate r1 is the maximum value of max and is the largest of three values, green coordinate b1 and blue coordinate b 1;
the red coordinate r1 is the minimum value of min, and is the minimum value of three values, namely a green coordinate b1 and a blue coordinate b 1;
the red pixel value of the target image is R, the green pixel value of the target image is G, and the blue pixel value of the target image is B;
the numerical values of S4 are collated so that a formula can be derived, the numerical values of S7 are collated, data is recorded, and then a formula is derived.
The invention has the beneficial effects that: the method comprises the steps of shooting a plurality of images on a certain picture, splicing different images, and then utilizing an endoscope, so that the optimal parts under different exposure degrees are combined into one image, wherein when a single image is shot, the adjustment of the exposure degree can influence all the images in the picture, so that the images without the value of utilization are eliminated by shooting the same picture under different exposure degrees, the images with different exposure degrees are selected from the rest images, and the parts with good shooting effects are combined.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.