Image processing method and apparatus, device and readable storage medium
AssigneeBeijing Zitiao Network Technology Co., Ltd.
InventorsXu Wang, Kai Liu
Life of this patent
Estimating the term…
Abstract
An image processing method and apparatus, a device and a readable storage medium are provided in embodiments of the present disclosure. After acquiring a source image, an electronic device generates a grayscale image based on the source image, and performs Gaussian blur on the grayscale image to obtain a Gaussian blur image. Then, the electronic device generates a first sketch image by using the Gaussian blur image and the grayscale image.
Claims15
An image processing method, comprising:
- acquiring a source image;
- converting the source image into a grayscale image;
- performing Gaussian blur on the grayscale image to obtain a Gaussian blur image;
- and
- generating a first sketch image corresponding to the source image based on the Gaussian blur image and the grayscale image, wherein
- after the generating the first sketch image based on the Gaussian blur image and the grayscale image, the method further comprises:
- converting the source image into a hue saturation value (HSV) image;
- determining a highlighted area from the first sketch image according to a saturation of a pixel in the HSV image;
- and
- correcting the highlighted area to obtain a second sketch image,
- the determining the highlighted area from the first sketch image according to the saturation of the pixel in the HSV image comprises:
- determining, from the HSV image, a pixel whose saturation exceeds a preset threshold after normalization, to obtain a first pixel set;
- and
- determining a second pixel set from the first sketch image according to the first pixel set, wherein pixels in the first pixel set and pixels in the second pixel set are in one-to-one correspondence, and the second pixel set forms the highlighted area, and
- the correcting the highlighted area to obtain the second sketch image comprises:
- determining a third pixel set from the grayscale image according to the first pixel set, wherein the pixels in the first pixel set and pixels in the third pixel set are in one-to-one correspondence;
- and
- performing weighted fusion on the pixels in the second pixel set and corresponding pixels in the third pixel set, so as to correct the first sketch image to obtain the second sketch image.
An electronic device, comprising:
- at least one processor and a memory;
- wherein the memory stores computer execution instructions;
- and
- the at least one processor executes the computer execution instructions stored in the memory, causing the at least one processor to execute the following operations:
- acquiring a source image;
- converting the source image into a grayscale image;
- performing Gaussian blur on the grayscale image to obtain a Gaussian blur image;
- and
- generating a first sketch image corresponding to the source image based on the Gaussian blur image and the grayscale image, wherein
- after the generating the first sketch image based on the Gaussian blur image and the grayscale image, the at least one processor is further caused to execute the operations of:
- converting the source image into a hue saturation value (HSV) image;
- determining a highlighted area from the first sketch image according to a saturation of a pixel in the HSV image;
- and
- correcting the highlighted area to obtain a second sketch image,
- the determining the highlighted area from the first sketch image according to the saturation of the pixel in the HSV image comprises:
- determining, from the HSV image, a pixel whose saturation exceeds a preset threshold after normalization, to obtain a first pixel set;
- and
- determining a second pixel set from the first sketch image according to the first pixel set, wherein pixels in the first pixel set and pixels in the second pixel set are in one-to-one correspondence, and the second pixel set forms the highlighted area, and
- the correcting the highlighted area to obtain the second sketch image comprises:
- determining a third pixel set from the grayscale image according to the first pixel set, wherein the pixels in the first pixel set and pixels in the third pixel set are in one-to-one correspondence;
- and
- performing weighted fusion on the pixels in the second pixel set and corresponding pixels in the third pixel set, so as to correct the first sketch image to obtain the second sketch image.
A non-transitory computer-readable storage medium, wherein the computer readable storage medium stores computer execution instructions, and when a processor executes the computer execution instructions, the following operations are executed:
- acquiring a source image;
- converting the source image into a grayscale image;
- performing Gaussian blur on the grayscale image to obtain a Gaussian blur image;
- and
- generating a first sketch image corresponding to the source image based on the Gaussian blur image and the grayscale image, wherein
- after the generating the first sketch image based on the Gaussian blur image and the grayscale image, the following operations are further executed:
- converting the source image into a hue saturation value (HSV) image;
- determining a highlighted area from the first sketch image according to a saturation of a pixel in the HSV image;
- and
- correcting the highlighted area to obtain a second sketch image,
- the determining the highlighted area from the first sketch image according to the saturation of the pixel in the HSV image comprises:
- determining, from the HSV image, a pixel whose saturation exceeds a preset threshold after normalization, to obtain a first pixel set;
- and
- determining a second pixel set from the first sketch image according to the first pixel set, wherein pixels in the first pixel set and pixels in the second pixel set are in one-to-one correspondence, and the second pixel set forms the highlighted area, and
- the correcting the highlighted area to obtain the second sketch image comprises:
- determining a third pixel set from the grayscale image according to the first pixel set, wherein the pixels in the first pixel set and pixels in the third pixel set are in one-to-one correspondence;
- and
- performing weighted fusion on the pixels in the second pixel set and corresponding pixels in the third pixel set, so as to correct the first sketch image to obtain the second sketch image.
Dependencies are inferred from the claim text.