Methods and devices for gamma correction
A medical system includes a shaft having a proximal end and a distal end, an imaging device at the distal end of the shaft, and a controller, the controller receives image data comprising pixel data from the imaging device, the pixel data including a plurality of individual pixel values, converts the pixel data from a RGB format to a YC b C r format, and forms adjusted pixel data by applying a gain to the pixel data, wherein the gain is based on a Y value, a C b value, and a C r value of the individual pixel values of the converted pixel data.
1. A medical system, comprising:
a shaft having a proximal end and a distal end;
an imaging device at the distal end of the shaft; and
a controller, wherein the controller is configured to:
receive image data comprising pixel data from the imaging device, the pixel data including a plurality of individual pixel values;
convert the pixel data from a RGB format to a YC b C r format; and
form adjusted pixel data by applying a gain to the pixel data,
wherein the gain is based on a Y value, a C b value, and a C r value of the individual pixel values of the converted pixel data, and
wherein the controller is further configured to calculate a magnitude for each pixel value, wherein the magnitude for each pixel value is equal to √(Y 2 +C b 2 +C r 2 ), and wherein the gain is a function of the magnitude.
2. The medical system according to claim 1 , wherein the gain includes a first gain and a second gain, and the first gain is applied to the Y value, and the second gain is applied to both the C b value and the C r value of a corresponding pixel value.
3. The medical system according to claim 1 , further comprising a memory, wherein the memory includes a look up table (LUT) for each of a luminance value and a chroma value.
4. The medical system according to claim 1 , wherein the controller is further configured to convert the adjusted pixel data from the YC b C r format to the RGB format.
5. The medical system according to claim 4 , further comprising a display, and wherein the controller is further configured to generate an image based on the adjusted and converted pixel data.
6. The medical system according to claim 1 , further comprising a light emitting device at the distal end of the shaft.
7. The medical system according to claim 1 , further comprising a user input device configured to receive at least one user input for controlling the medical system.
8. The medical system according to claim 1 , wherein the controller includes a field programmable gate array (FPGA).
9. The medical system according to claim 1 , wherein the medical system further includes a handle, wherein the controller is disposed on or in the handle.
10. A method of controlling an imaging device for a medical system, the method comprising:
receiving an image comprising pixel data from an imaging device of the medical system, the pixel data including a plurality of individual pixel values;
converting the pixel data from a RGB format to a second multi-channel color format, the second multi-channel color format having a brightness value and a color value; and
applying a gain to adjust the brightness value or the color value for each pixel; and
converting each of the plurality of pixels from the second multi-channel color format to the RGB format,
wherein the gain is based on a Y value, a C b value, and a C r value of the individual pixel values of the converted pixel data, and
wherein the controller is further configured to calculate a magnitude for each pixel value, wherein the magnitude for each pixel value is equal to √(Y 2 +C b 2 +C r 2 ), and wherein the gain is a function of the magnitude.
11. The method according to claim 10 , further comprising applying a different gain to the brightness value than the color value of a corresponding pixel value.
12. The method according to claim 10 , further comprising generating an image on a display of the medical system based on the adjusted and converted pixel data.
13. The method according to claim 10 , wherein applying the gain to each pixel value includes matching the magnitude with a corresponding value in a brightness look up table (LUT) for a corresponding brightness value, and matching the gain magnitude with a corresponding value in a color LUT for a corresponding color value.
14. The method according to claim 10 , wherein the gain magnitude is applied to each of the brightness and the color values for the corresponding pixel.
15. A non-transitory computer-readable medium storing instructions that, when executed by a computer, cause the computer to perform a method for processing electronic images from a medical system, the method including:
receiving an image comprising pixel data from an imaging device of the medical system, the pixel data including a plurality of individual pixel values;
converting the pixel data from a RGB format to a YC b C r format;
calculating a gain for each pixel value, wherein the gain is based on a Y value, a Cb value, and a Cr value of the individual pixel values of the converted pixel data, and wherein the controller is further configured to calculate a magnitude for each pixel value, wherein the magnitude for each pixel value is equal to √(Y 2 +C b 2 +C r 2 ), and wherein the gain is a function of the magnitude;
applying the gain to adjust the corresponding luminance or the corresponding chroma for each pixel; and
converting each of the plurality of pixels from the YC b C r format to the RGB format.
16. The non-transitory computer-readable medium of claim 15 , the method further comprising applying a different gain to the Y value than the C b value and the C r value of a corresponding pixel value.
17. The non-transitory computer-readable medium of claim 15 , the method further comprising generating an image on a display of the medical system based on the adjusted and converted pixel data.
18. The non-transitory computer-readable medium of claim 15 , wherein applying the gain to each pixel value includes matching the magnitude with a corresponding value in a luminance look up table (LUT) for a corresponding Y value, and matching the gain with a corresponding value in a chroma LUT for a corresponding C b value and a corresponding C r value.
19. The non-transitory computer-readable medium of claim 15 , wherein the gain is applied to each of the luminance and the chroma values for the corresponding pixel.