Image editing method and device and storage medium
By converting the image to a color space including the brightness channel during the image editing process for brightness adjustment, and color and saturation adjustment in the second color space, the problem that curve adjustment cannot take into account multiple factors is solved, and the image editing is improved Effect and quality.
Patent Information
- Application Number
- CN202310645329.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-01
- Publication Date
- 2024-12-03
AI Technical Summary
During the image editing process, curve adjustment usually cannot take into account both color, brightness and saturation, resulting in low image adjustment quality and inability to meet user needs.
By converting the image to be edited to a first color space including a brightness channel for brightness adjustment, a second image is obtained, and then converted to a second color space for color and saturation adjustment, and finally the target image is performed according to the second adjustment curve Adjust to achieve both color, brightness and saturation.
The image adjustment effect is improved, the generated image quality is higher, and it can better meet users' needs for color, brightness and saturation adjustment.
Smart Images

Figure CN119068075A_ABST
Abstract
Description
Technical Field
[0001] 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
[0002] In image editing scenarios, curve adjustment is a common color adjustment method. Curve adjustment functions are usually provided in various image / video color adjustment software for users to adjust the color of images.
[0003] When using curve adjustment, a one-dimensional color mapping table with a length of 256 is usually used to map the original image color to a new color value, thereby achieving the purpose of color adjustment. However, in the process of curve adjustment, factors such as color, brightness, and saturation are usually not taken into account at the same time, resulting in low quality of color adjustment and failure to meet user needs. Summary of the invention
[0004] The embodiments of the present disclosure provide an image editing method, device and storage medium, so as to take into account factors such as color, brightness, saturation, etc. when adjusting the image, thereby improving the effect of image adjustment.
[0005] In a first aspect, an embodiment of the present disclosure provides an image editing method, comprising:
[0006] 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;
[0007] Adjusting the first image in a brightness channel according to a first adjustment curve to obtain a second image;
[0008] Converting the second image into a second color space to obtain a third image;
[0009] The third image is adjusted according to the second adjustment curve to obtain a target image.
[0010] In a second aspect, an embodiment of the present disclosure provides an image editing device, including:
[0011] A conversion unit, 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;
[0012] 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;
[0013] The conversion unit is further used to convert the second image into a second color space to obtain a third image;
[0014] The second adjustment unit is used to adjust the third image according to the second adjustment curve to obtain a target image.
[0015] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: at least one processor and a memory;
[0016] The memory stores computer-executable instructions;
[0017] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the image editing method as described in the first aspect and various possible designs of the first aspect.
[0018] 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.
[0019] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including computer execution instructions. 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.
[0020] The image editing method, device and storage medium provided by the disclosed embodiment convert the image to be edited into a first color space in response to an editing instruction of the image to be edited to obtain a first image; wherein the first color space includes a brightness channel; the first image is adjusted in the brightness 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; the third image is adjusted according to the second adjustment curve to obtain a target image. By adjusting the image in a dual color space, factors such as color, brightness, and saturation can be taken into account at the same time, thereby improving the effect of image adjustment and obtaining a higher quality image. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 creative labor.
[0022] Figure 1 This is an example diagram of a curve adjustment in the prior art;
[0023] Figure 2A schematic diagram of a flow chart of an image editing method provided by an embodiment of the present disclosure;
[0024] Figure 3 A flowchart of an image editing method provided by another embodiment of the present disclosure;
[0025] Figure 4 A schematic diagram of an interface for selecting a target adjustment gear provided in an embodiment of the present disclosure;
[0026] Figure 5 A flowchart of an image editing method provided by another embodiment of the present disclosure;
[0027] Figure 6 A structural block diagram of an image editing device provided by an embodiment of the present disclosure;
[0028] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0030] When using curve adjustment, a one-dimensional color mapping table with a length of 256 (which can be expressed as an adjustment curve) is usually used to map the original image color to a new color value, thereby achieving the purpose of color adjustment. For example, Figure 1 As shown, the left side is the unadjusted original image (its adjustment curve 1 is y=x, x is the original color value, and y is the new color value after adjustment), and the right side uses adjustment curve 2 to adjust the original image, and the colors of the original image 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.
[0031] However, curve adjustment is usually performed in a single color space, especially in the RGB color space. During the curve adjustment process, factors such as color, brightness, and saturation are usually not taken into account at the same time. Curve adjustment of color can easily lead to more drastic changes in brightness and / or saturation, and these changes are difficult to control, resulting in low image quality and failure to meet user needs.
[0032] In order to solve the above technical problems, the present disclosure provides an image editing method, which converts the image to be edited into a first color space in response to an editing instruction of the image to be edited to obtain a first image; wherein the first color space includes a brightness channel; the first image is adjusted in the brightness 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; the third image is adjusted according to the second adjustment curve to obtain a target image. By adjusting the image in a dual color space, factors such as color, brightness, and saturation can be taken into account at the same time, thereby improving the effect of image adjustment and obtaining a higher quality image.
[0033] 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, a tablet computer, a laptop computer, a wearable device, etc.
[0034] 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 the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0035] The image editing method disclosed herein will be described in detail below in conjunction with specific embodiments.
[0036] refer to Figure 2 , Figure 2 A flowchart 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:
[0037] 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.
[0038] In this embodiment, when the user edits the 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 brightness channel (or lightness channel) to facilitate brightness adjustment of the image on the brightness channel, and the first color space includes but is not limited to HSV color space (Hue, Saturation, Value), HSL (Hue, Saturation, Lightness) color space, HSI (Hue, Saturation, Intensity) color space, Lab (Lab color space, color-opposition space) color space, etc.
[0039] Among them, since general display devices use RGB color space to display images, the image to be edited can be an image taken by a user or obtained and displayed by other means, so the image to be edited can be an image in RGB color space. Of course, the color space of the image to be edited is not limited in this embodiment. In addition, any feasible color space conversion method can be used to convert the image to be edited into the first color space, which is not limited in this embodiment.
[0040] S202: Adjust the first image in a brightness channel according to a first adjustment curve to obtain a second image.
[0041] In this embodiment, after the image to be edited is converted into a first image in a first color space, a curve adjustment can be performed on the first image 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.
[0042] Specifically, the brightness channel data of the first image may be extracted, the brightness channel data may be adjusted using a first adjustment curve to obtain adjusted brightness channel data, and then the adjusted brightness channel data may be used to replace the original brightness channel data of the first image.
[0043] S203: Convert the second image into a second color space to obtain a third image.
[0044] 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 users 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.
[0045] 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.
[0046] S204: Adjust the third image according to the second adjustment curve to obtain a target image.
[0047] 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.
[0048] 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 respectively using different adjustment curves.
[0049] Furthermore, the target image may be output, for example, displayed on a display device, wherein if the second color space is not an RGB color space, the target image may be converted to an RGB color space before being displayed.
[0050] 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 of the image to be edited to obtain a first image; wherein the first color space includes a brightness channel; the first image is adjusted in the brightness 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; the third image is adjusted according to the second adjustment curve to obtain a target image. By adjusting the image in a dual color space, factors such as color, brightness, and saturation can be taken into account at the same time, thereby improving the effect of image adjustment and obtaining a higher quality image.
[0051] Based on any embodiment, Figure 3As shown, the step of adjusting the first image in the brightness channel according to the first adjustment curve in S202 includes:
[0052] S301, acquiring a dark area of the first image;
[0053] S302: Adjust the dark area of the first image in the brightness channel according to the first adjustment curve.
[0054] In this embodiment, considering that the darker areas of the image have a greater impact on the viewing experience, the first image can be divided into a dark area and a bright area. During the brightness adjustment process, only the dark area of the first image is adjusted in the brightness channel according to the first adjustment curve, which can effectively improve the image viewing experience. At the same time, since the bright area is prone to color banding problems during adjustment, for example, relatively pure color or color gradient bright areas (such as the sky, halo and other areas) are prone to color banding problems during adjustment, this embodiment does not adjust the brightness of the bright area, and also largely avoids the color banding problem in the bright area.
[0055] Any feasible division method may be used for the division of the dark area and the bright area, for example, a preset dark area mask is used to obtain the dark area.
[0056] On the basis of the above embodiment, the step of adjusting the dark area of the first image in the brightness channel according to the first adjustment curve in S302 may specifically include:
[0057] 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
[0058] 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.
[0059] In this embodiment, the adjustment of brightness is divided into increasing brightness and decreasing brightness based on the initial brightness. Increasing brightness is a positive adjustment of brightness, and decreasing brightness is a negative adjustment of brightness. Different adjustment directions use different first adjustment curves, 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. Positive adjustment or negative adjustment can be determined according to the editing instruction. If it is determined to be a positive adjustment, the first adjustment curve for positive adjustment is used to increase the brightness of the dark area of the first image in the brightness channel; if it is determined to be a negative adjustment, the first adjustment curve for negative adjustment is used to reduce the brightness of the dark area of the first image in the brightness channel.
[0060] 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 adjustment directions use different second adjustment curves, 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 it is a positive adjustment or a negative adjustment can be determined according to the editing instruction. If it is determined to be a positive adjustment, the second adjustment curve for positive adjustment is used to adjust the third image; if it is determined to be a negative adjustment, the second adjustment curve for negative adjustment is used to adjust the third image.
[0061] On the basis of any of the above embodiments, since the bright area is prone to color banding problems during adjustment, when adjusting the third image according to the second adjustment curve, the bright area of the third image may be slightly adjusted or not adjusted as much as possible. In order to achieve slight adjustment or no adjustment of the bright area of the third image, it can be achieved by pre-configuring the curve shape of the second adjustment curve, and the part of the second adjustment curve with a larger horizontal coordinate value (greater than a preset threshold) reduces the adjustment amplitude or the adjustment amplitude is 0.
[0062] On the basis of the above embodiments, in order to achieve different degrees of adjustment effects for image adjustment, different adjustment curves can usually be used. For example, when adjusting the first image in the brightness channel according to the first adjustment curve, different first adjustment curves can be used to achieve different degrees of brightness adjustment effects. When adjusting the third image according to the second adjustment curve, different second adjustment curves can also be used to achieve different degrees of adjustment effects. The setting of different adjustment curves has a high degree of freedom. If the user sets the adjustment curve by himself, the adjustment effect strongly depends on the user's experience. For inexperienced users, it is difficult to set the adjustment curve well. Therefore, in this embodiment, different preset adjustment gears can be configured, and different first adjustment curves and second adjustment curves can be configured for each preset adjustment gear. More specifically, preset adjustment gears can be configured for positive adjustment and negative adjustment respectively. For example, positive adjustment is divided into 100 gears, and negative adjustment is divided into 100 gears. Each preset adjustment gear is configured with a different first adjustment curve and second adjustment curve. Specifically, Figure 4 As shown, a sliding control (or other controls) is used for the user to select a target adjustment gear from preset adjustment gears, and then the first adjustment curve and the second adjustment curve corresponding to the target adjustment gear can be automatically selected.
[0063] Furthermore, before adjusting the first image in the brightness channel according to the first adjustment curve in S202, the method further includes:
[0064] In response to an adjustment gear selection instruction, a target adjustment gear is determined from a plurality of preset adjustment gears, and then a corresponding first adjustment curve and a second adjustment curve are selected according to the target adjustment gear, so as to perform adjustments according to the first adjustment curve and the second adjustment curve corresponding to the target adjustment gear in each subsequent adjustment process.
[0065] 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.
[0066] Optionally, the method for obtaining the first adjustment curve and the second adjustment curve corresponding to different preset adjustment gears may be the same, including obtaining 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 using the same method, for any adjustment curve at different preset adjustment gear adjustment curves, the method is as follows: Figure 5 As shown, it may include:
[0067] S401, for any one of the first adjustment curve and the second adjustment curve, obtaining a plurality of 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 according to the plurality of preset key points;
[0068] S402: Determine 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, and generate an adjustment curve corresponding to any preset adjustment level according to the plurality of target key points.
[0069] In this embodiment, for any adjustment curve, a plurality of 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, such as shown in Table 1:
[0070] Table 1
[0071]
[0072] Among them, the horizontal axis is the value before adjustment, and the vertical axis is the value after adjustment. Since the horizontal and vertical axes are equal when the image is not adjusted, in the various adjustment curves of this embodiment, except (0,0) and (255,255), in the positive adjustment, the vertical axis value of each preset key point is generally not less than the horizontal axis value, and in the negative adjustment, the vertical axis value of each preset key point is generally not greater than the horizontal axis value. Of course, the horizontal and vertical axes of each preset key point can be set according to actual conditions, and are not limited to the above rules.
[0073] 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 according to the preset key points to generate the adjustment curve corresponding to the highest preset adjustment level.
[0074] As for the adjustment curves corresponding to the other preset adjustment gears of this type of adjustment curve, multiple target key points of the adjustment curve corresponding to any preset adjustment gear in this type of adjustment curve can be determined based on multiple preset key points of the adjustment curve corresponding to the highest preset adjustment gear and the total number of preset adjustment gears of this type of adjustment curve, and then curve fitting is performed according to these target key points to generate the adjustment curve corresponding to any preset adjustment gear.
[0075] Optionally, when determining multiple target key points of the adjustment curve corresponding to any preset adjustment gear in this type of adjustment curve, for any preset key point, linear interpolation can be 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 this type of 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.
[0076] In this embodiment, based on the reference curve (y=x, that is, the ordinate is equal to the abscissa) in the case of no image adjustment, a point corresponding to any preset key point (x) is selected on the reference curve. j ,y j ) 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 ) are linearly interpolated 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 j The preset adjustment gears are divided equally according to the total number of preset adjustment gears. 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 ), y-coordinate i Calculated by the following formula:
[0077] y i =x j +(i / n)*(y j -x j )
[0078] 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.
[0079] On the basis of 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 according to 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 according to the interpolation points and the multiple preset key points, thereby improving the curve fitting effect.
[0080] Similarly, since the number of target key points calculated is also limited and the curve fitting effect is poor, when S402 generates the adjustment curve corresponding to any preset adjustment gear according to the multiple target key points, curve interpolation can also be performed between the multiple target key points (for example, using spline interpolation), and the adjustment curve corresponding to any preset adjustment gear is generated according to the interpolation points and the multiple target key points.
[0081] 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 executed.
[0082] Corresponding to the image editing method of the above embodiment, Figure 6 The structure block diagram of the image editing device provided by the embodiment of the present disclosure. For the convenience of explanation, only the part related to the embodiment of the present disclosure is shown. Figure 6 The image editing device 600 includes: a conversion unit 601, a first adjustment unit 602, and a second adjustment unit 603.
[0083] The conversion unit 601 is used 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;
[0084] A first adjustment unit 602, configured to adjust the first image in a brightness channel according to a first adjustment curve to obtain a second image;
[0085] The conversion unit 601 is further used to convert the second image into a second color space to obtain a third image;
[0086] The second adjustment unit 603 is used to adjust the third image according to the second adjustment curve to obtain a target image.
[0087] 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 configured to:
[0088] Acquire a dark area of the first image;
[0089] The dark area of the first image is adjusted in a brightness channel according to the first adjustment curve.
[0090] In one or more embodiments of the present disclosure, when the first adjustment unit 602 adjusts the dark area of the first image in the brightness channel according to the first adjustment curve, it is configured to:
[0091] 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
[0092] 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.
[0093] 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 configured to:
[0094] In response to an 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; and selecting a corresponding first adjustment curve according to the target adjustment gear;
[0095] The second adjustment unit 603 is further configured to select a corresponding second adjustment curve according to the target adjustment gear.
[0096] In one or more embodiments of the present disclosure, the device further includes: an adjustment curve acquisition unit 604, which is used to
[0097] Obtaining different preset adjustment gears corresponds to different first adjustment curves and second adjustment curves.
[0098] 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:
[0099] 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;
[0100] According to the multiple preset key points and the total number of preset adjustment gears of this type of adjustment curve, multiple target key points of the adjustment curve corresponding to any preset adjustment gear in this type of adjustment curve are determined, and the adjustment curve corresponding to any preset adjustment gear is generated according to the multiple target key points.
[0101] In one or more embodiments of the present disclosure, when 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, the adjustment curve acquisition unit 604 is configured to:
[0102] 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.
[0103] 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 plurality of preset key points, it is configured to:
[0104] 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;
[0105] Generating the adjustment curve corresponding to any one of the preset adjustment gears according to the multiple target key points includes:
[0106] 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.
[0107] 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.
[0108] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0109] refer to Figure 7, which shows a schematic diagram of the structure of an electronic device 700 suitable for implementing the embodiment of the present disclosure, and 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, notebook computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0110] like Figure 7 As shown, 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 to 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.
[0111] Typically, the following devices may be connected to the I / O interface 705: input devices 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 708 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 709. The communication devices 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0112] 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 contains 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 through 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 executed.
[0113] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, 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 containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit 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 of the above.
[0114] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0115] 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.
[0116] 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 an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via 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).
[0117] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square 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 square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0118] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0119] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, 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 chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0120] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may 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 may 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.
[0121] In a first aspect, according to one or more embodiments of the present disclosure, there is provided an image editing method, comprising:
[0122] 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;
[0123] Adjusting the first image in a brightness channel according to a first adjustment curve to obtain a second image;
[0124] Converting the second image into a second color space to obtain a third image;
[0125] The third image is adjusted according to the second adjustment curve to obtain a target image.
[0126] 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:
[0127] Acquire a dark area of the first image;
[0128] The dark area of the first image is adjusted in a brightness channel according to the first adjustment curve.
[0129] According to one or more embodiments of the present disclosure, adjusting the dark area of the first image in the brightness channel according to the first adjustment curve includes:
[0130] 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
[0131] 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.
[0132] 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:
[0133] 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;
[0134] The corresponding first adjustment curve and second adjustment curve are selected according to the target adjustment gear.
[0135] According to one or more embodiments of the present disclosure, the method further includes:
[0136] Obtaining different preset adjustment gears corresponds to different first adjustment curves and second adjustment curves.
[0137] According to one or more embodiments of the present disclosure, the step of obtaining different first adjustment curves and second adjustment curves corresponding to different preset adjustment gears includes:
[0138] 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;
[0139] According to the multiple preset key points and the total number of preset adjustment gears of this type of adjustment curve, multiple target key points of the adjustment curve corresponding to any preset adjustment gear in this type of adjustment curve are determined, and the adjustment curve corresponding to any preset adjustment gear is generated according to the multiple target key points.
[0140] According to one or more embodiments of the present disclosure, 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 includes:
[0141] 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.
[0142] According to one or more embodiments of the present disclosure, generating an adjustment curve corresponding to a highest preset adjustment gear according to the plurality of preset key points includes:
[0143] 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;
[0144] Generating the adjustment curve corresponding to any one of the preset adjustment gears according to the multiple target key points includes:
[0145] 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.
[0146] According to one or more embodiments of the present disclosure, the first color space includes an HSV color space, an HSL color space, an HSI color space, or a Lab color space; and the second color space is an RGB color space.
[0147] In a second aspect, according to one or more embodiments of the present disclosure, there is provided an image editing device, comprising:
[0148] A conversion unit, 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;
[0149] 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;
[0150] The conversion unit is further used to convert the second image into a second color space to obtain a third image;
[0151] The second adjustment unit is used to adjust the third image according to the second adjustment curve to obtain a target image.
[0152] 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 configured to:
[0153] Acquire a dark area of the first image;
[0154] The dark area of the first image is adjusted in a brightness channel according to the first adjustment curve.
[0155] 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 configured to:
[0156] 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
[0157] 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.
[0158] According to one or more embodiments of the present disclosure, before the first adjustment unit adjusts the first image in the brightness channel according to the first adjustment curve, it is further configured to:
[0159] In response to an 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; and selecting a corresponding first adjustment curve according to the target adjustment gear;
[0160] The second adjustment unit is further configured to select a corresponding second adjustment curve according to the target adjustment gear.
[0161] According to one or more embodiments of the present disclosure, the device further includes: an adjustment curve acquisition unit for
[0162] Obtaining different preset adjustment gears corresponds to different first adjustment curves and second adjustment curves.
[0163] 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:
[0164] 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;
[0165] According to the multiple preset key points and the total number of preset adjustment gears of this type of adjustment curve, multiple target key points of the adjustment curve corresponding to any preset adjustment gear in this type of adjustment curve are determined, and the adjustment curve corresponding to any preset adjustment gear is generated according to the multiple target key points.
[0166] According to one or more embodiments of the present disclosure, when the adjustment curve acquisition unit determines a plurality of target key points of the adjustment curve corresponding to any preset adjustment gear in the adjustment curve according to the plurality of preset key points and the total number of preset adjustment gears of the adjustment curve, the adjustment curve acquisition unit is used to:
[0167] 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.
[0168] 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 plurality of preset key points, it is configured to:
[0169] 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;
[0170] Generating the adjustment curve corresponding to any one of the preset adjustment gears according to the multiple target key points includes:
[0171] 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.
[0172] According to one or more embodiments of the present disclosure, the first color space includes an HSV color space, an HSL color space, an HSI color space, or a Lab color space; and the second color space is an RGB color space.
[0173] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;
[0174] The memory stores computer-executable instructions;
[0175] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the image editing method as described in the first aspect and various possible designs of the first aspect.
[0176] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions. 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.
[0177] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, comprising computer execution instructions. When a processor executes the computer execution instructions, the image editing method as described in the first aspect and various possible designs of the first aspect is implemented.
[0178] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. 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 a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0179] 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 are 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.
[0180] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. An image editing method, characterized in that: include: 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, characterized in that 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, characterized in that 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, characterized in that: 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, characterized in that 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, characterized in that 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 multiple preset key points and the total number of preset adjustment gears of this type of adjustment curve, multiple target key points of the adjustment curve corresponding to any preset adjustment gear in this type of adjustment curve are determined, and the adjustment curve corresponding to any preset adjustment gear is generated according to the multiple target key points.
7. The method according to claim 6, characterized in that 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, characterized in that 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; 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, characterized in that: 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, characterized in that: include: 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, characterized in that: include: 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, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 9 is implemented.
13. A computer program product, characterized in that The method comprises 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.
