Image Processing Method and Electronic Device
By applying non-linear brightness conversion and edge extraction, the method enhances image style transformation diversity, achieving a pop art effect.
Patent Information
- Application Number
- CN202111177286.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-09
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-10-09
AI Technical Summary
Existing image processing methods lack diversity in style transformation options.
The method involves converting image brightness through a non-linear process, extracting image edges, and overlaying these to achieve a pop art style effect.
This approach enriches the variety of image style transformations by converting images into a pop art-like appearance, enhancing the visual appeal of processed images.
Smart Images

Figure CN113870100B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image processing, and particularly relates to an image processing method and an electronic device. Background Art
[0002] With the continuous development of computer technology, the application of image processing technologies such as image style conversion methods has received increasing attention. Among them, the image style conversion method is to convert the original image into an image with a certain specific style. With the increasingly wide application scope of photo-taking and image-making technologies, people's demand for the types of image styles is also increasing. Summary of the Invention
[0003] The purpose of the embodiments of this application is to provide an image processing method and an electronic device, which can solve the problem that the types of converted styles in the related image processing method are relatively few.
[0004] In a first aspect, the embodiments of this application provide an image processing method, including:
[0005] According to the luminance channel of the image to be processed, convert the luminance of the image to be processed in a non-linear processing manner to obtain a first image;
[0006] Extract the image edge of the image to be processed to obtain a second image;
[0007] Overlay the first image and the second image to obtain the processed target image.
[0008] In a second aspect, the embodiments of this application provide an image processing device, including:
[0009] A first conversion unit, configured to convert the luminance of the image to be processed in a non-linear processing manner according to the luminance channel of the image to be processed to obtain a first image;
[0010] An extraction unit, configured to extract the image edge of the image to be processed to obtain a second image;
[0011] A first overlay unit, configured to overlay the first image and the second image to obtain the processed target image.
[0012] In a third aspect, the embodiments of this application provide an electronic device, which includes a processor, a memory, and a program or instruction stored on the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of the method described in the first aspect are implemented.
[0013] In a fourth aspect, the embodiments of this application provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0014] Fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is configured to run programs or instructions to implement the method described in the first aspect.
[0015] In an embodiment of the present application, by converting the brightness of the image to be processed into an updated brightness according to a non-linear processing method to obtain a first image, and after extracting the image edge of the image to be processed to obtain a second image, the first image and the second image can be superimposed to obtain a processed target image, so that the image to be processed can be converted into an effect similar to the pop style, enriching the image processing method for image style conversion and solving the problem of fewer types of style conversions in the image processing method in the related art. Description of the Drawings
[0016] Figure 1 is a schematic flowchart of an image processing method provided by an embodiment of the present application;
[0017] Figure 2 is a schematic block diagram of an image processing device provided by an embodiment of the present application;
[0018] Figure 3 is a schematic diagram of an optional electronic device provided by an embodiment of the present application;
[0019] Figure 4 is a schematic diagram of another optional electronic device provided by an embodiment of the present application. Detailed Embodiments
[0020] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.
[0021] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. generally belong to the same category, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims indicates at least one of the connected objects, and the character " / " generally represents an "or" relationship between the associated objects before and after.
[0022] The following will, in conjunction with the accompanying drawings, elaborate on the image processing method provided by the embodiments of the present application through specific embodiments and their application scenarios.
[0023] As Figure 1 shown, it is a schematic flowchart of an image processing method provided by an embodiment of the present application, and the method includes the following steps:
[0024] Step 101: Convert the brightness of the image to be processed according to the brightness channel of the image to be processed in a non-linear processing manner to obtain a first image.
[0025] Here, the color space of the image to be processed includes a brightness channel. In the case where the color space of the image to be processed does not include a brightness channel, the color space of the image to be processed can be converted before performing step 101. Specifically, before performing step 101, the image to be processed can be converted from the original first color space to a specified second color space.
[0026] To convert the image to be processed from the first color space to the second color space, a corresponding conversion formula can be used for conversion. The conversion formula is related prior art and will not be elaborated here.
[0027] The first color space is the original color space of the image to be processed. Usually, the image adopts the RGB color space, which includes three color channels: R (red), G (green), and B (blue).
[0028] The second color space includes a brightness channel. Optionally, the second color space can be the LAB color space. The Lab color space consists of three channels. One channel is the brightness channel (L), and the other two are color channels a and b. The colors included in color channel a are from dark green (low brightness value) to gray (medium brightness value) and then to bright pink (high brightness value); color channel b is from bright blue (low brightness value) to gray (medium brightness value) and then to yellow (high brightness value).
[0029] Optionally, after converting the color space, bilateral filtering can also be performed to smooth and denoise and reduce the noise of the final result. In this optional implementation, the image after color space conversion and filtering is used as the image to be processed.
[0030] The non - linear processing method means taking the original luminance as the independent variable and calculating according to a non - linear preset function, and the function value obtained is the updated luminance. Since the second color space includes a luminance channel, the value of the luminance channel is the luminance. According to the luminance channel, a luminance distribution map of the image to be processed can be obtained (which is equivalent to a grayscale image, and the specific grayscale value of each pixel point is the luminance value of the corresponding pixel). Then, by using the non - linear processing method to process the luminance of the image to be processed, a new image, that is, the first image, can be obtained. The first image is the image obtained after processing the luminance channel of the image to be processed.
[0031] In one example, the non - linear processing method can be to process the luminance values in segments, and at least one segment is set to the same value, so that the luminance values after conversion in this segment are unified, making the converted image present a color - block effect.
[0032] For example, the specific implementation method of the non - linear processing method can be:
[0033] (1) Set the luminance values of the pixel points in the image to be processed whose luminance values exceed the first threshold to the first value.
[0034] (2) Set the luminance values of the pixel points in the image to be processed whose luminance values do not exceed the second threshold to the second value, where the second threshold is lower than the first threshold.
[0035] (3) Convert the luminance values of the pixel points in the image to be processed whose luminance values are between the first threshold and the second threshold according to a non - linear formula to obtain the corresponding values, thus obtaining the first image.
[0036] For example, in an application scenario, the luminance value is of floating - point type and the range is (0.0, 1.0). The luminance is converted in the following way:
[0037] (1) For all luminance values less than 0.2, the value is taken as 0.2, which can prevent the luminance from being too low and the color from being too dark, affecting the color - block effect.
[0038] (2) For all luminance values greater than 0.8, the value is taken as 0.9, which can prevent the luminance from being too high and causing over - exposure, affecting the color - block effect.
[0039] (3) For all luminance values greater than 0.2 and less than 0.8, the following function is used for calculation:
[0040] float(ceil(luminance * 10.0)) / 10.0
[0041] Here, float is a floating - point data - type function, ceil is the function to find the smallest integer greater than the parameter, and luminance is used to represent the luminance value.
[0042] Step 102: Extract the image edges of the image to be processed to obtain a second image.
[0043] The extraction of image edges can use edge detection algorithms in related technologies. Exemplarily, the Canny operator algorithm can be selected. The second image obtained includes the edge lines in the image to be processed. The specific steps are as follows:
[0044] (1) Perform Gaussian filtering on the image to be processed. The gray values of the pixel points to be filtered and their neighboring points are weighted and averaged according to the parameter rules generated by the Gaussian formula, which can effectively filter out the high-frequency noise superimposed in the ideal image.
[0045] (2) Calculate the gradient image and the angle image of the filtered image. The gradient detection operator used in the Canny algorithm is a filter obtained by performing gradient calculation using a Gaussian filter, and the result is also similar to the Sobel operator, that is, the pixel points closer to the center point have greater weights. The calculation of the angle image is relatively simple, and its function is to determine the direction of non-maximum suppression.
[0046] (3) Perform non-maximum suppression on the gradient image. There are many problems such as thick and wide edges and weak edge interference in the gradient image obtained from (2). Non-maximum suppression can be used to find the local maximum of pixel points, and the gray values corresponding to non-maximum values are set to 0, which can eliminate a large number of non-edge pixel points.
[0047] (4) Use double thresholds for edge connection. The edge quality obtained through the above three steps is already very high, but there are still many false edges. Therefore, the double-threshold method can be adopted. The specific idea is to select two thresholds. Points less than the lower threshold are considered false edges and set to 0, points greater than the higher threshold are considered strong edges and set to 1, and the pixel points in between need to be further checked. According to the high-threshold image, the edges are linked into contours. When reaching the end points of the contours, the algorithm will search for points that meet the lower threshold among the 8-neighborhood points of the breakpoints, and then collect new edges based on this point until the edge pixel points in the entire image are closed.
[0048] Step 103: Superimpose the first image and the second image to obtain the processed target image.
[0049] The superimposition of images can be direct multiplication, weighted average, covering, etc. Taking the multiplication of the first image and the second image as an example, in one example, the second image can be a binary image with black (pixel value 0) edge lines and white (pixel value 1) for other parts. In this way, multiplying the first image and the second image is equivalent to changing the edge lines to black in the first image, and the non-edge line parts remain unchanged. The specific formula is as follows:
[0050] f(a, b) = a * b
[0051] a represents the first image, b represents the second image, b is a binary image, the value 0 represents the edge, and the value 1 represents non-edge. Just multiply them directly. Calculate the edge part as black and keep the non-edge part unchanged.
[0052] The image processing method provided by the embodiments of this application can convert the brightness of the image to be processed into an updated brightness according to a non-linear processing method to obtain the first image. After extracting the image edge of the image to be processed to obtain the second image, the first image and the second image can be superimposed to obtain the processed target image, so that the image to be processed can be converted into an effect similar to the Pop style, enriching the image processing method for image style conversion and solving the problem that there are few types of image style conversion in the related art. In an optional example, in addition to the above processing, a polka dot effect can be added before superimposing the first image and the second image to obtain the processed target image. Specifically, the method may further include:
[0053] Step 201, obtain a polka dot image.
[0054] Obtaining a polka dot image can be reading a preset polka dot image or generating a polka dot image.
[0055] In one example, the polka dot image is an image with a white background and evenly distributed solid black circles. The center positions of the polka dots in the polka dot image are evenly distributed and the sizes are the same.
[0056] Optionally, a way to generate a polka dot image can be to take the modulus of the coordinate value of each pixel in the image according to a preset polka dot radius, so that regularly distributed coordinate moduli can be obtained. Then, according to each pixel coordinate modulus, the distance to the nearest polka dot center can be determined. If the distance from a pixel to the nearest center is less than the polka dot radius, the pixel is black, otherwise it is white. After such processing, a polka dot image with a white background, black polka dots, and each polka dot connected to the adjacent polka dots can be obtained.
[0057] Step 202, generate a scaling coefficient corresponding to each polka dot according to the brightness of each polka dot in the first image.
[0058] That is, after obtaining the polka dot image, the range of each polka dot in the polka dot image is determined accordingly. In the first image (the image to be processed after non-linear conversion processing), the brightness within the range of each polka dot can refer to the average brightness within the corresponding polka dot range or the brightness at the center position of the polka dot.
[0059] In one example, the luminance of the image to be processed in the untransformed color space can be calculated in the following manner. The luminance value Luma = f(R, G, B) = 0.2125R + 0.7154G + 0.0721B, where R, G, and B are the values of the red, green, and blue color channels respectively.
[0060] The scaling factor can be generated using a preset calculation formula. In one example, the scaling factor Scaling can be calculated by the following formula: Scaling = f(Luma) = 1.0 – Luma. The above is only used to exemplarily illustrate the formula for calculating the scaling factor and does not constitute a limitation to this application.
[0061] Step 203: Scale the corresponding dots in the dot image according to the scaling factor to obtain a third image.
[0062] The third image is the image obtained after scaling the dot image. Each dot is scaled according to the scaling factor corresponding to the dot. Specifically, the radius of each dot can be directly multiplied by the corresponding scaling factor to obtain the third image.
[0063] Step 204: Superimpose the third image and the first image to obtain a fourth image.
[0064] After obtaining the third image, the third image and the first image can be superimposed to obtain a fourth image. Furthermore, the fourth image and the second image can be superimposed to obtain the target image.
[0065] When superimposing the third image and the first image to obtain the fourth image, the following rules can be used for superimposition:
[0066] (1) For the pixel points in the first image whose luminance exceeds the first threshold, calculate the value of each channel according to the first superimposition formula;
[0067] (2) For the pixel points in the first image whose luminance does not exceed the first threshold, calculate the value of each channel according to the second superimposition formula.
[0068] In one example, for each pixel point, the superimposition formula is as follows:
[0069]
[0070] In the formula, a is the first image, b is the third image, and Luma(a) represents the luminance of the pixel point in a. After such calculation, the effect of the fused dots being warm colors can be obtained.
[0071] In the above optional embodiments, the non - linear distribution of color brightness is achieved through the first image, showing the effect of block distribution. The third image obtained by scaling the superimposed dot image is used to achieve the dot effect. Finally, the second image at the edge of the image is superimposed to achieve a sense of line, enriching the style of image conversion. It can be applied to the style conversion of the photos taken by users, thus improving the fun of taking pictures.
[0072] It should be noted that for the image processing method provided in the embodiments of the present application, the execution subject can be an image processing device, or a control module in the image processing device for executing the image processing method. In the embodiments of the present application, taking the image processing device executing the image processing method as an example, the image processing device provided in the embodiments of the present application is described.
[0073] As Figure 2 shown, it is a schematic block diagram of an image processing device provided in the embodiments of the present application. The image processing device includes a first conversion unit 21, an extraction unit 22, and a first superimposition unit 23.
[0074] The first conversion unit 21 is used to convert the brightness of the image to be processed according to the brightness channel of the image to be processed in a non - linear processing manner to obtain a first image;
[0075] The extraction unit 22 is used to extract the image edge of the image to be processed to obtain a second image;
[0076] The first superimposition unit 23 is used to superimpose the first image and the second image to obtain a processed target image.
[0077] The image processing device provided in the embodiments of the present application, by converting the brightness of the image to be processed in a non - linear processing manner to an updated brightness to obtain a first image, and after extracting the image edge of the image to be processed to obtain a second image, can superimpose the first image and the second image to obtain a processed target image, so that the image to be processed can be converted into an effect similar to the pop style, enriching the image processing method for image style conversion, and solving the problem that the types of image style conversion in the related art are few.
[0078] Optionally, the device may further include a second conversion unit, configured to convert the image to be processed from a first color space to a second color space before converting the brightness of the image to be processed in a non - linear processing manner according to the brightness channel of the image to be processed, where the second color space includes a brightness channel.
[0079] Optionally, the device may further include:
[0080] An acquisition unit, configured to acquire a dot image before superimposing the first image and the second image to obtain a processed target image;
[0081] A generating unit for generating a scaling coefficient corresponding to each wave point according to the brightness of each wave point in the first image;
[0082] A scaling unit for scaling the corresponding wave points in the wave point image according to the scaling coefficient to obtain a third image;
[0083] A second superposition unit for superposing the third image and the first image to obtain a fourth image;
[0084] Correspondingly, the first superposition unit can also be used to superpose the fourth image and the second image to obtain a target image.
[0085] Optionally, the above-mentioned scaling unit can also be used to multiply the radius of each wave point by the corresponding scaling coefficient to obtain a third image.
[0086] Optionally, the above-mentioned second superposition unit may include:
[0087] A first calculation subunit for calculating the value of each channel according to the first superposition formula for the pixel points in the first image whose brightness exceeds the first threshold;
[0088] A second calculation subunit for calculating the value of each channel according to the second superposition formula for the pixel points in the first image whose brightness does not exceed the first threshold.
[0089] Optionally, the first conversion unit 21 may include:
[0090] A first setting subunit for setting the brightness value of the pixel points in the image to be processed whose brightness value exceeds the first threshold to a first value;
[0091] A second setting subunit for setting the brightness value of the pixel points in the image to be processed whose brightness value does not exceed the second threshold to a second value, where the second threshold is lower than the first threshold;
[0092] Converting the brightness values of the pixel points in the image to be processed between the first threshold and the second threshold into corresponding values according to a non-linear formula to obtain a first image.
[0093] The image processing device in the embodiments of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiments of the present application do not make specific limitations.
[0094] The image processing device in the embodiments of the present application can be a device with an operating system. The operating system can be the Android operating system, the iOS operating system, or other possible operating systems. The embodiments of the present application do not make specific limitations.
[0095] The image processing device provided in the embodiments of the present application can implement Figure 1 each process implemented by the method embodiments. To avoid repetition, it will not be elaborated here.
[0096] Optionally, as Figure 3 shown, the embodiments of the present application further provide an electronic device 300, including a processor 301, a memory 302, a program or instruction stored on the memory 302 and executable on the processor 301. When the program or instruction is executed by the processor 301, it implements each process of the above-mentioned image processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0097] It should be noted that the electronic device in the embodiments of the present application includes the above-mentioned mobile electronic device and non-mobile electronic device.
[0098] Figure 4 It is a schematic diagram of the hardware structure of an electronic device for implementing the embodiments of the present application.
[0099] The electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010, etc.
[0100] Those skilled in the art can understand that the electronic device 1000 may further include a power source (such as a battery) for powering each component. The power source can be logically connected to the processor 1010 through a power management system, so as to manage functions such as charging, discharging, and power consumption management through the power management system. Figure 4 The structure of the electronic device shown in Figure 4 does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0101] Among them, the processor 1010 is used to execute the following steps:
[0102] According to the luminance channel of the image to be processed, convert the luminance of the image to be processed in a non-linear processing manner to obtain a first image; extract the image edge of the image to be processed to obtain a second image;
[0103] Overlay the first image and the second image to obtain a processed target image.
[0104] The electronic device provided by the embodiment of the present application can convert the luminance of the image to be processed into an updated luminance in a non-linear processing manner to obtain a first image. After extracting the image edge of the image to be processed to obtain a second image, the first image and the second image can be overlaid to obtain a processed target image, so that the image to be processed can be converted into an effect similar to the pop style, enriching the image processing method for image style conversion and solving the problem of fewer types of image style conversion in the related art.
[0105] Optionally, before the processor 1010 executes the step of converting the luminance of the image to be processed in a non-linear processing manner according to the luminance channel of the image to be processed, the following steps can also be executed:
[0106] Convert the image to be processed from a first color space to a second color space, where the second color space includes a luminance channel.
[0107] Optionally, before the processor 1010 executes the step of overlaying the first image and the second image to obtain a processed target image, the following steps can also be executed:
[0108] Obtain a dot image;
[0109] Generate a scaling coefficient corresponding to each dot according to the luminance of each dot in the first image;
[0110] Scale the corresponding dots in the dot image according to the scaling coefficient to obtain a third image;
[0111] Overlay the third image and the first image to obtain a fourth image;
[0112] Overlay the first image and the second image to obtain a processed target image, including: overlay the fourth image and the second image to obtain the target image.
[0113] Optionally, when the processor 1010 executes scaling the corresponding wave dots in the wave dot image according to the scaling factor to obtain the third image, it may include performing the following steps:
[0114] Multiply the radius of each wave dot by the corresponding scaling factor to obtain the third image.
[0115] Optionally, when the processor 1010 executes overlaying the third image and the first image to obtain the fourth image, it may include performing the following steps:
[0116] For the pixel points in the first image whose brightness exceeds the first threshold, calculate the value of each channel according to the first overlay formula;
[0117] For the pixel points in the first image whose brightness does not exceed the first threshold, calculate the value of each channel according to the second overlay formula.
[0118] Optionally, when the processor 1010 executes converting the brightness of the image to be processed according to the brightness channel of the image to be processed in a non-linear processing manner to obtain the first image, it may include performing the following steps:
[0119] Set the brightness value of the pixel points in the image to be processed whose brightness value exceeds the first threshold to the first value;
[0120] Set the brightness value of the pixel points in the image to be processed whose brightness value does not exceed the second threshold to the second value, where the second threshold is lower than the first threshold;
[0121] Convert the brightness value of the pixel points in the image to be processed whose brightness value is between the first threshold and the second threshold to the corresponding value according to the non-linear formula to obtain the first image.
[0122] It should be understood that in the embodiments of the present application, the input unit 1004 may include a Graphics Processing Unit (GPU) 10041 and a microphone 10042. The GPU 10041 processes the image data of static pictures or videos obtained by an image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also referred to as a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. The other input devices 10072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here. The memory 1009 can be used to store software programs and various data, including but not limited to application programs and operating systems. The processor 1010 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communications. It can be understood that the above-mentioned modem processor may not be integrated into the processor 1010.
[0123] The embodiments of the present application further provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the above-mentioned embodiment of the image processing method and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0124] Wherein, the processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disc, etc.
[0125] The embodiments of the present application further provide a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run a program or instruction to implement each process of the above-mentioned embodiment of the image processing method and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0126] It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.
[0127] It should be noted that, in this text, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, article or device comprising such element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0128] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present application.
[0129] The embodiments of the present application have been described above with reference to the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Those of ordinary skill in the art, under the inspiration of the present application and without departing from the spirit and scope protected by the claims of the present application, can still make many forms, all of which fall within the protection scope of the present application.
Claims
1. An image processing method, characterized in that, including: converting the brightness of the image to be processed according to the brightness channel of the image to be processed in a non-linear processing manner to obtain a first image; extracting the image edge of the image to be processed to obtain a second image; superimposing the first image and the second image to obtain a processed target image; before superimposing the first image and the second image to obtain a processed target image, the method further includes: acquiring a dot image; generating a scaling coefficient corresponding to each dot according to the brightness of each dot in the first image; scaling the corresponding dots in the dot image according to the scaling coefficient to obtain a third image; superimposing the third image and the first image to obtain a fourth image; the superimposing the first image and the second image to obtain a processed target image includes: superimposing the fourth image and the second image to obtain the target image; the superimposing the third image and the first image to obtain a fourth image includes: for the pixel points in the first image whose brightness exceeds a first threshold, calculating the value of each channel according to a first superimposing formula; for the pixel points in the first image whose brightness does not exceed the first threshold, calculating the value of each channel according to a second superimposing formula.
2. The method according to claim 1, wherein before converting the brightness of the image to be processed according to the brightness channel of the image to be processed in a non-linear processing manner, it further includes: converting the image to be processed from a first color space to a second color space, wherein the second color space includes the brightness channel.
3. The method according to claim 1, wherein the scaling the corresponding dots in the dot image according to the scaling coefficient to obtain a third image includes: multiplying the radius of each dot by the corresponding scaling coefficient to obtain the third image.
4. The method according to claim 1, wherein the converting the brightness of the image to be processed according to the brightness channel of the image to be processed in a non-linear processing manner to obtain a first image includes: setting the brightness value of the pixel points in the image to be processed whose brightness value exceeds a first threshold to a first value; setting the brightness value of the pixel points in the image to be processed whose brightness value does not exceed a second threshold to a second value, wherein the second threshold is lower than the first threshold; converting the brightness value of the pixel points in the image to be processed whose brightness value is between the first threshold and the second threshold to a corresponding value according to a non-linear formula to obtain the first image.
5. An image processing apparatus, characterized in that, including: a first conversion unit for converting the brightness of the image to be processed according to the brightness channel of the image to be processed in a non-linear processing manner to obtain a first image; an extraction unit for extracting the image edge of the image to be processed to obtain a second image; a first superimposing unit for superimposing the first image and the second image to obtain a processed target image; further including: an acquisition unit for acquiring a dot image before superimposing the first image and the second image to obtain a processed target image; a generation unit for generating a scaling coefficient corresponding to each dot according to the brightness of each dot in the first image; a scaling unit for scaling the corresponding dots in the dot image according to the scaling coefficient to obtain a third image; A second superimposing unit, configured to superimpose the third image and the first image to obtain a fourth image; The first superimposing unit is further configured to superimpose the fourth image and the second image to obtain the target image; The second superimposing unit includes: A first calculating subunit, configured to calculate the value of each channel for the pixel points in the first image whose brightness exceeds a first threshold according to a first superimposing formula; A second calculating subunit, configured to calculate the value of each channel for the pixel points in the first image whose brightness does not exceed the first threshold according to a second superimposing formula.
6. The device according to claim 5, wherein It further includes: A second conversion unit, configured to convert the to-be-processed image from a first color space to a second color space before converting the brightness of the to-be-processed image in a non-linear processing manner according to the brightness channel of the to-be-processed image, wherein the second color space includes the brightness channel.
7. The device according to claim 5, characterized in that The scaling unit is further configured to multiply the radius of each wave point by the corresponding scaling coefficient to obtain the third image.
8. The device according to claim 6, characterized in that, The first conversion unit includes: A first setting subunit, configured to set the brightness value of the pixel points in the to-be-processed image whose brightness value exceeds a first threshold to a first value; A second setting subunit, configured to set the brightness value of the pixel points in the to-be-processed image whose brightness value does not exceed a second threshold to a second value, wherein the second threshold is lower than the first threshold; Convert the brightness value of the pixel points in the to-be-processed image between the first threshold and the second threshold into a corresponding value according to a non-linear formula to obtain the first image.
9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instruction stored on the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of the image processing method according to any one of claims 1-4 are implemented.
10. A readable storage medium, characterized in that, A program or instruction is stored on the readable storage medium. When the program or instruction is executed by a processor, the steps of the image processing method according to any one of claims 1-4 are implemented.
Citation Information
Patent Citations
Image processing method and device
CN108734754A
Image processing method and device, computer equipment and storage medium
CN113012185A