Image processing method, image processing apparatus, electronic apparatus, and storage medium
阅读说明:本技术 图像处理方法、图像处理装置、电子装置和存储介质 (Image processing method, image processing apparatus, electronic apparatus, and storage medium ) 是由 席迎来 于 2018-08-23 设计创作,主要内容包括:一种图像处理方法、图像处理装置(10)、电子装置(100)和计算机可读存储介质(400)。图像处理方法包括:获取输入图像,输入图像包括多个输入像素值(01);获取调节参数(02);根据调节参数获取输入像素值和输出像素值的对应关系(03);根据对应关系和输入像素值获取输出像素值以得到输出图像(04)。(An image processing method, an image processing apparatus (10), an electronic apparatus (100), and a computer-readable storage medium (400). The image processing method comprises the following steps: acquiring an input image, the input image comprising a plurality of input pixel values (01); acquiring adjustment parameters (02); acquiring a corresponding relation (03) between the input pixel value and the output pixel value according to the adjusting parameter; and acquiring an output pixel value according to the corresponding relation and the input pixel value to obtain an output image (04).)
1. An image processing method, characterized in that the image processing method comprises:
obtaining an input image, the input image comprising a plurality of input pixel values;
acquiring an adjusting parameter;
acquiring the corresponding relation between the input pixel value and the output pixel value according to the adjusting parameter; and
and acquiring the output pixel value according to the corresponding relation and the input pixel value to obtain an output image.
2. The image processing method according to claim 1, wherein the image processing method is used for processing a video, the video comprising a plurality of frames of the input image, and the image processing method further comprises:
when the adjusting parameters are changed, updating the corresponding relation according to the changed adjusting parameters;
the obtaining the output pixel value according to the corresponding relationship and the input pixel value to obtain an output image includes:
and acquiring the output pixel value according to the updated corresponding relation and the input pixel value to obtain the output image.
3. The image processing method according to claim 1, wherein the correspondence relationship is an exponential curve function or an S-curve function, and the obtaining the correspondence relationship between the input pixel value and the output pixel value according to the adjustment parameter includes:
and acquiring the exponential curve function or the S curve function of the corresponding curvature according to the adjusting parameter.
4. The method according to claim 1, wherein the adjustment parameter includes a luminance adjustment parameter, the correspondence relationship includes a luminance correspondence relationship, and the obtaining the correspondence relationship between the input pixel value and the output pixel value according to the adjustment parameter includes:
acquiring the brightness corresponding relation according to the brightness adjusting parameter;
the obtaining the output pixel value according to the corresponding relationship and the input pixel value to obtain an output image includes:
and acquiring the output pixel value according to the brightness corresponding relation and the input pixel value to obtain the output image.
5. The image processing method according to claim 4, wherein the luminance of the output image is greater than the luminance of the input image when the luminance adjustment parameter is greater than zero, and the luminance of the output image is less than the luminance of the input image when the luminance adjustment parameter is less than zero.
6. The image processing method according to claim 1, wherein the adjustment parameter includes a contrast adjustment parameter, the correspondence includes a contrast correspondence, and the obtaining the correspondence between the input pixel value and the output pixel value according to the adjustment parameter includes:
acquiring the contrast corresponding relation according to the contrast adjusting parameter;
the obtaining the output pixel value according to the corresponding relationship and the input pixel value to obtain an output image includes:
and acquiring the output pixel value according to the contrast corresponding relation and the input pixel value to obtain the output image.
7. The image processing method according to claim 6, wherein the contrast of the output image is greater than the contrast of the input image when the contrast adjustment parameter is greater than zero, and the contrast of the output image is less than the contrast of the input image when the contrast adjustment parameter is less than zero.
8. The image processing method according to claim 1, wherein the adjustment parameters include a brightness adjustment parameter and the contrast adjustment parameter, and the obtaining the correspondence between the input pixel value and the output pixel value according to the adjustment parameters includes:
acquiring a brightness corresponding relation according to the brightness adjusting parameter;
obtaining a contrast corresponding relation according to the contrast parameter;
the obtaining the output pixel value according to the corresponding relationship and the input pixel value to obtain an output image includes:
acquiring an intermediate pixel value according to the brightness corresponding relation and the input pixel value;
and acquiring the output pixel value according to the contrast corresponding relation and the intermediate pixel value to obtain the output image.
9. The image processing method according to claim 1, wherein the adjustment parameters include a brightness adjustment parameter and the contrast adjustment parameter, and the obtaining the correspondence between the input pixel value and the output pixel value according to the adjustment parameters includes:
acquiring a brightness corresponding relation according to the brightness adjusting parameter;
obtaining a contrast corresponding relation according to the contrast parameter;
the obtaining the output pixel value according to the corresponding relationship and the input pixel value to obtain an output image includes:
acquiring an intermediate pixel value according to the contrast corresponding relation and the input pixel value;
and acquiring the output pixel value according to the brightness corresponding relation and the intermediate pixel value to obtain the output image.
10. The image processing method according to claim 4, 8 or 9, wherein the brightness correspondence is
11. The image processing method according to claim 6, 8 or 9, wherein the contrast correspondence is
12. The image processing method according to claim 1, characterized in that the image processing method further comprises:
generating a lookup table of the input pixel value and the output pixel value according to the corresponding relation;
the obtaining the output pixel value according to the corresponding relationship and the input pixel value to obtain an output image includes:
and acquiring the output pixel value according to the lookup table and the input pixel value to obtain the output image.
13. An image processing apparatus characterized by comprising:
a first obtaining module to obtain an input image, the input image comprising a plurality of input pixel values;
the second acquisition module is used for acquiring the adjusting parameters;
a third obtaining module, configured to obtain a corresponding relationship between the input pixel value and the output pixel value according to the adjustment parameter; and
and the fourth acquisition module is used for acquiring the output pixel value according to the corresponding relation and the input pixel value so as to obtain an output image.
14. The image processing apparatus according to claim 13, wherein the image processing apparatus is configured to process a video, the video including a plurality of frames of the input image, the image processing apparatus further comprising:
the updating module is used for updating the corresponding relation according to the changed adjusting parameters when the adjusting parameters are changed;
the fourth obtaining module is configured to obtain the output pixel value according to the updated corresponding relationship and the input pixel value to obtain the output image.
15. The image processing apparatus according to claim 13, wherein the corresponding relationship is an exponential curve function or an S-curve function, and the third obtaining module is configured to obtain the exponential curve function or the S-curve function of the corresponding curvature according to the adjustment parameter.
16. The image processing apparatus according to claim 13, wherein the adjustment parameter includes a brightness adjustment parameter, the correspondence relationship includes a brightness correspondence relationship, and the third obtaining module is configured to obtain the brightness correspondence relationship according to the brightness adjustment parameter; the fourth obtaining module is configured to obtain the output pixel value according to the luminance correspondence and the input pixel value to obtain the output image.
17. The apparatus according to claim 16, wherein the luminance of the output image is greater than the luminance of the input image when the luminance adjustment parameter is greater than zero, and the luminance of the output image is less than the luminance of the input image when the luminance adjustment parameter is less than zero.
18. The image processing apparatus according to claim 13, wherein the adjustment parameter includes a contrast adjustment parameter, the correspondence includes a contrast correspondence, and the third obtaining module is configured to obtain the contrast correspondence according to the contrast adjustment parameter; the fourth obtaining module is configured to obtain the output pixel value according to the contrast corresponding relationship and the input pixel value to obtain the output image.
19. The apparatus according to claim 18, wherein the contrast of the output image is larger than the contrast of the input image when the contrast adjustment parameter is larger than zero, and the contrast of the output image is smaller than the contrast of the input image when the contrast adjustment parameter is smaller than zero.
20. The image processing apparatus according to claim 13, wherein the adjustment parameters include a brightness adjustment parameter and the contrast adjustment parameter, and the third obtaining module is configured to obtain a brightness correspondence according to the brightness adjustment parameter and a contrast correspondence according to the contrast parameter; the fourth obtaining module is configured to obtain an intermediate pixel value according to the brightness correspondence and the input pixel value, and obtain the output pixel value according to the contrast correspondence and the intermediate pixel value to obtain the output image.
21. The image processing apparatus according to claim 13, wherein the adjustment parameters include a brightness adjustment parameter and the contrast adjustment parameter, and the third obtaining module is configured to obtain a brightness correspondence according to the brightness adjustment parameter and a contrast correspondence according to the contrast parameter; the fourth obtaining module is configured to obtain an intermediate pixel value according to the contrast correspondence and the input pixel value, and obtain the output pixel value according to the brightness correspondence and the intermediate pixel value to obtain the output image.
22. The image processing apparatus according to claim 16, 20 or 21, wherein the luminance pairShould be in relation to
23. The image processing apparatus according to claim 18, 20 or 21, wherein the contrast correspondence is
24. The image processing apparatus according to claim 13, characterized by further comprising:
a generating module for generating a lookup table of the input pixel values and the output pixel values according to the correspondence;
the fourth obtaining module is configured to obtain the output pixel value according to the lookup table and the input pixel value to obtain the output image.
25. An electronic device, comprising a processor configured to:
obtaining an input image, the input image comprising a plurality of input pixel values;
acquiring an adjusting parameter;
acquiring the corresponding relation between the input pixel value and the output pixel value according to the adjusting parameter; and
and acquiring the output pixel value according to the corresponding relation and the input pixel value to obtain an output image.
26. The electronic device of claim 25, wherein the electronic device is configured to process a video, the video comprising a plurality of frames of the input image, and wherein the processor is configured to:
when the adjusting parameters are changed, updating the corresponding relation according to the changed adjusting parameters;
and acquiring the output pixel value according to the updated corresponding relation and the input pixel value to obtain the output image.
27. The electronic device of claim 25, wherein the corresponding relationship is an exponential curve function or an S-curve function, and the processor is configured to obtain the exponential curve function or the S-curve function of the corresponding curvature according to the adjustment parameter.
28. The electronic device of claim 25, wherein the adjustment parameter comprises a brightness adjustment parameter, wherein the correspondence comprises a brightness correspondence, and wherein the processor is configured to:
acquiring the brightness corresponding relation according to the brightness adjusting parameter;
and acquiring the output pixel value according to the brightness corresponding relation and the input pixel value to obtain the output image.
29. The electronic device of claim 25, wherein the brightness of the output image is greater than the brightness of the input image when the brightness adjustment parameter is greater than zero, and wherein the brightness of the output image is less than the brightness of the input image when the brightness adjustment parameter is less than zero.
30. The electronic device of claim 25, wherein the adjustment parameter comprises a contrast adjustment parameter, wherein the correspondence comprises a contrast correspondence, and wherein the processor is configured to:
acquiring the contrast corresponding relation according to the contrast adjusting parameter;
and acquiring the output pixel value according to the contrast corresponding relation and the input pixel value to obtain the output image.
31. The electronic device of claim 30, wherein the contrast of the output image is greater than the contrast of the input image when the contrast adjustment parameter is greater than zero, and wherein the contrast of the output image is less than the contrast of the input image when the contrast adjustment parameter is less than zero.
32. The electronic device of claim 25, wherein the adjustment parameters comprise a brightness adjustment parameter and the contrast adjustment parameter, and wherein the processor is configured to:
acquiring a brightness corresponding relation according to the brightness adjusting parameter;
obtaining a contrast corresponding relation according to the contrast parameter;
acquiring an intermediate pixel value according to the brightness corresponding relation and the input pixel value;
and acquiring the output pixel value according to the contrast corresponding relation and the intermediate pixel value to obtain the output image.
33. The electronic device of claim 25, wherein the adjustment parameters comprise a brightness adjustment parameter and the contrast adjustment parameter, and wherein the processor is configured to:
acquiring a brightness corresponding relation according to the brightness adjusting parameter;
obtaining a contrast corresponding relation according to the contrast parameter;
acquiring an intermediate pixel value according to the contrast corresponding relation and the input pixel value;
and acquiring the output pixel value according to the brightness corresponding relation and the intermediate pixel value to obtain the output image.
34. The electronic device of claim 28, 32 or 33, wherein the brightness correspondence is0≤x≤(2z-1), wherein y is the output pixel value, x is the input pixel value, b is the luma adjustment parameter, f (b) is a transfer function of the luma adjustment parameter, 0.5 ≦ f (b) ≦ 2, and z is a number of bits.
35. The electronic device of claim 30, 32 or 33, wherein the contrast mapping is
36. The electronic device of claim 25, wherein the processor is configured to:
generating a lookup table of the input pixel value and the output pixel value according to the corresponding relation;
and acquiring the output pixel value according to the lookup table and the input pixel value to obtain the output image.
37. A computer-readable storage medium, on which a computer program is stored, the computer program being executable by a processor to perform the image processing method of any one of claims 1 to 12.
38. A movable platform comprising a powered device and an electronic device as claimed in any one of claims 25 to 36.
Technical Field
The present invention relates to image processing technologies, and in particular, to an image processing method, an image processing apparatus, an electronic apparatus, and a computer-readable storage medium.
Background
In adjusting the image, the brightness, contrast, etc. of the image may be adjusted by the image pixels. When adjusting the brightness of an image, RGB of pixels of the image is generally converted into color spaces such as hsl (hsv), and the brightness is increased or decreased and then converted into RGB spaces.
Disclosure of Invention
Embodiments of the present invention provide an image processing method, an image processing apparatus, an electronic apparatus, and a computer-readable storage medium.
The image processing method of the present invention includes: obtaining an input image, the input image comprising a plurality of input pixel values; acquiring an adjusting parameter; acquiring the corresponding relation between the input pixel value and the output pixel value according to the adjusting parameter; and acquiring the output pixel value according to the corresponding relation and the input pixel value to obtain an output image.
The image processing device comprises a first acquisition module, a second acquisition module, a third acquisition module and a fourth acquisition module. The first acquisition module is configured to acquire an input image, where the input image includes a plurality of input pixel values. The second obtaining module is used for obtaining the adjusting parameters. And the third acquisition module is used for acquiring the corresponding relation between the input pixel value and the output pixel value according to the adjusting parameter. The fourth obtaining module is configured to obtain the output pixel value according to the corresponding relationship and the input pixel value to obtain an output image.
The electronic device of the embodiment of the invention comprises a processor, wherein the processor is used for: the method comprises the steps of obtaining an input image, wherein the input image comprises a plurality of input pixel values, obtaining an adjusting parameter, obtaining a corresponding relation between the input pixel values and the output pixel values according to the adjusting parameter, and obtaining the output pixel values according to the corresponding relation and the input pixel values to obtain an output image.
The computer-readable storage medium of an embodiment of the present invention has stored thereon a computer program executable by a processor to perform the above-described image processing method.
The embodiment of the invention provides an image processing method, an image processing device, an electronic device and a computer readable storage medium. In the image processing method, the corresponding relation between the input pixel value and the output pixel value is obtained according to the adjusting parameter, so that the input pixel value of the input image can be processed according to the corresponding relation to obtain the output image, namely the output image can be quickly obtained according to the adjusting parameter and the input image.
Additional aspects and advantages of embodiments of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of embodiments of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIGS. 1-3 are schematic flow diagrams of image processing methods according to certain embodiments of the invention;
FIGS. 4 and 5 are schematic diagrams of correspondences according to certain embodiments of the present invention;
FIGS. 6-10 are flow diagrams of image processing methods according to some embodiments of the invention;
FIGS. 11 and 12 are schematic diagrams of an image processing apparatus according to some embodiments of the invention;
FIG. 13 is a schematic view of an electronic device according to some embodiments of the invention;
FIG. 14 is a schematic diagram of a connection between an electronic device and a computer-readable storage medium according to some embodiments of the invention;
FIG. 15 is a schematic view of a movable platform of certain embodiments of the present invention.
Description of the drawings with the main elements symbols:
the
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
In the description of the present invention, it is to be understood that the terms "first", "second" and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; may be mechanically connected, may be electrically connected or may be in communication with each other; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
The following disclosure provides many different embodiments or examples for implementing different features of the invention. To simplify the disclosure of the present invention, the components and arrangements of specific examples are described below. Of course, they are merely examples and are not intended to limit the present invention. Furthermore, the present invention may repeat reference numerals and/or letters in the various examples, such repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed. In addition, the present invention provides examples of various specific processes and materials, but one of ordinary skill in the art may recognize applications of other processes and/or uses of other materials.
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
Referring to fig. 1, an image processing method according to an embodiment of the present invention includes:
01: acquiring an input image, the input image comprising a plurality of input pixel values;
02: acquiring an adjusting parameter;
03: acquiring a corresponding relation between an input pixel value and an output pixel value according to the adjusting parameters; and
04: and acquiring an output pixel value according to the corresponding relation and the input pixel value to obtain an output image.
The image processing method of the embodiment of the invention obtains the corresponding relation between the input pixel value and the output pixel value according to the adjusting parameter, so that the input pixel value of the input image can be processed according to the corresponding relation to obtain the output image, namely the output image can be quickly obtained according to the adjusting parameter and the input image.
In some embodiments, the obtaining of the input image may specifically be controlling an image collector (e.g., a camera) to collect the input image, where the input image may be a preview image or an image that is output by the image collector and then saved in a storage element. Therefore, after the image collector collects the input image, the input image can be rapidly processed according to the adjusting parameters to obtain the output image. It will be appreciated that in other embodiments, the input image may be obtained in other ways. For example, acquiring the input image may be reading the input image stored in the storage element. For another example, the obtaining of the input image may be downloading the input image from a server, and the like, and is not particularly limited herein.
In some embodiments, the number of input images may be one or more frames, and the input images may be visible light images, infrared images, X-ray images, or the like. The format of the input image includes, but is not limited to YUV, RGB, RAW, etc.
In some embodiments, the obtaining of the adjustment parameter may specifically be determining the adjustment parameter according to user input, for example, the user may input the adjustment parameter by text input, voice input, triggering a virtual key, and the like. It is understood that in other embodiments, the adjustment parameters may be obtained in other ways. For example, the adjustment parameter may be a preset parameter, the preset parameter is stored in the storage element in advance, and the preset parameter in the storage element may be directly read when the adjustment parameter is acquired. For another example, the input image may be preprocessed to obtain information of the input image, where the information of the input image may include, but is not limited to, brightness, color, and the like, and then the adjustment parameter is determined according to the information of the input image, which is not limited herein.
In some embodiments, the input image is an image of an RGB space, and the input pixel values include red channel pixel values, green channel pixel values, and blue channel pixel values, wherein the red channel pixel values, the green channel pixel values, and the blue channel pixel values share the same correspondence when the input image is processed with the adjustment parameters. In this way, a synchronous adjustment of the input image can be ensured without unreasonable changes in the color of the output image compared to the input image due to adjustment of only the pixel values of a particular channel.
In other embodiments, the image processing method according to the embodiments of the present invention may also process pixel values of only one channel, and is not limited herein.
Referring to fig. 2, in some embodiments, the image processing method is used for processing a video, where the video includes a plurality of frames of input images, and the image processing method further includes:
05: when the adjusting parameters are changed, updating the corresponding relation according to the changed adjusting parameters;
041: and acquiring an output pixel value according to the updated corresponding relation and the input pixel value to obtain an output image.
In particular, the image processing method of the embodiment of the invention can be used for processing video, wherein the video comprises a plurality of frames of input images. In the process of continuously playing the video, the embodiment of the invention can process the video by adjusting the parameters, and in the processing process, if the adjustment parameters are not changed (for example, the user does not input the adjustment parameters again), the video is processed according to the original adjustment parameters, and if the adjustment parameters are changed (for example, the user inputs the adjustment parameters again), the corresponding relationship can be updated in real time according to the changed adjustment parameters, so that the output pixel value is obtained according to the updated corresponding relationship and the input pixel value to obtain the output image. It should be noted that, when the resolution of a video is high, for example, a 1080P high definition video, the prior art has a slow processing speed for the video, and cannot meet the requirement of processing the video in real time during the playing process of the video, and the image processing method in the real time mode of the present invention can directly process the input image in the RGB space through the corresponding relationship, so that the processing speed is fast, and the real time processing requirement of the high definition video can be met.
Referring to fig. 3 to 5, in some embodiments, the correspondence relationship is an exponential curve function or an S-curve function, and step 03 includes:
031: and obtaining an exponential curve function or an S-curve function of the corresponding curvature according to the adjusting parameters.
Specifically, if a certain pixel value is directly added or subtracted to or from an input pixel value to obtain an output pixel value, a large amount of information of the input image is lost, so that the output image becomes flat and non-hierarchical. The image processing method of the embodiment of the invention can process the input image by adopting an exponential curve function or an S curve function, specifically, can obtain the exponential curve function or the S curve function of corresponding curvature according to the adjusting function, and then obtain the output pixel value according to the exponential curve function and the input pixel value, or obtain the output pixel value according to the S curve function and the input pixel value, and can enable the output pixel value to be more accurate through the exponential curve function or the S curve function, so that the layering sense of the output image is stronger.
Referring to fig. 6, in some embodiments, the adjustment parameter includes a brightness adjustment parameter, the correspondence includes a brightness correspondence, and step 03 includes:
032: acquiring a brightness corresponding relation according to the brightness adjusting parameter;
042: and acquiring an output pixel value according to the corresponding relation of the brightness and the input pixel value to obtain an output image.
Specifically, in some embodiments, in order to implement brightness adjustment of an input image, a user may input a brightness adjustment parameter, in the image processing method according to the embodiments of the present invention, a brightness correspondence relationship is obtained according to the brightness adjustment parameter, and then an output pixel value is obtained according to the brightness correspondence relationship and the input pixel value to obtain an output image, where the output image is an image with brightness adjusted, so that the user may quickly adjust the brightness of the input image by inputting the brightness adjustment parameter.
In some embodiments, when the brightness adjustment parameter is greater than zero, the brightness of the output image is greater than the brightness of the input image, and when the brightness adjustment parameter is less than zero, the brightness of the output image is less than the brightness of the input image, i.e., the brightness of the input image is increased by inputting a parameter greater than zero, and the brightness of the input image is decreased by inputting a parameter less than zero. In addition, the larger the brightness adjustment parameter is, the larger the brightness of an output image of the same input image is; the smaller the brightness adjustment parameter, the smaller the brightness of the output image of the same input image. Therefore, the setting of the brightness adjusting parameter is more in accordance with the adjusting logic of the user, and the user can more conveniently control the brightness of the output image by using the image processing method of the embodiment of the invention.
Of course, the above-described relationship of the luminance adjustment parameter, the input image, and the output image is merely an example. In other embodiments, the following may be possible: when the brightness adjusting parameter is less than zero, the brightness of the output image is greater than that of the input image, and when the brightness adjusting parameter is greater than zero, the brightness of the output image is less than that of the input image; or the following steps: when the brightness adjusting parameter is larger than the preset value, the brightness of the output image is larger than that of the input image, and when the brightness adjusting parameter is smaller than the preset value, the brightness of the output image is smaller than that of the input image, and the like, wherein the preset value can be any value different from zero. In addition, the larger the brightness adjustment parameter is, the smaller the brightness of the output image of the same input image can be; the smaller the brightness adjustment parameter is, the greater the brightness of the output image of the same input image may be, and is not particularly limited herein.
Referring to fig. 7, in some embodiments, the adjustment parameter includes a contrast adjustment parameter, the correspondence includes a contrast correspondence, and step 03 includes:
033: acquiring a contrast corresponding relation according to the contrast adjusting parameter;
043: and acquiring an output pixel value according to the contrast corresponding relation and the input pixel value to obtain an output image.
Specifically, the conventional contrast adjustment algorithm adopts a histogram equalization method, adjusts the gray value by using an accumulation function, performs nonlinear stretching on the image, and reallocates the pixel values of the image, so that the number of pixels in a certain gray scale range is approximately the same to realize contrast enhancement, and the conventional contrast adjustment process is complex, so that the adjustment speed is slow. In the embodiment of the present invention, in order to adjust the contrast of the input image, a user may input a contrast adjustment parameter, and the image processing method according to the embodiment of the present invention obtains a contrast correspondence according to the contrast adjustment parameter, and then obtains an output pixel value according to the contrast correspondence and the input pixel value to obtain an output image, where the output image is an image with an adjusted contrast. In this way, the user can quickly adjust the contrast of the input image by inputting the contrast adjustment parameter.
Referring again to fig. 5, in some embodiments, the contrast mapping relationship is a piecewise exponential curve function, for example, the piecewise exponential curve function includes two pieces of exponential curve functions, and the two pieces of exponential curve functions form an S-curve function. Obtaining the output pixel values using the S-curve function and the input pixel values may adjust the contrast of the output image.
In some embodiments, when the contrast adjustment parameter is greater than zero, the contrast of the output image is greater than the contrast of the input image, and when the contrast adjustment parameter is less than zero, the contrast of the output image is less than the contrast of the input image, i.e., the contrast of the input image is increased by inputting a parameter greater than zero, and the contrast of the input image is decreased by inputting a parameter less than zero. In addition, the larger the contrast adjustment parameter is, the larger the contrast of an output image of the same input image is; the smaller the contrast adjustment parameter, the smaller the contrast of the output image of the same input image. Therefore, the setting of the contrast adjusting parameter is more in accordance with the adjusting logic of the user, and the user can more conveniently control the contrast of the output image by using the image processing method of the embodiment of the invention.
Of course, the above-described relationship of the contrast adjustment parameter, the input image, and the output image is merely an example illustration. In other embodiments, the following may be possible: when the contrast adjusting parameter is less than zero, the contrast of the output image is greater than that of the input image, and when the contrast adjusting parameter is greater than zero, the contrast of the output image is less than that of the input image; or the following steps: when the contrast adjusting parameter is larger than a preset value, the contrast of the output image is larger than that of the input image, and when the contrast adjusting parameter is smaller than the preset value, the contrast of the output image is smaller than that of the input image, and the like, wherein the preset value can be any value which is not zero. In addition, the larger the contrast adjustment parameter is, the smaller the contrast of the output image of the same input image can be; the smaller the contrast adjustment parameter is, the greater the contrast of the output image of the same input image may be, and is not specifically limited herein.
Referring to fig. 8, in some embodiments, the adjusting parameters include a brightness adjusting parameter and a contrast adjusting parameter, and step 03 includes:
032: acquiring a brightness corresponding relation according to the brightness adjusting parameter;
033: obtaining a contrast corresponding relation according to the contrast parameter;
044: acquiring an intermediate pixel value according to the brightness corresponding relation and the input pixel value;
045: and acquiring an output pixel value according to the contrast corresponding relation and the intermediate pixel value to obtain an output image.
Specifically, in some embodiments, in order to achieve simultaneous adjustment of brightness and contrast of an input image, a user may input a brightness adjustment parameter and a contrast adjustment parameter, in the image processing method according to the embodiments of the present invention, a brightness correspondence relationship is obtained according to the brightness adjustment parameter, a contrast correspondence relationship is obtained according to the contrast adjustment parameter, an intermediate pixel value is obtained according to the brightness correspondence relationship and the input pixel value, and an output pixel value is obtained according to the contrast correspondence relationship and the intermediate pixel value to obtain an output image, that is, the input image is subjected to brightness adjustment and then contrast adjustment to obtain the output image, so that the user may quickly adjust the brightness and contrast of the input image by inputting the brightness adjustment parameter and the contrast adjustment parameter.
Referring to fig. 9, in some embodiments, the adjusting parameters include a brightness adjusting parameter and a contrast adjusting parameter, and step 03 includes:
032: acquiring a brightness corresponding relation according to the brightness adjusting parameter;
033: obtaining a contrast corresponding relation according to the contrast parameter;
046: acquiring an intermediate pixel value according to the contrast corresponding relation and the input pixel value;
047: and acquiring an output pixel value according to the corresponding relation of the brightness and the intermediate pixel value to obtain an output image.
Specifically, in some embodiments, in order to achieve simultaneous adjustment of brightness and contrast of an input image, a user may input a brightness adjustment parameter and a contrast adjustment parameter, in the image processing method according to the embodiments of the present invention, a brightness correspondence relationship is obtained according to the brightness adjustment parameter, a contrast correspondence relationship is obtained according to the contrast adjustment parameter, an intermediate pixel value is obtained according to the contrast correspondence relationship and an input pixel value, and an output pixel value is obtained according to the brightness correspondence relationship and the intermediate pixel value to obtain an output image, that is, the input image is subjected to contrast adjustment first and then brightness adjustment to obtain the output image, so that the user may quickly adjust the brightness and contrast of the input image by inputting the brightness adjustment parameter and the contrast adjustment parameter.
In some embodiments, the brightness correspondence relationship is
Wherein y is the output pixel value, x is the input pixel value, b is the brightness adjustment parameter, f (b) is the conversion function of the brightness adjustment parameter, 0.5 ≤ f (b) ≤ 2, and z is the number of bits. Specifically, the bit number z is greater than or equal to 8, the larger the value of z is, the larger the color range of the image is, and at the same time, the storage space required by the image is also increased, and the smaller the value of z is, the smaller the color range of the image is, and at the same time, the storage space required by the image is also reduced. In the embodiment of the present invention, when z is, for example, 8, the luminance correspondence relationship isf (b) can be set according to the needs of the user. In one embodiment, f (b) is 0.5-bThe value range of b is-1 to 1, and when b is greater than or equal to-1 and less than 0, the brightness of the output image is less than that of the input image; when b is 0, the luminance of the output image is equal to the luminance of the input image; when b is greater than 0 and less than or equal to 1, the luminance of the output image is greater than the luminance of the input image. In another embodiment, f (b) is 0.5bThe value range of b is-1 to 1, and when b is greater than or equal to-1 and less than 0, the brightness of the output image is greater than that of the input image; when b is 0, the luminance of the output image is equal to the luminance of the input image; when b is greater than 0 and less than or equal to 1, the luminance of the output image is less than the luminance of the input image. In another embodiment, f (b) is 0.5-b/100And b ranges from-100 to 100. Of course, the above embodiments are only examples, and f (b) may be set according to requirements.In this way, the user may input different ranges of brightness adjustment parameters according to different f (b), and may switch the control logic of the brightness adjustment parameters to the output image, where the control logic of the brightness adjustment parameters to the output image includes: the larger the brightness adjusting parameter is, the larger the brightness of an output image of the same input image is; the larger the brightness adjustment parameter is, the smaller the output image brightness of the same input image is, and the like.
In one embodiment, z is 8, f (b) is 0.5-bWhen b is 1, the brightness is related to
The input pixel value is, for example, the red channel pixel value r, and the output pixel value isIf the input pixel value is the green channel pixel value g, the output pixel value isThe input pixel value is the blue channel pixel value b, then the output pixel value isIn some embodiments, the contrast mapping is
Wherein y is the output pixel value, x is the input pixel value, c is the contrast adjustment parameter, f (c) is a transfer function of the contrast adjustment parameter,z is the number of bits. Specifically, the bit number z is more than or equal to 8, and the larger the value of z is, the color range of the image isThe larger the value of z is, the smaller the color range of the image is, and the smaller the memory space required by the image is. In the embodiment of the present invention, z is, for example, 8, and the contrast ratio isf (c) can be set according to the needs of the user. In one embodiment, f (c) 1.5cThe value range of b is-1 to 1, and when c is greater than or equal to-1 and less than 0, the contrast of the output image is less than that of the input image; when c is 0, the contrast of the output image is equal to that of the input image; when c is greater than 0 and less than or equal to 1, the contrast of the output image is greater than the contrast of the input image. In another embodiment, f (c) 1.5-cThe value range of c is-1 to 1, and when c is greater than or equal to-1 and less than 0, the contrast of the output image is greater than that of the input image; when c is 0, the contrast of the output image is equal to that of the input image; when c is greater than 0 and less than or equal to 1, the contrast of the output image is less than the contrast of the input image. In another embodiment, f (c) 1.5c/100And c ranges from-100 to 100. Of course, the above embodiments are only examples, and f (c) may be set according to requirements. In this way, the user can input contrast adjusting parameters in different ranges according to different f (c), and can switch the control logic of the contrast adjusting parameters to the output image, and the control logic of the contrast adjusting parameters to the output image includes, for example: the larger the contrast adjusting parameter is, the larger the output image contrast of the same input image is; the larger the contrast adjustment parameter, the smaller the output image contrast of the same input image, etc.
Referring to fig. 10, in some embodiments, the image processing method further includes:
06: generating a lookup table of input pixel values and output pixel values according to the corresponding relation;
048: and acquiring an output pixel value according to the lookup table and the input pixel value to obtain an output image.
Specifically, z is 8, f (b) is 0.5-bAnd b is 1, the brightness corresponding relationship is
Generating a lookup table according to the brightness correspondence, where the lookup table is, for example: when x is equal to 1, the reaction solution is,when x is equal to 2, the reaction solution is,…, respectively; when x is 255, y is 255, where when y is not an integer, the rounding operation may be performed by rounding, rounding up, rounding down, specifically, in the embodiment of the present invention, rounding y by rounding up, and when x is 1, y is 2; when x is 2, y is 4; …, respectively; when x equals 255, y equals 255. Therefore, the output pixel value corresponding to the input pixel value can be searched through the lookup table, so that unnecessary data processing processes are reduced, and the acquisition of the output pixel value is quicker.In some embodiments, the lookup table is a one-dimensional lookup table, which may default to x, where, for example, the default x varies from 1 to 2z-1. The one-dimensional look-up table may allow for a smaller memory space required for the look-up table.
Referring to fig. 11, an
It should be noted that the above description of the image processing method is also applicable to the
The
Referring to fig. 12, in some embodiments, the
Referring again to fig. 11, in some embodiments, the corresponding relationship is an exponential curve function or an S-curve function. Step 031 may be implemented by the third obtaining
In some embodiments, the adjustment parameter comprises a brightness adjustment parameter and the correspondence comprises a brightness correspondence. Step 032 may be implemented by the third obtaining
In some embodiments, the brightness of the output image is greater than the brightness of the input image when the brightness adjustment parameter is greater than zero, and the brightness of the output image is less than the brightness of the input image when the brightness adjustment parameter is less than zero.
In some embodiments, the adjustment parameter comprises a contrast adjustment parameter and the correspondence comprises a contrast correspondence. Step 033 may be implemented by the third obtaining
In some embodiments, the contrast of the output image is greater than the contrast of the input image when the contrast adjustment parameter is greater than zero, and the contrast of the output image is less than the contrast of the input image when the contrast adjustment parameter is less than zero.
In some embodiments, the adjustment parameters include a brightness adjustment parameter and a contrast adjustment parameter.
In some embodiments, the adjustment parameters include a brightness adjustment parameter and a contrast adjustment parameter.
In some embodiments, the brightness correspondence relationship is
Wherein y is the output pixel value, x is the input pixel value, b is the brightness adjustment parameter, f (b) is the conversion function of the brightness adjustment parameter, 0.5 ≤ f (b) ≤ 2, and z is the number of bits.In some embodiments, the contrast mapping is
Wherein y is the output pixel value, x is the input pixel value, c is the contrast adjustment parameter, f (c) is a transfer function of the contrast adjustment parameter,z is the number of bits.Referring again to fig. 12, in some embodiments, the
It should be noted that the above description of the image processing method is also applicable to the
The division of the modules in the
Referring to fig. 13, an
It should be noted that the above description of the image processing method is also applicable to the
The
The
In some embodiments, the
In some embodiments, the correspondence is an exponential curve function or an S-curve function. Step 031 may be implemented by
In some embodiments, the adjustment parameter comprises a brightness adjustment parameter and the correspondence comprises a brightness correspondence. Step 032 and step 042 may be implemented by
In some embodiments, the brightness of the output image is greater than the brightness of the input image when the brightness adjustment parameter is greater than zero, and the brightness of the output image is less than the brightness of the input image when the brightness adjustment parameter is less than zero.
In some embodiments, the adjustment parameter comprises a contrast adjustment parameter and the correspondence comprises a contrast correspondence.
In some embodiments, the contrast of the output image is greater than the contrast of the input image when the contrast adjustment parameter is greater than zero, and the contrast of the output image is less than the contrast of the input image when the contrast adjustment parameter is less than zero.
In some embodiments, the adjustment parameters include a brightness adjustment parameter and a contrast adjustment parameter.
In some embodiments, the adjustment parameters include a brightness adjustment parameter and a contrast adjustment parameter.
In some embodiments, the brightness correspondence relationship is
Wherein y is the output pixel value, x is the input pixel value, b is the brightness adjustment parameter, f (b) is the conversion function of the brightness adjustment parameter, 0.5 ≤ f (b) ≤ 2, and z is the number of bits.In some embodiments, the contrast mapping is
Wherein y is the output pixel value, x is the input pixel value, c is the contrast adjustment parameter, f (c) is a transfer function of the contrast adjustment parameter,z is the number of bits.In certain embodiments, steps 06 and 048 may be implemented by
It should be noted that the above description of the image processing method is also applicable to the
Referring to fig. 14, a computer-
For example, the computer program may be executable by the
01: acquiring an input image, the input image comprising a plurality of input pixel values;
02: acquiring an adjusting parameter;
03: acquiring a corresponding relation between an input pixel value and an output pixel value according to the adjusting parameters; and
04: and acquiring an output pixel value according to the corresponding relation and the input pixel value to obtain an output image.
As another example, the computer program may also be executable by the
05: when the adjusting parameters are changed, updating the corresponding relation according to the changed adjusting parameters;
041: and acquiring an output pixel value according to the updated corresponding relation and the input pixel value to obtain an output image.
Referring to fig. 15, a
In the description herein, references to the description of the terms "one embodiment," "some embodiments," "an illustrative embodiment," "an example," "a specific example," or "some examples" or the like mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps in the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, such as an ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, various steps or methods may be performed by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for performing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried out in the above method may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be executed in the form of hardware or in the form of a software functional module. The integrated module, if executed in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.
- 上一篇:一种医用注射器针头装配设备
- 下一篇:竞技比赛视频的字幕处理方法和导播系统