CN116723411A - Underwater image processing method, electronic device and storage medium - Google Patents

Underwater image processing method, electronic device and storage medium Download PDF

Info

Publication number
CN116723411A
CN116723411A CN202310763663.8A CN202310763663A CN116723411A CN 116723411 A CN116723411 A CN 116723411A CN 202310763663 A CN202310763663 A CN 202310763663A CN 116723411 A CN116723411 A CN 116723411A
Authority
CN
China
Prior art keywords
pixel
underwater image
image
pixel point
underwater
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310763663.8A
Other languages
Chinese (zh)
Inventor
高志晔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Wingtech Electronic Technology Co Ltd
Original Assignee
Shanghai Wingtech Electronic Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Wingtech Electronic Technology Co Ltd filed Critical Shanghai Wingtech Electronic Technology Co Ltd
Priority to CN202310763663.8A priority Critical patent/CN116723411A/en
Publication of CN116723411A publication Critical patent/CN116723411A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • H04N23/76Circuitry for compensating brightness variation in the scene by influencing the image signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • H04N23/741Circuitry for compensating brightness variation in the scene by increasing the dynamic range of the image compared to the dynamic range of the electronic image sensors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/82Camera processing pipelines; Components thereof for controlling camera response irrespective of the scene brightness, e.g. gamma correction
    • H04N23/83Camera processing pipelines; Components thereof for controlling camera response irrespective of the scene brightness, e.g. gamma correction specially adapted for colour signals
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A90/00Technologies having an indirect contribution to adaptation to climate change
    • Y02A90/30Assessment of water resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the invention discloses an underwater image processing method, electronic equipment and a storage medium, which are applied to the technical field of image processing and can solve the problem of how to improve the imaging quality of underwater photographing. The method comprises the following steps: acquiring an original underwater image; performing red and blue light compensation processing on the original underwater image to obtain a first underwater image; and carrying out pixel enhancement on pixel points included in the image outline of the first underwater image to obtain the target underwater image.

Description

Underwater image processing method, electronic device and storage medium
Technical Field
The embodiment of the invention relates to the technical field of image processing, in particular to an underwater image processing method, electronic equipment and a storage medium.
Background
Along with the waterproof grade of the mobile phone is improved to a higher level by each large mobile phone manufacturer, underwater photographing gradually becomes normal, but the whole picture is greenish due to the loss of a large number of red and blue wave bands in the spectrum, the outline of an imaging main body can be blurred due to scattered light generated by impurities in the water body, and the contrast between texture areas is reduced, so that the current underwater photographing has poor imaging quality. Therefore, how to improve the imaging quality of underwater photographing is a problem to be solved.
Disclosure of Invention
The embodiment of the invention provides an underwater image processing method, electronic equipment and a storage medium, which are used for solving the problem of how to improve the imaging quality of underwater photographing in the prior art.
In a first aspect, there is provided a method of underwater image processing, the method comprising: acquiring an original underwater image;
performing red and blue light compensation processing on the original underwater image to obtain a first underwater image;
and carrying out pixel enhancement on pixel points included in the image outline of the first underwater image to obtain a target underwater image.
In a first aspect of the embodiment of the present invention, pixel enhancement is performed on pixel points included in an image contour of the first underwater image to obtain a target underwater image, where the pixel enhancement includes:
determining the edge variation of each pixel point in the first underwater image;
determining an image contour of the first underwater image according to the edge variation of each pixel point and a preset threshold value;
and superposing the image outline of the first underwater image and the first underwater image to obtain the target underwater image.
As an optional implementation manner, in a first aspect of the embodiment of the present invention, the determining an edge variation of each pixel point in the first underwater image includes:
Determining a pixel point set corresponding to a first pixel point, wherein the pixel point set comprises a plurality of pixel points which are co-located or co-located with the first pixel point, and the first pixel point is any pixel point in the first underwater image;
and determining the edge variation of the first pixel point according to the pixel difference value between the first pixel point and each pixel point in the pixel point set.
As an optional implementation manner, in a first aspect of the embodiment of the present invention, before the determining, according to the edge variation of each pixel point and the preset threshold, an image contour of the first underwater image, the method further includes:
determining a first number of all pixels included in the first underwater image and a second number of all pixels included in the set of pixels;
and determining the preset threshold according to the sum of pixel values of all pixel points included in the first underwater image, the first quantity and the second quantity.
In a first aspect of the embodiment of the present invention, the performing red and blue light compensation processing on the original underwater image to obtain a first underwater image includes:
When the original underwater image is in an RGB format, determining a three-color pixel value of each pixel point, wherein the three-color pixel value comprises: green pixel value, red pixel value and blue pixel value;
and compensating the red pixel value and the blue pixel value according to a preset coefficient and the green pixel value to obtain the first underwater image.
As an optional implementation manner, in the first aspect of the embodiment of the present invention, after determining the three-color pixel value of each pixel point when the original underwater image is in RGB format, the method further includes:
normalizing the three-color pixel values to obtain converted three-color pixel values;
pre-compensating the converted three-color pixel values according to a preset correction value to obtain a pre-compensation result;
and carrying out inverse normalization on the pre-compensation result to obtain the first underwater image.
As an optional implementation manner, in the first aspect of the embodiment of the present invention, after determining the three-color pixel value of each pixel point when the original underwater image is in RGB format, the method further includes:
determining a first pixel histogram of the original underwater image according to a first pixel value of each pixel point, wherein the first pixel value is any one of the three-color pixel values;
Determining a first mapping function according to the first pixel histogram;
and carrying out pixel equalization on the original underwater image according to the first mapping function to obtain the first underwater image.
In a second aspect, there is provided an electronic device comprising: the acquisition module is used for acquiring an original underwater image;
the processing module is used for carrying out red and blue light compensation processing on the original underwater image to obtain a first underwater image;
the processing module is further configured to perform pixel enhancement on pixel points included in the image contour of the first underwater image, so as to obtain a target underwater image.
In a third aspect, an electronic device is provided, the electronic device comprising:
a memory storing executable program code;
a processor coupled to the memory;
the processor invokes the executable program code stored in the memory to execute the underwater image processing method in the first aspect of the embodiment of the present invention.
In a fourth aspect, there is provided a computer-readable storage medium storing a computer program that causes a computer to execute the underwater image processing method in the first aspect of the embodiment of the present invention. The computer readable storage medium includes ROM/RAM, magnetic disk or optical disk, etc.
In a fifth aspect, there is provided a computer program product for causing a computer to carry out some or all of the steps of any one of the methods of the first aspect when the computer program product is run on the computer.
In a sixth aspect, an application publishing platform is provided for publishing a computer program product, wherein the computer program product, when run on a computer, causes the computer to perform part or all of the steps of any one of the methods of the first aspect.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, the electronic equipment can acquire the original underwater image; performing red and blue light compensation processing on the original underwater image to obtain a first underwater image; and carrying out pixel enhancement on pixel points included in the image outline of the first underwater image to obtain the target underwater image. In the scheme, as the absorption attenuation coefficient of green light in water is minimum and the penetrating power is strongest, and the blurring part in the image can be clear by increasing the contrast of color components on two sides of the image outline to carry out edge enhancement, the texture edge part of the image is enhanced, the electronic equipment can carry out red and blue light compensation and pixel enhancement operation on the original underwater image, so that a target underwater image with clearer color and richer contrast is obtained, and the quality of the underwater image is effectively improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of an underwater image processing method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart II of an underwater image processing method according to an embodiment of the present invention;
fig. 3 is a schematic image processing diagram of an underwater image processing method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a pixel point of an underwater image processing method according to an embodiment of the present invention;
fig. 5 is a schematic image processing diagram II of an underwater image processing method according to an embodiment of the present invention;
fig. 6 is a schematic image processing diagram III of an underwater image processing method according to an embodiment of the present invention;
fig. 7 is a schematic diagram of image processing in an underwater image processing method according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
Fig. 9 is a schematic diagram of a second structure of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms first and second and the like in the description and in the claims, are used for distinguishing between different objects and not necessarily for describing a particular sequential or chronological order of the objects. For example, a first number and a second number, etc. are used to distinguish between different numbers, and are not used to describe a particular order of numbers.
The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, in the embodiments of the present invention, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g." in an embodiment should not be taken as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
The electronic device related to the embodiment of the invention can be electronic devices such as a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a wearable device, an Ultra-Mobile Personal Computer (UMPC), a netbook or a personal digital assistant (Personal Digital Assistant, PDA) and the like. The wearable device may be an intelligent watch, an intelligent bracelet, a watch phone, an intelligent foot ring, an intelligent earring, an intelligent necklace, an intelligent earphone, etc., and the embodiment of the invention is not limited.
The execution main body of the underwater image processing method provided by the embodiment of the invention can be the electronic equipment, or can be a functional module and/or a functional entity which can realize the underwater image processing method in the electronic equipment, and the execution main body can be specifically determined according to actual use requirements. An exemplary description will be given below of an underwater image processing method provided by an embodiment of the present invention, taking an electronic device as an example.
As shown in fig. 1, an embodiment of the present invention provides an underwater image processing method, which may include the steps of:
101. and acquiring an original underwater image.
In the embodiment of the invention, the electronic equipment can acquire the original underwater image, and the image content included in the original underwater image is an underwater scene.
Optionally, the manner in which the electronic device obtains the original underwater image may be an image captured in real time through a camera disposed in the electronic device, or may be an image obtained by the electronic device from a cloud through a network, or may be an image sent by other electronic devices received by the electronic device, which may include other various obtaining manners, and the embodiment of the present invention is not limited specifically.
102. And carrying out red and blue light compensation processing on the original underwater image to obtain a first underwater image.
In the embodiment of the invention, the original underwater image can comprise red light, blue light and green light, and as the underwater scene usually loses the red wave band and the blue wave band, the absorption attenuation coefficient of the green light in water is minimum, and the penetrating capacity is strongest, the electronic equipment needs to perform red-blue light compensation processing on the original underwater image so as to enhance the red light and the blue light in the original underwater image, so that the first underwater image is obtained.
In the embodiment of the invention, since a large number of red wave bands and blue wave bands are lost in the image spectrum in the underwater scene, the whole image is greenish, that is, the brightness values of blue and red are lower than the actual brightness values, and the brightness values of green are higher than the actual brightness values, the electronic equipment needs to use green pixel values to compensate the blue pixel values and the red pixel values so as to adjust the color light of the whole original underwater image, and thus the first underwater image is obtained.
103. And carrying out pixel enhancement on pixel points included in the image outline of the first underwater image to obtain the target underwater image.
In the embodiment of the invention, the electronic device can perform edge pixel enhancement on the first underwater image, namely, pixel enhancement is performed on the image contour in the first underwater image, the first underwater image can comprise an image contour formed by a plurality of pixel points, the pixel values of the pixel points are generally larger in difference with the pixel values of the adjacent pixel points, at the moment, because the impurities in the water body in the underwater scene can generate scattered light, the contour of the imaging main body can be blurred, the contrast between texture areas is reduced, the electronic device can perform pixel enhancement on the pixel points included in the image contour, so that a target underwater image is obtained, the target underwater image is clearer and brighter than the original underwater image, and the contrast between colors is more obvious.
The embodiment of the invention provides an underwater image processing method, which can enable electronic equipment to acquire an original underwater image; performing red and blue light compensation processing on the original underwater image to obtain a first underwater image; and carrying out pixel enhancement on pixel points included in the image outline of the first underwater image to obtain the target underwater image. In the scheme, as the absorption attenuation coefficient of green light in water is minimum and the penetrating power is strongest, and the blurring part in the image can be clear by increasing the contrast of color components on two sides of the image outline to carry out edge enhancement, the texture edge part of the image is enhanced, the electronic equipment can carry out red and blue light compensation and pixel enhancement operation on the original underwater image, so that a target underwater image with clearer color and richer contrast is obtained, and the quality of the underwater image is effectively improved.
As shown in fig. 2, an embodiment of the present invention provides an underwater image processing method, which may further include the steps of:
201. and acquiring an original underwater image.
In the embodiment of the present invention, for the description of step 201, please refer to the detailed description of step 101 in the above embodiment, and the description of the embodiment of the present invention is omitted.
202. When the original underwater image is in RGB format, three-color pixel values of each pixel point are determined.
In the embodiment of the present invention, the electronic device may detect the image format of the original underwater image first, and if the original underwater image is in RGB format, the electronic device may determine a three-color pixel value of each pixel included in the original underwater image, where the three-color pixel value includes: green pixel value, red pixel value, and blue pixel value.
Alternatively, the format of the original underwater image may be: RGB format or YUV format.
Optionally, if the electronic device detects that the format of the original underwater image is RGB format, the electronic device may determine a three-color pixel value of each pixel included in the original underwater image; if the electronic device detects that the format of the original underwater image is YUV format, the electronic device can adjust the format of the original underwater image from YUV format to RGB format, and then determine the three-color pixel value of each pixel included in the original underwater image.
Alternatively, the RGB value is a color standard that is varied in color by varying the three primary color channels of red (R), green (G), blue (B) and overlapping them with each other. The colors which can be seen by naked eyes are formed by mixing light of three primary colors of red, green and blue according to different proportions, the pixel value (namely RGB value) of an image is the brightness of the light of the three primary colors, each light has 256 brightness values, and the brightness values are expressed as 0, 1 and 2.
Alternatively, the RGB color space may be regarded as a unit cube in a three-dimensional rectangular coordinate color system, the three axes respectively represent three primary colors of red, green and blue, and any color visible to the naked eye may be represented by a point in the three-dimensional space in the RGB color space.
Illustratively, on the RGB color space, when the luminance values of the three primary colors are zero, i.e., at the origin, they are displayed as black, denoted as (0, 0); when all three primary colors reach the highest brightness, they appear white, denoted (255, 255, 255); in the more common mixed colors, yellow is red and green reaching the highest brightness, and the brightness value of blue is zero, which is expressed as (255, 0); cyan is blue and green reaches the highest brightness, and the brightness value of red is zero, which is expressed as (0, 255, 255); magenta is blue and red reaches the highest brightness, and the brightness value of green is zero, which is indicated as (255, 0, 255).
Optionally, YUV is a color coding method, mainly used for optimizing the transmission of color signals. The greatest advantage over RGB signaling is that it takes up little bandwidth (RGB requires three separate color signals to be transmitted simultaneously). Where "Y" is a baseband signal, and represents brightness (Luminance), i.e., gray scale value. "U" and "V" denote chromaticity (chroma) which is used to describe the image color and saturation for the color of a given pixel. U and V are quadrature modulated signals. The YUV color model is derived from an RGB model, and has the characteristic of separating brightness from chromaticity, so that the YUV color model is more suitable for the field of image processing.
Optionally, there is a certain conversion relationship between the RGB value and the YUV value, and the conversion relationship is generally shown in the following formula: y=0.299×r+0.587×g+0.114×b, u= -0.147×r-0.289×g+0.436×b, v=0.615×r-0.515×g-0.100×b, r=y+1.140×v, g=y-0.394×u-0.581×v, b=y+2.032×u.
It should be noted that, if the format of the original underwater image is YUV format, the electronic device may convert the YUV value into the RGB value according to the above conversion formula.
Optionally, after determining the three-color pixel value of each pixel, the electronic device may further perform Gamma correction processing and pixel equalization processing on the original underwater image.
Optionally, since the perceived brightness of the human eye on the light ray does not show a linear relationship with the physical illumination intensity, the physical illumination intensity is directly used as the brightness value of the image pixel, and the detailed part of the dark part color cannot be accurately depicted.
Optionally, the specific step of Gamma correction on the original underwater image may include: normalizing the three-color pixel values to obtain converted three-color pixel values; pre-compensating the converted three-color pixel values according to a preset correction value to obtain a pre-compensation result; and carrying out inverse normalization on the precompensation result to obtain a first underwater image.
It should be noted that, the electronic device needs to perform Gamma correction for each pixel value in three-color pixel values of the original underwater image, and the steps of performing Gamma correction for each pixel value are the same, and the preset correction value corresponding to each pixel value is the same, so the following description will take 200 as an example of the red pixel value of the pixel point a.
Step one: normalization. The pixel value is converted into a real number between 0 and 1, the specific calculation formula is (A+0.5)/256, wherein the specific calculation formula comprises an addition operation and a division operation, namely, the pixel value is added by 0.5 and then the ratio between 0 and 255, and the corresponding normalized value for the pixel point A is (200+0.5)/256= 0.783203.
Step two: pre-compensation. The precompensation result is the corresponding value of the normalized value with 1/preset correction value as an index, wherein the precompensation result comprises an exponential operation. In order to make the color of the image richer, the preset correction value needs to be greater than 1, for example: 1.2, when the correction value is presetWhen the value is 1.2, the 1/preset correction value is 0.8333, and the precompensation result obtained by precompensation the normalized value is 0.783203 0.8333 =0.815766。
Step three: and (5) inverse normalization. And recovering the precompensated result to an integer value between 0 and 255, wherein the specific calculation formula is A.256-0.5, and the specific calculation formula comprises a subtraction operation and a multiplication operation, namely, reversely pushing the precompensated result to a ratio between 0 and 255 according to a ratio between 0 and 1, subtracting the ratio by 0.5, and for the pixel point A, the corresponding reversely normalized value is 0.815766.256-0.5=208.
And similarly, the operation is performed on each pixel value of each pixel point in the original underwater image, so that the pixel value of each pixel point after Gamma correction can be obtained, and the first underwater image is obtained.
Optionally, each pixel value of each pixel point in the original underwater image is within a range of 0-255, and then the pixel values of partial pixel points possibly appear to be too concentrated and are all located within a small range, so that the electronic equipment can equalize the pixel values, namely the pixel values are uniformly arranged within the range of 0-255, gray values are prevented from being concentrated in a certain range, and the overall brightness of the picture is ensured to be moderate, namely the pixel equalization processing is performed.
At present, a common pixel equalization processing mode is histogram equalization, which is a method for enhancing image contrast, the main idea is that the histogram distribution of an image is changed into approximately uniform distribution through a cumulative distribution function, so that the image contrast is enhanced, in order to expand the brightness range of an original image, a mapping function is needed, and the pixel value of the original image is mapped into a new histogram in an equalization way, however, the mapping function has two conditions: the original pixel value size sequence cannot be disturbed, and the size relation of brightness and darkness after mapping cannot be changed; and, the value range of the pixel mapping function should be within the original range after mapping, namely, the value range of the pixel mapping function should be within the range of 0-255.
Optionally, the specific step of performing pixel equalization on the original underwater image through histogram equalization may include: determining a first pixel histogram of the original underwater image according to the first pixel value of each pixel point, wherein the first pixel value is any one of three-color pixel values; determining a first mapping function according to the first pixel histogram; and carrying out pixel equalization on the original underwater image according to the first mapping function to obtain a first underwater image.
It should be noted that, the electronic device needs to perform pixel equalization for each pixel value in three-color pixel values of the original underwater image, and the pixel equalization step for each pixel value is the same. Taking the first pixel value as a red pixel value as an example, the first pixel histogram reflects the distribution rule of the red pixel values in the original underwater image, and describes the number of pixel points of each red pixel value, and the position information of the pixel points in the original underwater image is not included. Since the pixel histogram is not concerned with the spatial position of the pixel point, it is not affected by image rotation and translational changes.
Optionally, in determining the first mapping function according to the first pixel histogram, the mapping function is: Wherein S is k Refers to the value of the current pixel value mapped by the cumulative distribution function, n is the total number of pixel points in the original underwater image, n j The number of pixel points is the current pixel value, and L is the total number of pixel values in the original underwater image.
The red pixel value of each pixel point in the original underwater image after pixel equalization can be obtained, the operation is performed on each pixel value of each pixel point in the original underwater image in the same way, the pixel value of each pixel point after pixel equalization can be obtained, and therefore a first underwater image is obtained, as shown in fig. 3, the part a in fig. 3 is the original underwater image, the part b in fig. 3 is the first underwater image after pixel equalization, the image can be seen to be clearer, the color contrast is richer, and the overall brightness of the image is more suitable.
203. And compensating the red pixel value and the blue pixel value according to the preset coefficient and the green pixel value to obtain a first underwater image.
In the embodiment of the present invention, when the electronic device compensates the red pixel value and the blue pixel value, the compensation is performed according to the green pixel value which is multiple of a preset coefficient, and the preset coefficient may be a value obtained through experience of historical red and blue light compensation, which is usually 0.3.
Alternatively, when the red pixel value and the blue pixel value are compensated, an average value of the green pixel value of each pixel point in the original underwater image may be calculated first, and then the average value is multiplied by a preset coefficient, and the red pixel value and the blue pixel value are compensated by the result.
204. An edge variation of each pixel point in the first underwater image is determined.
In the embodiment of the invention, after the electronic device determines the first underwater image, the edge variation of each pixel point can be calculated, and the edge variation can indicate whether the current pixel point is an image contour.
Optionally, determining the edge variation of each pixel point in the first underwater image may specifically include: determining a pixel point set corresponding to a first pixel point, wherein the pixel point set comprises a plurality of pixel points which are co-located or co-located with the first pixel point, and the first pixel point is any pixel point in a first underwater image; and determining the edge variation of the first pixel point according to the pixel difference value between the first pixel point and each pixel point in the pixel point set.
In this implementation manner, the electronic device performs the same operation for each pixel in the first underwater image, so taking any pixel, that is, the first pixel, as an example, the electronic device may determine a set of pixels corresponding to the first pixel, where the set of pixels may include a plurality of pixels that are co-located or co-located with the first pixel, the electronic device may determine a pixel value of the first pixel, and a pixel value of each pixel in the set of pixels, and then determine an edge variation of the first pixel according to a difference between the pixel value of the first pixel and the pixel value of each pixel in the set of pixels.
For example, as shown in fig. 4, assuming that the first pixel point is the pixel point a, the pixels on the same side as the pixel point a are the pixel point B, the pixel point C, the pixel point D and the pixel point E, and the pixels on the same point as the pixel point a are the pixel point F, the pixel point G, the pixel point H and the pixel point I, so that the electronic device may form a pixel point set corresponding to the pixel point a by the pixel point B, the pixel point C, the pixel point D, the pixel point E, the pixel point F, the pixel point G, the pixel point H and the pixel point I, and as can also be seen from fig. 4, the pixel point set corresponding to each pixel point includes at most 8 pixel points.
Optionally, a specific calculation formula of the edge variation is: for any pixel f (x, y) in an image with resolution m×n, the edge variation G [ f (x, y) ]= |f (x, y) -f (x+1, y) |+|f (x, y) -f (x, y+1) |+|f (x, y) -f (x+1, y+1) |+|f (x, y) -f (x-1, y) |+|f (x, y) -f (x, y-1) |+|f (x, y) -f (x-1, y-1) |+|f (x, y) -f (x+1, y-1) |+|f (x, y) -f (x-1, y+1) |. The essence of the edge variation is the sum of pixel differences between the pixel point and all surrounding pixel points.
Optionally, the above formula shows that the pixel points and 8 pixel points perform pixel difference summation, and of course, in the actual calculation process, the electronic device may select 8 pixel points to perform pixel difference summation according to the above formula, or may select some of the pixel points to perform pixel difference summation, for example: as shown in fig. 4, the electronic device may determine the edge variation of the pixel a according to the pixel difference between the pixel a and the pixel B, the pixel C, the pixel D, the pixel E, the pixel F, the pixel G, the pixel H, and the pixel I, respectively; the edge variation of the pixel point A can be determined according to the pixel difference value between the pixel point A and the pixel point B, the pixel point C, the pixel point D and the pixel point E respectively; the edge variation of the pixel point a may also be determined according to the pixel difference between the pixel point a and the pixel points B, C and F, respectively, or may be any other pixel point combination.
205. A first number of all pixels included in the first underwater image and a second number of all pixels included in the set of pixels are determined.
In the embodiment of the invention, the electronic device may count the first number of all the pixels in the whole first underwater image, and also needs to count the second number of all the pixels included in the pixel set.
It should be noted that, the second number needs to be the same as the number of pixels in the pixel set included in the calculation of the edge variation, that is, when calculating the edge variation of the first pixel, the electronic device calculates the second number according to the pixel difference between the first pixel and the N pixels in the pixel set, and then the second number determined by the electronic device is N.
For example, as shown in fig. 4, assuming that the electronic device determines the edge variation of the pixel a according to the pixel difference between the pixel a and the pixel B, the pixel C, and the pixel F, respectively, the second number of all the pixels included in the pixel set determined by the electronic device is 3; assuming that the electronic device determines the edge variation of the pixel point a according to the pixel difference value between the pixel point a and the pixel point B, the pixel point C, the pixel point D, the pixel point E, the pixel point F, the pixel point G, the pixel point H and the pixel point I, respectively, the second number of all the pixel points included in the pixel point set determined by the electronic device is 8.
206. And determining a preset threshold according to the sum of pixel values of all the pixel points included in the first underwater image, the first quantity and the second quantity.
In the embodiment of the invention, since pixel enhancement is required for the pixel points included in the image contour, the electronic device determines the image contour first, and the electronic device may set a preset threshold to determine the image contour, where the preset threshold may be determined according to the sum of the pixel values of all the pixel points included in the first underwater image, the first number, and the second number.
Optionally, a specific calculation formula of the preset threshold is: for any pixel point f (x, y) in an image with resolution of m×n, a threshold is presetWherein L is the first number, m×n is the first number, and the substance of the preset threshold is the average value of the pixel values of all the pixel points in the first underwater image divided by the second number of all the pixel points included in calculating the edge variation.
207. And determining the image contour of the first underwater image according to the edge variation of each pixel point and a preset threshold value.
In the embodiment of the invention, the electronic equipment can compare the edge variation with the preset threshold value, and determine the image contour of the first underwater image according to the comparison result.
It should be noted that if a certain pixel point is an image contour, it can be said that the pixel difference between the pixel point and the adjacent pixel point is larger, so that if the edge variation of the certain pixel point is greater than a preset threshold, then the pixel point can be determined to be the image contour; if the edge variation of a pixel is less than or equal to a preset threshold, then it can be determined that the pixel is not an image contour.
Optionally, a specific calculation formula for determining the image contour is: for any pixel point f (x, y) in an image with resolution M x N, the image profileWherein G [ f (x, y)]The edge variation is defined as the edge variation, and T is defined as the preset threshold.
208. And superposing the image contour of the first underwater image and the first underwater image to obtain a target underwater image.
In the embodiment of the invention, the electronic equipment can superimpose the image contour with the first underwater image, which is equivalent to superimposing a layer of image contour edge on the basis of the whole image, and can strengthen the texture edge part of the image so as to make the image contour clearer and increase the contrast between each texture area.
Optionally, in this embodiment, the electronic device may perform four processing on the original underwater image altogether, where the four processing are respectively: the method comprises the steps of red and blue light compensation, gamma correction, pixel balance and pixel enhancement, wherein the electronic equipment at least needs to perform the red and blue light compensation and the pixel enhancement, and the Gamma correction and the pixel enhancement are optional processing methods, namely, the electronic equipment can perform the red and blue light compensation and the pixel enhancement on an original underwater image to obtain a target underwater image; red and blue light compensation, gamma correction and pixel enhancement can be carried out on the original underwater image to obtain a target underwater image; red and blue light compensation, pixel equalization and pixel enhancement can be carried out on the original underwater image to obtain a target underwater image; the target underwater image can also be obtained by performing red-blue light compensation, gamma correction, pixel equalization and pixel enhancement on the original underwater image, and the embodiment of the invention is not particularly limited.
For example, fig. 5-7 show the comparison of some underwater images before and after processing, as shown in fig. 5, part a in fig. 5 is an original underwater image, and part b in fig. 5 is a target underwater image; as shown in fig. 6, part a in fig. 6 is an original underwater image, and part b in fig. 6 is a target underwater image; as shown in fig. 7, the portion a in fig. 7 is an original underwater image, and the portion b in fig. 7 is a target underwater image.
The embodiment of the invention provides an underwater image processing method, which is characterized in that the absorption attenuation coefficient of green light in water is minimum, the penetrating capacity is strongest, the blurring part in an image can be clear by increasing the contrast of color components at two sides of the outline of the image to carry out edge enhancement, and the texture edge part of the image is enhanced, so that electronic equipment can carry out red and blue light compensation and pixel enhancement operation on an original underwater image, and on the basis, the electronic equipment can also carry out Gamma correction and pixel equalization operation, thereby obtaining a clearer target underwater image with more abundant color contrast, and effectively improving the quality of the underwater image.
As shown in fig. 8, an embodiment of the present invention provides an electronic device, including:
An acquisition module 801, configured to acquire an original underwater image;
the processing module 802 is configured to perform red-blue light compensation processing on the original underwater image to obtain a first underwater image;
the processing module 802 is further configured to perform pixel enhancement on pixel points included in the image contour of the first underwater image, so as to obtain the target underwater image.
Optionally, the processing module 802 is specifically configured to determine an edge variation of each pixel point in the first underwater image;
the processing module 802 is specifically configured to determine an image contour of the first underwater image according to the edge variation of each pixel point and a preset threshold;
the processing module 802 is specifically configured to superimpose the image contour of the first underwater image with the first underwater image to obtain a target underwater image.
Optionally, the processing module 802 is specifically configured to determine a pixel set corresponding to a first pixel, where the pixel set includes a plurality of pixels that are co-located or co-located with the first pixel, and the first pixel is any pixel in the first underwater image;
the processing module 802 is specifically configured to determine an edge variation of the first pixel according to a pixel difference between the first pixel and each pixel in the set of pixels.
Optionally, the processing module 802 is further configured to determine a first number of all pixels included in the first underwater image, and a second number of all pixels included in the pixel point set;
the processing module 802 is further configured to determine a preset threshold according to the sum of the pixel values of all the pixel points included in the first underwater image, the first number, and the second number.
Optionally, the processing module 802 is specifically configured to determine, when the original underwater image is in RGB format, a three-color pixel value of each pixel, where the three-color pixel value includes: green pixel value, red pixel value and blue pixel value;
the processing module 802 is specifically configured to compensate the red pixel value and the blue pixel value according to the preset coefficient and the green pixel value, so as to obtain a first underwater image.
Optionally, the processing module 802 is further configured to normalize the three-color pixel values to obtain converted three-color pixel values;
the processing module 802 is further configured to pre-compensate the converted three-color pixel values according to a preset correction value, so as to obtain a pre-compensation result;
the processing module 802 is further configured to denormalize the precompensation result to obtain a first underwater image.
Optionally, the processing module 802 is further configured to determine a first pixel histogram of the original underwater image according to a first pixel value of each pixel point, where the first pixel value is any one of three-color pixel values;
The processing module 802 is further configured to determine a first mapping function according to the first pixel histogram;
the processing module 802 is further configured to perform pixel equalization on the original underwater image according to the first mapping function, so as to obtain a first underwater image.
In the embodiment of the invention, each module can realize the underwater image processing method provided by the embodiment of the method, and can achieve the same technical effect, and in order to avoid repetition, the description is omitted.
As shown in fig. 9, an embodiment of the present invention further provides an electronic device, including:
a memory 901 storing executable program code;
a processor 902 coupled to the memory 901;
the processor 902 invokes executable program codes stored in the memory 901, and executes the underwater image processing method executed by the electronic device in the above-mentioned method embodiments.
The present invention provides a computer-readable storage medium storing a computer program, wherein the computer program causes a computer to execute some or all of the steps of the method as in the above method embodiments.
Embodiments of the present invention also provide a computer program product, wherein the computer program product, when run on a computer, causes the computer to perform some or all of the steps of the method as in the method embodiments above.
The embodiment of the invention also provides an application publishing platform, wherein the application publishing platform is used for publishing a computer program product, and the computer program product, when running on a computer, causes the computer to execute part or all of the steps of the method as in the above method embodiments.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. Those skilled in the art will also appreciate that the embodiments described in the specification are alternative embodiments and that the acts and modules referred to are not necessarily required for the present invention. The above embodiments are not necessarily independent embodiments, and the separation into the embodiments is merely used to highlight different technical features in different embodiments, and those skilled in the art should appreciate that the above embodiments may be combined arbitrarily.
In various embodiments of the present invention, it should be understood that the sequence numbers of the foregoing processes do not imply that the execution sequences of the processes should be determined by the functions and internal logic of the processes, and should not be construed as limiting the implementation of the embodiments of the present invention.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units described above, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present invention, or a part contributing to the prior art or all or part of the technical solution, may be embodied in the form of a software product stored in a memory, comprising several requests for a computer device (which may be a personal computer, a server or a network device, etc., in particular may be a processor in a computer device) to execute some or all of the steps of the above-mentioned method of the various embodiments of the present invention.
Those of ordinary skill in the art will appreciate that all or part of the steps of the various methods of the above embodiments may be implemented by a program that instructs associated hardware, the program may be stored in a computer readable storage medium including Read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), programmable Read-Only Memory (Programmable Read-Only Memory, PROM), erasable programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), one-time programmable Read-Only Memory (OTPROM), electrically erasable programmable Read-Only Memory (EEPROM), compact disc Read-Only Memory (Compact Disc Read-Only Memory, CD-ROM) or other optical disk Memory, magnetic disk Memory, tape Memory, or any other medium that can be used for carrying or storing data that is readable by a computer.

Claims (10)

1. A method of underwater image processing, the method comprising:
acquiring an original underwater image;
performing red and blue light compensation processing on the original underwater image to obtain a first underwater image;
And carrying out pixel enhancement on pixel points included in the image outline of the first underwater image to obtain a target underwater image.
2. The method according to claim 1, wherein the pixel enhancing the pixel points included in the image contour of the first underwater image to obtain the target underwater image includes:
determining the edge variation of each pixel point in the first underwater image;
determining an image contour of the first underwater image according to the edge variation of each pixel point and a preset threshold value;
and superposing the image outline of the first underwater image and the first underwater image to obtain the target underwater image.
3. The method of claim 2, wherein the determining an edge variance for each pixel point in the first underwater image comprises:
determining a pixel point set corresponding to a first pixel point, wherein the pixel point set comprises a plurality of pixel points which are co-located or co-located with the first pixel point, and the first pixel point is any pixel point in the first underwater image;
and determining the edge variation of the first pixel point according to the pixel difference value between the first pixel point and each pixel point in the pixel point set.
4. A method according to claim 3, wherein before determining the image profile of the first underwater image according to the edge variation of each pixel point and a preset threshold value, the method further comprises:
determining a first number of all pixels included in the first underwater image and a second number of all pixels included in the set of pixels;
and determining the preset threshold according to the sum of pixel values of all pixel points included in the first underwater image, the first quantity and the second quantity.
5. The method according to claim 1, wherein said performing a red-blue light compensation process on said original underwater image to obtain a first underwater image comprises:
when the original underwater image is in an RGB format, determining a three-color pixel value of each pixel point, wherein the three-color pixel value comprises: green pixel value, red pixel value and blue pixel value;
and compensating the red pixel value and the blue pixel value according to a preset coefficient and the green pixel value to obtain the first underwater image.
6. The method of claim 5, wherein after determining the three-color pixel values for each pixel point when the original underwater image is in RGB format, the method further comprises:
Normalizing the three-color pixel values to obtain converted three-color pixel values;
pre-compensating the converted three-color pixel values according to a preset correction value to obtain a pre-compensation result;
and carrying out inverse normalization on the pre-compensation result to obtain the first underwater image.
7. The method of claim 5, wherein after determining the three-color pixel values for each pixel point when the original underwater image is in RGB format, the method further comprises:
determining a first pixel histogram of the original underwater image according to a first pixel value of each pixel point, wherein the first pixel value is any one of the three-color pixel values;
determining a first mapping function according to the first pixel histogram;
and carrying out pixel equalization on the original underwater image according to the first mapping function to obtain the first underwater image.
8. An electronic device, comprising:
the acquisition module is used for acquiring an original underwater image;
the processing module is used for carrying out red and blue light compensation processing on the original underwater image to obtain a first underwater image;
the processing module is further configured to perform pixel enhancement on pixel points included in the image contour of the first underwater image, so as to obtain a target underwater image.
9. An electronic device, comprising:
a memory storing executable program code;
and a processor coupled to the memory;
the processor invokes the executable program code stored in the memory for performing the underwater image processing method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, comprising: computer instructions stored on the computer readable storage medium, which when executed by a processor, implement the underwater image processing method according to any of claims 1 to 7.
CN202310763663.8A 2023-06-26 2023-06-26 Underwater image processing method, electronic device and storage medium Pending CN116723411A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310763663.8A CN116723411A (en) 2023-06-26 2023-06-26 Underwater image processing method, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310763663.8A CN116723411A (en) 2023-06-26 2023-06-26 Underwater image processing method, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN116723411A true CN116723411A (en) 2023-09-08

Family

ID=87871335

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310763663.8A Pending CN116723411A (en) 2023-06-26 2023-06-26 Underwater image processing method, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN116723411A (en)

Similar Documents

Publication Publication Date Title
US9723285B2 (en) Multi-area white-balance control device, multi-area white-balance control method, multi-area white-balance control program, computer in which multi-area white-balance control program is recorded, multi-area white-balance image-processing device, multi-area white-balance image-processing method, multi-area white-balance image-processing program, computer in which multi-area white-balance image-processing program is recorded, and image-capture apparatus
CN107909553B (en) Image processing method and device
US6028646A (en) Color image enhancement device for video display appliance
Jang et al. Adaptive color enhancement based on multi-scaled Retinex using local contrast of the input image
KR20120016475A (en) Image processing method and image processing apparatus
CN102187657A (en) Contrast enhancement of images
CN114693580B (en) Image processing method and related device
CN111970432A (en) Image processing method and image processing device
JPWO2002021849A1 (en) Image processing apparatus and color system conversion method
CN110807735A (en) Image processing method, image processing device, terminal equipment and computer readable storage medium
KR100888429B1 (en) Image brightness controlling apparatus and method thereof
Kwon et al. CAM-based HDR image reproduction using CA–TC decoupled JCh decomposition
US8305499B2 (en) Image processing circuit and method for image processing
CN115550575B (en) Image processing method and related device
CN116723411A (en) Underwater image processing method, electronic device and storage medium
JP2007288573A (en) Chroma suppress processing device
US20080075174A1 (en) Chroma Supression Features
CN114266803A (en) Image processing method, image processing device, electronic equipment and storage medium
EP1895781B1 (en) Method of and apparatus for adjusting colour saturation
US7557953B2 (en) Image processing device and image processing method
CN111612702B (en) Neutral color correction post-treatment method for color migration
Neumann et al. Fast underwater color correction using integral images
US11284044B2 (en) Image generation device and imaging device
CN117094908A (en) Image processing method, device, electronic equipment and storage medium
Lee et al. Color image enhancement using multiscale retinex and image fusion techniques

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination