WO2022237657A1 - 图像处理方法、装置及电子设备 - Google Patents

图像处理方法、装置及电子设备 Download PDF

Info

Publication number
WO2022237657A1
WO2022237657A1 PCT/CN2022/091294 CN2022091294W WO2022237657A1 WO 2022237657 A1 WO2022237657 A1 WO 2022237657A1 CN 2022091294 W CN2022091294 W CN 2022091294W WO 2022237657 A1 WO2022237657 A1 WO 2022237657A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
pixel
target
processed
pixel point
Prior art date
Application number
PCT/CN2022/091294
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 WO2022237657A1 publication Critical patent/WO2022237657A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks

Definitions

  • the present disclosure relates to the field of computer technology, and in particular to an image processing method and device, electronic equipment, computer readable storage medium, computer program product and computer program.
  • depth models are usually used to process images to achieve the beauty of faces in images, cartoonization or style of images. effect of migration.
  • the present disclosure aims to solve one of the technical problems in the related art at least to a certain extent.
  • the present disclosure proposes an image processing method and device, an electronic device, a computer-readable storage medium, a computer program product, and a computer program capable of processing a high-resolution image in a device with low computing power.
  • the embodiment of the first aspect of the present disclosure proposes an image processing method, including: acquiring an image processing request, wherein the image processing request carries an image to be processed, location information of a target area to be processed in the image to be processed, and Processing method: according to the position information, perform image extraction on the image to be processed to obtain a partial image including the target area; according to the processing method, use a depth model to process the partial image to generate a target a partial image, wherein the target partial image has the same size as the partial image; and embedding the target partial image into the image to be processed to generate a target image.
  • the embodiment of the second aspect of the present disclosure proposes an image processing device, including: an acquisition module, configured to acquire an image processing request, wherein the image processing request carries an image to be processed, an object to be processed in the image to be processed The location information of the area and the processing method; the extraction module is used to perform image extraction on the image to be processed according to the location information, so as to obtain a partial image including the target area; the processing module is used to follow the processing method , using a depth model to process the partial image to generate a target partial image, wherein the size of the target partial image is the same as that of the partial image; and a generating module configured to embed the target partial image into the target partial image Process the image to generate the target image.
  • the embodiment of the third aspect of the present disclosure proposes an electronic device, including: at least one processor; and a memory connected in communication with the at least one processor, wherein the memory stores information that can be executed by the at least one processor. instructions, the instructions are executed by the at least one processor, so that the at least one processor can execute the image processing method proposed in the embodiment of the first aspect of the present disclosure.
  • the embodiment of the fourth aspect of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, the computer instructions are used to enable the computer to execute the image processing method provided by the embodiment of the first aspect of the present disclosure.
  • the embodiment of the fifth aspect of the present disclosure provides a computer program product, including a computer program, and when the computer program is executed by a processor, the image processing method as proposed in the embodiment of the first aspect of the present disclosure is implemented.
  • the embodiment of the sixth aspect of the present disclosure provides a computer program, including computer program code.
  • the computer program code When the computer program code is run on a computer, the computer is made to execute the image processing method as provided in the embodiment of the first aspect of the present disclosure.
  • the technical solution proposed by the present disclosure has the following beneficial effects: after obtaining the image processing request carrying the image to be processed, the location information of the target area to be processed in the image to be processed, and the processing method, image extraction is performed on the image to be processed according to the location information , to obtain the partial image containing the target area, and then according to the processing method, use the depth model to process the partial image to generate the target partial image with the same size as the partial image, and then embed the target partial image into the image to be processed to generate the target image , because the depth model only needs to process local images, thereby reducing the processing load of the depth model and reducing the computing resources required for image processing, so that high-resolution images can also be processed in edge devices.
  • FIG. 1 is a schematic flowchart of an image processing method provided by Embodiment 1 of the present disclosure
  • FIG. 2 is another schematic flowchart of the image processing method provided by Embodiment 1 of the present disclosure.
  • FIG. 3 is a schematic flow diagram of processing a partial image using a depth model provided by Embodiment 1 of the present disclosure
  • FIG. 4 is a schematic structural diagram of an image processing device provided in Embodiment 2 of the present disclosure.
  • FIG. 5 is a schematic flowchart of an image processing method provided by Embodiment 3 of the present disclosure.
  • FIG. 6 is another schematic flowchart of the image processing method provided by Embodiment 3 of the present disclosure.
  • FIG. 7 is a schematic structural diagram of an image processing device provided by Embodiment 4 of the present disclosure.
  • FIG. 8 shows a block diagram of an exemplary electronic device suitable for use in implementing embodiments of the present disclosure.
  • the present disclosure proposes an image processing method capable of realizing processing of high-resolution images in a device with low computing power.
  • the method obtains the image processing request carrying the image to be processed, the location information of the target area to be processed in the image to be processed, and the processing mode image processing request, it first performs image extraction on the image to be processed according to the location information to obtain a partial image including the target area.
  • the partial image is processed by using the depth model to generate the target partial image with the same size as the partial image, and then the target partial image is embedded into the image to be processed to generate the target image. Since the depth model only needs to process the partial image Processing, thereby reducing the processing load of the depth model and reducing the computing resources required for image processing, so that the processing of high-resolution images can also be realized in edge devices.
  • FIG. 1 is a schematic flowchart of an image processing method provided by Embodiment 1 of the present disclosure.
  • the embodiment of the present disclosure is illustrated by taking the image processing method configured in an image processing device as an example, and the image processing device can be applied to any electronic device such as an edge device, so that the electronic device can realize high-resolution rate image processing.
  • the electronic device can be a personal computer (Personal Computer, referred to as PC), cloud device, mobile device, etc.
  • the mobile device can be a mobile phone, a tablet computer, a personal digital assistant, a wearable device, a vehicle-mounted device and other hardware devices, or it can be a Any device with low computing power capable of deploying a lightweight depth model, such as an edge device, where the edge device may be, for example, an RK3399 chip or the like.
  • the image processing method may include the following steps 101 - 104 .
  • step 101 an image processing request is acquired, wherein the image processing request carries an image to be processed, location information of a target area to be processed in the image to be processed, and a processing method.
  • the image processing request may be triggered by the user touching a button with an image processing function on the human-computer interaction interface of the electronic device where the image processing device is located, or by other means, which is not limited in the present disclosure.
  • the image to be processed may be obtained by the image processing device from the camera device in the electronic device where it is located, or may be sent to the image processing device by other electronic devices, or may be obtained by the image processing device in other ways. This is not limited.
  • the image to be processed may be a static image, a dynamic image, or other types of images, which is not limited in the present disclosure.
  • the image to be processed can be a high-resolution image or a low-resolution image.
  • the disclosure does not limit the resolution of the image to be processed. That is, the image processing method provided by the embodiment of the disclosure can be applied to any resolution rate image processing.
  • the position information of the target area is used to indicate the position of the target area in the image to be processed, wherein the position information of the target area may include any information related to the position of the target area, for example, it may include coordinates of multiple points of the target area , or the coordinates of the contour line of the target area, etc., which are not limited in the present disclosure.
  • the processing method is the target processing method that needs to be processed on the image to be processed, for example, beautification processing (such as skin smoothing, makeup application, filter), cartoon processing, stylization processing, etc.
  • beautification processing such as skin smoothing, makeup application, filter
  • cartoon processing such as cartoon processing, stylization processing, etc.
  • the image processing request can carry the face image A, the coordinate information of each pixel of the face area, or the face area The coordinate information of the contour line, and the processing method of the microdermabrasion treatment;
  • the image processing request can carry the coordinate information of each pixel of the image B and the portrait area or The coordinate information of the contour line of the portrait area, and the processing method of cartoonization.
  • Step 102 perform image extraction on the image to be processed according to the location information, so as to obtain a partial image including the target area.
  • Step 103 the partial image is processed by using the depth model to generate a target partial image, wherein the target partial image is the same size as the partial image.
  • Step 104 embedding the target partial image into the image to be processed to generate the target image.
  • the image processing device After obtaining the image processing request carrying the image to be processed, the position information of the target area to be processed in the image to be processed, and the processing method, the image processing device That is, according to the location information of the target area carried in the image processing request, image extraction is performed on the image to be processed to obtain a partial image containing the target area, and then according to the processing method carried in the image processing request, a depth model is used to process the partial image , to generate the target partial image with the same size as the partial image, and finally embed the target partial image into the image to be processed to generate the target image.
  • the depth model may be any image processing model, and the present disclosure does not limit the structure and type of the depth model.
  • a deep model can include 10 convolutional layers, 2 pooling layers, and 2 deconvolutional layers.
  • FIG. 3 for a schematic flowchart of processing a partial image using a depth model.
  • the squares in FIG. 3 represent the convolution results after each step of processing, and their length, width, and height correspond to the length, width, and channel of the image after convolution.
  • the depth model can reduce the dimensionality through convolution and pooling operations to extract features in the local image.
  • Multi-layer convolution can extract multiple features in local images and obtain a feature matrix that contains the smallest space.
  • the depth model can perform a deconvolution operation to convolute the extracted image features upwards to generate a target local image with the same size as the local image.
  • the characteristics of the generated target partial image can be controlled, so as to realize different processing of the partial image, such as beautification, cartoonization, and stylization.
  • the depth model only needs to process local images, the processing amount of the depth model is reduced, and the computing resources consumed by image processing are reduced, so that high-resolution images can also be processed in edge devices.
  • the network structure of the depth model can be as shown in Table 1 below, wherein the first column of Table 1 is each network of the depth model Layer, the second column is the input image size or image feature size of the corresponding network layer. Referring to Table 1, it can be seen that when the input size of the depth model is 256*256*3, the output is also 256*256*3.
  • Table 1 The network structure of the deep model and the input size of each network layer
  • Convolution layer 1 256*256*3 Convolution layer 2 256*256*64 pooling layer 1 128*128*64 Convolution layer 3 128*128*128 Convolution layer 4 128*128*128 pooling layer 2 64*64*128 Convolution layer 5 64*64*256 Deconvolution layer 1 128*128*256 Convolution layer 6 128*128*128 Convolution layer 7 128*128*128 Deconvolution layer 2 256*256*128 Convolutional Layer 8 256*256*64 Convolutional Layer 9 256*256*64 Convolution layer 10 256*256*3
  • the loss function may use an image quality loss function SSIM Loss (Structural Similarity Loss, structural similarity loss). The following is a brief introduction to SSIM Loss.
  • the SSIM value measures the similarity between the two images through three parts: brightness l(x,y), contrast c(x,y), and structure s(x,y), and the SSIM value is 1 Indicates that the two images are completely similar.
  • SSIM Loss is defined as shown in the following formula (1):
  • the image brightness l(x,y) can be calculated by the following formula (2):
  • C1 (K 1 L) 2 , K 1 ⁇ 1.
  • the image contrast c(x,y) can be calculated using the following formula (3):
  • C2 (K 2 L) 2 , K 2 ⁇ 1.
  • the image structure comparison s(x,y) can be calculated by the following formula (4):
  • ⁇ x and ⁇ y represent the mean value of all pixels in image x and image y, respectively
  • ⁇ x and ⁇ y represent the variance of all pixels in image x and image y, respectively
  • ⁇ xy represents the covariance of image x and image y
  • L represents The dynamic range of pixels.
  • L is related to the data type of the image. For example, when the image is an 8-bit grayscale image, L can be set to 255.
  • the mean value of the pixels of the image x is shown in the following formula (5)
  • the variance of the pixels of the image x is shown in the following formula (6)
  • the image The covariance of x and image y is shown in the following formula (7).
  • x i represents the pixel value of the i-th pixel in the image x
  • y i represents the pixel value of the i-th pixel in the image y.
  • the image to be processed is firstly extracted according to the location information to obtain The partial image containing the target area, and then according to the processing method, use the depth model to process the partial image to generate the target partial image with the same size as the partial image, and then embed the target partial image into the image to be processed to generate the target image, due to the depth
  • the model only needs to process local images, thereby reducing the processing load of the depth model and the computing resources consumed by image processing, so that high-resolution images can also be processed in edge devices.
  • image extraction can be performed on the image to be processed according to the position information to obtain a partial image including the target area.
  • the position Information the process of extracting the image to be processed to obtain a partial image including the target area will be further described.
  • FIG. 4 is a schematic flowchart of an image processing method provided by Embodiment 2 of the present disclosure. As shown in FIG. 4 , the image processing method may specifically include the following steps 401 - 406 .
  • step 401 an image processing request is obtained, wherein the image processing request carries an image to be processed, location information of a target area to be processed in the image to be processed, and a processing method.
  • step 401 For the specific implementation process and principle of step 401, reference may be made to the description of the foregoing embodiments, which will not be repeated here.
  • Step 402 determine a rectangular area according to the first coordinates and the second coordinates.
  • Step 403 extracting a first image including a rectangular area from the image to be processed.
  • Step 404 determining the first image as a partial image including the target area.
  • the target area may be a regular rectangular area
  • the location information may include at least first coordinates and second coordinates, wherein the first coordinates and second coordinates may be the coordinates of the upper left vertex and right corner of the rectangular area, respectively.
  • the coordinates of the lower vertex, or the coordinates of the lower left vertex and the upper right vertex of the rectangular area, are not limited in this disclosure, as long as the position of the target area can be uniquely determined.
  • the rectangular area may be, for example, an area enclosed by a compact rectangular frame containing an object, such as an area containing all pixel information of the object and containing the least background pixels.
  • a rectangular area can be determined according to the first coordinates and the second coordinates, and the target area can be extracted from the image to be processed.
  • the pixel information of the location of the rectangular area is used to obtain the first image including the target area, so that the first image can be determined as a partial image including the target area.
  • the target area may be an irregular area, such as a human face area, and the location information may include coordinate information of a contour line of the target area.
  • the first area enclosed by the contour line may be determined according to the coordinate information of the contour line of the target area, and The image information of the location of the first area is extracted from the image to be processed to obtain a second image including the first area, so that the second image can be determined as a partial image including the target area.
  • steps 402-404 can be replaced by the following steps:
  • the second image is determined as a partial image containing the target area.
  • Step 405 According to the processing method, the partial image is processed by using the depth model to generate a target partial image, wherein the size of the target partial image is the same as that of the partial image.
  • Step 406 embedding the partial image of the target into the image to be processed, so as to generate the target image.
  • the processing method after obtaining the image processing request carrying the image to be processed, the location information of the target area to be processed in the image to be processed, and the processing method, first determine the rectangular area according to the first coordinates and the second coordinates, Extract the first image containing a rectangular area from the image to be processed, determine the first image as a partial image containing the target area, and then process the partial image with a depth model according to the processing method to generate a partial image with the same size as the partial image The target partial image, and then embed the target partial image into the image to be processed to generate the target image. Since the depth model only needs to process the partial image, the processing amount of the depth model is reduced, and the computing resources consumed by image processing are reduced. This makes it possible to process high-resolution images in edge devices.
  • the target partial image can be embedded into the image to be processed to generate the target image.
  • the target partial image can be embedded into the image to be processed below in conjunction with FIG. 5 , to further illustrate the process of generating the target image.
  • FIG. 5 is a schematic flowchart of an image processing method provided by Embodiment 3 of the present disclosure. As shown in FIG. 5 , the above step 104 or 204 may specifically include the following steps 501 - 504 .
  • Step 501 Acquire the center point of the target partial image, and determine the point in the target image corresponding to the position of the center point as the embedding center.
  • Step 502 Determine the embedding radius according to the distance between the center point and the boundary line of the target partial image.
  • the shortest distance between the center point of the target partial image and the boundary line of the target partial image can be determined as the embedding radius value.
  • Step 503 for each first pixel in the target image, according to the pixel value of each second pixel in the target partial image, the pixel value of each third pixel in the image to be processed, the relationship between the first pixel and the embedding center The distance between them and the embedding radius determine the pixel value of the first pixel.
  • Step 504 generating a target image according to the pixel values of each first pixel in the target image.
  • the point in the target image corresponding to the position of the central point is the embedding center
  • the embedding radius is determined, for each first pixel in the target image, according to the The pixel value of each second pixel point, the pixel value of each third pixel point in the image to be processed, the distance between the first pixel point and the embedding center, and the embedding radius determine the pixel value of the first pixel point, and then according to the target image The pixel value of each first pixel in , to generate the target image.
  • the process of determining the pixel value of the first pixel point can be:
  • the pixel value of the third pixel point corresponding to the position of the first pixel point in the image to be processed is determined as the pixel value of the first pixel point ;
  • the preset distance threshold can be set arbitrarily according to needs, and it can be set as a fixed value, or can be set according to different tasks or situations, for example, it can be set as embedding radius*1.1, which is not limited in the present disclosure.
  • the process of determining the pixel value of the first pixel point may specifically be: determine the target image The neighborhood area of the preset size of the first pixel point in the neighborhood area; for each fourth pixel point in the neighborhood area, determine the pixel value of the third pixel point corresponding to the position in the image to be processed and the position of the fourth pixel point, And the pixel value of the second pixel point corresponding to the position of the fourth pixel point in the target partial image; the pixel value of the third pixel point corresponding to the position of the fourth pixel point in the image to be processed is obtained, which is consistent with the target partial image
  • the preset size can be set arbitrarily as required, which is not limited in the present disclosure.
  • the mean value may be multiplied by the weight constant, and then added to the pixel value of the third pixel corresponding to the position of the first pixel in the image to be processed to obtain the pixel value of the first pixel.
  • step 503 The specific process of step 503 will be described below with reference to FIG. 6 .
  • the image to be processed is image S
  • the target partial image is image E
  • the target image is image D
  • the embedding center is (C x , Cy y )
  • the embedding radius is r
  • the preset distance threshold is d.
  • the target partial image is image E
  • the target image is image D
  • the embedding center is (C x , C y )
  • the embedding radius is r
  • the preset distance threshold is d (step 601)
  • D(x,y) E(x,y), that is, the pixel value E(x,y) of the second pixel point corresponding to the position (P x , P y ) of the first pixel point in the target partial image E is determined as the target image D in The pixel value D(x, y) of the first pixel at (P x , P y ) (step 604).
  • each third pixel point in the image S is used to determine the pixel value of the first pixel point of the target image D at (P x , P y ) (step 606).
  • the target image D can be determined according to the following formula (8): The pixel value of the first pixel at (P x , P y ).
  • D(x, y) represents the pixel value of the first pixel point of the target image D at (P x , P y );
  • S(x, y) represents the position of the first pixel point in the image S to be processed ( P x , P y ) corresponds to the pixel value of the third pixel point;
  • w represents a weight constant, which can be set arbitrarily according to needs;
  • ⁇ RGB mean represents the neighborhood U of the first pixel point at (P x , P y ), The mean value of the pixel difference between the image S to be processed and the target partial image E.
  • ⁇ RGB mean can be calculated by the following method: for each fourth pixel in the neighborhood U of the first pixel at (P x , P y ) in the target image D, determine the position and The pixel value of the third pixel point corresponding to the position of the fourth pixel point, and the pixel value of the second pixel point corresponding to the position of the fourth pixel point in the target image E, and obtain the position and the fourth pixel point in the image S to be processed The difference between the pixel value of the third pixel corresponding to the position of the pixel and the pixel value of the second pixel corresponding to the position of the fourth pixel in the target image E, and then according to each fourth pixel in the neighborhood U For the corresponding difference, determine the mean of the difference.
  • the fourth pixel in the neighborhood U of the first pixel at (P x , P y ) in the image D is a pixel whose distance from the first pixel at (P x , P y ) is 1.
  • D(x,y) S(x,y), which will be Process the pixel value S(x, y) of the third pixel point corresponding to the position (P x , P y ) of the first pixel point in the image S, and determine it as the pixel value S(x, y) of the target image D at (P x , P y ).
  • the pixel value D(x,y) of a pixel point (step 607).
  • the pixel value of the first pixel point of the target image D at (P x , P y ) can be output (step 608) , and judge whether the first pixel point at (P x , P y ) is the last first pixel point (step 609), if not, continue to determine that the position in the target image is the first pixel point at other positions, and Perform the same operation on the first pixel point as the first pixel point at (P x , P y ) until the last pixel value of the first pixel point is output, so that according to each first pixel point in the target image D Generate and output the target image D with pixel values (step 610).
  • the pixel value of each third pixel in the image to be processed the pixel value of the first
  • the distance between a pixel point and the embedding center and the embedding radius determine the pixel value of the first pixel point, so that as the distance from the embedding center increases, the pixel value of the first pixel in the target image gradually changes from the target local image Transition to the image to be processed, so that after the target partial image is embedded in the image to be processed, the boundary of the target partial image transitions naturally, and the visual effect of the generated target image is good.
  • FIG. 7 is a schematic structural diagram of an image processing device provided by Embodiment 4 of the present disclosure.
  • the image processing apparatus 700 may include: an acquisition module 710 , an extraction module 720 , a processing module 730 and a generation module 740 .
  • the obtaining module 710 is configured to obtain an image processing request, wherein the image processing request carries the image to be processed, the position information of the target area to be processed in the image to be processed, and the processing method.
  • the extraction module 720 is configured to perform image extraction on the image to be processed according to the location information, so as to obtain a partial image including the target area.
  • the processing module 730 is configured to process the partial image by using the depth model according to the processing manner, so as to generate the target partial image, wherein the size of the target partial image is the same as that of the partial image.
  • a generating module 740 configured to embed the partial image of the target into the image to be processed, so as to generate the target image.
  • the image processing device provided by the embodiment of the present disclosure can execute the image processing method of the foregoing embodiment, and the image processing device can be applied to any electronic device such as an edge device, so that the electronic device can realize high-resolution rate image processing.
  • the electronic device can be a personal computer (PC for short), a cloud device, a mobile device, etc.
  • the mobile device can be a mobile phone, a tablet computer, a personal digital assistant, a wearable device, a vehicle-mounted device and other hardware devices, or it can be any A device with low computing power that deploys a lightweight depth model, such as an edge device, where the edge device may be, for example, an RK3399 chip or the like.
  • the location information includes first coordinates and second coordinates.
  • the extraction module 720 includes:
  • a first determining unit configured to determine a rectangular area according to the first coordinates and the second coordinates
  • a first extraction unit configured to extract a first image containing a rectangular area from the image to be processed
  • the second determining unit is configured to determine the first image as a partial image including the target area.
  • the location information includes coordinate information of the contour line of the target area; correspondingly, the extraction module 720 includes:
  • the third determination unit is configured to determine the first area enclosed by the contour line according to the coordinate information of the contour line of the target area
  • a second extraction unit configured to extract a second image including the first region from the image to be processed
  • the fourth determining unit is configured to determine the second image as a partial image including the target area.
  • the generating module 740 includes:
  • the fifth determination unit is used to obtain the center point of the target partial image, and determine the point in the target image corresponding to the position of the center point as the embedding center;
  • the sixth determination unit is used to determine the embedding radius according to the distance between the center point and the boundary line of the target partial image
  • the seventh determination unit is configured to, for each first pixel in the target image, according to the pixel value of each second pixel in the target partial image, the pixel value of each third pixel in the image to be processed, the first pixel The distance from the embedding center and the embedding radius determine the pixel value of the first pixel;
  • the generating unit is configured to generate the target image according to the pixel values of the first pixel points in the target image.
  • the seventh determining unit is specifically used for:
  • the distance between the first pixel point and the embedding center is not less than the embedding radius, it is further judged whether the distance between the first pixel point and the embedding center is greater than a preset distance threshold, wherein the preset distance threshold is greater than the embedding radius;
  • the pixel value of the third pixel point corresponding to the position of the first pixel point in the image to be processed is determined as the pixel value of the first pixel point ;
  • the seventh determining unit is also used for:
  • For each fourth pixel point in the neighborhood area determine the pixel value of the third pixel point corresponding to the position of the fourth pixel point in the image to be processed, and the corresponding position of the fourth pixel point in the target partial image The pixel value of the second pixel point of ;
  • the pixel value of the first pixel is determined according to the pixel value and mean value of the third pixel corresponding to the position of the first pixel in the image to be processed.
  • the seventh determining unit is further configured to:
  • the pixel value of the second pixel point corresponding to the position of the first pixel point in the target partial image is determined as the pixel value of the first pixel point.
  • the image processing device of the embodiment of the present disclosure after obtaining the image processing request carrying the image to be processed, the location information of the target area to be processed in the image to be processed, and the processing method, first performs image extraction on the image to be processed according to the location information, to obtain The partial image containing the target area, and then according to the processing method, use the depth model to process the partial image to generate the target partial image with the same size as the partial image, and then embed the target partial image into the image to be processed to generate the target image, due to the depth
  • the model only needs to process local images, thereby reducing the processing load of the depth model and the computing resources consumed by image processing, so that high-resolution images can also be processed in edge devices.
  • an embodiment of the present disclosure further proposes an electronic device, including: at least one processor; and a memory connected to the at least one processor in communication; An instruction executed by a processor, the instruction is executed by the at least one processor, so that the at least one processor can execute the image processing method provided in the foregoing embodiments of the present disclosure.
  • the embodiments of the present disclosure also propose a non-transitory computer-readable storage medium storing computer instructions, the computer instructions are used to make the computer execute the image processing method as proposed in the foregoing embodiments of the present disclosure .
  • the embodiments of the present disclosure further propose a computer program product, including a computer program, when the computer program is executed by a processor, the image processing method as provided in the foregoing embodiments of the present disclosure is implemented.
  • the embodiments of the present disclosure further propose a computer program, including computer program codes, when the computer program codes run on the computer, the computer executes the image processing method as provided in the foregoing embodiments of the present disclosure.
  • FIG. 8 shows a block diagram of an exemplary electronic device suitable for use in implementing embodiments of the present disclosure.
  • the electronic device 12 shown in FIG. 8 is only an example, and should not limit the functions and scope of use of the embodiments of the present disclosure.
  • electronic device 12 takes the form of a general-purpose computing device.
  • Components of electronic device 12 may include, but are not limited to, one or more processors or processing units 16, system memory 28, bus 18 connecting various system components including system memory 28 and processing unit 16.
  • Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus structures.
  • these architectures include but are not limited to Industry Standard Architecture (Industry Standard Architecture; hereinafter referred to as: ISA) bus, Micro Channel Architecture (Micro Channel Architecture; hereinafter referred to as: MAC) bus, enhanced ISA bus, video electronics Standards Association (Video Electronics Standards Association; hereinafter referred to as: VESA) local bus and Peripheral Component Interconnection (hereinafter referred to as: PCI) bus.
  • Electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 12 and include both volatile and nonvolatile media, removable and non-removable media.
  • the memory 28 may include a computer system readable medium in the form of a volatile memory, such as a random access memory (Random Access Memory; hereinafter referred to as: RAM) 30 and/or a cache memory 32 .
  • RAM Random Access Memory
  • the electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media.
  • storage system 34 may be used to read and write to non-removable, non-volatile magnetic media (not shown in FIG. 8, commonly referred to as a "hard drive").
  • a disk drive for reading and writing to a removable nonvolatile disk may be provided, as well as a removable nonvolatile disk (such as a Compact Disk ROM (Compact Disk).
  • Disc Read Only Memory hereinafter referred to as: CD-ROM
  • DVD-ROM Digital Video Disc Read Only Memory
  • each drive may be connected to bus 18 via one or more data media interfaces.
  • Memory 28 may include at least one program product having a set (eg, at least one) of program modules configured to perform the functions of various embodiments of the present disclosure.
  • a program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data , each or some combination of these examples may include implementations of network environments.
  • the program modules 42 generally perform the functions and/or methods of the embodiments described in this disclosure.
  • the electronic device 12 may also communicate with one or more external devices 14 (e.g., a keyboard, pointing device, display 24, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 12, and/or communicate with Any device (eg, network card, modem, etc.) that enables the electronic device 12 to communicate with one or more other computing devices. Such communication may occur through input/output (I/O) interface 22 .
  • the electronic device 12 can also communicate with one or more networks (such as a local area network (Local Area Network; hereinafter referred to as: LAN), a wide area network (Wide Area Network; hereinafter referred to as: WAN) and/or a public network, such as the Internet, through the network adapter 20.
  • networks such as a local area network (Local Area Network; hereinafter referred to as: LAN), a wide area network (Wide Area Network; hereinafter referred to as: WAN) and/or a public network, such as the Internet, through
  • network adapter 20 communicates with other modules of electronic device 12 via bus 18 .
  • other hardware and/or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape Drives and data backup storage systems, etc.
  • the processing unit 16 executes various functional applications and data processing by running the programs stored in the system memory 28 , such as implementing the methods mentioned in the foregoing embodiments.
  • first and second are used for descriptive purposes only, and cannot be interpreted as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features.
  • the features defined as “first” and “second” may explicitly or implicitly include at least one of these features.
  • “plurality” means at least two, such as two, three, etc., unless otherwise specifically defined.
  • a "computer-readable medium” may be any device that can contain, store, communicate, propagate or transmit a program for use in or in conjunction with an instruction execution system, device or device.
  • computer-readable media include the following: electrical connection with one or more wires (electronic device), portable computer disk case (magnetic device), random access memory (RAM), Read Only Memory (ROM), Erasable and Editable Read Only Memory (EPROM or Flash Memory), Fiber Optic Devices, and Portable Compact Disc Read Only Memory (CDROM).
  • the computer-readable medium may even be paper or other suitable medium on which the program can be printed, since the program can be read, for example, by optically scanning the paper or other medium, followed by editing, interpretation or other suitable processing if necessary.
  • the program is processed electronically and stored in computer memory.
  • various parts of the present disclosure may be implemented in hardware, software, firmware or a combination thereof.
  • various steps or methods may be implemented by software or firmware stored in memory and executed by a suitable instruction execution system.
  • a suitable instruction execution system For example, if implemented in hardware as in another embodiment, it can be implemented by any one or a combination of the following techniques known in the art: a discrete Logic circuits, ASICs with suitable combinational logic gates, Programmable Gate Arrays (PGA), Field Programmable Gate Arrays (FPGA), etc.
  • each functional unit in each embodiment of the present disclosure may be integrated into one processing module, each unit may exist separately physically, or two or more units may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or in the form of software function modules. If the integrated modules are realized in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium.
  • the storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Image Processing (AREA)

Abstract

一种图像处理方法和装置、电子设备、计算机可读存储介质、计算机程序产品和计算机程序,图像处理方法包括:获取图像处理请求,图像处理请求中携带待处理图像、待处理图像中待处理的目标区域的位置信息以及处理方式;根据位置信息,对待处理图像进行图像提取,以得到包含目标区域的局部图像;按照处理方式,采用深度模型对局部图像进行处理,以生成目标局部图像,目标局部图像与局部图像的尺寸相同;将目标局部图像嵌入待处理图像,以生成目标图像。

Description

图像处理方法、装置及电子设备
相关申请的交叉引用
本申请要求在2021年5月10日在中国提交的中国专利申请号202110506293.0的优先权,其全部内容通过引用并入本文。
技术领域
本公开涉及计算机技术领域,具体涉及一种图像处理方法和装置、电子设备、计算机可读存储介质、计算机程序产品及计算机程序。
背景技术
随着用户对图像的编辑需求日益增加,形成了多样化的图像编辑和生成方法,目前,通常使用深度模型对图像进行处理,以实现对图像中人脸的美颜、图像的卡通化或者风格迁移等效果。
然而,在一些仅能部署轻量级深度模型的设备(例如边缘设备)中,由于设备的计算能力较低,需要降低图像的分辨率才能实现对高分辨率图像的处理,而这会影响图像处理后的效果,因此,需要一种能够在计算能力较低的设备中实现对高分辨率图像的处理的方法。
发明内容
本公开旨在至少在一定程度上解决相关技术中的技术问题之一。
本公开提出一种能够在计算能力较低的设备中实现对高分辨率图像的处理的图像处理方法和装置、电子设备、计算机可读存储介质、计算机程序产品及计算机程序。
本公开第一方面实施例提出了一种图像处理方法,包括:获取图像处理请求,其中,所述图像处理请求中携带待处理图像、所述待处理图像中待处理的目标区域的位置信息以及处理方式;根据所述位置信息,对所述待处理图像进行图像提取,以得到包含所述目标区域的局部图像;按照所述处理方式,采用深度模型对所述局部图像进行处理,以生成目标局部图像,其中,所述目标局部图像与所述局部图像的尺寸相同;和将所述目标局部图像嵌入所述待处理图像,以生成目标图像。
本公开第二方面实施例提出了一种图像处理装置,包括:获取模块,用于获取图像处理请求,其中,所述图像处理请求中携带待处理图像、所述待处理图像中待处理的目标区域的位置信息以及处理方式;提取模块,用于根据所述位置信息,对所述待处理图像进行图像提取,以得到包含所述目标区域的局部图像;处理模块,用于按照所述处理方式,采用深度模型对所述局部图像进行处理,以生成目标局部图像,其中,所述目标局部图像与所述局部图像的尺寸相同;和生成模块,用于将所述目标局部图像嵌入所述待处理图像,以生成目标图像。
本公开第三方面实施例提出了一种电子设备,包括:至少一个处理器;和与所述至少一个处理器通信连接的存储器,其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如本公开第一方面实施例提出的图像处理方法。
本公开第四方面实施例提出了一种存储有计算机指令的非瞬时计算机可读存储介质,所述计算机指令用于使所述计算机执行如本公开第一方面实施例提出的图像处理方法。
本公开第五方面实施例提出了一种计算机程序产品,包括计算机程序,所述计算 机程序在被处理器执行时实现如本公开第一方面实施例提出的图像处理方法。
本公开第六方面实施例提出了一种计算机程序,包括计算机程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行如本公开第一方面实施例提出的图像处理方法。
本公开提出的技术方案,具有如下有益效果:通过获取到携带待处理图像、待处理图像中待处理的目标区域的位置信息以及处理方式图像处理请求后,根据位置信息,对待处理图像进行图像提取,以得到包含目标区域的局部图像,再按照处理方式,采用深度模型对局部图像进行处理,以生成与局部图像尺寸相同的目标局部图像,进而将目标局部图像嵌入待处理图像,以生成目标图像,由于深度模型只需对局部图像进行处理,从而减少了深度模型的处理量,减少了图像处理所需消耗的计算资源,使得在边缘设备中也能实现对高分辨率图像的处理。
本公开附加的方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本公开的实践了解到。
附图说明
本公开上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:
图1为本公开实施例一所提供的图像处理方法的流程示意图;
图2为本公开实施例一所提供的图像处理方法的另一流程示意图;
图3为本公开实施例一所提供的采用深度模型对局部图像进行处理的流程示意图;
图4为本公开实施例二所提供的图像处理装置的结构示意图;
图5为本公开实施例三所提供的图像处理方法的流程示意图;
图6为本公开实施例三所提供的图像处理方法的另一流程示意图;
图7为本公开实施例四所提供的图像处理装置的结构示意图;
图8示出了适于用来实现本公开实施方式的示例性电子设备的框图。
具体实施方式
下面详细描述本公开的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,旨在用于解释本公开,而不能理解为对本公开的限制。
可以理解的是,相关技术中,无论是对图像的整个图像区域进行比如颜(磨皮、滤镜,上妆)、卡通化、风格化等处理,还是对图像的局部区域进行处理,都需要将整张图像输入深度模型,对整张图像进行卷积操作和池化操作降维,提取整张图像的特征,生成特征矩阵,再通过反卷积操作,将提取的图像特征向上卷积,生成和原图像尺寸相同的目标图像。这种处理方式,随着图像的分辨率的升高,对图像进行处理消耗的计算资源越多。
相关技术中,在一些仅能部署轻量级深度模型的设备(例如边缘设备)中,由于设备的计算能力较低,通常需要降低图像的分辨率才能实现对高分辨率图像的处理,而这会忽略图像中的细节,影响图像处理后的效果,因此,需要一种能够在计算能力较低的设备中实现对高分辨率图像的处理的方法。
本公开提出一种能够在计算能力较低的设备中实现对高分辨率图像的处理的图像处理方法。该方法获取到携带待处理图像、待处理图像中待处理的目标区域的位置信息以及处理方式图像处理请求后,先根据位置信息,对待处理图像进行图像提取,以得到包含目标区域的局部图像,再按照处理方式,采用深度模型对局部图像进行处理,以生成与局部图像尺寸相同的目标局部图像,进而将目标局部图像嵌入待处理图像, 以生成目标图像,由于深度模型只需对局部图像进行处理,从而减少了深度模型的处理量,减少了图像处理所需消耗的计算资源,使得在边缘设备中也能实现对高分辨率图像的处理。
下面参考附图描述本公开实施例的图像处理方法和装置、电子设备、计算机可读存储介质、计算机程序产品及计算机程序。
图1为本公开实施例一所提供的图像处理方法的流程示意图。
需要说明的是,本公开实施例以该图像处理方法被配置于图像处理装置中来举例说明,该图像处理装置可以应用于任意电子设备比如边缘设备中,以使该电子设备可以实现对高分辨率图像的处理。
其中,电子设备可以为个人电脑(Personal Computer,简称PC)、云端设备、移动设备等,移动设备例如可以为手机、平板电脑、个人数字助理、穿戴式设备、车载设备等硬件设备,也可以为任意能部署轻量级深度模型的计算能力较低的设备,比如边缘设备,其中,边缘设备例如可以为RK3399芯片等。
如图1所示,该图像处理方法可以包括以下步骤101-步骤104。
步骤101,获取图像处理请求,其中,图像处理请求中携带待处理图像、待处理图像中待处理的目标区域的位置信息以及处理方式。
图像处理请求,可以是用户通过在图像处理装置所在的电子设备的人机交互界面中触控具有图像处理功能的按钮触发的,也可以是通过其它方式触发的,本公开对此不作限制。
待处理图像,可以是图像处理装置从其所在的电子设备中的摄像装置获取的,也可以是其它电子设备发送至图像处理装置的,也可以是图像处理装置通过其它方式获取的,本公开对此不作限制。
待处理图像,可以是静态图像,也可以是动态图像,或者也可以是其它类型的图像,本公开对此不作限制。另外,待处理图像,可以是高分辨率图像,也可以是低分辨率图像,本公开对待处理图像的分辨率高低不作限制,即本公开实施例提供的图像处理方法,可以应用于对任意分辨率的图像的处理。
目标区域的位置信息,用于指示目标区域在待处理图像中的位置,其中,目标区域的位置信息,可以包括任意与目标区域所在位置有关的信息,比如可以包括目标区域的多个点的坐标,或者目标区域的轮廓线的坐标等,本公开对此不作限制。
处理方式,为需要对待处理图像进行处理的目标处理方式,比如,美颜处理(例如磨皮、上妆、滤镜)、卡通化处理、风格化处理等。
举例来说,假设用户需要对某张人脸图像A的人脸区域进行磨皮处理,则图像处理请求中可以携带人脸图像A、人脸区域的各个像素点的坐标信息或者人脸区域的轮廓线的坐标信息,以及磨皮处理的处理方式;假设用户需要对某张图像B的人像区域进行卡通化处理,则图像处理请求中可以携带图像B、人像区域的各个像素点的坐标信息或者人像区域的轮廓线的坐标信息,以及卡通化处理的处理方式。
步骤102,根据位置信息,对待处理图像进行图像提取,以得到包含目标区域的局部图像。
步骤103,按照处理方式,采用深度模型对局部图像进行处理,以生成目标局部图像,其中,目标局部图像与局部图像的尺寸相同。
步骤104,将目标局部图像嵌入待处理图像,以生成目标图像。
在一些实施例中,参考图2所示的图像处理方法的流程示意图,获取到携带待处理图像、待处理图像中待处理的目标区域的位置信息以及处理方式的图像处理请求后,图像处理装置即可根据图像处理请求中携带的目标区域的位置信息,对待处理图像进行图像提取,以得到包含目标区域的局部图像,进而按照图像处理请求中携带的处理方式,采用深度模型对局部图像进行处理,以生成与局部图像的尺寸相同的目标局部 图像,最后将目标局部图像嵌入待处理图像,以生成目标图像。
其中,深度模型,可以为任意图像处理模型,本公开对深度模型的结构、类型等不作限制。比如,深度模型可以包括10个卷积层、2个池化层、2个反卷积层。
参考图3所示的采用深度模型对局部图像进行处理的流程示意图。具体地,图3中方块表示每一步处理后的卷积结果,其长、宽、高对应卷积后图像的长、宽、通道。
如图3所示,深度模型可以通过卷积操作和池化操作降维,提取局部图像中的特征,越接近局部图像的卷积操作提取的特征越低级,这部分特征包括局部图像中一些纹理、边缘信息;而越远离局部图像的卷积操作提取的特征越高级,这部分特征包括局部图像中的一些语义特征。多层卷积可以提取局部图像中的多重特征,得到一个包含最小空间的特征矩阵。为了还原局部图像的分辨率,深度模型可以进行反卷积操作,将提取的图像特征向上卷积,生成和局部图像尺寸相同的目标局部图像。
通过设计深度模型的网络架构和损失函数,可以控制生成的目标局部图像的特点,从而实现对局部图像的不同方式的处理,比如美颜、卡通化和风格化等。
由于深度模型只需对局部图像进行处理,从而减少了深度模型的处理量,减少了图像处理所需消耗的计算资源,使得在边缘设备中也能实现对高分辨率图像的处理。
在一些实施例中,假设局部图像的长、宽分别为256像素,通道为3,则深度模型的网络结构可以为下表1所示,其中,表1的第一列为深度模型的各个网络层,第二列为输入对应网络层的图像尺寸或图像特征尺寸。参考表1可知,深度模型的输入尺寸为256*256*3时,输出也为256*256*3。
表1深度模型的网络结构及各网络层的输入尺寸
输入 尺寸
卷积层1 256*256*3
卷积层2 256*256*64
池化层1 128*128*64
卷积层3 128*128*128
卷积层4 128*128*128
池化层2 64*64*128
卷积层5 64*64*256
反卷积层1 128*128*256
卷积层6 128*128*128
卷积层7 128*128*128
反卷积层2 256*256*128
卷积层8 256*256*64
卷积层9 256*256*64
卷积层10 256*256*3
在一些实施例中,损失函数可以采用图像质量损失函数SSIM Loss(Structural Similarity Loss,结构相似性损失)。下面对SSIM Loss进行简单介绍。
对于两张图像x和y,SSIM值通过亮度l(x,y)、对比度c(x,y)、结构s(x,y)三部分来度量两张图像间的相似性,SSIM值为1表示两张图完全相似。
其中,SSIM Loss定义如下公式(1)所示:
SSIM(x,y)=f(l(x,y),c(x,y),s(x,y))
=l(x,y)·c(x,y)·s(x,y)           (1)
其中,图像亮度l(x,y)可以采用以下公式(2)计算得到:
Figure PCTCN2022091294-appb-000001
其中,C1=(K 1L) 2,K 1<<1。
图像对比度c(x,y)可以采用以下公式(3)计算得到:
Figure PCTCN2022091294-appb-000002
其中,C2=(K 2L) 2,K 2<<1。
图像结构比较s(x,y)可以采用以下公式(4)计算得到:
Figure PCTCN2022091294-appb-000003
其中,C3=C2/2。
其中,μ x和μ y分别表示图像x和图像y所有像素的均值,σ x和σ y分别表示图像x和图像y所有像素的方差,σ xy表示图像x和图像y的协方差,L表示像素的动态范围。其中,L与图像的数据类型有关,比如在图像为8位灰度图时,L可以设置为255。
以图像x为例,假设图像x包括N个像素点,则该图像x的像素点的均值为以下公式(5)所示,图像x的像素点的方差为以下公式(6)所示,图像x和图像y的协方差为以下公式(7)所示。
Figure PCTCN2022091294-appb-000004
Figure PCTCN2022091294-appb-000005
Figure PCTCN2022091294-appb-000006
其中,x i表示图像x中第i个像素点的像素值,y i表示图像y中第i个像素点的像素值。
需要说明的是,上述实施例中所示的深度模型的网络结构及损失函数,仅是举例说明,不能理解为对本公开技术方案的限制,在实际应用中,本领域技术人员可以任 意设置深度模型的网络结构及损失函数,本公开对此不作限制。
本公开实施例的图像处理方法,获取到携带待处理图像、待处理图像中待处理的目标区域的位置信息以及处理方式图像处理请求后,先根据位置信息,对待处理图像进行图像提取,以得到包含目标区域的局部图像,再按照处理方式,采用深度模型对局部图像进行处理,以生成与局部图像尺寸相同的目标局部图像,进而将目标局部图像嵌入待处理图像,以生成目标图像,由于深度模型只需对局部图像进行处理,从而减少了深度模型的处理量,减少了图像处理所需消耗的计算资源,使得在边缘设备中也能实现对高分辨率图像的处理。
通过上述分析可知,本公开实施例中,可以根据位置信息,对待处理图像进行图像提取,以得到包含目标区域的局部图像,下面结合图4,对本公开实施例中的图像处理方法中,根据位置信息,对待处理图像进行图像提取,以得到包含目标区域的局部图像的过程进行进一步说明。
图4为本公开实施例二所提供的图像处理方法的流程示意图。如图4所示,图像处理方法具体可以包括以下步骤401-步骤406。
步骤401,获取图像处理请求,其中,图像处理请求中携带待处理图像、待处理图像中待处理的目标区域的位置信息以及处理方式。
需要说明的是,步骤401的具体实现过程及原理,可以参考上述实施例的描述,此处不再赘述。
步骤402,根据第一坐标和第二坐标,确定矩形区域。
步骤403,从待处理图像中提取包含矩形区域的第一图像。
步骤404,将第一图像确定为包含目标区域的局部图像。
在一些实施例中,目标区域可以为一个规则的矩形区域,位置信息可以至少包括第一坐标和第二坐标,其中,第一坐标和第二坐标,可以分别为矩形区域的左上顶点坐标和右下顶点坐标,或者也可以分别为矩形区域的左下顶点坐标和右上顶点坐标,本公开对此不作限制,只需能够唯一确定目标区域的位置即可。其中,矩形区域例如可以为包含某个物体的紧致矩形框围成的区域,比如为一个包含该物体的全部像素信息且包含背景像素最少的区域。
在一些实施例中,图像处理请求中携带的目标区域的位置信息包括第一坐标和第二坐标时,可以根据第一坐标和第二坐标,确定一个矩形区域,并从待处理图像中提取该矩形区域所在位置的像素信息,得到包含目标区域的第一图像,从而可以将第一图像确定为包含目标区域的局部图像。
在一些实施例中,目标区域可以为一个不规则的区域,比如人脸区域,位置信息可以包括目标区域的轮廓线的坐标信息。
在一些实施例中,图像处理请求中携带的目标区域的位置信息包括目标区域的轮廓线的坐标信息时,可以根据目标区域的轮廓线的坐标信息,确定轮廓线围成的第一区域,并从待处理图像中提取该第一区域所在位置的图像信息,得到包含第一区域的第二图像,从而可以将第二图像确定为包含目标区域的局部图像。
相应的,步骤402-404可以替换为以下步骤:
根据目标区域的轮廓线的坐标信息,确定轮廓线围成的第一区域;
从待处理图像中提取包含第一区域的第二图像;
将第二图像确定为包含目标区域的局部图像。
步骤405,按照处理方式,采用深度模型对局部图像进行处理,以生成目标局部图像,其中,目标局部图像与局部图像的尺寸相同。
步骤406,将目标局部图像嵌入待处理图像,以生成目标图像。
本公开实施例的图像处理方法,获取到携带待处理图像、待处理图像中待处理的目标区域的位置信息以及处理方式图像处理请求后,先根据第一坐标和第二坐标,确 定矩形区域,从待处理图像中提取包含矩形区域的第一图像,将第一图像确定为包含目标区域的局部图像,再按照处理方式,采用深度模型对局部图像进行处理,以生成与局部图像的尺寸相同的目标局部图像,进而将目标局部图像嵌入待处理图像,以生成目标图像,由于深度模型只需对局部图像进行处理,从而减少了深度模型的处理量,减少了图像处理所需消耗的计算资源,使得在边缘设备中也能实现对高分辨率图像的处理。
通过上述分析可知,本公开实施例中,可以将目标局部图像嵌入待处理图像,以生成目标图像,下面结合图5,对本公开实施例中的图像处理方法中,将目标局部图像嵌入待处理图像,以生成目标图像的过程进行进一步说明。
图5为本公开实施例三所提供的图像处理方法的流程示意图。如图5所示,上述步骤104或204具体可以包括以下步骤501-步骤504。
步骤501,获取目标局部图像的中心点,并将目标图像中位置与中心点的位置对应的点确定为嵌入中心。
步骤502,根据中心点与目标局部图像的边界线之间的距离,确定嵌入半径。
在一些实施例中,可以根据目标局部图像的中心点与目标局部图像的边界线的位置关系,将目标局部图像的中心点与目标局部图像的边界线之间的最短距离值,确定为嵌入半径的值。
步骤503,针对目标图像中的每个第一像素点,根据目标局部图像中各第二像素点的像素值、待处理图像中各第三像素点的像素值、第一像素点与嵌入中心之间的距离以及嵌入半径,确定第一像素点的像素值。
步骤504,根据目标图像中的各第一像素点的像素值,生成目标图像。
在一些实施例中,确定了目标图像中位置与中心点的位置对应的点为嵌入中心,并确定了嵌入半径后,针对目标图像中的每个第一像素点,即可根据目标局部图像中各第二像素点的像素值、待处理图像中各第三像素点的像素值、第一像素点与嵌入中心之间的距离以及嵌入半径,确定第一像素点的像素值,进而根据目标图像中的各第一像素点的像素值,生成目标图像。
在一些实施例中,针对目标图像中的每个第一像素点,根据目标局部图像中各第二像素点的像素值、待处理图像中各第三像素点的像素值、第一像素点与嵌入中心之间的距离以及嵌入半径,确定第一像素点的像素值的过程可以为:
判断第一像素点与嵌入中心之间的距离,是否小于嵌入半径;
若是,则将目标局部图像中与第一像素点的位置对应的第二像素点的像素值,确定为第一像素点的像素值;
若否,则进一步判断第一像素点与嵌入中心之间的距离,是否大于预设距离阈值,其中,预设距离阈值大于嵌入半径;
在第一像素点与嵌入中心之间的距离大于预设距离阈值时,将待处理图像中与第一像素点的位置对应的第三像素点的像素值,确定为第一像素点的像素值;
在第一像素点与嵌入中心之间的距离不大于预设距离阈值时,根据目标局部图像中各第二像素点的像素值以及待处理图像中各第三像素点的像素值,确定第一像素点的像素值。
其中,预设距离阈值,可以根据需要任意设置,其可以设置为一个固定值,也可以根据不同任务或情况进行设置,比如可以设置为嵌入半径*1.1,本公开对此不作限制。
在一些实施例中,根据目标局部图像中各第二像素点的像素值以及待处理图像中各第三像素点的像素值,确定第一像素点的像素值的过程具体可以为:确定目标图像中第一像素点的预设大小的邻域区域;针对邻域区域内的每个第四像素点,确定待处理图像中位置与第四像素点的位置对应的第三像素点的像素值,以及目标局部图像中位置与第四像素点的位置对应的第二像素点的像素值;获取待处理图像中位置与第四 像素点的位置对应的第三像素点的像素值,与目标局部图像中位置与第四像素点的位置对应的第二像素点的像素值的差值;根据邻域区域内的各个第四像素点对应的差值,确定差值的均值;根据待处理图像中与第一像素点的位置对应的第三像素点的像素值与均值,确定第一像素点的像素值。
预设大小,可以根据需要任意设置,本公开对此不作限制。
在一些实施例中,可以将均值与权重常数相乘后,与待处理图像中与第一像素点的位置对应的第三像素点的像素值相加,得到第一像素点的像素值。
下面结合图6,对步骤503的具体过程进行说明。其中,假设待处理图像为图像S,目标局部图像为图像E,目标图像为图像D,嵌入中心为(C x,C y),嵌入半径为r,预设距离阈值为d。
具体的,确定待处理图像为S、目标局部图像为图像E,目标图像为图像D,嵌入中心为(C x,C y),嵌入半径为r,预设距离阈值为d(步骤601)后,可以确定目标图像D中的位置为(P x,P y)的任意第一像素点(步骤602),针对该第一像素点,可以判断(P x,P y)与嵌入中心(C x,C y)之间的距离,是否小于嵌入半径r(步骤603)。
在(P x,P y)与嵌入中心(C x,C y)之间的距离小于嵌入半径r,即(P x,P y)在嵌入半径r内时,可以确定D(x,y)=E(x,y),即将目标局部图像E中与第一像素点的位置(P x,P y)对应的第二像素点的像素值E(x,y),确定为目标图像D在(P x,P y)处的第一像素点的像素值D(x,y)(步骤604)。
在(P x,P y)与嵌入中心(C x,C y)之间的距离不小于嵌入半径r,即(P x,P y)不在嵌入半径r内时,可以进一步判断(P x,P y)与嵌入中心(Cx,C y)之间的距离,是否大于预设距离阈值d(步骤605)。在(P x,P y)与嵌入中心(C x,C y)之间的距离,不大于预设距离阈值d时,可以根据目标局部图像E中各第二像素点的像素值以及待处理图像S中各第三像素点的像素值,确定目标图像D在(P x,P y)处的第一像素点的像素值(步骤606)。
在一些实施例中,在(P x,P y)与嵌入中心(C x,C y)之间的距离,不大于预设距离阈值d时,可以按照以下公式(8),确定目标图像D在(P x,P y)处的第一像素点的像素值。
D(x,y)=S(x,y)+w﹒ΔRGB mean           (8)
其中,D(x,y)表示目标图像D在(P x,P y)处的第一像素点的像素值;S(x,y)表示待处理图像S中与第一像素点的位置(P x,P y)对应的第三像素点的像素值;w表示权重常数,其可以根据需要任意设置;ΔRGB mean表示(P x,P y)处的第一像素点的邻域U内,待处理图像S与目标局部图像E的像素差的均值。
其中,ΔRGB mean可以通过以下方式计算得到:针对目标图像D中(P x,P y)处的第一像素点的邻域U内的每个第四像素点,确定待处理图像S中位置与第四像素点的位置对应的第三像素点的像素值,以及目标图像E中位置与第四像素点的位置对应的第二像素点的像素值,并获取待处理图像S中位置与第四像素点的位置对应的第三像素点的像素值与目标图像E中位置与第四像素点的位置对应的第二像素点的像素值的差值,进而根据邻域U内各个第四像素点对应的差值,确定差值的均值。
其中,邻域U的预设大小,可以根据需要设置,比如可以将邻域U设置为U(x,y)={(x±t,y±t),t=1},从而可以确定目标图像D中(P x,P y)处的第一像素点的邻域U内的第四像素点,为距离(P x,P y)处的第一像素点的距离为1的像素点。
在(P x,P y)与嵌入中心(C x,C y)之间是的距离,大于预设距离阈值d时,可以确定D(x,y)=S(x,y),即将待处理图像S中与第一像素点的位置(P x,P y)对应的第三像素点的像素值S(x,y),确定为目标图像D在(P x,P y)处的第一像素点的像素值D(x,y)(步骤607)。
在确定目标图像D在(P x,P y)处的第一像素点的像素值后,可以输出目标图像D在(P x,P y)处的第一像素点的像素值(步骤608),并判断(P x,P y)处的第一像素点是否为最后一个第一像素点(步骤609),若否,则继续确定目标图像中的位置为其它位置的第一像素点,并对该第一像素点执行与(P x,P y)处的第一像素点相同的操作,直至输出最后一个第一像素点的像素值,从而可以根据目标图像D中的各第一像素点的像素值生成并输出目标图像D(步骤610)。
可以理解的是,生成目标局部图像后,若将目标局部图像直接拼接到待处理图像中,会因为两个图像的像素差而在目标局部图像的边界处产生明显的缝隙,影响目标图像的视觉效果,而本公开实施例中,通过针对目标图像中的每个第一像素点,根据目标局部图像中各第二像素点的像素值、待处理图像中各第三像素点的像素值、第一像素点与嵌入中心之间的距离以及嵌入半径,确定第一像素点的像素值,实现了随着与嵌入中心的距离的增加,目标图像中的第一像素的像素值从目标局部图像逐渐过渡到待处理图像,从而使得目标局部图像嵌入待处理图像后,目标局部图像的边界处过渡自然,生成的目标图像的视觉效果好。
图7为本公开实施例四所提供的图像处理装置的结构示意图。
如图7所示,该图像处理装置700可以包括:获取模块710、提取模块720、处理模块730和生成模块740。
获取模块710,用于获取图像处理请求,其中,图像处理请求中携带待处理图像、待处理图像中待处理的目标区域的位置信息以及处理方式。
提取模块720,用于根据位置信息,对待处理图像进行图像提取,以得到包含目标区域的局部图像。
处理模块730,用于按照处理方式,采用深度模型对局部图像进行处理,以生成目标局部图像,其中,目标局部图像与局部图像的尺寸相同。
生成模块740,用于将目标局部图像嵌入待处理图像,以生成目标图像。
需要说明的是,本公开实施例提供的图像处理装置,可以执行前述实施例的图像处理方法,该图像处理装置可以应用于任意电子设备比如边缘设备中,以使该电子设备可以实现对高分辨率图像的处理。
电子设备可以为个人电脑(Personal Computer,简称PC)、云端设备、移动设备等,移动设备例如可以为手机、平板电脑、个人数字助理、穿戴式设备、车载设备等硬件设备,也可以为任意能部署轻量级深度模型的计算能力较低的设备,比如边缘设备,其中,边缘设备例如可以为RK3399芯片等。
在一些实施例中,位置信息包括第一坐标和第二坐标。相应的,提取模块720,包括:
第一确定单元,用于根据第一坐标和第二坐标,确定矩形区域;
第一提取单元,用于从待处理图像中提取包含矩形区域的第一图像;和
第二确定单元,用于将第一图像确定为包含目标区域的局部图像。
在一些实施例中,位置信息包括目标区域的轮廓线的坐标信息;相应的,提取模块720,包括:
第三确定单元,用于根据目标区域的轮廓线的坐标信息,确定轮廓线围成的第一区域;
第二提取单元,用于从待处理图像中提取包含第一区域的第二图像;和
第四确定单元,用于将第二图像确定为包含目标区域的局部图像。
在一些实施例中,生成模块740,包括:
第五确定单元,用于获取目标局部图像的中心点,并将目标图像中位置与中心点的位置对应的点确定为嵌入中心;
第六确定单元,用于根据中心点与目标局部图像的边界线之间的距离,确定嵌入 半径;
第七确定单元,用于针对目标图像中的每个第一像素点,根据目标局部图像中各第二像素点的像素值、待处理图像中各第三像素点的像素值、第一像素点与嵌入中心之间的距离以及嵌入半径,确定第一像素点的像素值;和
生成单元,用于根据目标图像中的各第一像素点的像素值,生成目标图像。
在一些实施例中,第七确定单元,具体用于:
判断第一像素点与嵌入中心之间的距离,是否小于嵌入半径;
在第一像素点与嵌入中心之间的距离不小于嵌入半径时,进一步判断第一像素点与嵌入中心之间的距离,是否大于预设距离阈值,其中,预设距离阈值大于嵌入半径;
在第一像素点与嵌入中心之间的距离大于预设距离阈值时,将待处理图像中与第一像素点的位置对应的第三像素点的像素值,确定为第一像素点的像素值;和
在第一像素点与嵌入中心之间的距离不大于预设距离阈值时,根据目标局部图像中各第二像素点的像素值以及待处理图像中各第三像素点的像素值,确定第一像素点的像素值。
在一些实施例中,第七确定单元,还用于:
确定目标图像中第一像素点的预设大小的邻域区域;
针对邻域区域内的每个第四像素点,确定待处理图像中位置与第四像素点的位置对应的第三像素点的像素值,以及目标局部图像中位置与第四像素点的位置对应的第二像素点的像素值;
获取待处理图像中位置与第四像素点的位置对应的第三像素点的像素值与目标局部图像中位置与第四像素点的位置对应的第二像素点的像素值的差值;
根据邻域区域内的各个第四像素点对应的差值,确定差值的均值;和
根据待处理图像中与第一像素点的位置对应的第三像素点的像素值与均值,确定第一像素点的像素值。
在一些实施例中,第七确定单元,还用于:
在第一像素点与嵌入中心之间的距离小于嵌入半径时,将目标局部图像中与第一像素点的位置对应的第二像素点的像素值,确定为第一像素点的像素值。
需要说明的是,前述图像处理方法实施例中的解释说明也适用于该实施例的图像处理装置,此处不再赘述。
本公开实施例的图像处理装置,获取到携带待处理图像、待处理图像中待处理的目标区域的位置信息以及处理方式图像处理请求后,先根据位置信息,对待处理图像进行图像提取,以得到包含目标区域的局部图像,再按照处理方式,采用深度模型对局部图像进行处理,以生成与局部图像尺寸相同的目标局部图像,进而将目标局部图像嵌入待处理图像,以生成目标图像,由于深度模型只需对局部图像进行处理,从而减少了深度模型的处理量,减少了图像处理所需消耗的计算资源,使得在边缘设备中也能实现对高分辨率图像的处理。
为了实现上述实施例,本公开的实施例还提出一种电子设备,包括:至少一个处理器;以及与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如本公开前述实施例提出的图像处理方法。
为了实现上述实施例,本公开的实施例还提出一种存储有计算机指令的非瞬时计算机可读存储介质,所述计算机指令用于使所述计算机执行如本公开前述实施例提出的图像处理方法。
为了实现上述实施例,本公开的实施例还提出一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现如本公开前述实施例提出的图像处理方法。
为了实现上述实施例,本公开的实施例还提出一种计算机程序,包括计算机程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行如本公开前述实施例提出的图像处理方法。
需要说明的是,前述图像处理方法实施例中的解释说明也适用于上述实施例的电子设备、计算机可读存储介质、计算机程序产品和计算机程序,此处不再赘述。
图8示出了适于用来实现本公开实施方式的示例性电子设备的框图。图8显示的电子设备12仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图8所示,电子设备12以通用计算设备的形式表现。电子设备12的组件可以包括但不限于:一个或者多个处理器或者处理单元16,系统存储器28,连接不同系统组件(包括系统存储器28和处理单元16)的总线18。
总线18表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(Industry Standard Architecture;以下简称:ISA)总线,微通道体系结构(Micro Channel Architecture;以下简称:MAC)总线,增强型ISA总线、视频电子标准协会(Video Electronics Standards Association;以下简称:VESA)局域总线以及外围组件互连(Peripheral Component Interconnection;以下简称:PCI)总线。
电子设备12典型地包括多种计算机系统可读介质。这些介质可以是任何能够被电子设备12访问的可用介质,包括易失性和非易失性介质,可移动的和不可移动的介质。
存储器28可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(Random Access Memory;以下简称:RAM)30和/或高速缓存存储器32。电子设备12可以进一步包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统34可以用于读写不可移动的、非易失性磁介质(图8未显示,通常称为“硬盘驱动器”)。尽管图8中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如:光盘只读存储器(Compact Disc Read Only Memory;以下简称:CD-ROM)、数字多功能只读光盘(Digital Video Disc Read Only Memory;以下简称:DVD-ROM)或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过一个或者多个数据介质接口与总线18相连。存储器28可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本公开各实施例的功能。
具有一组(至少一个)程序模块42的程序/实用工具40,可以存储在例如存储器28中,这样的程序模块42包括但不限于操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块42通常执行本公开所描述的实施例中的功能和/或方法。
电子设备12也可以与一个或多个外部设备14(例如键盘、指向设备、显示器24等)通信,还可与一个或者多个使得用户能与该电子设备12交互的设备通信,和/或与使得该电子设备12能与一个或多个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口22进行。并且,电子设备12还可以通过网络适配器20与一个或者多个网络(例如局域网(Local Area Network;以下简称:LAN),广域网(Wide Area Network;以下简称:WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器20通过总线18与电子设备12的其它模块通信。应当明白,尽管图8中未示出,可以结合电子设备12使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。
处理单元16通过运行存储在系统存储器28中的程序,从而执行各种功能应用以及数据处理,例如实现前述实施例中提及的方法。
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本公开的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。在本公开的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现定制逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本公开的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本公开的实施例所属技术领域的技术人员所理解。
在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,"计算机可读介质"可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器(RAM),只读存储器(ROM),可擦除可编辑只读存储器(EPROM或闪速存储器),光纤装置,以及便携式光盘只读存储器(CDROM)。另外,计算机可读介质甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得所述程序,然后将其存储在计算机存储器中。
应当理解,本公开的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。如,如果用硬件来实现和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。
此外,在本公开各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。
上述提到的存储介质可以是只读存储器,磁盘或光盘等。
尽管上面已经示出和描述了本公开的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本公开的限制,本领域的普通技术人员在本公开的范围内可以对上述实施例 进行变化、修改、替换和变型。
本公开所有实施例均可以单独被执行,也可以与其他实施例相结合被执行,均视为本公开要求的保护范围。

Claims (18)

  1. 一种图像处理方法,包括:
    获取图像处理请求,其中,所述图像处理请求中携带待处理图像、所述待处理图像中待处理的目标区域的位置信息以及处理方式;
    根据所述位置信息,对所述待处理图像进行图像提取,以得到包含所述目标区域的局部图像;
    按照所述处理方式,采用深度模型对所述局部图像进行处理,以生成目标局部图像,其中,所述目标局部图像与所述局部图像的尺寸相同;和
    将所述目标局部图像嵌入所述待处理图像,以生成目标图像。
  2. 根据权利要求1所述的方法,其中所述位置信息包括第一坐标和第二坐标,
    其中,所述根据所述位置信息,对所述待处理图像进行图像提取,以得到包含所述目标区域的局部图像,包括:
    根据所述第一坐标和所述第二坐标,确定矩形区域;
    从所述待处理图像中提取包含所述矩形区域的第一图像;和
    将所述第一图像确定为所述包含所述目标区域的局部图像。
  3. 根据权利要求1所述的图像处理方法,其中所述位置信息包括所述目标区域的轮廓线的坐标信息,
    其中,所述根据所述位置信息,对所述待处理图像进行图像提取,以得到包含所述目标区域的局部图像,包括:
    根据所述目标区域的轮廓线的坐标信息,确定所述轮廓线围成的第一区域;
    从所述待处理图像中提取包含所述第一区域的第二图像;和
    将所述第二图像确定为所述包含所述目标区域的局部图像。
  4. 根据权利要求1至3中任一项所述的图像处理方法,其中所述将所述目标局部图像嵌入所述待处理图像,以生成目标图像,包括:
    获取所述目标局部图像的中心点,并将所述目标图像中位置与所述中心点的位置对应的点确定为嵌入中心;
    根据所述中心点与所述目标局部图像的边界线之间的距离,确定嵌入半径;
    针对所述目标图像中的每个第一像素点,根据所述目标局部图像中各第二像素点的像素值、所述待处理图像中各第三像素点的像素值、所述第一像素点与所述嵌入中心之间的距离以及所述嵌入半径,确定所述第一像素点的像素值;和
    根据所述目标图像中的各所述第一像素点的像素值,生成所述目标图像。
  5. 根据权利要求4所述的图像处理方法,其中所述针对所述目标图像中的每个第一像素点,根据所述目标局部图像中各第二像素点的像素值、所述待处理图像中各第三像素点的像素值、所述第一像素点与所述嵌入中心之间的距离以及所述嵌入半径,确定所述第一像素点的像素值,包括:
    判断所述第一像素点与所述嵌入中心之间的距离,是否小于所述嵌入半径;
    基于所述第一像素点与所述嵌入中心之间的距离不小于所述嵌入半径,进一步判断所述第一像素点与所述嵌入中心之间的距离,是否大于预设距离阈值,其中,所述预设距离阈值大于所述嵌入半径,
    基于所述第一像素点与所述嵌入中心之间的距离大于所述预设距离阈值,将所述待处理图像中与所述第一像素点的位置对应的第三像素点的像素值,确定为所述第一 像素点的像素值;
    基于所述第一像素点与所述嵌入中心之间的距离不大于所述预设距离阈值,根据所述目标局部图像中各第二像素点的像素值以及所述待处理图像中各第三像素点的像素值,确定所述第一像素点的像素值。
  6. 根据权利要求5所述的图像处理方法,其中所述根据所述目标局部图像中各第二像素点的像素值以及所述待处理图像中各第三像素点的像素值,确定所述第一像素点的像素值,包括:
    确定所述目标图像中所述第一像素点的预设大小的邻域区域;
    针对所述邻域区域内的每个第四像素点,确定所述待处理图像中位置与所述第四像素点的位置对应的第三像素点的像素值,以及所述目标局部图像中位置与所述第四像素点的位置对应的第二像素点的像素值;
    获取所述待处理图像中位置与所述第四像素点的位置对应的第三像素点的像素值与所述目标局部图像中位置与所述第四像素点的位置对应的第二像素点的像素值的差值;
    根据所述邻域区域内的各个所述第四像素点对应的所述差值,确定所述差值的均值;和
    根据所述待处理图像中与所述第一像素点的位置对应的第三像素点的像素值与所述均值,确定所述第一像素点的像素值。
  7. 根据权利要求5或6所述的图像处理方法,其中所述判断所述第一像素点与所述嵌入中心之间的距离,是否小于所述嵌入半径之后,还包括:
    基于所述第一像素点与所述嵌入中心之间的距离小于所述嵌入半径,将所述目标局部图像中与所述第一像素点的位置对应的第二像素点的像素值,确定为所述第一像素点的像素值。
  8. 一种图像处理装置,包括:
    获取模块,用于获取图像处理请求,其中,所述图像处理请求中携带待处理图像、所述待处理图像中待处理的目标区域的位置信息以及处理方式;
    提取模块,用于根据所述位置信息,对所述待处理图像进行图像提取,以得到包含所述目标区域的局部图像;
    处理模块,用于按照所述处理方式,采用深度模型对所述局部图像进行处理,以生成目标局部图像,其中,所述目标局部图像与所述局部图像的尺寸相同;和
    生成模块,用于将所述目标局部图像嵌入所述待处理图像,以生成目标图像。
  9. 根据权利要求8所述的图像处理装置,其中所述位置信息包括第一坐标和第二坐标,
    其中,所述提取模块,包括:
    第一确定单元,用于根据所述第一坐标和所述第二坐标,确定矩形区域;
    第一提取单元,用于从所述待处理图像中提取包含所述矩形区域的第一图像;和
    第二确定单元,用于将所述第一图像确定为所述包含所述目标区域的局部图像。
  10. 根据权利要求8所述的图像处理装置,其中所述位置信息包括所述目标区域的轮廓线的坐标信息,
    其中,所述提取模块,包括:
    第三确定单元,用于根据所述目标区域的轮廓线的坐标信息,确定所述轮廓线围 成的第一区域;
    第二提取单元,用于从所述待处理图像中提取包含所述第一区域的第二图像;和
    第四确定单元,用于将所述第二图像确定为所述包含所述目标区域的局部图像。
  11. 根据权利要求8至10中任一项所述的图像处理装置,其中所述生成模块,包括:
    第五确定单元,用于获取所述目标局部图像的中心点,并将所述目标图像中位置与所述中心点的位置对应的点确定为嵌入中心;
    第六确定单元,用于根据所述中心点与所述目标局部图像的边界线之间的距离,确定嵌入半径;
    第七确定单元,用于针对所述目标图像中的每个第一像素点,根据所述目标局部图像中各第二像素点的像素值、所述待处理图像中各第三像素点的像素值、所述第一像素点与所述嵌入中心之间的距离以及所述嵌入半径,确定所述第一像素点的像素值;和
    生成单元,用于根据所述目标图像中的各所述第一像素点的像素值,生成所述目标图像。
  12. 根据权利要求11所述的图像处理装置,其中所述第七确定单元,具体用于:
    判断所述第一像素点与所述嵌入中心之间的距离,是否小于所述嵌入半径;
    基于所述第一像素点与所述嵌入中心之间的距离不小于所述嵌入半径,进一步判断所述第一像素点与所述嵌入中心之间的距离,是否大于预设距离阈值,其中,所述预设距离阈值大于所述嵌入半径;
    基于所述第一像素点与所述嵌入中心之间的距离大于所述预设距离阈值,将所述待处理图像中与所述第一像素点的位置对应的第三像素点的像素值,确定为所述第一像素点的像素值;和
    基于所述第一像素点与所述嵌入中心之间的距离不大于所述预设距离阈值,根据所述目标局部图像中各第二像素点的像素值以及所述待处理图像中各第三像素点的像素值,确定所述第一像素点的像素值。
  13. 根据权利要求12所述的图像处理装置,其中所述第七确定单元,还用于:
    确定所述目标图像中所述第一像素点的预设大小的邻域区域;
    针对所述邻域区域内的每个第四像素点,确定所述待处理图像中位置与所述第四像素点的位置对应的第三像素点的像素值,以及所述目标局部图像中位置与所述第四像素点的位置对应的第二像素点的像素值;
    获取所述待处理图像中位置与所述第四像素点的位置对应的第三像素点的像素值与所述目标局部图像中位置与所述第四像素点的位置对应的第二像素点的像素值的差值;
    根据所述邻域区域内的各个所述第四像素点对应的所述差值,确定所述差值的均值;和
    根据所述待处理图像中与所述第一像素点的位置对应的第三像素点的像素值与所述均值,确定所述第一像素点的像素值。
  14. 根据权利要求12或13所述的图像处理装置,其中所述第七确定单元,还用于:
    基于所述第一像素点与所述嵌入中心之间的距离小于所述嵌入半径,将所述目标局部图像中与所述第一像素点的位置对应的第二像素点的像素值,确定为所述第一像素点的像素值。
  15. 一种电子设备,包括:
    至少一个处理器;和
    与所述至少一个处理器通信连接的存储器,其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-7中任一项所述的图像处理方法。
  16. 一种存储有计算机指令的非瞬时计算机可读存储介质,其中所述计算机指令用于使所述计算机执行权利要求1-7中任一项所述的图像处理方法。
  17. 一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现权利要求1-7中任一项所述的图像处理方法。
  18. 一种计算机程序,包括计算机程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行权利要求1-7中任一项所述的图像处理方法。
PCT/CN2022/091294 2021-05-10 2022-05-06 图像处理方法、装置及电子设备 WO2022237657A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110506293.0 2021-05-10
CN202110506293.0A CN115393453A (zh) 2021-05-10 2021-05-10 图像处理方法、装置及电子设备

Publications (1)

Publication Number Publication Date
WO2022237657A1 true WO2022237657A1 (zh) 2022-11-17

Family

ID=84027973

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/091294 WO2022237657A1 (zh) 2021-05-10 2022-05-06 图像处理方法、装置及电子设备

Country Status (2)

Country Link
CN (1) CN115393453A (zh)
WO (1) WO2022237657A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100092085A1 (en) * 2008-10-13 2010-04-15 Xerox Corporation Content-based image harmonization
CN108550107A (zh) * 2018-04-27 2018-09-18 Oppo广东移动通信有限公司 一种图片处理方法、图片处理装置及移动终端
CN110619369A (zh) * 2019-09-23 2019-12-27 常熟理工学院 基于特征金字塔与全局平均池化的细粒度图像分类方法
CN111127378A (zh) * 2019-12-23 2020-05-08 Oppo广东移动通信有限公司 图像处理方法、装置、计算机设备及存储介质
CN111583154A (zh) * 2020-05-12 2020-08-25 Oppo广东移动通信有限公司 图像处理方法、肤质美化模型训练方法及相关装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100092085A1 (en) * 2008-10-13 2010-04-15 Xerox Corporation Content-based image harmonization
CN108550107A (zh) * 2018-04-27 2018-09-18 Oppo广东移动通信有限公司 一种图片处理方法、图片处理装置及移动终端
CN110619369A (zh) * 2019-09-23 2019-12-27 常熟理工学院 基于特征金字塔与全局平均池化的细粒度图像分类方法
CN111127378A (zh) * 2019-12-23 2020-05-08 Oppo广东移动通信有限公司 图像处理方法、装置、计算机设备及存储介质
CN111583154A (zh) * 2020-05-12 2020-08-25 Oppo广东移动通信有限公司 图像处理方法、肤质美化模型训练方法及相关装置

Also Published As

Publication number Publication date
CN115393453A (zh) 2022-11-25

Similar Documents

Publication Publication Date Title
US10872420B2 (en) Electronic device and method for automatic human segmentation in image
KR102304674B1 (ko) 얼굴 표정 합성 방법과 장치, 전자 기기, 및 저장 매체
JP4740657B2 (ja) カラーセグメンテーションに基づくステレオ3次元再構成システムおよびプロセス
JP7061225B2 (ja) 病巣検出方法、装置、機器および記憶媒体
US8803896B2 (en) Providing a coherent user interface across multiple output devices
WO2020259453A1 (zh) 3d图像的分类方法、装置、设备及存储介质
US11403819B2 (en) Three-dimensional model processing method, electronic device, and readable storage medium
US10347052B2 (en) Color-based geometric feature enhancement for 3D models
US8879835B2 (en) Fast adaptive edge-aware matting
WO2020034786A1 (zh) 三维模型处理方法、装置、电子设备和存储介质
WO2021052028A1 (zh) 图像颜色迁移方法、装置、计算机设备和存储介质
US9959672B2 (en) Color-based dynamic sub-division to generate 3D mesh
CN110503704B (zh) 三分图的构造方法、装置和电子设备
WO2019047409A1 (zh) 图像处理方法、系统、可读存储介质及移动摄像设备
JP2013137761A (ja) 参照背景色に基づく透明化塗りつぶしの判定
WO2019237744A1 (zh) 构建图像深度信息的方法及装置
CN113506305B (zh) 三维点云数据的图像增强方法、语义分割方法及装置
WO2022237657A1 (zh) 图像处理方法、装置及电子设备
US8891857B2 (en) Concave surface modeling in image-based visual hull
US10963988B2 (en) Image processing device, image processing system, image processing method, and program
AU2017279613A1 (en) Method, system and apparatus for processing a page of a document
JP2006133941A (ja) 画像処理装置、画像処理方法、画像処理プログラム及び携帯型端末
JPWO2006062132A1 (ja) 立体画像再構成装置、立体画像再構成方法、及び立体画像再構成プログラム
KR20150094108A (ko) 배경 영상의 위치를 이용한 관심맵 생성 방법 및 이를 기록한 기록 매체
CN108520259A (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: 22806623

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE