WO2022199583A1 - 图像处理方法、装置、计算机设备和存储介质 - Google Patents

图像处理方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2022199583A1
WO2022199583A1 PCT/CN2022/082309 CN2022082309W WO2022199583A1 WO 2022199583 A1 WO2022199583 A1 WO 2022199583A1 CN 2022082309 W CN2022082309 W CN 2022082309W WO 2022199583 A1 WO2022199583 A1 WO 2022199583A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
target
edge
luminance
quantized
Prior art date
Application number
PCT/CN2022/082309
Other languages
English (en)
French (fr)
Inventor
谢朝毅
Original Assignee
影石创新科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 影石创新科技股份有限公司 filed Critical 影石创新科技股份有限公司
Publication of WO2022199583A1 publication Critical patent/WO2022199583A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/181Segmentation; Edge detection involving edge growing; involving edge linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/94Dynamic range modification of images or parts thereof based on local image properties, e.g. for local contrast enhancement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of computer vision technology, and in particular, to an image processing method, apparatus, computer equipment and storage medium.
  • image processing technology With the development of computer vision technology, image processing technology has emerged, and images are the main source for humans to obtain and exchange information. Therefore, the application field of image processing involves all aspects of human life and work, including aerospace and aviation technology, biomedical engineering, Communication engineering, industry and engineering, military and public security, culture and art, etc.
  • image processing technology users have more requirements for the style of images. For example, manga-style imagery, as a widely circulated form of artistic expression, is becoming more and more popular.
  • An image processing method comprising: acquiring a target image to be subjected to style transformation; acquiring a brightness channel image corresponding to the target image; acquiring a target edge image corresponding to the target image; The pixel values corresponding to the pixel points are quantized to obtain a quantized image; the image fusion of the target edge image and the quantized image is performed to obtain a fusion image; the color channel image corresponding to the target image is obtained, based on the fusion image and A style-transformed image corresponding to the target image is obtained from the color channel image.
  • the performing quantization processing on the pixel values corresponding to each pixel in the luminance channel image to obtain the quantized image includes: sorting the luminance values corresponding to each pixel in the luminance channel image to obtain luminance value sequence; segment the luminance value sequence to obtain subsequences corresponding to each luminance value range; obtain the target quantized luminance value corresponding to the luminance value range corresponding to the subsequence, and use the target quantized luminance value as A quantized image is obtained from the luminance values of the pixels corresponding to the subsequences in the luminance channel image.
  • the acquiring the target quantized luminance value corresponding to the luminance value range corresponding to the subsequence includes: performing statistics on the luminance values corresponding to the subsequence to obtain the luminance value range corresponding to the subsequence The corresponding target statistical brightness value; based on the preset correspondence between the statistical pixel value and the quantized brightness value, the target quantized brightness value corresponding to the target statistical brightness value is obtained.
  • performing image fusion on the target edge image and the quantized image to obtain a fused image includes: combining a brightness value in the target edge image with a brightness value at a corresponding position in the quantized image Perform multiplication to obtain a multiplied luminance value; and arrange the multiplied luminance values according to the image positions corresponding to the multiplied luminance values to obtain a fusion image.
  • the acquiring the target edge image corresponding to the target image includes: performing smoothing processing on the luminance channel image based on a first smoothing method to obtain a first smoothed image; performing a smoothing process on the luminance channel image to obtain a second smooth image; performing a difference calculation between the first smooth image and the second smooth image to obtain a difference image; determining the corresponding luminance channel image based on the difference image edge area; amplify the image difference of the edge area in the luminance channel image to obtain a target edge image.
  • the amplifying the image difference of the edge region in the luminance channel image to obtain the target edge image includes: amplifying the image difference of the edge region in the luminance channel image to obtain the initial edge image; Determine the edge direction corresponding to the initial edge image; determine the smoothing direction of the initial edge image according to the change speed of the brightness value corresponding to the edge direction, and perform smooth processing on the initial edge image according to the smoothing direction to obtain a target edge image.
  • the determining the edge area corresponding to the luminance channel image based on the difference image includes: taking an area in the difference image with a luminance value greater than a preset luminance threshold as the luminance channel image corresponding edge area; taking the area other than the edge area in the brightness channel image as a non-edge area; the amplifying the image difference of the edge area in the brightness channel image to obtain the edge image includes: amplifying the brightness channel The image difference of the edge area in the image is reduced, and the image difference of the non-edge area is reduced to obtain the target edge image.
  • An image processing device comprises: a target image acquisition module for acquiring a target image to be subjected to style transformation; a luminance channel image acquisition module for acquiring a luminance channel image corresponding to the target image; a target edge image for obtaining module, used to obtain the target edge image corresponding to the target image; quantized image obtaining module, used to quantify the pixel value corresponding to each pixel in the brightness channel image, to obtain a quantized image; fusion image obtaining module, using Perform image fusion on the target edge image and the quantized image to obtain a fusion image; a style-transformed image obtaining module is used to obtain a color channel image corresponding to the target image, based on the fusion image and the color The channel image obtains the style-transformed image corresponding to the target image.
  • the quantized image obtaining module is configured to sort the luminance values corresponding to each pixel in the luminance channel image to obtain a sequence of luminance values; segment the sequence of luminance values to obtain ranges of luminance values The corresponding subsequence; obtain the target quantized luminance value corresponding to the luminance value range corresponding to the subsequence, and use the target quantized luminance value as the luminance value of the pixel corresponding to the subsequence in the luminance channel image to obtain Quantify the image.
  • the quantized image obtaining module is configured to perform statistics on the luminance values corresponding to the subsequences, and obtain the target statistical luminance values corresponding to the luminance value ranges corresponding to the subsequences; based on the preset statistical pixel values and The corresponding relationship of the quantized luminance values is obtained, and the target quantized luminance value corresponding to the target statistical luminance value is obtained.
  • the fused image obtaining module is configured to multiply the brightness value in the target edge image by the brightness value of the corresponding position in the quantized image to obtain the multiplied brightness value;
  • the image positions corresponding to the multiplied luminance values are arranged, and the multiplied luminance values are arranged to obtain a fusion image.
  • the target edge image obtaining module is configured to perform smoothing processing on the luminance channel image based on a first smoothing method to obtain a first smoothed image and perform smoothing processing on the luminance channel image based on a second smoothing method , obtain a second smooth image; perform difference calculation between the first smooth image and the second smooth image to obtain a difference image; determine the edge area corresponding to the brightness channel image based on the difference image; amplify the brightness The image difference of the edge area in the channel image is used to obtain the target edge image.
  • the target edge image obtaining module is configured to amplify the image difference of the edge region in the luminance channel image to obtain an initial edge image; determine the edge direction corresponding to the initial edge image; according to the edge direction The change speed of the corresponding brightness value determines the smoothing direction of the initial edge image, and the initial edge image is smoothed according to the smoothing direction to obtain a target edge image.
  • the target edge image obtaining module is configured to use an area in the difference image with a luminance value greater than a preset luminance threshold as an edge area corresponding to the luminance channel image;
  • the area outside the area is regarded as a non-edge area; the image difference of the edge area in the luminance channel image is enlarged, and the image difference of the non-edge area is reduced to obtain the target edge image.
  • a computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program: acquiring a target image to be subjected to style transformation; acquiring a brightness corresponding to the target image channel image; obtain the target edge image corresponding to the target image; perform quantization processing on the pixel values corresponding to each pixel in the luminance channel image to obtain a quantized image; perform image fusion on the target edge image and the quantized image to obtain a fusion image; acquire a color channel image corresponding to the target image, and obtain a style-transformed image corresponding to the target image based on the fusion image and the color channel image.
  • the terminal can obtain the target image to be subjected to style transformation; obtain the brightness channel image corresponding to the target image; obtain the target edge image corresponding to the target image; The pixel value corresponding to each pixel is quantized to obtain a quantized image; the target edge image and the quantized image are image-fused to obtain a fused image; at the same time, by obtaining the color channel image corresponding to the target image, based on the above-mentioned fusion image and this The color channel image obtains the style-transformed image corresponding to the target image.
  • the pixel value can be obtained by quantization, which improves the image processing effect of the style-transformed image.
  • Fig. 1 is the application environment diagram of the image processing method in one embodiment
  • FIG. 2 is a schematic flowchart of an image processing method in one embodiment
  • FIG. 3 is a schematic flowchart of performing quantization processing on the pixel values corresponding to each pixel in the luminance channel image to obtain a quantized image in one embodiment
  • FIG. 4 is a schematic flowchart of obtaining a target quantized luminance value corresponding to a luminance value range corresponding to a subsequence in one embodiment
  • FIG. 5 is a schematic flow chart of performing image fusion with a target edge image and a quantized image to obtain a fused image in one embodiment
  • FIG. 6 is a schematic flowchart of obtaining a target edge image corresponding to a target image in one embodiment
  • FIG. 7 is a schematic flowchart of amplifying the image difference of the edge region in the luminance channel image to obtain the target edge image in one embodiment
  • FIG. 8 is a schematic diagram of the realization of amplifying the image difference of the edge region in the brightness channel image to obtain the target edge image in one embodiment
  • FIG. 9 is a schematic diagram of an implementation of smoothing an initial edge image according to a smoothing direction in one embodiment
  • FIG. 10 is a structural block diagram of an image processing apparatus in one embodiment
  • Figure 11 is a schematic diagram of an image smoothing direction in one embodiment
  • 13 is a second smoothing image after image smoothing processing in one embodiment
  • Fig. 15 is the cartoon image after the beautification mapping of the image to be processed in one embodiment
  • Fig. 16 is an image after optimization of the cartoon image after beautification mapping of the image to be processed in one embodiment
  • Figure 17 is a diagram of the internal structure of a computer device in one embodiment.
  • the image processing method provided by the present application can be applied to the application environment shown in FIG. 1 , and is specifically applied to an image processing system.
  • the image processing system includes a terminal 102 and an image acquisition device 104 , wherein the terminal 102 is connected with the image acquisition device 104 .
  • the terminal 102 executes an image processing method.
  • the terminal 102 acquires a target image to be subjected to style transformation collected by the image acquisition device 104; in the process of image processing, the terminal 102 acquires a luminance channel image corresponding to the above target image; The target edge image corresponding to the target image; quantify the pixel values corresponding to each pixel in the brightness channel image to obtain a quantized image; fuse the target edge image and the quantized image to obtain a fused image; obtain the color channel corresponding to the target image Image, based on the fusion image and the color channel image, the style-transformed image corresponding to the target image is obtained.
  • the terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices
  • the image acquisition device 104 can be, but is not limited to, various devices with image acquisition functions, which can be located in the terminal 104 It can also be located inside the terminal 104.
  • the image capture device 104 may be various cameras, scanners, various cameras, and image capture cards located outside the terminal. It can be understood that the image processing method provided by the embodiment of the present application may also be executed by a server.
  • an image processing method is provided, and the method is applied to the terminal in FIG. 1 as an example for description, including the following steps:
  • Step 202 acquiring a target image to be subjected to style transformation.
  • style transformation refers to the conversion from one style of image to another style image. For example, converting from a sketch-style image to a manga-style or watercolor-style image, etc.
  • an image stored locally or transmitted to the terminal in real time may be acquired as a target image to be subjected to style transformation.
  • the image processing instruction carries the image identifier of the target image to be style-transformed and the image style to be transformed. Through the image identifier, the terminal can retrieve the image from the locally stored image. The target image to be style-transformed is obtained from .
  • the target image to be subjected to style transformation can be acquired by an image acquisition device.
  • the image capture device is connected to the terminal.
  • the image capture device receives an image acquisition instruction from the terminal, it transmits the captured real-time image or the image stored locally by the image capture device to the terminal, and the terminal uses the received image as the image to be transformed.
  • the target image is subjected to image processing.
  • Image acquisition equipment includes various cameras, scanners, various cameras, and image acquisition cards.
  • the image acquisition device can transmit the acquired images to the terminal sequentially or in batches according to a certain time interval. After the terminal acquires the images, it can be stored locally for later use, or can be processed in real time after receiving the images.
  • Step 204 Obtain a luminance channel image corresponding to the target image.
  • the luminance channel image refers to the image of the luminance channel among the three channels.
  • Three-channel refers to the pixel components that divide each pixel in the image into three channels.
  • three channels include Lab (Lab color space) channel space, YUV (YUV color space) channel space, HSV (HSV color space) channel space or RGB channel space, etc., through Lab channel space, YUV channel space, HSV channel space or The RGB channel space can decompose the image into pixel components.
  • the terminal after the terminal acquires the target image to be subjected to style transformation, it can perform channel analysis on the target image to obtain the required luminance channel image.
  • the luminance channel image may be an image obtained by performing grayscale processing on the target image.
  • Step 206 acquiring a target edge image corresponding to the target image.
  • edge recognition refers to identifying points with obvious brightness changes in the brightness channel image.
  • the target edge image refers to an image composed of points with obvious brightness changes obtained after edge recognition is performed on the brightness channel image.
  • some style transformations require obvious edges of the target image to achieve better image processing effects. For example, transform the target image into a manga-style image. It is required that the terminal acquires the target edge image corresponding to the target image after acquiring the luminance channel image corresponding to the target image.
  • an edge detection algorithm may be used to identify the edge to obtain a target edge image.
  • edge detection algorithms such as the sobel (Sobel operator) algorithm, the canny (Canny edge detector) algorithm or the DoG (Difference of Gaussian) algorithm are used to identify the edge to obtain the target edge image.
  • a smoothed image may be obtained by performing different degrees of smoothing on the luminance channel image, using the difference between the obtained smoothed images to obtain the edge region of the luminance channel image, and then comparing the difference values in the obtained difference image.
  • the brightness difference value is processed to obtain the target edge image. For example, the smaller the luminance difference in the difference image is smaller, and the larger the luminance difference is larger, so as to obtain the target edge image with more prominent edges.
  • the image obtained by processing the luminance difference in the difference image may be used as the initial edge image, and the target edge image is obtained after smoothing the initial edge image.
  • the difference image after the brightness difference is processed by the image smoothing algorithm is smoothed.
  • Gaussian blur, median blur, or mean blur, etc. may be used to smooth the difference image after processing the luminance difference.
  • the function between the pixel value of the pixel point in the neighborhood and the pixel value of the target pixel point in the smoothing direction of each pixel point can be used relationship to obtain the pixel value of the target pixel, thereby obtaining the target edge image composed of the target pixel.
  • Step 208 Perform quantization processing on the pixel values corresponding to each pixel in the luminance channel image to obtain a quantized image.
  • quantization processing refers to processing continuous pixel values corresponding to each pixel point in the image, correspondingly obtaining discontinuous pixel values, or correspondingly obtaining a pixel value from the pixel values of multiple pixel points within a certain pixel value range,
  • quantization a large number of discrete values can be approximated into fewer discrete values.
  • the pixel values of the 10 pixel points are ⁇ 0, 20, 25, 24, 50, 45, 32, 36, 50, 60 ⁇ , respectively, and the corresponding pixel value is 51 after quantization processing.
  • the terminal may perform quantization processing on the target image in order to reduce the detail texture in the target image and reduce the total amount of colors in the image processing process.
  • the luminance values corresponding to each pixel in the luminance channel image are grouped according to a preset luminance value range, and then a quantized image after quantization is obtained according to the correspondence between the luminance value range and the quantized luminance value .
  • the quantized luminance value corresponding to a pixel with a luminance value ranging from 0 to 20 is 0, and the corresponding quantized luminance value of a pixel with a luminance value ranging from 21 to 100 is 105.
  • the luminance values of are converted into quantized luminance values of 0, and the luminance values of pixels with luminance values ranging from 21 to 100 are converted into quantized luminance values of 105, etc., to obtain a quantized image composed of pixels with quantized luminance values.
  • the luminance values corresponding to the pixels in the luminance channel image may be divided into multiple groups, where multiple refers to at least two, and the quantized luminance values corresponding to each group are different.
  • the brightness values corresponding to each pixel in the brightness channel image can be sorted and divided into N equal parts, and the statistical value of the brightness values of each equal part can be obtained. According to the difference between the statistical value of the brightness value and the quantized brightness value The corresponding relationship is obtained to obtain the quantized luminance value.
  • the 10 pixels in the luminance channel image are ⁇ 0, 20, 26, 24, 50, 46, 32, 36, 50, 60 ⁇
  • the sorting sequence ⁇ 0, 20, 24, 25, 32, 36, 45, 50, 50, 60 ⁇
  • the sorted luminance values are divided into 5 equal parts, and the sets of luminance values of the 5 equal parts are ⁇ 0, 20 ⁇ , ⁇ 24, 26 ⁇ , ⁇ 32, 36 ⁇ , ⁇ 46, 50 ⁇ , ⁇ 50, 60 ⁇
  • the statistical values of the luminance values of each equal part are 10, 25, 34, 48, 55, respectively.
  • the statistical values of the luminance values and the quantized luminance The correspondence between the values is shown in Table 1 below, respectively.
  • the quantized luminance value can be obtained from Table 1, thereby obtaining a quantized image composed of pixel points of the quantized luminance value.
  • Step 210 Perform image fusion on the target edge image and the quantized image to obtain a fusion image.
  • the image fusion refers to an image processing process in which two or more images are processed and synthesized into a new image. Compared with the original image, the useful information of the new image after image fusion is more prominent.
  • an image fusion algorithm can be used to fuse the target edge image and the quantized image, so that the useful information in the obtained fused image is more prominent.
  • a fusion method such as linear fusion, Poisson fusion, multi-scale fusion, weighted fusion, or Laplacian pyramid fusion may be used to fuse the target edge image and the quantized image to obtain a fusion image.
  • a multiplicative fusion algorithm can be used to perform image fusion on the target edge image and the quantized image to obtain a fusion image.
  • the target edge image is represented as edge
  • the quantized image is represented as quantized image
  • the fusion image is represented as dst
  • the fusion image dst using the product fusion algorithm can be represented as the formula:
  • Step 212 Obtain a color channel image corresponding to the target image, and obtain a style-transformed image corresponding to the target image based on the fusion image and the color channel image.
  • the color channel image refers to the image corresponding to the color channel in the three channels.
  • the color channel image and the luminance channel image together make up the target image.
  • the terminal processes the image composed of the fusion image and the color channel image, and then performs color space conversion to obtain a style-transformed image corresponding to the target image.
  • the image formed by the fusion image and the color channel image is an image in the Lab color space
  • the image in the Lab color space is converted into an image in the RGB color space
  • the image in the RGB color space is the style transformation corresponding to the target image. post image.
  • a smoothed color channel image is obtained, and a style-transformed image corresponding to the target image is obtained based on the fusion image and the smoothed color channel image.
  • the terminal can obtain the target image to be subjected to style transformation; obtain the brightness channel image corresponding to the target image; obtain the target edge image corresponding to the target image; Perform quantization processing to obtain a quantized image; fuse the target edge image and the quantized image to obtain a fused image; at the same time, obtain the corresponding color channel image of the target image based on the above-mentioned fusion image and the color channel image.
  • the style of the transformed image In the image processing process, while identifying the edge of the image, excessive pixel values can be removed through quantization processing, which improves the image processing effect of the style-transformed image.
  • performing quantization processing on the pixel values corresponding to each pixel in the luminance channel image, and obtaining the quantized image includes:
  • Step 302 Sort the luminance values corresponding to each pixel in the luminance channel image to obtain a sequence of luminance values.
  • the luminance value sequence refers to an ordered set arranged according to the size of the luminance values.
  • the luminance value sequence may be arranged in descending order of luminance values to form a luminance value sequence, or may be arranged in descending order of luminance values to form a luminance value sequence.
  • the luminance values corresponding to each pixel in the luminance channel image are large or small, and the luminance values corresponding to these pixels can be arranged in an orderly manner to obtain a sequence of luminance values.
  • the terminal may use a sorting algorithm to sort the luminance values corresponding to each pixel in the extracted luminance channel image to obtain a sequence of luminance values.
  • Sorting algorithms include quick sort, insertion sort, Hill sort or merge sort.
  • Step 304 Divide the luminance value sequence to obtain subsequences corresponding to each luminance value range.
  • the terminal may segment the luminance value sequence, and divide the luminance value sequence into subsequences, and each luminance value in the subsequence is within the luminance value range corresponding to the subsequence. For example, if the luminance value sequence is ⁇ 0, 20, 24, 25, 32, 36, 45, 50, 55, 60 ⁇ , and the luminance value ranges are 0-40 and 41-80, respectively, the luminance value range is 0-40 corresponding to The subsequence of is ⁇ 0, 20, 24, 25, 32, 36 ⁇ , and the subsequence corresponding to the luminance value range of 41-80 is ⁇ 45, 50, 55, 60 ⁇ .
  • the luminance value sequence may be divided on average to obtain subsequences within each luminance value range.
  • the luminance value sequence is ⁇ 0, 20, 24, 25, 32, 36, 45, 50, 55, 60, 70, 80 ⁇
  • the luminance value ranges are 0-30, 31-50 and 51-80 respectively, then the corresponding The 3 subsequences after the average segmentation are ⁇ 0, 20, 24, 25 ⁇ , ⁇ 32, 36, 45, 50 ⁇ and ⁇ 55, 60, 70, 80 ⁇ , respectively.
  • the luminance value sequence may be directly divided into average divisions to obtain subsequences after division.
  • Step 306 Obtain the target quantized luminance value corresponding to the luminance value range corresponding to the subsequence, and use the target quantized luminance value as the luminance value of the pixel corresponding to the subsequence in the luminance channel image to obtain a quantized image.
  • the luminance values of the pixels corresponding to each subsequence can be obtained according to the luminance value range in each sequence to obtain a quantized image.
  • the luminance value range can be represented by a statistical value of the luminance values of the pixels in each subsequence, and the statistical value has a one-to-one correspondence with the target quantized luminance value.
  • the corresponding target quantized luminance value can be obtained through the corresponding relationship, and the target quantized luminance value can be used as the luminance value of each pixel point in the subsequence to obtain a quantized image.
  • the obtained sub-sequences corresponding to the luminance value range statistical values are 10, 25, 34, 48, 55, respectively, and the sub-sequences corresponding to the statistical values are ⁇ 0, 20 ⁇ , ⁇ 24, 26 ⁇ , ⁇ 32, 36 ⁇ , ⁇ 46, 50 ⁇ , ⁇ 50, 60 ⁇ .
  • the quantized luminance value can be obtained from Table 2.
  • the quantized luminance value is substituted for the luminance value of the corresponding pixel in the subsequence, and the subsequences after the quantized luminance value is substituted for the luminance value of the corresponding pixel in the subsequence are ⁇ 0, 0 ⁇ respectively. , ⁇ 20, 20 ⁇ , ⁇ 30, 30 ⁇ , ⁇ 40, 40 ⁇ , ⁇ 50, 50 ⁇ , so as to obtain a quantized image composed of pixels with quantized luminance values.
  • the luminance value sequence is obtained by sorting the luminance values corresponding to each pixel in the luminance channel image, the sorted luminance value sequence is segmented, the subsequence of the luminance value sequence is obtained, and the luminance value corresponding to the subsequence is obtained.
  • the target quantized brightness value corresponding to the value range is obtained to obtain a quantized image, which can reduce the color components in the image and reduce the image details.
  • acquiring the target quantized luminance value corresponding to the luminance value range corresponding to the subsequence includes:
  • step 402 statistics are performed on the luminance values corresponding to the subsequences to obtain the target statistical luminance values corresponding to the luminance value ranges corresponding to the subsequences.
  • the target statistical brightness value refers to a brightness value that can reflect the overall numerical value of the brightness values in the subsequence. For example, the mean, median, or mode of the luminance values corresponding to the subsequence, etc.
  • the average value of the luminance values corresponding to the subsequences may be used as the target statistical luminance value corresponding to the luminance value range.
  • Step 404 Obtain a target quantized luminance value corresponding to the target statistical luminance value based on the preset correspondence between the statistical pixel value and the quantized luminance value.
  • the target statistical brightness value is known to be a certain statistical pixel value
  • the quantized brightness value corresponding to the target statistical brightness value can be determined, and the quantized brightness value can be determined.
  • the luminance value serves as the target quantized luminance value.
  • the corresponding relationship between the preset statistical pixel value and the quantized luminance value is as shown in Table 2. If the target statistical luminance value is 25, the corresponding target quantized luminance value is 20.
  • the target statistical brightness value is obtained by counting the brightness values corresponding to the subsequences, and the target quantized brightness value corresponding to the target statistical brightness value is obtained based on the preset correspondence between the statistical pixel value and the quantized brightness value,
  • the purpose of accurately obtaining the target quantized luminance value can be achieved, so that a quantized image can be obtained through the target quantized luminance value.
  • image fusion is performed on the target edge image and the quantized image, and the obtained fusion image includes:
  • Step 502 Multiply the brightness value in the target edge image and the brightness value at the corresponding position in the quantized image to obtain the multiplied brightness value.
  • the brightness value in the target edge image can be multiplied by the brightness value of the corresponding position in the quantized image, and the multiplied brightness value can be obtained as the brightness of the processed image. value.
  • the brightness value in the target edge image can be expressed as edge (brightness value)
  • the brightness value of the corresponding position in the quantized image can be expressed as quantized image (brightness value)
  • the brightness value after the multiplication of the two can be expressed as dst (brightness value)
  • dst (brightness value)
  • Step 504 Arrange the multiplied brightness values according to the image positions corresponding to the multiplied brightness values to obtain a fusion image.
  • the image position refers to the coordinate position of a pixel with a certain brightness value in the image. For example, if the coordinate position of a pixel in the target edge image is (x0, y0), then the coordinate position (x0, y0) of the pixel at the corresponding position in the quantized image, the coordinates of the multiplied luminance value to be arranged The position is (x0,y0).
  • the pixel point corresponding to the luminance value is placed at the position of the image to form a complete image, and the complete image is the obtained fusion image.
  • the number of colors in the image is reduced, the edge of the image is more prominent, and the purpose of improving the image processing effect can be achieved.
  • acquiring the target edge image corresponding to the target image includes:
  • Step 602 smoothing the luminance channel image based on the first smoothing method to obtain a first smoothed image, and performing smoothing processing on the luminance channel image based on the second smoothing method to obtain a second smoothed image.
  • the smoothing method refers to a method or method used for smoothing the luminance channel image. Smoothing refers to processing that reduces image noise in luminance channel images. Image noise refers to unnecessary and redundant interference information in an image. Smoothing the luminance channel image can improve the image quality of the luminance channel image.
  • different smoothing processing methods may be determined by using different smoothing parameters corresponding to the image smoothing algorithm.
  • the Gaussian blur algorithm is used to smooth the brightness channel image
  • the Gaussian function in the Gaussian blur algorithm is used to calculate the weight of each pixel in the brightness channel image
  • the brightness channel processed by the Gaussian blur algorithm is obtained according to the weight of each pixel. image.
  • the size of the weight depends on the size of the parameter in the Gaussian function, which can be regarded as a smoothing parameter. Smoothing graphs with different smoothing effects can be obtained by adjusting different smoothing parameters. While smoothing the luminance channel image, the edges of the luminance channel image are preserved.
  • different smoothing algorithms are used to smooth the same luminance channel image to obtain different smoothed images.
  • a mean blurring algorithm is used to smooth the luminance channel image to obtain a first smoothed image; meanwhile, a median blurring algorithm can be used to smooth the same luminance channel image to obtain a second smoothed image.
  • Step 604 Perform difference calculation between the first smoothed image and the second smoothed image to obtain a difference image.
  • the difference image refers to an image obtained by calculating the difference between the luminance values of the pixels at the same position of the two images.
  • the difference value calculation may be performed on the pixel points at the same position of the first smooth image and the second smooth image, and the difference value may be used as the brightness value of the pixel point at the same position in the difference value image.
  • Step 606 Determine the edge region corresponding to the luminance channel image based on the difference image.
  • the edge area refers to the area in the luminance channel image where the luminance value changes relatively large.
  • the difference image can be determined as the luminance channel image with the prominent edge area.
  • Step 608 amplify the image difference of the edge region in the luminance channel image to obtain the target edge image.
  • the difference image can be processed by the method of level mapping or curve stretching, and the image difference of the edge region in the luminance channel image can be enlarged to obtain the target edge image.
  • the difference image is processed by using the curve stretch difference map to obtain the target edge image.
  • the abscissa represents the brightness value after normalizing the brightness value in the difference image
  • the ordinate represents the brightness value corresponding to the target edge image
  • the areas greater than 0 and less than 0 on the abscissa are both
  • the brightness value corresponding to the ordinate value can be selected as the brightness value after the brightness value in the target edge image is normalized, and the corresponding target edge image can be obtained through the brightness value.
  • the corresponding ordinate value is 0, which means that the pixel with the brightness value of 63.75 in the difference image is mapped to the target edge image with a brightness value of 0.
  • two smooth images with different smoothing effects are obtained by processing the brightness channel images in different smoothing methods, and the difference images are obtained by performing difference calculation on the two smoothed images with different smoothing effects, and the difference images are processed After obtaining the target edge image, the purpose of obtaining the target edge image with obvious edge can be achieved, thereby improving the image processing effect.
  • amplifying the image difference of the edge region in the luminance channel image to obtain the target edge image includes:
  • Step 702 Amplify the image difference of the edge region in the luminance channel image to obtain an initial edge image.
  • the edge region of the brightness channel image can be enlarged to make the edge in the brightness channel image more obvious, and an initial edge image can be obtained.
  • the initial edge image may be directly a difference image of two smoothed images, or may be an image obtained by performing difference magnification processing on the difference image.
  • the image after curve stretching or level mapping is performed on the difference image as the initial edge image.
  • Step 704 Determine the edge direction corresponding to the initial edge image.
  • the edge direction refers to the general direction of the edge of the initial edge image, and a plurality of edge directions constitute the entire edge of the initial edge image.
  • the edge feature points of the initial edge image are extracted by the edge detection algorithm of the image, and the edge direction corresponding to the initial edge image is determined.
  • image edge detection algorithms such as sobel (Sobel operator), canny (Canny edge detector), or DoG (Difference of Gaussian) can be used to determine the edge direction corresponding to the initial edge image.
  • Step 706 Determine the smoothing direction of the initial edge image according to the change speed of the brightness value corresponding to the edge direction, and perform smoothing processing on the initial edge image according to the smoothing direction to obtain the target edge image.
  • the smoothing direction refers to the direction perpendicular to the gradient field direction of the feature points of the initial edge image; the gradient field direction refers to the direction in which the brightness value changes the fastest. Smoothing the edge of the image along the smoothing direction can make the edge direction more obvious.
  • the gradient field direction of the initial edge image may be determined by the Sobel algorithm or the like, and the smoothing direction of the initial edge image may be determined by the vertical direction of the obtained gradient field direction of the initial edge image.
  • the pixel points in the neighborhood of a certain pixel point in the initial edge image are weighted and summed along the smoothing direction of the pixel point to obtain the brightness value of the pixel point.
  • the luminance value at point C is the luminance value of the pixel points in the neighborhood along the smooth positive and negative directions at point C, and the luminance value at point C is obtained.
  • A1 in the smooth positive direction neighborhood at point C and there is brightness A2 in the smooth direction neighborhood along A1.
  • A3, B1, B2 and B3 are obtained.
  • the brightness values of A1-A3 are expressed as: A1, A2 and A3, the corresponding weights of A1, A2 and A3 are W1, W2 and W3 respectively; the brightness values of B1-B3 are B1, B2 and B3 respectively, and the corresponding weights of B1, B2 and B3 are W4, W5 respectively and W6, then the brightness value C at point C can be expressed as the formula:
  • A1- The brightness values of A3 are 100, 120 and 130, respectively, and the weights are 0.9, 0.8, and 0.7; the brightness values of B1-B3 are: 120, 140, and 160, and the weights are 0.9, 0.8, and 0.7, respectively; the brightness value of point C is 80 , the brightness value of the updated point C is 118.
  • the initial edge image is obtained by amplifying the image difference of the edge region in the brightness channel image, and the smoothing direction of the initial edge image is determined according to the change speed of the brightness value corresponding to the edge direction of the initial edge image. After smoothing, the target edge image can be obtained.
  • determining the edge area corresponding to the luminance channel image based on the difference image includes: taking an area with a luminance value greater than a luminance threshold in the difference image as the edge area corresponding to the luminance channel image;
  • the area with a larger brightness value is more likely to be an edge area.
  • the brightness threshold is used as a reference, and the brightness value is greater than
  • the area of the luminance threshold is used as the edge area corresponding to the luminance channel image.
  • the luminance threshold value may be set to 79, and the area with the luminance value greater than the luminance threshold value is regarded as the edge area corresponding to the luminance channel image.
  • the non-edge area refers to the area except the edge area is removed in the luminance channel image, and in this area, the luminance difference value of the pixels in the luminance channel image is small.
  • the area in the difference image with the luminance value greater than the luminance threshold is regarded as the edge area corresponding to the luminance channel image as the edge area corresponding to the luminance channel image
  • the area outside the edge area in the luminance channel image is regarded as the non-edge area .
  • Amplify the image difference of the edge area in the luminance channel image to obtain the target edge image including:
  • the image difference refers to the difference in the luminance channel image due to the magnitude of the luminance difference.
  • mapping the result of the brightness value mapped from the brightness difference value of the edge area with large image difference is larger, and the result of the brightness value mapped from the brightness difference value of the edge area with small image difference is smaller.
  • the result of the brightness value after mapping is obtained to obtain the target edge image.
  • the image difference of the edge area in the luminance channel image can be enlarged by the method of level mapping, and the image difference of the non-edge area can be reduced to obtain the target edge image. It can be understood that after amplifying the image difference of the edge area in the luminance channel image and reducing the image difference of the non-edge area, the processed image can be smoothed to obtain the target edge image.
  • the edge area and the non-edge area corresponding to the brightness channel image are obtained by judging the brightness value, and by enlarging the image difference of the edge area in the brightness channel image and reducing the image difference of the non-edge area, the target edge can be accurately obtained. the purpose of the image.
  • taking the conversion of the target image to be processed into a comic image is based on the characteristics of comics, that is, the characteristics of particularly obvious lines and less detailed texture.
  • the edge of the target image can be extracted to make the edge obvious and smooth and natural, so as to make the lines obvious and in line with the characteristics of comics.
  • the details of the target image are filtered out and the level is mapped to make the edges more obvious and the cartoon effect is better.
  • the target image can be mapped to the Lab color space, and the target image can be decomposed into a luminance channel image in the luminance channel L and a color channel image in the color channel ab. It can be understood that the target image can also be mapped to the YUV color space or the HSV color space or the like.
  • the target image can be converted into a manga image by the following steps.
  • the image can be divided into a flat area and an edge area. Since the smoothing results of different degrees of the flat area are the same, for example, the value of a certain area is 128, using the mean blurring algorithm, the area with a radius of 3 and a radius of The results obtained in the area of 7 are all 128, and the difference in brightness value is 0; while the edge area is just the opposite, the results obtained by different degrees of smoothing are very different, so that the edge area and the flat area are distinguished.
  • the difference image obtained by calculating the difference between two smooth images can be used as the initial edge image.
  • two smooth images can be obtained using Gaussian blur, median blur, mean blur, or other image smoothing algorithms. are the first smoothed image and the second smoothed image, respectively.
  • Figure 12 and Figure 13 are two smooth images obtained by using Gaussian blur.
  • the difference image is obtained by performing difference calculation on the first smooth image and the second smooth image, which is used as the initial edge image.
  • the obtained difference image is further enlarged for the luminance difference value therein.
  • tone level mapping which makes the difference value of the luminance value in the difference image smaller becomes smaller, and the difference value becomes larger.
  • a curve stretching difference map method is used, as shown in FIG. 8 , the abscissa represents the normalized brightness value of the difference image, and the ordinate represents the initial value obtained after stretching the difference image. Edge image, so that the difference image in the difference image in the difference image is smaller, and the difference image is larger.
  • the normalized luminance value of the difference image on the abscissa is -0.25, and the luminance value of the corresponding ordinate is 0, which means the initial edge obtained by stretching the luminance value of 0.25*255 in the difference image
  • the image brightness value is 0*255.
  • the normalized luminance value of the difference image on the abscissa can be selected as a negative value, and the corresponding image when the luminance value on the corresponding ordinate exceeds the set luminance threshold is the initial edge image.
  • the initial edge map needs to be smoothed.
  • Edge-preserving filtering algorithms such as bilateral filtering, surface blurring or guided filtering, can be used to obtain edge-preserving effects through adaptive edge direction selection. Point weighted average to get the filtered result. Thereby determining the edge direction of the image.
  • the gradient g x , g y may be extracted first by the Sobel algorithm, where g x represents the horizontal gradient matrix of the pixel point, and g y represents the vertical gradient matrix of the pixel point, and then the structure tensor matrix is obtained by calculation:
  • the eigenvector corresponding to the largest eigenvalue in the structure tensor matrix is the direction with the strongest correlation.
  • the E direction with the strongest correlation can be regarded as the gradient field direction of the pixel.
  • the points on the edge are smoothed, and the smoothing direction can be regarded as the smoothing direction.
  • one or more pixels in the neighborhood of the smooth direction can be weighted and summed to obtain the brightness value of the current position.
  • the effect diagram of the target edge image is obtained by performing edge smoothing on the initial edge image.
  • the luminance value at point C is the luminance value of the pixel points in the neighborhood along the smooth positive and negative directions at point C, and the luminance value at point C is obtained.
  • there is pixel point A1 in the smooth positive direction neighborhood at point C and there is brightness A2 in the smooth direction neighborhood along A1.
  • A3, B1, B2 and B3 are obtained.
  • the weights are 0.9, 0.8, and 0.7;
  • the brightness values of B1-B3 are: 120, 140, and 160, and the weights are 0.9, 0.8, and 0.7, respectively;
  • the brightness value of point C is 80, the brightness value of point C after updating is 118.
  • the brightness values in the brightness channel image can be sorted and divided into N equal parts, and the average value of the brightness values in each equal part can be mapped to the quantized value of the color level, and the quantized value of the color level can be used as the quantized value in each equal part.
  • the luminance value of thereby obtaining the quantized luminance channel image.
  • luminance values with luminance values of 0 to 255 may be mapped to quantized values of ⁇ 0, 51, 102, 154, 205, 255 ⁇ , respectively.
  • the brightness channel image in the comic image can be represented as dst (brightness channel image)
  • the color channel image in the comic image can be represented as dst (color channel image)
  • the target edge image can be represented as edge
  • dst (brightness channel image) )It can be expressed as:
  • the brightness channel image and the color channel image in the obtained comic image are images in the Lab color space, and the image in the Lab color space is converted into the target comic image in the RGB color space. As shown in Figure 15, it is the rendering of the target cartoon image.
  • the obtained target cartoon image can be optimized, and the target cartoon image can be adjusted by querying the LUT (Look Up Table) table, as shown in FIG. 16 , a cartoon effect with a more beautiful image processing effect can be obtained.
  • LUT Look Up Table
  • FIGS. 2-7 are shown in sequence according to the arrows, these steps are not necessarily executed in the sequence shown by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order, and these steps may be performed in other orders. Moreover, at least a part of the steps in FIGS. 2-7 may include multiple steps or multiple stages. These steps or stages are not necessarily executed and completed at the same time, but may be executed at different times. The execution of these steps or stages The order is also not necessarily sequential, but may be performed alternately or alternately with other steps or at least a portion of the steps or phases within the other steps.
  • an image processing apparatus 1000 including: a target image acquisition module 1002, a luminance channel image acquisition module 1004, a target edge image acquisition module 1006, a quantized image acquisition module 1008, a fusion
  • the image obtaining module 1010 and the style-transformed image obtaining module 1012 wherein: the target image obtaining module 1002 is used to obtain the target image to be subjected to style transformation; the luminance channel image obtaining module 1004 is used to obtain the luminance channel image corresponding to the target image ;
  • the target edge image obtaining module 1006 is used to obtain the target edge image corresponding to the target image;
  • the quantized image obtaining module 1008 is used to quantify the pixel values corresponding to each pixel point in the luminance channel image to obtain a quantized image;
  • the module 1010 is used for image fusion of the target edge image and the quantized image to obtain a fusion image; the style-transformed image obtaining module 1012 is used to obtain the color channel image corresponding to the target image, and obtain the target image
  • the quantized image obtaining module 1008 is configured to sort the luminance values corresponding to each pixel in the luminance channel image to obtain a sequence of luminance values; divide the sequence of luminance values to obtain subsequences corresponding to each range of luminance values ; Obtain the target quantized luminance value corresponding to the luminance value range corresponding to the subsequence, and use the target quantized luminance value as the luminance value of the pixel point corresponding to the subsequence in the luminance channel image to obtain a quantized image.
  • the quantized image obtaining module 1008 is configured to perform statistics on the luminance values corresponding to the subsequences, and obtain the target statistical luminance values corresponding to the luminance value ranges corresponding to the subsequences; The corresponding relationship is obtained, and the target quantized luminance value corresponding to the target statistical luminance value is obtained.
  • the fusion image obtaining module 1010 is configured to multiply the brightness value in the target edge image and the brightness value of the corresponding position in the quantized image to obtain the multiplied brightness value; Corresponding image positions, the multiplied brightness values are arranged to obtain a fusion image.
  • the target edge image obtaining module 1006 is configured to perform smoothing processing on the luminance channel image based on the first smoothing method to obtain a first smoothed image and, based on the second smoothing method, perform smoothing processing on the luminance channel image to obtain the second smoothing method. smoothing the image; calculating the difference between the first smooth image and the second smooth image to obtain a difference image; determining the edge area corresponding to the brightness channel image based on the difference image; amplifying the image difference of the edge area in the brightness channel image to obtain the target edge image.
  • the target edge image obtaining module 1006 is used to amplify the image difference of the edge region in the luminance channel image to obtain the initial edge image; determine the edge direction corresponding to the initial edge image; determine according to the change speed of the brightness value corresponding to the edge direction The smoothing direction of the initial edge image.
  • the initial edge image is smoothed according to the smoothing direction to obtain the target edge image.
  • the target edge image obtaining module 1006 is configured to use the difference image, the area with the luminance value greater than the luminance threshold as the edge area corresponding to the luminance channel image; use the area outside the edge area in the luminance channel image as the non-edge area area; enlarge the image difference of the edge area in the luminance channel image, reduce the image difference of the non-edge area, and obtain the target edge image.
  • Each module in the above-mentioned image processing apparatus may be implemented in whole or in part by software, hardware, and combinations thereof.
  • the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • a computer device is provided, and the computer device may be a terminal, and its internal structure diagram may be as shown in FIG. 17 .
  • the computer equipment includes a processor, memory, a communication interface, a display screen, and an input device connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium, an internal memory.
  • the nonvolatile storage medium stores an operating system and a computer program.
  • the internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium.
  • the communication interface of the computer device is used for wired or wireless communication with an external terminal, and the wireless communication can be realized by WIFI, operator network, NFC (Near Field Communication) or other technologies.
  • the computer program implements an image processing method when executed by a processor.
  • the display screen of the computer equipment may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment may be a touch layer covered on the display screen, or a button, a trackball or a touchpad set on the shell of the computer equipment , or an external keyboard, trackpad, or mouse.
  • FIG. 17 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
  • a computer device including a memory and a processor, where a computer program is stored in the memory, and the processor implements the steps in the foregoing method embodiments when the processor executes the computer program.
  • a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps in the foregoing method embodiments.
  • Non-volatile memory may include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, or optical memory, and the like.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • the RAM may be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

本申请涉及一种图像处理方法、装置、计算机设备和存储介质。所述方法包括:获取待进行风格变换的目标图像;获取所述目标图像对应的亮度通道图像;获取所述目标图像对应的目标边缘图像;对所述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;将所述目标边缘图像和所述量化图像进行图像融合,得到融合图像;获取所述目标图像对应的颜色通道图像,基于所述融合图像以及所述颜色通道图像得到所述目标图像对应的风格变换后的图像。采用本方法能够提高图像处理效果。

Description

图像处理方法、装置、计算机设备和存储介质 技术领域
本申请涉及计算机视觉技术领域,特别是涉及一种图像处理方法、装置、计算机设备和存储介质。
背景技术
随着计算机视觉技术的发展,出现了图像处理技术,图像是人类获取和交换信息的主要来源,因此,图像处理的应用领域涉及人类生活和工作的方方面面,包括航天和航空技术、生物医学工程、通信工程、工业和工程、军事和公安、文化与艺术等方面。随着图像处理技术的发展,用户对图像的风格也有了更多的要求。例如,漫画风格的图像,作为一种广为流传的艺术表现形式,受到越来越多人的喜欢。
技术问题
然而,目前的图像处理方法对图像进行处理,存在图像处理效果差的问题。
技术解决方案
基于此,有必要针对上述技术问题,提供一种能够提高图像处理效果的图像处理方法、装置、计算机设备和存储介质。
一种图像处理方法,所述方法包括:获取待进行风格变换的目标图像;获取所述目标图像对应的亮度通道图像;获取所述目标图像对应的目标边缘图像;对所述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;将所述目标边缘图像和所述量化图像进行图像融合,得到融合图像;获取所述目标图像对应的颜色通道图像,基于所述融合图像以及所述颜色通道图像得到所述目标图像对应的风格变换后的图像。
在其中一个实施例中,所述对所述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像包括:将所述亮度通道图像中各个像素点对应的亮度值进行排序,得到亮度值序列;对所述亮度值序列进行切分,得到各个亮度值范围对应的子序列;获取所述子序列对应的亮度值范围所对应的目标量化亮度值,将所述目标量化亮度值作为所述亮度通道图像中所述子序列对应的像素点的亮度值,得到量化图像。
在其中一个实施例中,所述获取所述子序列对应的亮度值范围所对应的目标量化亮度值包括:对所述子序列对应的亮度值进行统计,得到所述子序列对应的亮度值范围对应的目标统计亮度值;基于预设的统计像素值与量化亮度值的对应关系,得到所述目标统计亮度值所对应的目标量化亮度值。
在其中一个实施例中,所述将所述目标边缘图像和所述量化图像进行图像融合,得到融合图像包括:将所述目标边缘图像中的亮度值与所述量化图像中对应位置的亮度值进行相乘,得到相乘后的亮度值;按照所述相乘后的亮度值所对应的图像位置,将所述相乘后的亮度值进行排列,得到融合图像。
在其中一个实施例中,所述获取所述目标图像对应的目标边缘图像包括:基于第一平滑方式对所述亮度通道图像进行平滑处理,得到第一平滑图像以及,基于第二平滑方式对所述亮度通道图像进行平滑处理,得到第二平滑图像;将所述第一平滑图像和第二平滑图像进行差值计算,得到差值图像;基于所述差值图像确定所述亮度通道图像对应的边缘区域;放大所述亮度通道图像中所述边缘区域的图像差别,得到目标边缘图像。
在其中一个实施例中,所述放大所述亮度通道图像中所述边缘区域的图像差别,得到目标边缘图像包括:放大所述亮度通道图像中所述边缘区域的图像差别,得到初始边缘图像;确定所述初始边缘图像对应的边缘方向;根据所述边缘方向对应的亮度值的变化速度确定所述初始边缘图像的平滑方向,根据所述平滑方向对所述初始边缘图像进行平滑处理,得到目标边缘图像。
在其中一个实施例中,所述基于所述差值图像确定所述亮度通道图像对应的边缘区域包括:将所述差值图像中,亮度值大于预设亮度阈值的区域作为所述亮度通道图像对应的边缘区域;将所述亮度通道图像中边缘区域之外的区域作为非边缘区域;所述放大所述亮度通道图像中所述边缘区域的图像差别,得到边缘图像包括:放大所述亮度通道图像中所述边缘区域的图像差别,缩小所述非边缘区域的图像差别,得到目标边缘图像。
一种图像处理装置,所述装置包括:目标图像获取模块,用于获取待进行风格变换的目标图像;亮度通道图像获取模块,用于获取所述目标图像对应的亮度通道图像;目标边缘图像得到模块,用于获取所述目标图像对应的目标边缘图像;量化图像得到模块,用于对所述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;融合图像得到模块,用于将所述目标边缘图像和所述量化图像进行图像融合,得到融合图像;风格变换后的图像得到模块,用于获取所述目标图像对应的颜色通道图像,基于所述融合图像以及所述颜色通道图像得到所述目标图像对应的风格变换后的图像。
在其中一个实施例中,量化图像得到模块用于将所述亮度通道图像中各个像素点对应的亮度值进行排序,得到亮度值序列;对所述亮度值序列进行切分,得到各个亮度值范围对应的子序列;获取所述子序列对应的亮度值范围所对应的目标量化亮度值,将所述目标量化亮度值作为所述亮度通道图像中所述子序列对应的像素点的亮度值,得到量化图像。
在其中一个实施例中,量化图像得到模块用于对所述子序列对应的亮度值进行统计,得到所述子序列对应的亮度值范围对应的目标统计亮度值;基于预设的统计像素值与量化亮度值的对应关系,得到所述目标统计亮度值所对应的目标量化亮度值。
在其中一个实施例中,融合图像得到模块用于将所述目标边缘图像中的亮度值与所述量化图像中对应 位置的亮度值进行相乘,得到相乘后的亮度值;按照所述相乘后的亮度值所对应的图像位置,将所述相乘后的亮度值进行排列,得到融合图像。
在其中一个实施例中,目标边缘图像得到模块用于基于第一平滑方式对所述亮度通道图像进行平滑处理,得到第一平滑图像以及,基于第二平滑方式对所述亮度通道图像进行平滑处理,得到第二平滑图像;将所述第一平滑图像和第二平滑图像进行差值计算,得到差值图像;基于所述差值图像确定所述亮度通道图像对应的边缘区域;放大所述亮度通道图像中所述边缘区域的图像差别,得到目标边缘图像。
在其中一个实施例中,目标边缘图像得到模块用于放大所述亮度通道图像中所述边缘区域的图像差别,得到初始边缘图像;确定所述初始边缘图像对应的边缘方向;根据所述边缘方向对应的亮度值的变化速度确定所述初始边缘图像的平滑方向,根据所述平滑方向对所述初始边缘图像进行平滑处理,得到目标边缘图像。
在其中一个实施例中,目标边缘图像得到模块用于将所述差值图像中,亮度值大于预设亮度阈值的区域作为所述亮度通道图像对应的边缘区域;将所述亮度通道图像中边缘区域之外的区域作为非边缘区域;放大所述亮度通道图像中所述边缘区域的图像差别,缩小所述非边缘区域的图像差别,得到目标边缘图像。
一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:获取待进行风格变换的目标图像;获取所述目标图像对应的亮度通道图像;获取所述目标图像对应的目标边缘图像;对所述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;将所述目标边缘图像和所述量化图像进行图像融合,得到融合图像;获取所述目标图像对应的颜色通道图像,基于所述融合图像以及所述颜色通道图像得到所述目标图像对应的风格变换后的图像。
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:获取待进行风格变换的目标图像;获取所述目标图像对应的亮度通道图像;获取所述目标图像对应的目标边缘图像;对所述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;将所述目标边缘图像和所述量化图像进行图像融合,得到融合图像;获取所述目标图像对应的颜色通道图像,基于所述融合图像以及所述颜色通道图像得到所述目标图像对应的风格变换后的图像。
技术效果
上述图像处理方法、装置、计算机设备和存储介质,终端能够通过获取待进行风格变换的目标图像;获取上述目标图像对应的亮度通道图像;获取目标图像对应的目标边缘图像;对上述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;将目标边缘图像和量化图像进行图像融合,得到融合 图像;同时,通过获取到目标图像对应的颜色通道图像,基于上述的融合图像以及该颜色通道图像得到目标图像对应的风格变换后的图像。在上述图像处理过程,对图像的边缘进行识别的同时可以通过量化得到像素值,提高了风格变换后的图像的图像处理效果。
附图说明
图1为一个实施例中图像处理方法的应用环境图;
图2为一个实施例中图像处理方法的流程示意图;
图3为一个实施例中对亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像的流程示意图;
图4为一个实施例中获取子序列对应的亮度值范围所对应的目标量化亮度值的流程示意图;
图5为一个实施例中将目标边缘图像和量化图像进行图像融合,得到融合图像的流程示意图;
图6为一个实施例中获取目标图像对应的目标边缘图像的流程示意图;
图7为一个实施例中放大亮度通道图像中边缘区域的图像差别,得到目标边缘图像的流程示意图;
图8为一个实施例中放大亮度通道图像中边缘区域的图像差别,得到目标边缘图像的实现示意图;
图9为一个实施例中根据平滑方向对初始边缘图像进行平滑处理的实现示意图;
图10为一个实施例中图像处理装置的结构框图;
图11为一个实施例中图像平滑方向示意图;
图12为一个实施例中图像平滑处理后的第一平滑图;
图13为一个实施例中图像平滑处理后的第二平滑图;
图14为一个实施例中进行边缘平滑后的边缘图像;
图15为一个实施例中对待处理图像美化映射后的漫画图像;
图16为一个实施例中对待处理图像美化映射后的漫画图像进行优化后的图像;
图17为一个实施例中计算机设备的内部结构图。
本发明的实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请提供的图像处理方法,可以应用于如图1所示的应用环境中,具体应用到一种图像处理系统中。该图像处理系统包括终端102和图像采集设备104,其中,终端102与图像采集设备104进行连接。终端102执行一种图像处理方法,具体的,终端102获取到图像采集设备104采集的待进行风格变换的目标图 像;终端102在进行图像处理过程中,获取上述目标图像对应的亮度通道图像;获取目标图像对应的目标边缘图像;对亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;将目标边缘图像和量化图像进行图像融合,得到融合图像;获取目标图像对应的颜色通道图像,基于融合图像以及颜色通道图像得到目标图像对应的风格变换后的图像。其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备,图像采集设备104可以但不限于是各种有图像采集功能的设备,可以位于终端104的外部,也可以位于终端104的内部。例如:图像采集设备104可以是位于终端外部的各种摄像头、扫描仪、各种相机、图像采集卡。可以理解,本申请实施例提供的图像处理方法也可以是服务器执行的。
在一个实施例中,如图2所示,提供了一种图像处理方法,以该方法应用于图1中的终端为例进行说明,包括以下步骤:
步骤202,获取待进行风格变换的目标图像。
其中,风格变换是指从一种风格的图像转换成另一种风格图像。例如,从素描风格的图像转换成漫画风格或者水彩画风格的图像等。
具体地,可以获取本地存储或者实时传输到终端上的图像作为待进行风格变换的目标图像。
在一个实施例中,当终端接收到图像处理指令后,图像处理指令中携带有待进行风格变换的目标图像的图像标识以及要变换到的图像风格,通过此图像标识,终端可以从本地存储的图像中获取到待进行风格变换的目标图像。
在一个实施例中,待进行风格变换的目标图像可以通过图像采集设备采集得到。图像采集设备与终端连接,当图像采集设备接收到终端的获取图像指令时,将采集到的实时图像或者图像采集设备本地存储的图像传输给终端,终端将接收到的图像作为待进行风格变换的目标图像进行图像处理。图像采集设备包括各种摄像头、扫描仪、各种相机、图像采集卡等。
在一个实施例中,图像采集设备可以将采集到的图像根据一定时间间隔顺序或者批量传输给终端,终端获取到图像后可以存储于本地待用,也可以在接收到图像后进行实时处理。
步骤204,获取目标图像对应的亮度通道图像。
其中,亮度通道图像是指图像处于三通道中的亮度通道的图像。三通道是指将图像中每个像素分割成三个通道的像素分量。例如,三通道包括Lab(Lab color space)通道空间、YUV(YUV color space)通道空间、HSV(HSV color space)通道空间或者RGB通道空间等,通过Lab通道空间、YUV通道空间、HSV通道空间或者RGB通道空间可以将图像进行像素分量的分解。
具体的,在终端获取到待进行风格变换的目标图像之后,可以对目标图像进行通道分析,得到需要的亮度通道图像。亮度通道图像可以是对目标图像进行灰度处理后的图像。
步骤206,获取目标图像对应的目标边缘图像。
其中,边缘识别是指识别出亮度通道图像中亮度变化明显的点。目标边缘图像是指对亮度通道图像进行边缘识别之后,得到的亮度变化明显的点组成的图像。
具体的,在对目标图像进行风格变换时,有些风格的变换需要目标图像的边缘明显,才能够达到更好的图像处理效果。例如,将目标图像变换为漫画风格的图像。需要终端在获取目标图像对应的亮度通道图像之后,获取目标图像对应的目标边缘图像。
在一个实施例中,可以利用边缘检测算法对边缘进行识别,得到目标边缘图像。例如,利用sobel(Sobel operator)算法、canny(Canny edge detector)算法或者DoG(Difference of Gaussian)算法等边缘检测算法对边缘进行识别,得到目标边缘图像。
在一个实施例中,可以通过对亮度通道图像进行不同程度的平滑处理之后得到平滑图像,利用得到的平滑图像之间的差值得到亮度通道图像的边缘区域,然后对得到的差值图像中的亮度差值进行处理得到目标边缘图像。例如,使差值图像中亮度差值小的更小,亮度差值大的更大,从而得到边缘更加突出的目标边缘图像。
在一个实施例中,可以将差值图像中的亮度差值进行处理后的图像作为初始边缘图像,再对初始边缘图像进行平滑处理后,得到目标边缘图像。通过图像的平滑算法对亮度差值进行处理后的差值图像进行平滑处理。例如,可以利用高斯模糊、中值模糊或者均值模糊等对亮度差值进行处理后的差值图像进行平滑处理。
在一个实施例中,可以通过提取初始边缘图像中边缘上的像素点的平滑方向,利用每个像素点的平滑方向上邻域内的像素点的像素值及目标像素点的像素值之间的函数关系,得到目标像素点的像素值,从而得到由目标像素点组成的目标边缘图像。
步骤208,对亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像。
其中,量化处理是指将图像中各个像素点对应的连续的像素值进行处理,对应得到不连续的像素值或者将某个像素值范围内的多个像素点的像素值对应得到一个像素值,通过量化处理,可以将大量离散取值近似为较少的离散值。例如,其中的10个像素点的像素值分别是{0,20,25,24,50,45,32,36,50,60},对应的量化处理后得到像素值为51。
具体的,终端在得到目标图像之后,为了减少目标图像中细节纹理,减少图像处理过程中颜色的总 量,可以对目标图像进行量化处理。
在一个实施例中,将亮度通道图像中各个像素点对应的亮度值按照预设的亮度值范围进行分组,再根据亮度值范围与量化亮度值之间的对应关系,得到量化处理后的量化图像。例如,亮度值范围为0-20的像素点对应的量化亮度值为0,亮度值范围为21-100的像素点对应的量化亮度值为105等,将亮度值范围为0-20的像素点的亮度值都转换为量化亮度值为0,将亮度值范围为21-100的像素点的亮度值都转换为量化亮度值为105等,得到量化亮度值的像素点组成的量化图像。其中,亮度通道图像中的像素点对应的亮度值可以切分为多个组,多个是指至少两个,每个组对应的量化亮度值不同。
在一个实施例中,可以将亮度通道图像中各个像素点对应的亮度值排序后分成N等份,得到各个等份的亮度值的统计值,根据亮度值的统计值与量化亮度值之间的对应关系,得到量化亮度值。例如,亮度通道图像中的10个像素点分别是{0,20,26,24,50,46,32,36,50,60},将这10个像素点进行排序后得到排序序列{0,20,24,25,32,36,45,50,50,60},将排序后的亮度值分成5等份,5等份的亮度值集合分别为{0,20},{24,26},{32,36},{46,50},{50,60},分别得到每等份的亮度值的统计值分别是10,25,34,48,55,亮度值的统计值与量化亮度值之间的对应关系分别如下表1所示。
表1.亮度值的统计值与量化亮度值对应关系表
亮度值的统计值 量化亮度值
10 0
25 20
34 30
48 40
55 50
由表1可以得到量化亮度值,从而得到量化亮度值的像素点组成的量化图像。
步骤210,将目标边缘图像和量化图像进行图像融合,得到融合图像。
其中,图像融合是指对两幅或者两幅以上的图像进行处理后,合成为一幅新图像的图像处理过程。通过图像融合后的新图像对比于原始图像有用信息更加突出。
具体的,可以通过图像融合算法对目标边缘图像和量化图像进行图像融合,使得到的融合图像中的有用信息更加突出。
在一个实施例中,对目标边缘图像和量化图像可以采用线性融合、泊松融合、多尺度融合、加权融合或者拉普拉斯金字塔融合等的融合方法进行融合,得到融合图像。
在一个实施例中,可以采用乘积性融合算法对目标边缘图像和量化图像进行图像融合,得到融合图 像。例如,目标边缘图像表示为edge,量化图像表示为quantized image,融合图像表示为dst,采用乘积性融合算法融合图像dst可以表示为公式:
dst=edge*quantized image
步骤212,获取目标图像对应的颜色通道图像,基于融合图像以及颜色通道图像得到目标图像对应的风格变换后的图像。
其中,颜色通道图像是指图像处于三通道中的颜色通道对应的图像。颜色通道图像和亮度通道图像共同组成了目标图像。
具体的,终端在得到融合图像之后,对融合图像以及颜色通道图像组成的图像进行处理后,再进行颜色空间的转换,得到目标图像对应的风格变换后的图像。
在一个实施例中,融合图像以及颜色通道图像组成的图像为Lab颜色空间的图像,将该Lab颜色空间的图像转换为RGB颜色空间的图像,该RGB颜色空间的图像为目标图像对应的风格变换后的图像。
在一个实施例中,可以对颜色通道图像进行图像平滑处理后,得到平滑处理后颜色通道图像,基于融合图像以及平滑处理后颜色通道图像得到目标图像对应的风格变换后的图像。
上述图像处理方法中,终端能够通过获取待进行风格变换的目标图像;获取上述目标图像对应的亮度通道图像;获取目标图像对应的目标边缘图像;对上述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;将目标边缘图像和量化图像进行图像融合,得到融合图像;同时,通过获取到目标图像对应的颜色通道图像,基于上述的融合图像以及该颜色通道图像得到目标图像对应的风格变换后的图像。图像处理过程,对图像的边缘进行识别的同时可以通过量化处理去除掉过多的像素值,提高了风格变换后的图像的图像处理效果。
在一个实施例中,如图3所示,对亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像包括:
步骤302,将亮度通道图像中各个像素点对应的亮度值进行排序,得到亮度值序列。
其中,亮度值序列是指按照亮度值大小进行排列的有序的集合。可以按照亮度值从大到小的顺序进行排列组成亮度值序列,也可以按照亮度值从小到大的顺序进行排列组成亮度值序列。
具体的,亮度通道图像中各个像素点对应的亮度值有大有小,可以对这些像素点对应的亮度值进行有序的排列,得到亮度值序列。
在一个实施例中,终端可以将提取到的亮度通道图像中各个像素点对应的亮度值,利用排序算法对各个像素点对应的亮度值进行排序,得到亮度值序列。排序算法包括快速排序、插入排序、希尔排序或者归 并排序等。
步骤304,对亮度值序列进行切分,得到各个亮度值范围对应的子序列。
具体的,终端在得到亮度值序列之后,可以对亮度值序列进行切分,将亮度值序列切分为各个子序列,子序列中的各个亮度值都处于子序列对应的亮度值范围内。例如,亮度值序列为{0,20,24,25,32,36,45,50,55,60},亮度值范围分别为0-40和41-80,则亮度值范围为0-40对应的子序列为{0,20,24,25,32,36},亮度值范围为41-80对应的子序列为{45,50,55,60}。
在一个实施例中,可以将亮度值序列进行平均切分,得到各个亮度值范围内的子序列。例如亮度值序列为{0,20,24,25,32,36,45,50,55,60,70,80},亮度值范围分别为0-30、31-50和51-80,则对应的平均切分后的3个子序列分别为{0,20,24,25}、{32,36,45,50}和{55,60,70,80}。
在一个实施例中,可以将亮度值序列直接进行平均切分,得到切分后的子序列。
步骤306,获取子序列对应的亮度值范围所对应的目标量化亮度值,将目标量化亮度值作为亮度通道图像中子序列对应的像素点的亮度值,得到量化图像。
具体的,亮度值范围和目标量化亮度值之间存在一一对应关系,在获取到子序列后,可以根据各个序列中亮度值范围得到各个子序列对应的像素点的亮度值,得到量化图像。
在一个实施例中,亮度值范围可以使用各个子序列中像素点的亮度值的统计值表示,该统计值与目标量化亮度值存在一一对应关系,在得知亮度值的统计值的情况下,可以通过该对应关系得到相应的目标量化亮度值,将该目标量化亮度值作为子序列中各个像素点的亮度值,得到量化图像。例如,获取到的子序列对应的亮度值范围统计值分别是10,25,34,48,55,统计值分别对应的子序列分别为{0,20},{24,26},{32,36},{46,50},{50,60}。
表2.亮度值的统计值与量化亮度值对应关系表
亮度值的统计值 量化亮度值
10 0
25 20
34 30
48 40
55 50
由表2可以得到量化亮度值,将量化亮度值替代子序列中对应的像素点的亮度值,量化亮度值替代子序列中对应的像素点的亮度值之后的子序列分别为{0,0},{20,20},{30,30},{40,40},{50,50},从而得到量化亮度值的像素点组成的量化图像。
本实施例中,通过亮度通道图像中各个像素点对应的亮度值进行排序,得到亮度值序列,对排序后的亮度值序列进行切分,得到亮度值序列的子序列,获取子序列对应的亮度值范围所对应的目标量化亮度值,得到量化图像,能够达到减少图像中颜色分量,减少图像细节。
在一个实施例中,如图4所示,获取子序列对应的亮度值范围所对应的目标量化亮度值包括:
步骤402,对子序列对应的亮度值进行统计,得到子序列对应的亮度值范围对应的目标统计亮度值。
其中,目标统计亮度值是指能够体现子序列中的亮度值整体数值情况的亮度值。例如,子序列对应的亮度值的平均值、中位数或者众数等。
具体的,可以以子序列对应的亮度值的平均值,将亮度值的平均值作为亮度值范围对应的目标统计亮度值。
步骤404,基于预设的统计像素值与量化亮度值的对应关系,得到目标统计亮度值所对应的目标量化亮度值。
具体的,统计像素值与量化亮度值之间存在一一对应关系,在得知目标统计亮度值为某个统计像素值的情况下,可以确定目标统计亮度值对应的量化亮度值,将该量化亮度值作为目标量化亮度值。例如,预设的统计像素值与量化亮度值为如表2所示的对应关系,假设目标统计亮度值为25,则对应的目标量化亮度值为20。
本实施例中,通过对子序列对应的亮度值进行统计,得到目标统计亮度值,基于预设的统计像素值与量化亮度值的对应关系,得到目标统计亮度值所对应的目标量化亮度值,能够达到准确获得目标量化亮度值的目的,以使得通过目标量化亮度值,得到量化图像。
在一个实施例中,如图5所示,将目标边缘图像和量化图像进行图像融合,得到融合图像包括:
步骤502,将目标边缘图像中的亮度值与量化图像中对应位置的亮度值进行相乘,得到相乘后的亮度值。
具体的,为了使处理后图像的效果亮度更加明显,可以通过将目标边缘图像中的亮度值与量化图像中对应位置的亮度值进行相乘,得到相乘后的亮度值作为处理后图像的亮度值。
在一个实施例中,目标边缘图像中的亮度值可以表示为edge(亮度值),量化图像中对应位置的亮度值可以表示为quantized image(亮度值),两者相乘之后的亮度值表示为dst(亮度值),则dst(亮度值)可以表示为公式:
dst(亮度值)=edge(亮度值)*quantized image(亮度值)
步骤504,按照相乘后的亮度值所对应的图像位置,将相乘后的亮度值进行排列,得到融合图像。
其中,图像位置是指具有某个亮度值的像素点在图像中的坐标位置。例如,某个像素点在目标边缘图像中的坐标位置为(x0,y0),则在量化图像中对应位置的像素点的坐标位置(x0,y0),相乘后的亮度值所要排列的坐标位置为(x0,y0)。
具体的,在得到相乘后的亮度值之后,将亮度值对应的像素点放置于图像位置处,形成完整图像,该完整图像为得到的融合图像。
本实施例中,通过对目标边缘图像中的亮度值与量化图像进行图像融合,减少了图像中的颜色数量,使图像的边缘更加突出,能够达到提高图像处理效果的目的。
在一个实施例中,如图6所示,获取目标图像对应的目标边缘图像包括:
步骤602,基于第一平滑方式对亮度通道图像进行平滑处理,得到第一平滑图像以及,基于第二平滑方式对亮度通道图像进行平滑处理,得到第二平滑图像。
其中,平滑方式是指对亮度通道图像进行平滑处理时所采用的方式或者方法。平滑处理是指能够降低亮度通道图像中图像噪声的处理。图像噪声是指图像中不必要的、多余的干扰信息。对亮度通道图像进行平滑处理能够提高亮度通道图像的图像质量。
在一个实施例中,可以采用图像平滑算法对应的不同的平滑参数确定不同的平滑处理方式。例如,采用高斯模糊算法对亮度通道图像进行平滑处理,利用高斯模糊算法中的高斯函数计算亮度通道图像中每个像素点的权重,根据每个像素点的权重得到高斯模糊算法处理后的亮度通道图像。权重的大小取决于高斯函数中参数的大小,可以将该参数看作平滑参数。通过调节不同的平滑参数可以得到不同平滑效果的平滑图。在对亮度通道图像进行平滑处理的同时,保持亮度通道图像的边缘。
在一个实施例中,采用不同的平滑算法对同一幅亮度通道图像进行平滑处理,得到不同的平滑图像。例如,利用均值模糊算法对亮度通道图像进行平滑处理,得到第一平滑图像;同时,可以利用中值模糊算法对同一幅亮度通道图像进行平滑处理进行平滑处理,得到第二平滑图像。
步骤604,将第一平滑图像和第二平滑图像进行差值计算,得到差值图像。
其中,差值图像是指对两幅图像相同位置上的像素点的亮度值进行求差值计算后,得到的图像。
具体的,可以对第一平滑图像和第二平滑图像相同位置上的像素点进行求差值计算,将差值作为差值图像中相同位置像素点的亮度值。
步骤606,基于差值图像确定亮度通道图像对应的边缘区域。
其中,边缘区域是指亮度通道图像中亮度值变化相对较大的区域。
具体的,在得到差值图像后,因为差值图像比较于亮度通道图像的边缘区域更加明显,可以将该差值 图像确定为边缘区域突出的亮度通道图像。
步骤608,放大亮度通道图像中边缘区域的图像差别,得到目标边缘图像。
具体的,可以通过色阶映射或者曲线拉伸的方法对差值图像进行处理,放大亮度通道图像中边缘区域的图像差别,得到目标边缘图像。
在一个实施例中,采用曲线拉伸差值图对差值图像进行处理,得到目标边缘图像。如图8所示,横坐标表示对差值图像中亮度值进行归一化处理后的亮度值,纵坐标表示目标边缘图像对应的亮度值,在横坐标上大于0和小于0的区域都是边缘区域,可以选取横坐标小于0时,纵坐标值对应的亮度值作为目标边缘图像中亮度值归一化之后的亮度值,通过该亮度值可以得到相应的目标边缘图像。例如,横坐标值为负轴处绝对值为0.25处对应的纵坐标值为0,则表示差值图像中亮度值为63.75的像素点映射到目标边缘图像亮度值为0。
本实施例中,通过不同平滑方式对亮度通道图像进行处理得到的两幅不同平滑效果的平滑图像,通过对两幅不同平滑效果的平滑图像进行差值计算得到差值图像,将差值图像处理后得到目标边缘图像,能够达到得到边缘明显的目标边缘图像的目的,进而提高图像处理效果。
在一个实施例中,如图7所示,放大亮度通道图像中边缘区域的图像差别,得到目标边缘图像包括:
步骤702,放大亮度通道图像中边缘区域的图像差别,得到初始边缘图像。
具体的,可以通过亮度通道图像的边缘区域进行放大处理,使得亮度通道图像中边缘更加明显,得到初始边缘图像。
在一个实施例中,初始边缘图像可以直接是两张平滑图像差值图像,也可以是差值图像进行差值放大处理后的图像。例如,对差值图像进行曲线拉伸或者色阶映射后的图像作为初始边缘图像。
步骤704,确定初始边缘图像对应的边缘方向。
其中,边缘方向是指初始边缘图像边缘的大致走向,多个边缘方向构成了初始边缘图像整体的边缘。
具体的,通过图像的边缘检测算法对初始边缘图像的边缘特征点进行提取,确定初始边缘图像对应的边缘方向。例如,可以采用sobel(Sobel operator)、canny(Canny edge detector)或者DoG(Difference of Gaussian)等图像边缘检测算法确定初始边缘图像对应的边缘方向。
步骤706,根据边缘方向对应的亮度值的变化速度确定初始边缘图像的平滑方向,根据平滑方向对初始边缘图像进行平滑处理,得到目标边缘图像。
其中,平滑方向是指与初始边缘图像的特征点的梯度场方向垂直的方向;梯度场方向是指亮度值的变化速度最快的方向。沿着平滑方向对图像边缘进行平滑处理,能够使边缘方向的更加明显。
具体的,可以通过Sobel算法等确定初始边缘图像的梯度场方向,通过得到的初始边缘图像的梯度场方向的垂直方向确定初始边缘图像的平滑方向。
在一个实施例中,如图9所示,沿着初始边缘图像中某个像素点的平滑方向对该像素点邻域内的像素点进行加权求和,得到像素点的亮度值。例如,C点处的亮度值为沿着C点处的平滑正方向和负方向的邻域内的像素点的亮度值,得到C点处的亮度值。假设,C点处的平滑正方向邻域内有像素点A1,沿着A1的平滑方向邻域内有亮度A2,同理得到A3、B1、B2和B3,假设A1-A3的亮度值分别表示为:A1、A2和A3,A1、A2和A3对应的权重分别表示为W1、W2和W3;B1-B3的亮度值分别为B1、B2和B3,B1、B2和B3对应的权重分别为W4、W5和W6,则C点处的亮度值C可以表示为公式:
C=(C+A1*W1+A2*W2+A3*W3+B1*W4+B2*W5+B3*W6)/(1+W1+W2+W3+W4+W5+W6)例如,当A1-A3的亮度值分别为100、120和130,权重分别为0.9、0.8和0.7;B1-B3的亮度值分别为:120、140和160,权重分别为0.9、0.8和0.7;C点亮度值80时,更新后的C点的亮度值为118。
本实施例中,通过放大亮度通道图像中边缘区域的图像差别,得到初始边缘图像,对初始边缘图像的边缘方向对应亮度值的变化速度确定初始边缘图像的平滑方向,根据平滑方向对初始边缘图像进行平滑处理,能够达到得到目标边缘图像。
在一个实施例中,基于差值图像确定亮度通道图像对应的边缘区域包括:将差值图像中,亮度值大于亮度阈值的区域作为亮度通道图像对应的边缘区域;
具体的,在差值图像中,亮度值越大的区域,是边缘区域的几率越大,为了提高边缘区域识别的准确率,在对边缘区域确定时,利用亮度阈值作为参考,将亮度值大于亮度阈值的区域作为亮度通道图像对应的边缘区域。
在一个实施例中,可以将亮度阈值取值为79,当亮度值大于亮度阈值的区域作为亮度通道图像对应的边缘区域。
将亮度通道图像中边缘区域之外的区域作为非边缘区域;
其中,非边缘区域是指在亮度通道图像中去除掉边缘区域之外的区域,在该区域中,亮度通道图像中像素点的亮度差值较小。例如,亮度通道图像的平坦区域,在该区域中,亮度通道图像中像素点的亮度差值较小。可以理解的,非边缘区域是相对于边缘区域来说的区域。
具体的,当将差值图像中,亮度值大于亮度阈值的区域作为亮度通道图像对应的边缘区域作为亮度通道图像对应的边缘区域之后,将亮度通道图像中边缘区域之外的区域作为非边缘区域。
放大亮度通道图像中边缘区域的图像差别,得到目标边缘图像包括:
放大亮度通道图像中边缘区域的图像差别,缩小非边缘区域的图像差别,得到目标边缘图像。
其中,图像差别是指亮度通道图像中因为亮度差值的大小形成的差别。
具体的,可以通过映射的方式,使图像差别大的边缘区域的亮度差值映射出来的亮度值结果更大,使图像差别小的边缘区域的亮度差值映射出来的亮度值结果更小,通过映射之后的亮度值结果,得到目标边缘图像。
在一个实施例中,可以通过色阶映射的方法,放大亮度通道图像中边缘区域的图像差别,缩小非边缘区域的图像差别,得到目标边缘图像。可以理解的,也可以在放大亮度通道图像中边缘区域的图像差别,缩小非边缘区域的图像差别之后,可以将处理后的图像进行平滑处理,得到目标边缘图像。
本实施例中,通过亮度值的判断得到亮度通道图像对应的边缘区域以及非边缘区域,并且通过放大亮度通道图像中边缘区域的图像差别,缩小非边缘区域的图像差别,能够达到准确得到目标边缘图像的目的。
在一个实施例中,以将待处理的目标图像转换成漫画图像为例,基于漫画的特点,即线条特别明显而且细节纹理比较少的特点。一方面,可以对目标图像进行边缘的提取,使得边缘明显并且平滑自然,以便使线条明显,符合漫画的特点。另一方面,对目标图像的细节进行滤除以及色阶映射,使得边缘更加明显,漫画效果更好。具体的,可以将目标图像映射到Lab颜色空间,可以将目标图像分解成处于亮度通道L的亮度通道图像和处于颜色通道ab的颜色通道图像。可以理解的,也可以将目标图像映射到YUV颜色空间或者HSV颜色空间等。可以通过以下步骤将目标图像转换成漫画图像。
将其中的亮度通道图像利用Sobel、canny或者DoG等算法对边缘进行提取,得到初始边缘图像;
在一个实施例中,图像可以分为平坦区域和边缘区域,由于平坦区域不同程度的平滑结果都一样,比如某个区域的值都是128,利用均值模糊算法,半径为3的区域和半径为7的区域得到的结果都是128,亮度值差值为0;而边缘区域则刚好相反,不同程度的平滑得到的结果差距很大,从而区分出边缘区域和平坦区域。可以通过对两张平滑图像进行差值计算得到的差值图像作为初始边缘图像。例如,可以使用高斯模糊、中值模糊、均值模糊或者其他图像平滑算法得到两张平滑图像。分别为第一平滑图像和第二平滑图像。如图12和如图13为利用高斯模糊得到的两幅平滑图像。对第一平滑图像和第二平滑图像进行差值计算得到差值图像,作为初始边缘图像。
在一个实施例中,通过曲线映射或者其他方法,将得到的差值图像进一步放大其中的亮度差值。例如色阶映射,使得差值图像中亮度值差值小的变小,差值大的变得更大。
在一个实施例中,采用曲线拉伸差值图方法,如图8所示,横坐标表示将差值图像归一化后的亮度值,纵坐标表示将差值图像进行拉伸之后得到的初始边缘图像,使得差值图像中差值图像中亮度值差值小的变 小,差值大的变得更大。例如,横坐标上差值图像归一化后的亮度值为-0.25,对应的纵坐标的亮度值为0,则表示差值图像中0.25*255的亮度值在进行拉伸之后得到的初始边缘图像亮度值为0*255。
在一个实施例中,如图8所示,可以选择横坐标上差值图像归一化后的亮度值为负值,并且对应的纵坐标上的亮度值超过设定的亮度阈值时对应的图像为初始边缘图像。
对初始边缘图像进行边缘平滑得到目标边缘图像;
具体的,在得到初始边缘图像之后,由于初始边缘图像太过锐利,图像效果不理想。为了得到抽象的漫画效果,需要对初始边缘图进行平滑处理。为了勾勒轮廓,反复处理边缘,使得边缘平滑。要使图像边缘比较平滑,需要连接断裂的边缘,平滑掉比较锐利的地方,需要沿着图像边缘对其平滑操作。可以通过保边滤波算法,比如双边滤波、表面模糊或者导向滤波等方法,通过自适应的边缘方向选择得到保边效果,保边过程是在当前像素点的局部邻域范围内,将所有的像素点加权平均得到滤波结果。从而确定图像的边缘方向。
在一个实施例中,可以首先通过Sobel算法提取梯度g x,g y,其中g x表示像素点的横向梯度矩阵,g y表示像素点的纵向梯度矩阵,然后计算得到结构张量矩阵:
Figure PCTCN2022082309-appb-000001
结构张量矩阵中对应的最大的特征值对应的特征向量就是相关性最强的方向。如图11所示,相关性最强的E方向可以认为是该像素点的梯度场方向。然后沿着与梯度场垂直的方向,即沿着F方向,将边缘上的点进行平滑处理,进行平滑处理的方向可以认为是平滑方向。比如可以沿着平滑方向邻域内的一个或者多个像素点,经过像素点加权求和得到当前位置的亮度值。如图14,为对初始边缘图像进行边缘平滑得到目标边缘图像的效果图。如图9所示,C点处的亮度值为沿着C点处的平滑正方向和负方向的邻域内的像素点的亮度值,得到C点处的亮度值。假设,C点处的平滑正方向邻域内有像素点A1,沿着A1的平滑方向邻域内有亮度A2,同理得到A3、B1、B2和B3,假设A1-A3的亮度值分别表示为:A1、A2和A3,A1、A2和A3对应的权重分别表示为W1、W2和W3;B1-B3的亮度值分别为B1、B2和B3,B1、B2和B3对应的权重分别为W4、W5和W6,则C点处的亮度值C可以表示为公式:C=(C+A1*W1+A2*W2+A3*W3+B1*W4+B2*W5+B3*W6)/(1+W1+W2+W3+W4+W5+W6)。例如,当A1-A3的亮度值分别为100、120和130,权重分别为0.9、0.8和0.7;B1-B3的亮度值分别为:120、140和160,权重分别为0.9、0.8和0.7;C点亮度值80时,更新后的C点的亮度值为118。
对亮度通道图像进行色阶量化得到量化亮度通道图像;
具体的,可以将亮度通道图像中的亮度值排序后分成N等份,并将每等份中的亮度值的平均值对应映射为色阶量化值,将该色阶量化值作为每等份中的亮度值,从而得到量化亮度通道图像。例如,可以将亮度值为0到255的亮度值映射为量化值分别为{0,51,102,154,205,255}。
将目标边缘图像和量化亮度通道图像进行乘积融合得到漫画图像中的亮度通道图像;将颜色通道图像作为漫画图像中的颜色通道图像;
具体的,漫画图像中的亮度通道图像可以表示为dst(亮度通道图像)、漫画图像中的颜色通道图像表示为dst(颜色通道图像)、目标边缘图像可以表示为edge,则dst(亮度通道图像)可以表示为:
dst(亮度通道图像)=edge*量化亮度通道图像;
dst(颜色通道图像)=颜色通道图像;
将得到的漫画图像中的亮度通道图像和颜色通道图像转换成RGB颜色空间中的目标漫画图像;
具体的,得到的漫画图像中的亮度通道图像和颜色通道图像为Lab颜色空间的图像,将该Lab颜色空间的图像转换为RGB颜色空间中的目标漫画图像。如图15所示,为目标漫画图像的效果图。
在一个实施例中,可以对得到的目标漫画图像进行优化,通过查询LUT(Look Up Table)表,对目标漫画图像进行调整,如图16所示,可以得到图像处理效果更加艳丽的漫画效果。
应该理解的是,虽然图2-7的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2-7中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。
在一个实施例中,如图10所示,提供了一种图像处理装置1000,包括:目标图像获取模块1002、亮度通道图像获取模块1004、目标边缘图像得到模块1006、量化图像得到模块1008、融合图像得到模块1010和风格变换后的图像得到模块1012,其中:目标图像获取模块1002,用于获取待进行风格变换的目标图像;亮度通道图像获取模块1004,用于获取目标图像对应的亮度通道图像;目标边缘图像得到模块1006,用于获取目标图像对应的目标边缘图像;量化图像得到模块1008,用于对亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;融合图像得到模块1010,用于将目标边缘图像和量化图像进行图像融合,得到融合图像;风格变换后的图像得到模块1012,用于获取目标图像对应的颜色通道图像,基于融合图像以及颜色通道图像得到目标图像对应的风格变换后的图像。
在一个实施例中,量化图像得到模块1008用于将亮度通道图像中各个像素点对应的亮度值进行排序,得到亮度值序列;对亮度值序列进行切分,得到各个亮度值范围对应的子序列;获取子序列对应的亮度值范围所对应的目标量化亮度值,将目标量化亮度值作为亮度通道图像中子序列对应的像素点的亮度 值,得到量化图像。
在一个实施例中,量化图像得到模块1008用于对子序列对应的亮度值进行统计,得到子序列对应的亮度值范围对应的目标统计亮度值;基于预设的统计像素值与量化亮度值的对应关系,得到目标统计亮度值所对应的目标量化亮度值。
在一个实施例中,融合图像得到模块1010用于将目标边缘图像中的亮度值与量化图像中对应位置的亮度值进行相乘,得到相乘后的亮度值;按照相乘后的亮度值所对应的图像位置,将相乘后的亮度值进行排列,得到融合图像。
在一个实施例中,目标边缘图像得到模块1006用于基于第一平滑方式对亮度通道图像进行平滑处理,得到第一平滑图像以及,基于第二平滑方式对亮度通道图像进行平滑处理,得到第二平滑图像;将第一平滑图像和第二平滑图像进行差值计算,得到差值图像;基于差值图像确定亮度通道图像对应的边缘区域;放大亮度通道图像中边缘区域的图像差别,得到目标边缘图像。
在一个实施例中,目标边缘图像得到模块1006用于放大亮度通道图像中边缘区域的图像差别,得到初始边缘图像;确定初始边缘图像对应的边缘方向;根据边缘方向对应的亮度值的变化速度确定初始边缘图像的平滑方向,根据平滑方向对初始边缘图像进行平滑处理,得到目标边缘图像。
在一个实施例中,目标边缘图像得到模块1006用于将差值图像中,亮度值大于亮度阈值的区域作为亮度通道图像对应的边缘区域;将亮度通道图像中边缘区域之外的区域作为非边缘区域;放大亮度通道图像中边缘区域的图像差别,缩小非边缘区域的图像差别,得到目标边缘图像。
关于图像处理装置的具体限定可以参见上文中对于图像处理方法的限定,在此不再赘述。上述图像处理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图17所示。该计算机设备包括通过系统总线连接的处理器、存储器、通信接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、运营商网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种图像处理方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装 置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。
本领域技术人员可以理解,图17中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,还提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各方法实施例中的步骤。
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述各方法实施例中的步骤。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存或光存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (10)

  1. 一种图像处理方法,其特征在于,所述方法包括:
    获取待进行风格变换的目标图像;
    获取所述目标图像对应的亮度通道图像;
    获取所述目标图像对应的目标边缘图像;
    对所述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;
    将所述目标边缘图像和所述量化图像进行图像融合,得到融合图像;
    获取所述目标图像对应的颜色通道图像,基于所述融合图像以及所述颜色通道图像得到所述目标图像对应的风格变换后的图像。
  2. 根据权利要求1所述的方法,其特征在于,所述对所述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像包括:
    将所述亮度通道图像中各个像素点对应的亮度值进行排序,得到亮度值序列;
    对所述亮度值序列进行切分,得到各个亮度值范围对应的子序列;
    获取所述子序列对应的亮度值范围所对应的目标量化亮度值,将所述目标量化亮度值作为所述亮度通道图像中所述子序列对应的像素点的亮度值,得到量化图像。
  3. 根据权利要求2所述的方法,其特征在于,所述获取所述子序列对应的亮度值范围所对应的目标量化亮度值包括:
    对所述子序列对应的亮度值进行统计,得到所述子序列对应的亮度值范围对应的目标统计亮度值;
    基于预设的统计像素值与量化亮度值的对应关系,得到所述目标统计亮度值所对应的目标量化亮度值。
  4. 根据权利要求1所述的方法,其特征在于,所述将所述目标边缘图像和所述量化图像进行图像融合,得到融合图像包括:
    将所述目标边缘图像中的亮度值与所述量化图像中对应位置的亮度值进行相乘,得到相乘后的亮度值;
    按照所述相乘后的亮度值所对应的图像位置,将所述相乘后的强度值进行排列,得到融合图像。
  5. 根据权利要求1所述的方法,其特征在于,所述获取所述目标图像对应的目标边缘图像包括:
    基于第一平滑方式对所述亮度通道图像进行平滑处理,得到第一平滑图像以及,基于第二平滑方式对所述亮度通道图像进行平滑处理,得到第二平滑图像;
    将所述第一平滑图像和第二平滑图像进行差值计算,得到差值图像;
    基于所述差值图像确定所述亮度通道图像对应的边缘区域;
    放大所述亮度通道图像中所述边缘区域的图像差别,得到目标边缘图像。
  6. 根据权利要求5所述的方法,其特征在于,所述放大所述亮度通道图像中所述边缘区域的图像差别,得到目标边缘图像包括:
    放大所述亮度通道图像中所述边缘区域的图像差别,得到初始边缘图像;
    确定所述初始边缘图像对应的边缘方向;
    根据所述边缘方向对应的亮度值的变化速度确定所述初始边缘图像的平滑方向,根据所述平滑方向对所述初始边缘图像进行平滑处理,得到目标边缘图像。
  7. 根据权利要求5所述的方法,其特征在于,所述基于所述差值图像确定所述亮度通道图像对应的边缘区域包括:
    将所述差值图像中,亮度值大于预设亮度阈值的区域作为所述亮度通道图像对应的边缘区域;
    将所述亮度通道图像中边缘区域之外的区域作为非边缘区域;
    所述放大所述亮度通道图像中所述边缘区域的图像差别,得到目标边缘图像包括:
    放大所述亮度通道图像中所述边缘区域的图像差别,缩小所述非边缘区域的图像差别,得到目标边缘图像。
  8. 一种图像处理装置,其特征在于,所述装置包括:
    目标图像获取模块,用于获取待进行风格变换的目标图像;
    亮度通道图像获取模块,用于获取所述目标图像对应的亮度通道图像;
    目标边缘图像得到模块,用于获取所述目标图像对应的目标边缘图像;
    量化图像得到模块,用于对所述亮度通道图像中各个像素点对应的像素值进行量化处理,得到量化图像;
    融合图像得到模块,用于将所述目标边缘图像和所述量化图像进行图像融合,得到融合图像;
    风格变换后的图像得到模块,用于获取所述目标图像对应的颜色通道图像,基于所述融合图像以及所述颜色通道图像得到所述目标图像对应的风格变换后的图像。
  9. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至7中任一项所述的方法的步骤。
  10. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的方法的步骤。
PCT/CN2022/082309 2021-03-26 2022-03-22 图像处理方法、装置、计算机设备和存储介质 WO2022199583A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110323566.8A CN113012185B (zh) 2021-03-26 2021-03-26 图像处理方法、装置、计算机设备和存储介质
CN202110323566.8 2021-03-26

Publications (1)

Publication Number Publication Date
WO2022199583A1 true WO2022199583A1 (zh) 2022-09-29

Family

ID=76407468

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/082309 WO2022199583A1 (zh) 2021-03-26 2022-03-22 图像处理方法、装置、计算机设备和存储介质

Country Status (2)

Country Link
CN (1) CN113012185B (zh)
WO (1) WO2022199583A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116095245A (zh) * 2023-04-07 2023-05-09 江西财经大学 秘密信息分享方法、系统、终端及存储介质
CN116664559A (zh) * 2023-07-28 2023-08-29 深圳市金胜电子科技有限公司 基于机器视觉的内存条损伤快速检测方法
CN116777845A (zh) * 2023-05-26 2023-09-19 浙江嘉宇工程管理有限公司 基于人工智能的建筑工地安全风险智能评估方法及系统
CN116824586A (zh) * 2023-08-31 2023-09-29 山东黑猿生物科技有限公司 图像处理方法及应用该方法的黑蒜生产质量在线检测系统
CN116883392A (zh) * 2023-09-05 2023-10-13 烟台金丝猴食品科技有限公司 基于图像处理的投料控制方法及系统
CN117474820A (zh) * 2023-10-12 2024-01-30 书行科技(北京)有限公司 图像处理方法、装置、电子设备及存储介质
CN117853365A (zh) * 2024-03-04 2024-04-09 济宁职业技术学院 基于计算机图像处理的艺术成果展示方法

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113012185B (zh) * 2021-03-26 2023-08-29 影石创新科技股份有限公司 图像处理方法、装置、计算机设备和存储介质
CN113469876B (zh) * 2021-07-28 2024-01-09 北京达佳互联信息技术有限公司 图像风格迁移模型训练方法、图像处理方法、装置及设备
CN113610823B (zh) * 2021-08-13 2023-08-22 南京诺源医疗器械有限公司 图像处理方法、装置、电子设备及存储介质
CN113870100A (zh) * 2021-10-09 2021-12-31 维沃移动通信有限公司 图像处理方法和电子设备
CN114119847B (zh) * 2021-12-05 2023-11-07 北京字跳网络技术有限公司 一种图形处理方法、装置、计算机设备及存储介质

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2034436A1 (en) * 2007-09-06 2009-03-11 Thomson Licensing Method for non-photorealistic rendering
CN104915975A (zh) * 2015-06-03 2015-09-16 厦门美图之家科技有限公司 一种模拟蜡笔彩绘的图像处理方法和系统
CN107492110A (zh) * 2017-07-31 2017-12-19 腾讯科技(深圳)有限公司 一种图像边缘检测方法、装置和存储介质
CN110070499A (zh) * 2019-03-14 2019-07-30 北京字节跳动网络技术有限公司 图像处理方法、装置和计算机可读存储介质
CN110619614A (zh) * 2019-10-24 2019-12-27 广州酷狗计算机科技有限公司 图像处理的方法、装置、计算机设备以及存储介质
CN110636331A (zh) * 2019-09-26 2019-12-31 北京百度网讯科技有限公司 用于处理视频的方法和装置
CN111815659A (zh) * 2020-06-08 2020-10-23 北京美摄网络科技有限公司 图像处理方法、装置、电子设备及计算机可读存储介质
CN111986096A (zh) * 2019-05-22 2020-11-24 上海哔哩哔哩科技有限公司 基于边缘提取的漫画生成方法及漫画生成装置
CN113012185A (zh) * 2021-03-26 2021-06-22 影石创新科技股份有限公司 图像处理方法、装置、计算机设备和存储介质
CN113870100A (zh) * 2021-10-09 2021-12-31 维沃移动通信有限公司 图像处理方法和电子设备

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101859440A (zh) * 2010-05-31 2010-10-13 浙江捷尚视觉科技有限公司 基于块的运动区域检测方法
CN112150368A (zh) * 2019-06-27 2020-12-29 北京金山云网络技术有限公司 图像处理方法、装置、电子设备及计算机可读存储介质
CN111415308B (zh) * 2020-03-13 2023-04-28 青岛海信医疗设备股份有限公司 一种超声图像处理方法和通信终端

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2034436A1 (en) * 2007-09-06 2009-03-11 Thomson Licensing Method for non-photorealistic rendering
CN104915975A (zh) * 2015-06-03 2015-09-16 厦门美图之家科技有限公司 一种模拟蜡笔彩绘的图像处理方法和系统
CN107492110A (zh) * 2017-07-31 2017-12-19 腾讯科技(深圳)有限公司 一种图像边缘检测方法、装置和存储介质
CN110070499A (zh) * 2019-03-14 2019-07-30 北京字节跳动网络技术有限公司 图像处理方法、装置和计算机可读存储介质
CN111986096A (zh) * 2019-05-22 2020-11-24 上海哔哩哔哩科技有限公司 基于边缘提取的漫画生成方法及漫画生成装置
CN110636331A (zh) * 2019-09-26 2019-12-31 北京百度网讯科技有限公司 用于处理视频的方法和装置
CN110619614A (zh) * 2019-10-24 2019-12-27 广州酷狗计算机科技有限公司 图像处理的方法、装置、计算机设备以及存储介质
CN111815659A (zh) * 2020-06-08 2020-10-23 北京美摄网络科技有限公司 图像处理方法、装置、电子设备及计算机可读存储介质
CN113012185A (zh) * 2021-03-26 2021-06-22 影石创新科技股份有限公司 图像处理方法、装置、计算机设备和存储介质
CN113870100A (zh) * 2021-10-09 2021-12-31 维沃移动通信有限公司 图像处理方法和电子设备

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116095245A (zh) * 2023-04-07 2023-05-09 江西财经大学 秘密信息分享方法、系统、终端及存储介质
CN116777845A (zh) * 2023-05-26 2023-09-19 浙江嘉宇工程管理有限公司 基于人工智能的建筑工地安全风险智能评估方法及系统
CN116777845B (zh) * 2023-05-26 2024-02-13 浙江嘉宇工程管理有限公司 基于人工智能的建筑工地安全风险智能评估方法及系统
CN116664559A (zh) * 2023-07-28 2023-08-29 深圳市金胜电子科技有限公司 基于机器视觉的内存条损伤快速检测方法
CN116664559B (zh) * 2023-07-28 2023-11-03 深圳市金胜电子科技有限公司 基于机器视觉的内存条损伤快速检测方法
CN116824586A (zh) * 2023-08-31 2023-09-29 山东黑猿生物科技有限公司 图像处理方法及应用该方法的黑蒜生产质量在线检测系统
CN116824586B (zh) * 2023-08-31 2023-12-01 山东黑猿生物科技有限公司 图像处理方法及应用该方法的黑蒜生产质量在线检测系统
CN116883392A (zh) * 2023-09-05 2023-10-13 烟台金丝猴食品科技有限公司 基于图像处理的投料控制方法及系统
CN116883392B (zh) * 2023-09-05 2023-11-17 烟台金丝猴食品科技有限公司 基于图像处理的投料控制方法及系统
CN117474820A (zh) * 2023-10-12 2024-01-30 书行科技(北京)有限公司 图像处理方法、装置、电子设备及存储介质
CN117853365A (zh) * 2024-03-04 2024-04-09 济宁职业技术学院 基于计算机图像处理的艺术成果展示方法
CN117853365B (zh) * 2024-03-04 2024-05-17 济宁职业技术学院 基于计算机图像处理的艺术成果展示方法

Also Published As

Publication number Publication date
CN113012185B (zh) 2023-08-29
CN113012185A (zh) 2021-06-22

Similar Documents

Publication Publication Date Title
WO2022199583A1 (zh) 图像处理方法、装置、计算机设备和存储介质
CN107330439B (zh) 一种图像中物体姿态的确定方法、客户端及服务器
US9483835B2 (en) Depth value restoration method and system
Yuan et al. Factorization-based texture segmentation
Li et al. Visual-salience-based tone mapping for high dynamic range images
WO2020119458A1 (zh) 脸部关键点检测方法、装置、计算机设备和存储介质
CN111383232B (zh) 抠图方法、装置、终端设备及计算机可读存储介质
CN111340745B (zh) 一种图像生成方法、装置、存储介质及电子设备
US9401027B2 (en) Method and apparatus for scene segmentation from focal stack images
Liu et al. Image de-hazing from the perspective of noise filtering
CN113469092B (zh) 字符识别模型生成方法、装置、计算机设备和存储介质
WO2022194079A1 (zh) 天空区域分割方法、装置、计算机设备和存储介质
US20210248729A1 (en) Superpixel merging
WO2022135574A1 (zh) 肤色检测方法、装置、移动终端和存储介质
Jeong et al. An optimization-based approach to gamma correction parameter estimation for low-light image enhancement
CN111353955A (zh) 一种图像处理方法、装置、设备和存储介质
Feng et al. Low-light image enhancement algorithm based on an atmospheric physical model
Wen et al. Autonomous robot navigation using Retinex algorithm for multiscale image adaptability in low-light environment
Chaudhry et al. Multi scale entropy based adaptive fuzzy contrast image enhancement for crowd images
CN111489318A (zh) 医学图像增强方法和计算机可读存储介质
WO2018166289A1 (zh) 图像生成方法和装置
CN116029916A (zh) 基于结合稠密小波的双分支网络的低照度图像增强方法
CN115358943A (zh) 低光图像增强方法、系统、终端以及存储介质
CN115082345A (zh) 图像阴影去除方法、装置、计算机设备和存储介质
CN110796609B (zh) 基于尺度感知和细节增强模型的低光图像增强方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22774239

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22774239

Country of ref document: EP

Kind code of ref document: A1