Image editing method and device, and storage medium
By using the curve adjustment method of the two-color space during the image editing process, the problem that curve adjustment cannot take into account both color, brightness and saturation is solved, the effect of image editing is improved, and the generated image quality is higher.
Patent Information
- Application Number
- PCT/CN2024/096914
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-06-01
- Filing Date
- 2024-06-01
- Publication Date
- 2024-12-05
AI Technical Summary
During the image editing process, curve adjustment usually cannot take into account both color, brightness and saturation, resulting in low image quality and inability to meet user needs.
By converting the image to be edited to the first color space containing the brightness channel for brightness adjustment, and then converting the image to the second color space for color and saturation adjustment, a curve adjustment method of the two-color space is adopted to take into account both color, brightness and Saturation.
The image adjustment effect is improved, the generated image quality is higher, and it can better meet the color adjustment needs of users.
Smart Images

Figure CN2024096914_05122024_PF_FP_ABST
Abstract
Description
Image editing method, device and storage medium
[0001] This application claims priority to the Chinese invention patent application entitled “Image Editing Method, Device and Storage Medium” and application number 202310645329.2 filed on June 1, 2023, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present disclosure relate to the field of computer and network communication technology, and more particularly to an image editing method, device, and storage medium. Background Art
[0003] In image editing scenarios, curve adjustment is a common color adjustment method. Various image / video color grading software usually provide a curve adjustment function for users to adjust the color of the image.
[0004] When using curve adjustment, a one-dimensional color mapping table with a length of 256 is typically used to map the original image colors to new color values, thereby achieving color adjustment. However, during the curve adjustment process, factors such as color, brightness, and saturation are usually not taken into account simultaneously, resulting in low-quality color adjustment that fails to meet user needs.
[0005] Summary of the Invention
[0006] The embodiments of the present disclosure provide an image editing method, device, and storage medium, which can simultaneously take into account factors such as color, brightness, and saturation when adjusting an image, thereby improving the effect of image adjustment.
[0007] In a first aspect, an embodiment of the present disclosure provides an image editing method, comprising: in response to an editing instruction for an image to be edited, converting the image to be edited to a first color space to obtain a first image; wherein the first color space includes a brightness channel; adjusting the first image in the brightness channel according to a first adjustment curve to obtain a second image; converting the second image to a second color space to obtain a third image; and adjusting the third image according to a second adjustment curve to obtain a target image.
[0008] In a second aspect, an embodiment of the present disclosure provides an image editing device, comprising: a conversion unit, for converting the image to be edited into a first color space in response to an editing instruction for the image to be edited, to obtain a first image; wherein the first color space includes a brightness channel; a first adjustment unit, for adjusting the first image in the brightness channel according to a first adjustment curve, to obtain a second image; the conversion unit is also for converting the second image into a second color space, to obtain a third image; a second adjustment unit, for adjusting the third image according to the second adjustment curve, to obtain a target image.
[0009] In a third aspect, an embodiment of the present disclosure provides an electronic device comprising: at least one processor and a memory; the memory stores computer-executable instructions; the at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the image editing method described in the first aspect and various possible designs of the first aspect.
[0010] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the image editing method described in the first aspect and various possible designs of the first aspect is implemented.
[0011] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, comprising computer-executable instructions. When a processor executes the computer-executable instructions, the image editing method as described in the first aspect and various possible designs of the first aspect is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0013] FIG1 is an example diagram of a curve adjustment in the prior art;
[0014] FIG2 is a flow chart of an image editing method according to an embodiment of the present disclosure;
[0015] FIG3 is a flow chart of an image editing method provided by another embodiment of the present disclosure;
[0016] FIG4 is a schematic diagram of an interface for selecting a target adjustment gear according to an embodiment of the present disclosure;
[0017] FIG5 is a flow chart of an image editing method provided by another embodiment of the present disclosure;
[0018] FIG6 is a structural block diagram of an image editing device provided by an embodiment of the present disclosure;
[0019] FIG7 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0021] When using curve adjustment, a one-dimensional color mapping table with a length of 256 (which can be represented as an adjustment curve) is usually used to map the original image colors to new color values, thereby achieving the purpose of color adjustment. For example, as shown in Figure 1, the left side is the original image without adjustment (its adjustment curve 1 is y=x, x is the original color value, and y is the new color value after adjustment), while the right side uses adjustment curve 2 to adjust the original image. The original image's colors are mapped according to adjustment curve 2. The horizontal axis of adjustment curve 2 is the original color value, and the vertical axis is the new color value after adjustment.
[0022] However, curve adjustment is typically performed in a single color space, particularly the RGB color space. During the curve adjustment process, factors such as color, brightness, and saturation are often not taken into account simultaneously. Curve adjustment of color can easily lead to drastic changes in brightness and / or saturation, which are difficult to control, resulting in low image quality and a failure to meet user needs.
[0023] To address the above technical issues, the present disclosure provides an image editing method. In response to an editing instruction for an image to be edited, the method converts the image to be edited into a first color space to obtain a first image; wherein the first color space includes a luminance channel; the method adjusts the first image in the luminance channel according to a first adjustment curve to obtain a second image; the method converts the second image to a second color space to obtain a third image; and the method adjusts the third image according to the second adjustment curve to obtain a target image. By performing image adjustment in dual color spaces, factors such as color, brightness, and saturation can be simultaneously taken into account, thereby improving the image adjustment effect and producing a higher-quality image.
[0024] The image editing method disclosed herein is applied in image editing scenarios and can be applied to any electronic device that can be used for image editing, such as a terminal device or a server. The terminal device is not limited to a smartphone, tablet computer, laptop computer, wearable device, etc.
[0025] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0026] The image editing method disclosed herein will be described in detail below with reference to specific embodiments.
[0027] Refer to Figure 2, which is a flow chart of an image editing method provided by an embodiment of the present disclosure. The method of this embodiment can be applied in a terminal device or a server, and the image editing method includes:
[0028] S201 . In response to an editing instruction for an image to be edited, convert the image to be edited into a first color space to obtain a first image; wherein the first color space includes a brightness channel.
[0029] In this embodiment, when a user edits an image to be edited, the image to be edited can be first converted to a first color space to obtain a corresponding first image, wherein the first color space includes a luminance channel (or brightness channel) to facilitate brightness adjustment of the image on the luminance channel. The first color space includes, but is not limited to, HSV color space (Hue, Saturation, Value), HSL (Hue, Saturation, Lightness), HSI (Hue, Saturation, Intensity), Lab (Lab color space, color-opponent space), etc.
[0030] In some embodiments, since typical display devices display images in the RGB color space, the image to be edited can be an image captured by a user or acquired and displayed through other means. Therefore, the image to be edited can be an image in the RGB color space. Of course, this embodiment does not limit the color space of the image to be edited. Furthermore, any feasible color space conversion method can be used to convert the image to the first color space, and this embodiment does not impose any restrictions.
[0031] S202: Adjust the first image in a brightness channel according to a first adjustment curve to obtain a second image.
[0032] In this embodiment, after the image to be edited is converted into a first image in a first color space, the first image can be curve-adjusted in the brightness channel of the first color space to obtain a second image, and the curve based on the preset first adjustment curve can better achieve image brightness adjustment.
[0033] Specifically, the brightness channel data of the first image may be extracted, and the brightness channel data may be adjusted using a first adjustment curve to obtain adjusted brightness channel data, which may then replace the original brightness channel data of the first image.
[0034] S203: Convert the second image into a second color space to obtain a third image.
[0035] In this embodiment, in order to make the image editing process take into account factors such as brightness, color, and saturation, after the brightness is adjusted in the first color space, the obtained second image can be converted to the second color space for color and saturation adjustment, wherein the second color space can be an RGB color space. Since the display device can display images in the RGB space, the adjustment in the RGB color space can intuitively display the changes in the image before and after the adjustment, which is convenient for the user to view the adjustment effect. Of course, the second color space can also be other color spaces. In addition, the second image after the brightness is adjusted in the first color space will have a certain degree of undersaturation. In the second color space, the color and saturation can be adjusted simultaneously to achieve the expected color adjustment effect and saturation adjustment effect, so that the color and saturation are also taken into account.
[0036] In this embodiment, any feasible color space conversion method may be used to convert the second image into the second color space, and this embodiment does not impose any limitation thereto.
[0037] S204: Adjust the third image according to the second adjustment curve to obtain a target image.
[0038] In this embodiment, the third image can be adjusted according to the second adjustment curve in the second color space to finally obtain the target image, thereby achieving a balance between brightness, color, saturation and other factors in the image editing process.
[0039] Specifically, multiple channels of the third image in the second color space may be adjusted simultaneously using a second adjustment curve, or any one or more channels may be adjusted separately using different adjustment curves.
[0040] Furthermore, the target image can be output, for example, displayed on a display device. In some embodiments, if the second color space is not an RGB color space, the target image can be converted to an RGB color space before being displayed.
[0041] The image editing method provided in this embodiment converts the image to be edited into a first color space in response to an editing instruction for the image to be edited, thereby obtaining a first image; wherein the first color space includes a luminance channel; adjusts the first image in the luminance channel according to a first adjustment curve to obtain a second image; converts the second image to a second color space to obtain a third image; and adjusts the third image according to the second adjustment curve to obtain a target image. By performing image adjustment in dual color spaces, factors such as color, brightness, and saturation can be simultaneously considered, thereby improving the image adjustment effect and producing a higher-quality image.
[0042] Based on any embodiment, as shown in FIG3 , the step of adjusting the first image in the brightness channel according to the first adjustment curve in S202 includes:
[0043] S301: Acquire a dark area of the first image.
[0044] S302: Adjust the dark area of the first image in the brightness channel according to the first adjustment curve.
[0045] In this embodiment, considering that darker areas of an image have a greater impact on the viewing experience, the first image can be divided into dark and bright areas. During the brightness adjustment process, only the dark areas of the first image are adjusted in the brightness channel according to the first adjustment curve, which can effectively improve the image viewing experience. At the same time, because bright areas are prone to color banding when adjusted, such as relatively pure colors or color gradients (such as the sky, the sun halo, etc.), this embodiment does not adjust the brightness of bright areas, which also largely avoids color banding in bright areas.
[0046] In some embodiments, any feasible division method may be used to divide the dark area and the bright area, for example, a preset dark mask is used to obtain the dark area.
[0047] Based on the above embodiment, S302 adjusting the dark area of the first image in the brightness channel according to the first adjustment curve may specifically include: if the editing instruction is a positive adjustment instruction, determining the first adjustment curve for positive adjustment; increasing the brightness of the dark area of the first image in the brightness channel according to the first adjustment curve; or if the editing instruction is a negative adjustment instruction, determining the first adjustment curve for negative adjustment; reducing the brightness of the dark area of the first image in the brightness channel according to the first adjustment curve.
[0048] In this embodiment, brightness adjustment is divided into increasing and decreasing brightness based on the initial brightness. Increasing brightness is a positive adjustment to brightness, while decreasing brightness is a negative adjustment to brightness. Different first adjustment curves are used for different adjustment directions. That is, the first adjustment curve can be divided into a first adjustment curve for positive adjustment and a first adjustment curve for negative adjustment. Whether the adjustment is positive or negative can be determined based on the editing instruction. If the adjustment is positive, the first adjustment curve for positive adjustment is used to increase the brightness of the dark areas of the first image in the brightness channel. If the adjustment is negative, the first adjustment curve for negative adjustment is used to decrease the brightness of the dark areas of the first image in the brightness channel.
[0049] Similarly, the adjustment of the third image according to the second adjustment curve described in S204 is also divided into positive adjustment and negative adjustment. Different second adjustment curves are used for different adjustment directions, that is, the second adjustment curve can also be divided into a second adjustment curve for positive adjustment and a second adjustment curve for negative adjustment. Similarly, whether the adjustment is positive or negative can be determined based on the editing instruction. If it is determined to be positive adjustment, the second adjustment curve for positive adjustment is used to adjust the third image. If it is determined to be negative adjustment, the second adjustment curve for negative adjustment is used to adjust the third image.
[0050] Based on any of the above embodiments, since bright areas are prone to color banding during adjustment, when adjusting the third image according to the second adjustment curve, the bright areas of the third image may be adjusted slightly or not at all. To achieve slight or no adjustment of the bright areas of the third image, the shape of the second adjustment curve can be preconfigured, whereby portions of the second adjustment curve with larger abscissa values (greater than a preset threshold) have their adjustment amplitude reduced or set to zero.
[0051] Based on the above embodiments, different adjustment curves can generally be used to achieve varying degrees of image adjustment effects. For example, when adjusting the brightness channel of a first image according to a first adjustment curve, using different first adjustment curves can achieve varying degrees of brightness adjustment effects. When adjusting a third image according to a second adjustment curve, using different second adjustment curves can also achieve varying degrees of adjustment effects. Setting different adjustment curves offers a high degree of flexibility. If the user sets the adjustment curves themselves, the adjustment effect is highly dependent on their experience. Inexperienced users may not be able to effectively set adjustment curves. Therefore, in this embodiment, different preset adjustment levels can be configured, and a different first and second adjustment curves can be assigned to each preset adjustment level. More specifically, preset adjustment levels can be assigned separately for positive and negative adjustment. For example, positive adjustment can be divided into 100 levels, and negative adjustment can be divided into 100 levels, with each preset adjustment level assigned a different first and second adjustment curves. Specifically, as shown in FIG4 , a slider control (or other control) can be used to allow the user to select a target adjustment level from the preset adjustment levels, and the first and second adjustment curves corresponding to the target adjustment level can then be automatically selected.
[0052] Furthermore, before adjusting the first image in the brightness channel according to the first adjustment curve, S202 also includes: responding to an adjustment gear selection instruction, determining a target adjustment gear from a plurality of preset adjustment gears, and then selecting the corresponding first adjustment curve and second adjustment curve according to the target adjustment gear, for use in subsequent adjustment processes according to the first adjustment curve and the second adjustment curve corresponding to the target adjustment gear.
[0053] On the basis of the above embodiment, different first adjustment curves and second adjustment curves corresponding to different preset adjustment gears may be obtained first.
[0054] Optionally, the same method may be used to obtain the first and second adjustment curves corresponding to different preset adjustment gears, including the same method used to obtain the first adjustment curve for positive adjustment, the first adjustment curve for negative adjustment, the second adjustment curve for positive adjustment, and the second adjustment curve for negative adjustment corresponding to different preset adjustment gears. For any adjustment curve at different preset adjustment gears, the method is shown in FIG5 and may include:
[0055] S401: For any one of the first adjustment curve and the second adjustment curve, obtain a plurality of preset key points of the adjustment curve corresponding to the highest preset adjustment level in the adjustment curve, and generate an adjustment curve corresponding to the highest preset adjustment level according to the plurality of preset key points.
[0056] S402. Determine, based on the multiple preset key points and the total number of preset adjustment levels of the adjustment curve, multiple target key points of the adjustment curve corresponding to any preset adjustment level in the adjustment curve, and generate, based on the multiple target key points, an adjustment curve corresponding to any preset adjustment level.
[0057] In this embodiment, for any adjustment curve, multiple preset key points of the adjustment curve corresponding to the highest preset adjustment gear can be predetermined, and the number of preset key points can be set according to actual conditions. For example, as shown in Table 1:
[0058] Table 1
[0059] The horizontal axis represents the value before adjustment, and the vertical axis represents the value after adjustment. Since the horizontal and vertical coordinates are equal when the image is unadjusted, in the various adjustment curves of this embodiment, except for (0,0) and (255,255), the vertical coordinate value of each preset key point during positive adjustment is generally not less than the horizontal coordinate value. During negative adjustment, the vertical coordinate value of each preset key point is generally not greater than the horizontal coordinate value. Of course, the horizontal and vertical coordinates of each preset key point can be set according to actual conditions and are not limited to the above rules.
[0060] Furthermore, for a plurality of preset key points of the adjustment curve corresponding to the highest preset adjustment level in any adjustment curve, curve fitting may be performed based on the preset key points to generate the adjustment curve corresponding to the highest preset adjustment level.
[0061] For the adjustment curves corresponding to the remaining preset adjustment levels of the adjustment curve, multiple target key points for the adjustment curve corresponding to any preset adjustment level in the adjustment curve can be determined based on the multiple preset key points of the adjustment curve corresponding to the highest preset adjustment level and the total number of preset adjustment levels of the adjustment curve. Curve fitting is then performed based on these target key points to generate the adjustment curve corresponding to any preset adjustment level.
[0062] Optionally, when determining multiple target key points of the adjustment curve corresponding to any preset adjustment level in the adjustment curve, for each preset key point, linear interpolation may be performed between the preset key point and the corresponding reference point based on the total number of preset adjustment levels to determine the target key point of the adjustment curve corresponding to the preset adjustment level in the adjustment curve. In some embodiments, the reference point corresponding to the preset key point is a point on the reference curve of the image without adjustment that has the same horizontal coordinate as the preset key point.
[0063] In this embodiment, based on the reference curve (y=x, that is, the ordinate is equal to the abscissa) when the image is not adjusted, a point corresponding to any preset key point (x j ,yj ) points with the same horizontal coordinate (x j ,x j ) as its reference point. At the preset key point (x j ,y j ) and the reference point (x j ,x j ) between the preset adjustment gears and perform linear interpolation according to the total number of preset adjustment gears to obtain the target key points of the adjustment curve corresponding to each preset adjustment gear, that is, each horizontal coordinate is still x j , the vertical coordinate is x j and y j Specifically, if the total number of preset adjustment gears is n, for the i-th preset adjustment gear, the preset key point (x j ,y j ) corresponds to the target key point (x j ,y i ), ordinate y i Calculated by the following formula: i =x j +(i / n)*(y j -x j )
[0064] According to the above process, the target key points corresponding to the preset key points in each preset adjustment gear can be calculated, and then the adjustment curve corresponding to each preset adjustment gear can be generated through curve fitting.
[0065] Based on the above embodiment, since the number of given preset key points is limited and the curve fitting effect is poor, when S401 generates the adjustment curve corresponding to the highest preset adjustment gear based on the multiple preset key points, curve interpolation can be performed between the multiple preset key points (for example, using spline interpolation), and the adjustment curve corresponding to the highest preset adjustment gear is generated based on the interpolation points and the multiple preset key points to improve the curve fitting effect.
[0066] Similarly, since the number of target key points obtained by calculation is also limited, the curve fitting effect is poor. Therefore, when generating the adjustment curve corresponding to any preset adjustment level based on the multiple target key points in S402, curve interpolation (for example, using spline interpolation) can also be performed between the multiple target key points. The adjustment curve corresponding to any preset adjustment level is generated based on the interpolation points and the multiple target key points.
[0067] Based on the above embodiment, the total number of preset adjustment gears can be determined by the user. That is, in response to the total number of preset adjustment gears input by the user, the process of obtaining different first adjustment curves and second adjustment curves corresponding to different preset adjustment gears in the above embodiment is performed.
[0068] The image editing method, device, and storage medium provided by the disclosed embodiments convert the image to be edited into a first color space in response to an editing instruction for the image to be edited, thereby obtaining a first image; wherein the first color space includes a luminance channel; the first image is adjusted in the luminance channel according to a first adjustment curve to obtain a second image; the second image is converted to a second color space to obtain a third image; and the third image is adjusted according to the second adjustment curve to obtain a target image. By performing image adjustment in dual color spaces, factors such as color, brightness, and saturation can be simultaneously taken into account, thereby improving the image adjustment effect and obtaining a higher-quality image.
[0069] Corresponding to the image editing method described in the preceding embodiment, FIG6 is a block diagram of the image editing device provided in the present embodiment. For ease of illustration, only the portions relevant to the present embodiment are shown. Referring to FIG6 , the image editing device 600 includes a conversion unit 601, a first adjustment unit 602, and a second adjustment unit 603.
[0070] The conversion unit 601 is configured to convert the image to be edited into a first color space to obtain a first image in response to an editing instruction for the image to be edited; wherein the first color space includes a brightness channel.
[0071] The first adjustment unit 602 is configured to adjust the first image in a brightness channel according to a first adjustment curve to obtain a second image.
[0072] The conversion unit 601 is further configured to convert the second image into a second color space to obtain a third image.
[0073] The second adjustment unit 603 is configured to adjust the third image according to a second adjustment curve to obtain a target image.
[0074] In one or more embodiments of the present disclosure, when the first adjustment unit 602 adjusts the first image in the brightness channel according to the first adjustment curve, it is used to: obtain the dark area of the first image; and adjust the dark area of the first image in the brightness channel according to the first adjustment curve.
[0075] In one or more embodiments of the present disclosure, when adjusting the dark area of the first image in the brightness channel according to the first adjustment curve, the first adjustment unit 602 is used to: if the editing instruction is a positive adjustment instruction, determine the first adjustment curve for positive adjustment; increase the brightness of the dark area of the first image in the brightness channel according to the first adjustment curve; or if the editing instruction is a negative adjustment instruction, determine the first adjustment curve for negative adjustment; and reduce the brightness of the dark area of the first image in the brightness channel according to the first adjustment curve.
[0076] In one or more embodiments of the present disclosure, before adjusting the first image in the brightness channel according to the first adjustment curve, the first adjustment unit 602 is further used to: determine a target adjustment gear from a plurality of preset adjustment gears in response to an adjustment gear selection instruction, wherein different preset adjustment gears correspond to different first adjustment curves and second adjustment curves; select the corresponding first adjustment curve according to the target adjustment gear; and the second adjustment unit 603 is further used to select the corresponding second adjustment curve according to the target adjustment gear.
[0077] In one or more embodiments of the present disclosure, the device further includes: an adjustment curve acquisition unit 604, configured to acquire different first adjustment curves and second adjustment curves corresponding to different preset adjustment gears.
[0078] In one or more embodiments of the present disclosure, when acquiring different first and second adjustment curves corresponding to different preset adjustment gears, the adjustment curve acquisition unit 604 is used to: for any one of the first and second adjustment curves, acquire multiple preset key points of the adjustment curve corresponding to the highest preset adjustment gear in the adjustment curve, and generate the adjustment curve corresponding to the highest preset adjustment gear based on the multiple preset key points; determine multiple target key points of the adjustment curve corresponding to any preset adjustment gear in the adjustment curve based on the multiple preset key points and the total number of preset adjustment gears of the adjustment curve, and generate the adjustment curve corresponding to any preset adjustment gear based on the multiple target key points.
[0079] In one or more embodiments of the present disclosure, when the adjustment curve acquisition unit 604 determines multiple target key points of the adjustment curve corresponding to any preset adjustment level in the adjustment curve based on the multiple preset key points and the total number of preset adjustment levels of the adjustment curve, it is used to: for any preset key point, perform linear interpolation between the preset key point and the corresponding reference point according to the total number of preset adjustment levels to determine the target key point of the adjustment curve corresponding to any preset adjustment level in the adjustment curve, wherein the reference point corresponding to the preset key point is a point on the reference curve when the image is not adjusted that has the same horizontal coordinate as the preset key point.
[0080] In one or more embodiments of the present disclosure, when the adjustment curve acquisition unit 604 generates the adjustment curve corresponding to the highest preset adjustment gear according to the multiple preset key points, it is used to: perform curve interpolation between the multiple preset key points, and generate the adjustment curve corresponding to the highest preset adjustment gear according to the interpolation point and the multiple preset key points; the generation of the adjustment curve corresponding to any preset adjustment gear according to the multiple target key points includes: performing curve interpolation between the multiple target key points, and generating the adjustment curve corresponding to any preset adjustment gear according to the interpolation point and the multiple target key points.
[0081] In one or more embodiments of the present disclosure, the first color space includes HSV color space, HSL color space, HSI color space, or Lab color space; and the second color space is RGB color space.
[0082] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.
[0083] Referring to FIG7 , a schematic diagram of the structure of an electronic device 700 suitable for implementing an embodiment of the present disclosure is shown. The electronic device 700 may be a terminal device or a server. The terminal device may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle-mounted terminals (e.g., vehicle-mounted navigation terminals), and fixed terminals such as digital TVs and desktop computers. The electronic device shown in FIG7 is merely an example and should not limit the functionality and scope of use of the embodiments of the present disclosure.
[0084] As shown in FIG7 , the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the electronic device 700 are also stored in the RAM 703. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0085] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although FIG. 7 shows an electronic device 700 having various devices, it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0086] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 709, or installed from the storage device 708, or installed from the ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0087] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0088] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0089] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0090] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet Service Provider).
[0091] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0092] The units involved in the embodiments described in this disclosure may be implemented in software or hardware. In some cases, the name of a unit does not limit the unit itself. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses."
[0093] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0094] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0095] In a first aspect, according to one or more embodiments of the present disclosure, there is provided an image editing method, comprising: in response to an editing instruction for an image to be edited, converting the image to be edited to a first color space to obtain a first image; wherein the first color space includes a brightness channel; adjusting the first image in the brightness channel according to a first adjustment curve to obtain a second image; converting the second image to a second color space to obtain a third image; and adjusting the third image according to the second adjustment curve to obtain a target image.
[0096] According to one or more embodiments of the present disclosure, adjusting the first image in the brightness channel according to the first adjustment curve includes: acquiring a dark area of the first image; and adjusting the dark area of the first image in the brightness channel according to the first adjustment curve.
[0097] According to one or more embodiments of the present disclosure, the adjusting the dark area of the first image in the brightness channel according to the first adjustment curve includes: if the editing instruction is a positive adjustment instruction, determining the first adjustment curve for positive adjustment; increasing the brightness of the dark area of the first image in the brightness channel according to the first adjustment curve; or if the editing instruction is a negative adjustment instruction, determining the first adjustment curve for negative adjustment; reducing the brightness of the dark area of the first image in the brightness channel according to the first adjustment curve.
[0098] According to one or more embodiments of the present disclosure, before adjusting the first image in the brightness channel according to the first adjustment curve, the method further includes: determining a target adjustment gear from a plurality of preset adjustment gears in response to an adjustment gear selection instruction, wherein different preset adjustment gears correspond to different first adjustment curves and second adjustment curves; and selecting the corresponding first adjustment curve and second adjustment curve according to the target adjustment gear.
[0099] According to one or more embodiments of the present disclosure, the method further includes: obtaining different first adjustment curves and second adjustment curves corresponding to different preset adjustment gears.
[0100] According to one or more embodiments of the present disclosure, obtaining different first and second adjustment curves corresponding to different preset adjustment gears includes: for any one of the first and second adjustment curves, obtaining multiple preset key points of the adjustment curve corresponding to the highest preset adjustment gear in the adjustment curve, and generating the adjustment curve corresponding to the highest preset adjustment gear based on the multiple preset key points; determining multiple target key points of the adjustment curve corresponding to any preset adjustment gear in the adjustment curve based on the multiple preset key points and the total number of preset adjustment gears of the adjustment curve, and generating the adjustment curve corresponding to any preset adjustment gear based on the multiple target key points.
[0101] According to one or more embodiments of the present disclosure, the method of determining multiple target key points of the adjustment curve corresponding to any preset adjustment level in the adjustment curve based on the multiple preset key points and the total number of preset adjustment levels of the adjustment curve includes: for any preset key point, performing linear interpolation between the preset key point and the corresponding reference point based on the total number of preset adjustment levels to determine the target key point of the adjustment curve corresponding to any preset adjustment level in the adjustment curve, wherein the reference point corresponding to the preset key point is a point on the reference curve when the image is not adjusted that has the same horizontal coordinate as the preset key point.
[0102] According to one or more embodiments of the present disclosure, generating an adjustment curve corresponding to the highest preset adjustment gear according to the multiple preset key points includes: performing curve interpolation between the multiple preset key points, and generating an adjustment curve corresponding to the highest preset adjustment gear according to the interpolation point and the multiple preset key points; generating an adjustment curve corresponding to any preset adjustment gear according to the multiple target key points includes: performing curve interpolation between the multiple target key points, and generating an adjustment curve corresponding to any preset adjustment gear according to the interpolation point and the multiple target key points.
[0103] According to one or more embodiments of the present disclosure, the first color space includes HSV color space, HSL color space, HSI color space, or Lab color space; and the second color space is RGB color space.
[0104] In a second aspect, according to one or more embodiments of the present disclosure, an image editing device is provided, comprising: a conversion unit for converting the image to be edited into a first color space in response to an editing instruction for the image to be edited, so as to obtain a first image; wherein the first color space includes a brightness channel; a first adjustment unit for adjusting the first image in the brightness channel according to a first adjustment curve, so as to obtain a second image; the conversion unit is also for converting the second image into a second color space, so as to obtain a third image; and a second adjustment unit for adjusting the third image according to the second adjustment curve, so as to obtain a target image.
[0105] According to one or more embodiments of the present disclosure, when the first adjustment unit adjusts the first image in the brightness channel according to the first adjustment curve, it is used to: obtain the dark area of the first image; and adjust the dark area of the first image in the brightness channel according to the first adjustment curve.
[0106] According to one or more embodiments of the present disclosure, when the first adjustment unit adjusts the dark area of the first image in the brightness channel according to the first adjustment curve, it is used to: if the editing instruction is a positive adjustment instruction, determine the first adjustment curve for positive adjustment; increase the brightness of the dark area of the first image in the brightness channel according to the first adjustment curve; or if the editing instruction is a negative adjustment instruction, determine the first adjustment curve for negative adjustment; reduce the brightness of the dark area of the first image in the brightness channel according to the first adjustment curve.
[0107] According to one or more embodiments of the present disclosure, before adjusting the first image in the brightness channel according to the first adjustment curve, the first adjustment unit is further used to: determine a target adjustment gear from a plurality of preset adjustment gears in response to an adjustment gear selection instruction, wherein different preset adjustment gears correspond to different first adjustment curves and second adjustment curves; select the corresponding first adjustment curve according to the target adjustment gear; and the second adjustment unit is further used to select the corresponding second adjustment curve according to the target adjustment gear.
[0108] According to one or more embodiments of the present disclosure, the device further includes: an adjustment curve acquisition unit, configured to acquire different first adjustment curves and second adjustment curves corresponding to different preset adjustment gears.
[0109] According to one or more embodiments of the present disclosure, when acquiring different first and second adjustment curves corresponding to different preset adjustment gears, the adjustment curve acquisition unit is used to: for any one of the first and second adjustment curves, acquire multiple preset key points of the adjustment curve corresponding to the highest preset adjustment gear in the adjustment curve, and generate the adjustment curve corresponding to the highest preset adjustment gear based on the multiple preset key points; determine multiple target key points of the adjustment curve corresponding to any preset adjustment gear in the adjustment curve based on the multiple preset key points and the total number of preset adjustment gears of the adjustment curve, and generate the adjustment curve corresponding to any preset adjustment gear based on the multiple target key points.
[0110] According to one or more embodiments of the present disclosure, when the adjustment curve acquisition unit determines multiple target key points of the adjustment curve corresponding to any preset adjustment gear in the adjustment curve based on the multiple preset key points and the total number of preset adjustment gears of the adjustment curve, it is used to: for any preset key point, perform linear interpolation between the preset key point and the corresponding reference point according to the total number of preset adjustment gears to determine the target key point of the adjustment curve corresponding to any preset adjustment gear in the adjustment curve, wherein the reference point corresponding to the preset key point is a point on the reference curve when the image is not adjusted that has the same horizontal coordinate as the preset key point.
[0111] According to one or more embodiments of the present disclosure, when the adjustment curve acquisition unit generates the adjustment curve corresponding to the highest preset adjustment gear according to the multiple preset key points, it is used to: perform curve interpolation between the multiple preset key points, and generate the adjustment curve corresponding to the highest preset adjustment gear according to the interpolation point and the multiple preset key points; the generation of the adjustment curve corresponding to any preset adjustment gear according to the multiple target key points includes: performing curve interpolation between the multiple target key points, and generating the adjustment curve corresponding to any preset adjustment gear according to the interpolation point and the multiple target key points.
[0112] According to one or more embodiments of the present disclosure, the first color space includes HSV color space, HSL color space, HSI color space, or Lab color space; and the second color space is RGB color space.
[0113] In a third aspect, according to one or more embodiments of the present disclosure, an electronic device is provided, comprising: at least one processor and a memory; the memory stores computer-executable instructions; the at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the image editing method described in the first aspect and various possible designs of the first aspect.
[0114] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the image editing method described in the first aspect and various possible designs of the first aspect is implemented.
[0115] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, comprising computer-executable instructions. When a processor executes the computer-executable instructions, the image editing method as described in the first aspect and various possible designs of the first aspect is implemented.
[0116] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0117] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0118] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. An image editing method, comprising: In response to an editing instruction for an image to be edited, converting the image to be edited into a first color space to obtain a first image; wherein the first color space includes a brightness channel; Adjusting the first image in a brightness channel according to a first adjustment curve to obtain a second image; Converting the second image into a second color space to obtain a third image; The third image is adjusted according to the second adjustment curve to obtain a target image.
2. The method according to claim 1, wherein: The step of adjusting the first image in the brightness channel according to the first adjustment curve includes: Acquire a dark area of the first image; The dark area of the first image is adjusted in a brightness channel according to the first adjustment curve.
3. The method according to claim 2, wherein: The step of adjusting the dark area of the first image in the brightness channel according to the first adjustment curve includes: If the editing instruction is a positive adjustment instruction, determining a first adjustment curve for positive adjustment; and increasing the brightness of a dark area of the first image in a brightness channel according to the first adjustment curve; or If the editing instruction is a negative adjustment instruction, a first adjustment curve for negative adjustment is determined; and the brightness of the dark area of the first image is reduced in the brightness channel according to the first adjustment curve.
4. The method according to any one of claims 1 to 3, wherein: Before adjusting the first image in the brightness channel according to the first adjustment curve, the method further includes: In response to the adjustment gear selection instruction, determining a target adjustment gear from a plurality of preset adjustment gears, wherein different preset adjustment gears correspond to different first adjustment curves and second adjustment curves; The corresponding first adjustment curve and second adjustment curve are selected according to the target adjustment gear.
5. The method according to claim 4, wherein: The method further comprises: Obtaining different preset adjustment gears corresponds to different first adjustment curves and second adjustment curves.
6. The method according to claim 5, wherein: The obtaining of different first adjustment curves and second adjustment curves corresponding to different preset adjustment gears includes: For any one of the first adjustment curve and the second adjustment curve, a plurality of preset key points of the adjustment curve corresponding to the highest preset adjustment gear in the adjustment curve are obtained, and the adjustment curve corresponding to the highest preset adjustment gear is generated according to the plurality of preset key points; According to the plurality of preset key points and the total number of preset adjustment gears of the adjustment curve, determine A plurality of target key points of the adjustment curve corresponding to any preset adjustment gear in the adjustment curve, and an adjustment curve corresponding to any preset adjustment gear is generated according to the plurality of target key points.
7. The method according to claim 6, wherein: The step of determining a plurality of target key points of the adjustment curve corresponding to any preset adjustment level in the adjustment curve according to the plurality of preset key points and the total number of preset adjustment levels of the adjustment curve comprises: For any preset key point, linear interpolation is performed between the preset key point and the corresponding reference point according to the total number of preset adjustment gears to determine the target key point of the adjustment curve corresponding to any preset adjustment gear in the adjustment curve, wherein the reference point corresponding to the preset key point is a point on the reference curve when the image is not adjusted that has the same horizontal coordinate as the preset key point.
8. The method according to claim 6, wherein: The step of generating an adjustment curve corresponding to the highest preset adjustment gear according to the plurality of preset key points includes: Performing curve interpolation between the plurality of preset key points, and generating an adjustment curve corresponding to the highest preset adjustment gear according to the interpolation point and the plurality of preset key points; The step of generating the adjustment curve corresponding to any one of the preset adjustment gears according to the multiple target key points includes: Curve interpolation is performed between the multiple target key points, and an adjustment curve corresponding to any one of the preset adjustment gears is generated according to the interpolation points and the multiple target key points.
9. The method according to claim 1, wherein: The first color space includes HSV color space, HSL color space, HSI color space, or Lab color space; the second color space is RGB color space.
10. An image editing device, comprising: A conversion unit, configured to convert the image to be edited into a first color space in response to an editing instruction for the image to be edited, so as to obtain a first image; wherein the first color space includes a brightness channel; A first adjustment unit, configured to adjust the first image in a brightness channel according to a first adjustment curve to obtain a second image; The conversion unit is further used to convert the second image into a second color space to obtain a third image; The second adjustment unit is used to adjust the third image according to the second adjustment curve to obtain a target image.
11. An electronic device, comprising: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method according to any one of claims 1 to 9 is implemented.
13. A computer program product, comprising computer executable instructions, and when a processor executes the computer executable instructions, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Image color enhancement method and device, and electronic equipment
CN104935902A
Image processing method and device, electronic equipment and storage medium
CN112767238A
Image processing method and device, electronic equipment, chip and storage medium
CN116017171A
Image processing method and device, electronic equipment and storage medium
CN116167950A
Image content-based color balancing
WO2012167128A1
