WO2020056901A1 - 用于处理图像的方法和装置 - Google Patents

用于处理图像的方法和装置 Download PDF

Info

Publication number
WO2020056901A1
WO2020056901A1 PCT/CN2018/115970 CN2018115970W WO2020056901A1 WO 2020056901 A1 WO2020056901 A1 WO 2020056901A1 CN 2018115970 W CN2018115970 W CN 2018115970W WO 2020056901 A1 WO2020056901 A1 WO 2020056901A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
processed
eyebrows
target image
eyebrow
Prior art date
Application number
PCT/CN2018/115970
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 WO2020056901A1 publication Critical patent/WO2020056901A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • G06V40/171Local features and components; Facial parts ; Occluding parts, e.g. glasses; Geometrical relationships

Definitions

  • Embodiments of the present application relate to the field of computer technology, and in particular, to a method and an apparatus for processing an image.
  • the image area where the eyebrows are displayed in the image is located first, and then a preset eyebrow image is selected to cover the positioned image area.
  • This processing method can only display the preset eyebrow image, and when the preset eyebrow image cannot completely cover the originally displayed eyebrows, some originally displayed eyebrows are still displayed in the processed image.
  • the embodiments of the present application provide a method and an apparatus for processing an image.
  • an embodiment of the present application provides a method for processing an image.
  • the method includes: acquiring an image to be processed; and acquiring position information of a position of an image region of the image to be processed and displaying an eyebrow in the image to be processed; According to the position information, the eyebrows displayed in the image to be processed are replaced to obtain a processed image to be processed.
  • replacing the eyebrows displayed in the image to be processed according to the position information to obtain a processed image to be processed includes: processing the image region to obtain a to-be-processed image that does not display eyebrows; and according to the position information, The image to be processed without displaying eyebrows is processed to obtain an image to be processed with new eyebrows, and the image to be processed with new eyebrows is determined as a processed image to be processed.
  • processing the to-be-processed image without displaying eyebrows to obtain a to-be-processed image displaying new eyebrows according to the position information including: inputting the to-be-processed image and position information without displaying eyebrows to a pre-trained The eyebrows were replaced with a model, and a new image of a new eyebrow was obtained.
  • processing the image region to obtain an image to be processed without displaying eyebrows includes: adjusting the color or transparency of pixel points in the image region to obtain an image to be processed without displaying eyebrows.
  • acquiring the image to be processed includes: acquiring a target image; adjusting the size of the target image to a preset size, and determining the target image of the preset size as the image to be processed.
  • the eyebrow replacement model is obtained by training as follows: obtaining a target image set, wherein the target image in the target image set displays eyebrows; and for the target image in the target image set, obtaining the target image and displaying the eyebrows Position information of the position of the image region in the target image; and processing the target image to obtain a target image corresponding to the target image that does not show eyebrows; determine the initial eyebrow replacement model; use machine learning methods to convert the target
  • the position information corresponding to the target image in the image set and the target image without eyebrows are used as the input of the initial eyebrow replacement model, and this target image is used as the expected output of the initial eyebrow replacement model.
  • the eyebrow replacement model is trained.
  • an embodiment of the present application provides an apparatus for processing an image.
  • the apparatus includes: an image acquiring unit configured to acquire an image to be processed; a position information acquiring unit configured to acquire an image to be processed; The position information of the position of the image area of the eyebrows in the image to be processed; the processing unit is configured to replace the eyebrows displayed in the image to be processed according to the position information to obtain a processed image to be processed.
  • the processing unit is further configured to: process the image area to obtain an image to be processed without displaying eyebrows; and process the image to be processed without displaying eyebrows according to the position information to obtain a new display
  • the to-be-processed image of the eyebrows and the to-be-processed image displaying the new eyebrows are determined as the processed to-be-processed image.
  • the processing unit is further configured to input a to-be-processed image and position information that does not display eyebrows into a pre-trained eyebrow replacement model to obtain a to-be-processed image that displays new eyebrows.
  • the processing unit is further configured to adjust the color or transparency of the pixel points in the image area to obtain an image to be processed without displaying eyebrows.
  • the image obtaining unit is further configured to: obtain a target image; adjust the size of the target image to a preset size, and determine the target image of the preset size as an image to be processed.
  • the eyebrow replacement model is obtained by training as follows: obtaining a target image set, wherein the target image in the target image set displays eyebrows; and for the target image in the target image set, obtaining the target image and displaying the eyebrows Position information of the position of the image region in the target image; and processing the target image to obtain a target image corresponding to the target image that does not show eyebrows; determine the initial eyebrow replacement model; use machine learning methods to convert the target
  • the position information corresponding to the target image in the image set and the target image without eyebrows are used as the input of the initial eyebrow replacement model, and this target image is used as the expected output of the initial eyebrow replacement model.
  • the eyebrow replacement model is trained.
  • an embodiment of the present application provides an electronic device.
  • the electronic device includes: one or more processors; a storage device configured to store one or more programs;
  • the processor executes such that one or more processors implement the method as described in any implementation of the first aspect.
  • an embodiment of the present application provides a computer-readable medium having stored thereon a computer program that, when executed by a processor, implements the method as described in any implementation manner of the first aspect.
  • the method and device for processing an image obtained in the embodiments of the present application obtain an image to be processed by acquiring the position information of the position of the image area of the image to be processed and the eyebrows in the image to be processed;
  • the eyebrows displayed in the image are replaced to obtain a processed image to be processed, thereby realizing the replacement of the eyebrows displayed in the image to be processed, so that new eyebrows are displayed in the image to be processed instead of the original eyebrows in the image to be processed.
  • FIG. 1 is an exemplary system architecture diagram to which an embodiment of the present application can be applied;
  • FIG. 1 is an exemplary system architecture diagram to which an embodiment of the present application can be applied;
  • FIG. 2 is a flowchart of an embodiment of a method for processing an image according to the present application
  • FIG. 3 is a flowchart of still another embodiment of a method for processing an image according to the present application.
  • FIG. 4 is a schematic diagram of an application scenario of a method for processing an image according to an embodiment of the present application
  • FIG. 5 is a schematic structural diagram of an embodiment of an apparatus for processing an image according to the present application.
  • FIG. 6 is a schematic structural diagram of a computer system suitable for implementing an electronic device according to an embodiment of the present application.
  • FIG. 1 illustrates an exemplary architecture 100 of an embodiment of a method for processing an image or an apparatus for processing an image to which the present application can be applied.
  • the system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105.
  • the network 104 is a medium for providing a communication link between the terminal devices 101, 102, 103 and the server 105.
  • the network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, and so on.
  • the terminal devices 101, 102, 103 interact with the server 105 through the network 104 to receive or send messages and the like.
  • Various client applications can be installed on the terminal devices 101, 102, and 103. For example, camera applications, image processing applications, and so on.
  • the terminal devices 101, 102, and 103 may be hardware or software.
  • the terminal devices 101, 102, and 103 can be various electronic devices that support image storage and image transmission, including but not limited to smartphones, tablets, e-book readers, laptop computers, and desktop computers. Wait.
  • the terminal devices 101, 102, and 103 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (such as multiple software or software modules used to provide distributed services), or it can be implemented as a single software or software module. It is not specifically limited here.
  • the server 105 may be a server that provides various services, for example, an image processing server that processes images to be processed sent by the terminal devices 101, 102, and 103. Further, the image processing server may return the processed image to be processed to the terminal devices 101, 102, and 103.
  • the above-mentioned to-be-processed images may also be directly stored locally on the server 105, and the server 105 may directly extract and process the locally-stored to-be-processed images.
  • the terminal devices 101, 102, 103 and the network may not exist. 104.
  • the method for processing an image provided by the embodiment of the present application is generally executed by the server 105, and accordingly, an apparatus for processing an image is generally disposed in the server 105.
  • the image processing applications can also be installed in the terminal devices 101, 102, 103, and the terminal devices 101, 102, 103 can also process images to be processed based on the image processing applications.
  • the method can also be executed by the terminal devices 101, 102, 103, and correspondingly, a device for processing an image can also be provided in the terminal devices 101, 102, 103.
  • the exemplary system architecture 100 may be absent from the server 105 and the network 104.
  • the server may be hardware or software.
  • the server can be implemented as a distributed server cluster consisting of multiple servers or as a single server.
  • the server can be implemented as multiple software or software modules (for example, multiple software or software modules used to provide distributed services), or it can be implemented as a single software or software module. It is not specifically limited here.
  • terminal devices, networks, and servers in FIG. 1 are merely exemplary. According to implementation needs, there can be any number of terminal devices, networks, and servers.
  • the method for processing an image includes the following steps:
  • Step 201 Obtain an image to be processed.
  • the execution subject of the method for processing an image may be wired or wirelessly connected from a local or other storage device (such as the terminal device 101 shown in FIG. 1). , 102, 103) Acquire the image to be processed.
  • the image to be processed may be an image with eyebrows displayed.
  • the target image may be acquired first, and then the size of the target image is adjusted to a preset size, and the target image of the preset size is determined as an image to be processed.
  • the target image may be any image.
  • the target image may be an image designated in advance by a technician, or may be an image currently acquired by the execution subject.
  • the preset size may be preset by a technician. Specifically, some image processing software can be used to adjust the size of the target image by enlarging or reducing the size of the target image, and can also be used to adjust the size of the target image by cropping.
  • Step 202 Obtain position information of a position of an image region of an image to be processed and an eyebrow on the image to be processed.
  • the position information may be used to indicate the position of the image area where the eyebrows are displayed relative to the image to be processed.
  • the location information can be expressed in various ways.
  • the position information may include coordinates of respective pixel points in an image area in which an eyebrow is displayed.
  • the location information may also include the coordinates of the pixels at the edges of the image area where the eyebrows are displayed, or may also be pixels that are filtered from the image area where the eyebrows are displayed according to a preset condition (for example, the surrounding area contains pixels that do not show eyebrows) coordinate of.
  • the position information may also include the coordinates of the geometric center of the image area where the eyebrows are displayed, the length of the longest line segment that passes through the geometric center in the image area that displays the eyebrows, the length of the shortest line segment that passes through the geometric center in the image area that displays the eyebrows .
  • the position information of the image area where the eyebrows are displayed in the image to be processed can be obtained in various ways. For example, you can use some existing image processing software to obtain location information, or you can first use various detection methods (such as using keypoint-based algorithms to locate the image area showing eyebrows, and use neural network based on semantic segmentation to locate and display Image area of eyebrows, etc.) First, the image area showing the eyebrows is detected. The detection result can be directly used as the position information, or the position information can be further extracted based on the detection result.
  • Step 203 According to the position information, the eyebrows displayed in the image to be processed are replaced to obtain a processed image to be processed.
  • a target eyebrow image may be obtained first, wherein the target eyebrow image may be preset, or may be an eyebrow image selected by a user from a preset eyebrow image collection, or may be based on location information.
  • the determined eyebrow image (for example, an eyebrow image that best fits the contour line of the image area of the eyebrows in the image to be processed).
  • the target eyebrow image can be overlaid on the image area where the eyebrows are displayed according to the position information. Then, based on the position information and the position of the target eyebrow image in the image to be processed, the region of the eyebrow image originally displayed in the image to be processed that cannot be covered by the target eyebrow image can be determined. Further, for the pixels in these eyebrow image areas that cannot be covered, the pixels in the target eyebrow image closest to the pixels can be used to replace the eyebrows originally displayed in the image to be processed.
  • the image area where the eyebrows of the image to be processed are displayed may be processed first to obtain an image to be processed without displaying eyebrows. Then, according to the position information, the to-be-processed image without displaying eyebrows is processed to obtain a to-be-processed image displaying new eyebrows, and the obtained to-be-processed image displaying new eyebrows is determined as a processed to-be-processed image.
  • the image to be processed may be processed in various ways to obtain an image to be processed without displaying eyebrows.
  • the color or transparency of each pixel in the image area where the eyebrows of the image to be processed are displayed can be adjusted to obtain the image to be processed without displaying eyebrows.
  • the color of each pixel point may be uniformly adjusted to white, or the color of each pixel point may be adjusted to the color of a pixel point in an image area that is closest to each pixel point and does not display eyebrows.
  • the transparency of each pixel can be set to be completely transparent, so as to obtain an image to be processed without displaying eyebrows.
  • the method provided by the foregoing embodiment of the present application implements the replacement of the eyebrows displayed in the image to be processed according to the position of the image area of the eyebrows of the image to be processed in the image to be processed, so that the new image is displayed in the image to be processed without Displaying the original eyebrows in the image to be processed again helps to improve the observability of the eyebrows displayed in the processed image.
  • a flowchart 300 of still another embodiment of a method for processing an image is shown.
  • the process 300 of the method for processing an image includes the following steps:
  • Step 301 Obtain a to-be-processed image.
  • Step 302 Obtain position information of a position of an image region of an image to be processed and an eyebrow on the image to be processed.
  • Step 303 Process the image area to obtain an image to be processed without displaying eyebrows.
  • Step 304 Input the to-be-processed image and position information without displaying eyebrows into a pre-trained eyebrow replacement model to obtain a to-be-processed image displaying new eyebrows.
  • the eyebrow replacement model may be used to process the image to be processed without displaying the eyebrows according to the position information, so that the image to be processed without displaying the eyebrows displays a new eyebrow.
  • the above eyebrow replacement model can be obtained by training in various ways.
  • the above eyebrow replacement model can be obtained by training in the following steps:
  • Step 1 Obtain a training sample set.
  • each training sample includes an image showing eyebrows.
  • the training sample set may be an image selected or generated by a technician according to actual application requirements.
  • the training sample set can be generated using some image processing software, or it can be downloaded from some third-party image libraries.
  • relevant personnel may select some images that the displayed eyebrows look better as the training sample set.
  • Step 2 Determine the initial eyebrow treatment model.
  • the initial eyebrow processing model may include an initial eyebrow erasing model and an initial eyebrow replacement model connected to the initial eyebrow erasing model.
  • the initial eyebrow erasure model can be used to erase the eyebrows displayed in the image to get an image that does not show eyebrows.
  • the initial eyebrow replacement model takes the output of the initial eyebrow erasure model as input.
  • a technician can build an initial eyebrow erasure model and an initial eyebrow replacement model according to the actual application requirements (such as which layers need to be included, the number of layers in each layer, the size of the convolution kernel, etc.).
  • Step 3 Train the initial eyebrow processing model. Specifically, the images in the training samples in the training sample set can be used as the input and expected output of the initial eyebrow processing model. Based on a preset loss function, the initial eyebrow processing model is trained to obtain the trained initial eyebrow processing model.
  • the value of the loss function can be used to indicate the degree of difference between the actual output of the initial eyebrow processing model and the image in the training sample. Then, based on the value of the loss function, the parameters of the initial eyebrow processing model can be adjusted using the back-propagation method, and the training can be terminated if the preset training end conditions are met. After the training is completed, the trained initial eyebrow replacement model included in the trained initial eyebrow processing model may be determined as the aforementioned eyebrow replacement model.
  • the preset training end condition may include, but is not limited to, at least one of the following: training time exceeds a preset duration, training times exceeds a preset number of times, a value of a loss function is less than a preset difference threshold, and the like.
  • the above eyebrow replacement model can also be obtained by training in the following steps:
  • Step 1 Obtain a target image collection.
  • the target images in the target image collection are displayed with eyebrows.
  • the target image may be an image selected or generated by a technician according to actual application requirements.
  • the target image can be generated by using some image processing software, or it can be downloaded from some third-party image libraries.
  • the relevant person may select the image that the displayed eyebrows look better as the target image.
  • Step 2 For the target image in the target image set, obtain position information of the position of the target image in the target image where the eyebrow image area is displayed. After that, the eyebrows displayed in the target image may be processed to obtain a corresponding target image that does not display eyebrows.
  • Step 3 Determine the initial eyebrow replacement model.
  • the initial eyebrow replacement model may be various types of untrained or untrained artificial neural networks, such as a deep learning model.
  • the initial eyebrow replacement model may also be a model obtained by combining a plurality of untrained or untrained artificial neural networks.
  • the initial eyebrow replacement model may be a model obtained by combining an untrained convolutional neural network, an untrained recurrent neural network, and an untrained fully connected layer.
  • some existing network models may be obtained first, and then a technician may adaptively adjust the network structure according to requirements to obtain an initial eyebrow replacement model.
  • Step 4 Using the method of machine learning, use the position information corresponding to the target image in the target image set and the target image without eyebrows as the input of the initial eyebrow replacement model, and use this target image as the expected output of the initial eyebrow replacement model to train Get the above eyebrow replacement model.
  • FIG. 4 is a schematic diagram of an application scenario of a method for processing an image according to this embodiment.
  • the execution subject may first obtain a face image 401. Then, based on the method of key point analysis, eyebrow position information 402 representing the position of the eyebrows displayed in the face image 401 is obtained. After that, the color of the pixels showing the eyebrows in the face image 401 can be adjusted to white to obtain a face image 403 without the eyebrows. After that, the face image 403 and the eyebrow position information 402 not showing the eyebrows may be input to the eyebrow replacement model 404 to obtain a face image 505 showing a new eyebrow.
  • the process 300 of the method for processing an image in this embodiment highlights the steps of processing an image to be processed without displaying eyebrows according to the position information. . Therefore, the solution described in this embodiment can use a pre-trained eyebrow replacement model to obtain a to-be-processed image that displays new eyebrows based on the image that does not display the eyebrows and the corresponding position information, and also helps to improve the displayed new eyebrows.
  • the diversity and flexibility makes the generation of new eyebrows no longer limited by the preset number and style of eyebrow images to be replaced.
  • this application provides an embodiment of an apparatus for processing an image.
  • the apparatus embodiment corresponds to the method embodiment shown in FIG. 2, and the apparatus is specific Can be applied to various electronic devices.
  • the apparatus 500 for processing an image includes an image acquisition unit 501, a position information acquisition unit 502, and a processing unit 503.
  • the image acquisition unit 501 is configured to acquire the image to be processed;
  • the position information acquisition unit 502 is configured to acquire the position information of the position of the image region of the eyebrows in the image to be processed, and
  • the processing unit 503 is configured to According to the position information, the eyebrows displayed in the image to be processed are replaced to obtain a processed image to be processed.
  • step 201, step 202, and step 203 are not repeated here.
  • the processing unit 503 is further configured to: process the image area to obtain an image to be processed without displaying eyebrows; and according to the position information, to process an image without displaying eyebrows Perform processing to obtain a to-be-processed image displaying new eyebrows, and determine a to-be-processed image displaying new eyebrows as a processed to-be-processed image.
  • the processing unit 503 is further configured to: input a to-be-processed image and position information without displaying eyebrows into a pre-trained eyebrow replacement model, and obtain a to-be-processed display of new eyebrows. image.
  • the processing unit 503 is further configured to: adjust the color or transparency of the pixels in the image area to obtain an image to be processed without displaying eyebrows.
  • the image acquisition unit 501 is further configured to: acquire a target image; adjust the size of the target image to a preset size, and determine the target image of the preset size as an image to be processed .
  • the eyebrow replacement model is obtained by training as follows: obtaining a target image set, wherein the target image in the target image set displays eyebrows; for the target image in the target image set, obtaining Position information of the target image showing the position of the eyebrow image region in the target image; and processing the target image to obtain a target image corresponding to the target image that does not display eyebrows; determining an initial eyebrow replacement model; using Machine learning method, using the position information corresponding to the target image in the target image set and the target image without eyebrows as the input of the initial eyebrow replacement model, using this target image as the expected output of the initial eyebrow replacement model, and training to obtain the eyebrow replacement model .
  • the device provided by the foregoing embodiment of the present application obtains an image to be processed through an image acquisition unit; the position information acquisition unit acquires position information of a position of an image region of an image to be processed and an eyebrow in the image to be processed; and the processing unit according to the position information ,
  • the eyebrows displayed in the image to be processed are replaced to obtain a processed image to be processed, thereby realizing the replacement of the eyebrows displayed in the image to be processed, so that new eyebrows are displayed in the image to be processed, and the original Some eyebrows.
  • FIG. 6 illustrates a schematic structural diagram of a computer system 600 suitable for implementing an electronic device according to an embodiment of the present application.
  • the electronic device shown in FIG. 6 is only an example, and should not impose any limitation on the functions and scope of use of the embodiments of the present application.
  • the computer system 600 includes a central processing unit (CPU) 601, which can be loaded into a random access memory (RAM) 603 according to a program stored in a read-only memory (ROM) 602 or from a storage portion 608. Instead, perform various appropriate actions and processes.
  • RAM random access memory
  • ROM read-only memory
  • various programs and data required for the operation of the system 600 are also stored.
  • the CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604.
  • An input / output (I / O) interface 605 is also connected to the bus 604.
  • the following components are connected to the I / O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), and the speaker; a storage portion 608 including a hard disk and the like; a communication section 609 including a network interface card such as a LAN card, a modem, and the like.
  • the communication section 609 performs communication processing via a network such as the Internet.
  • the driver 610 is also connected to the I / O interface 605 as necessary.
  • a removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
  • the process described above with reference to the flowchart may be implemented as a computer software program.
  • embodiments of the present disclosure include a computer program product including a computer program carried on a computer-readable medium, the computer program containing program code for performing a method shown in a flowchart.
  • the computer program may be downloaded and installed from a network through the communication portion 609, and / or installed from a removable medium 611.
  • CPU central processing unit
  • the computer-readable medium of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the foregoing.
  • the computer-readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programming read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in combination with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal that is included in baseband or propagated as part of a carrier wave, and which carries computer-readable program code. Such a propagated data signal may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable medium may send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
  • each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, which contains one or more functions to implement a specified logical function Executable instructions.
  • the functions noted in the blocks may also occur in a different order than those marked in the drawings. For example, two successively represented boxes may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts can be implemented by a dedicated hardware-based system that performs the specified function or operation Or, it can be implemented by a combination of dedicated hardware and computer instructions.
  • the units described in the embodiments of the present application may be implemented by software or hardware.
  • the described unit may also be provided in a processor, for example, it may be described as: a processor including an image acquisition unit, a position information acquisition unit, and a processing unit.
  • the names of these units do not constitute a limitation on the unit itself in some cases.
  • the image acquisition unit may also be described as a “unit that acquires an image to be processed”.
  • the present application also provides a computer-readable medium, which may be included in the electronic device described in the foregoing embodiments; or may exist alone without being assembled into the electronic device in.
  • the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device: obtains a to-be-processed image; obtains the to-be-processed image, and an image area showing an eyebrow is waiting The position information of the position in the processed image; according to the position information, the eyebrows displayed in the image to be processed are replaced to obtain a processed image to be processed.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Image Processing (AREA)

Abstract

本申请实施例公开了用于处理图像的方法和装置。该方法的一具体实施方式包括:获取待处理图像;获取待处理图像的、显示眉毛的图像区域在待处理图像中的位置的位置信息;根据位置信息,对待处理图像中显示的眉毛进行更换,得到处理后的待处理图像。该实施方式实现了对待处理图像中显示的眉毛的更换,使得待处理图像中显示新的眉毛,而不再显示待处理图像中原有的眉毛。

Description

用于处理图像的方法和装置
本专利申请要求于2018年9月20日提交的、申请号为201811102337.8、申请人为北京字节跳动网络技术有限公司、发明名称为“用于处理图像的方法和装置”的中国专利申请的优先权,该申请的全文以引用的方式并入本申请中。
技术领域
本申请实施例涉及计算机技术领域,具体涉及用于处理图像的方法和装置。
背景技术
关于眉毛的美化等特效处理,通常是先定位出图像中显示眉毛的图像区域,然后选取预设的眉毛图像覆盖于定位出的图像区域中。这种处理方式只能显示预设的眉毛图像,而且在预设的眉毛图像不能完全覆盖原本显示的眉毛时,仍会有部分原本显示的眉毛显示在处理后的图像中。
发明内容
本申请实施例提出了用于处理图像的方法和装置。
第一方面,本申请实施例提供了一种用于处理图像的方法,该方法包括:获取待处理图像;获取待处理图像的、显示眉毛的图像区域在待处理图像中的位置的位置信息;根据位置信息,对待处理图像中显示的眉毛进行更换,得到处理后的待处理图像。
在一些实施例中,根据位置信息,对待处理图像中显示的眉毛进行更换,得到处理后的待处理图像,包括:对图像区域进行处理,以得到不显示眉毛的待处理图像;根据位置信息,对不显示眉毛的待处理图像进行处理,以得到显示新的眉毛的待处理图像,以及将显示新 的眉毛的待处理图像确定为处理后的待处理图像。
在一些实施例中,根据位置信息,对不显示眉毛的待处理图像进行处理,以得到显示新的眉毛的待处理图像,包括:将不显示眉毛的待处理图像和位置信息输入至预先训练的眉毛更换模型,得到显示新的眉毛的待处理图像。
在一些实施例中,对图像区域进行处理,以得到不显示眉毛的待处理图像,包括:调整图像区域中的像素点的颜色或透明度,以得到不显示眉毛的待处理图像。
在一些实施例中,获取待处理图像,包括:获取目标图像;调整目标图像的尺寸为预设尺寸,以及将预设尺寸的目标图像确定为待处理图像。
在一些实施例中,眉毛更换模型通过如下步骤训练得到:获取目标图像集合,其中,目标图像集合中的目标图像显示有眉毛;针对目标图像集合中的目标图像,获取该目标图像的、显示眉毛的图像区域在该目标图像中的位置的位置信息;以及对该目标图像进行处理,以得到该目标图像对应的不显示眉毛的目标图像;确定初始眉毛更换模型;利用机器学习的方法,将目标图像集合中的目标图像对应的位置信息和不显示眉毛的目标图像作为初始眉毛更换模型的输入,将该目标图像作为初始眉毛更换模型的期望输出,训练得到眉毛更换模型。
第二方面,本申请实施例提供了一种用于处理图像的装置,该装置包括:图像获取单元,被配置成获取待处理图像;位置信息获取单元,被配置成获取待处理图像的、显示眉毛的图像区域在待处理图像中的位置的位置信息;处理单元,被配置成根据位置信息,对待处理图像中显示的眉毛进行更换,得到处理后的待处理图像。
在一些实施例中,上述处理单元进一步被配置成:对图像区域进行处理,以得到不显示眉毛的待处理图像;根据位置信息,对不显示眉毛的待处理图像进行处理,以得到显示新的眉毛的待处理图像,以及将显示新的眉毛的待处理图像确定为处理后的待处理图像。
在一些实施例中,上述处理单元进一步被配置成:将不显示眉毛的待处理图像和位置信息输入至预先训练的眉毛更换模型,得到显示 新的眉毛的待处理图像。
在一些实施例中,上述处理单元进一步被配置成:调整图像区域中的像素点的颜色或透明度,以得到不显示眉毛的待处理图像。
在一些实施例中,上述图像获取单元进一步被配置成:获取目标图像;调整目标图像的尺寸为预设尺寸,以及将预设尺寸的目标图像确定为待处理图像。
在一些实施例中,眉毛更换模型通过如下步骤训练得到:获取目标图像集合,其中,目标图像集合中的目标图像显示有眉毛;针对目标图像集合中的目标图像,获取该目标图像的、显示眉毛的图像区域在该目标图像中的位置的位置信息;以及对该目标图像进行处理,以得到该目标图像对应的不显示眉毛的目标图像;确定初始眉毛更换模型;利用机器学习的方法,将目标图像集合中的目标图像对应的位置信息和不显示眉毛的目标图像作为初始眉毛更换模型的输入,将该目标图像作为初始眉毛更换模型的期望输出,训练得到眉毛更换模型。
第三方面,本申请实施例提供了一种电子设备,该电子设备包括:一个或多个处理器;存储装置,用于存储一个或多个程序;当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现如第一方面中任一实现方式描述的方法。
第四方面,本申请实施例提供了一种计算机可读介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如第一方面中任一实现方式描述的方法。
本申请实施例提供的用于处理图像的方法和装置,通过获取待处理图像;获取待处理图像的、显示眉毛的图像区域在待处理图像中的位置的位置信息;根据位置信息,对待处理图像中显示的眉毛进行更换,得到处理后的待处理图像,从而实现了对待处理图像中显示的眉毛的更换,使得待处理图像中显示新的眉毛,而不再显示待处理图像中原有的眉毛。
附图说明
通过阅读参照以下附图所作的对非限制性实施例所作的详细描 述,本申请的其它特征、目的和优点将会变得更明显:
图1是本申请的一个实施例可以应用于其中的示例性系统架构图;
图2是根据本申请的用于处理图像的方法的一个实施例的流程图;
图3是根据本申请的用于处理图像的方法的又一个实施例的流程图;
图4是根据本申请实施例的用于处理图像的方法的一个应用场景的示意图;
图5是根据本申请的用于处理图像的装置的一个实施例的结构示意图;
图6是适于用来实现本申请实施例的电子设备的计算机系统的结构示意图。
具体实施方式
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。
图1示出了可以应用本申请的用于处理图像的方法或用于处理图像的装置的实施例的示例性架构100。
如图1所示,系统架构100可以包括终端设备101、102、103,网络104和服务器105。网络104用以在终端设备101、102、103和服务器105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。
终端设备101、102、103通过网络104与服务器105交互,以接收或发送消息等。终端设备101、102、103上可以安装有各种客户端 应用。例如摄像类应用、图像处理类应用等。
终端设备101、102、103可以是硬件,也可以是软件。当终端设备101、102、103为硬件时,可以是支持图像存储和图像传输的各种电子设备,包括但不限于智能手机、平板电脑、电子书阅读器、膝上型便携计算机和台式计算机等等。当终端设备101、102、103为软件时,可以安装在上述所列举的电子设备中。其可以实现成多个软件或软件模块(例如用来提供分布式服务的多个软件或软件模块),也可以实现成单个软件或软件模块。在此不做具体限定。
服务器105可以是提供各种服务的服务器,例如为终端设备101、102、103发送的待处理图像进行处理的图像处理服务器。进一步地,图像处理服务器还可以将处理后的待处理图像返回至终端设备101、102、103。
需要说明的是,上述待处理图像也可以直接存储在服务器105的本地,服务器105可以直接提取本地所存储的待处理图像并进行处理,此时,可以不存在终端设备101、102、103和网络104。
需要说明的是,本申请实施例所提供的用于处理图像的方法一般由服务器105执行,相应地,用于处理图像的装置一般设置于服务器105中。
还需要指出的是,终端设备101、102、103中也可以安装有图像处理类应用,终端设备101、102、103也可以基于图像处理类应用对待处理图像进行处理,此时,用于处理图像的方法也可以由终端设备101、102、103执行,相应地,用于处理图像的装置也可以设置于终端设备101、102、103中。此时,示例性系统架构100可以不存在服务器105和网络104。
需要说明的是,服务器可以是硬件,也可以是软件。当服务器为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当服务器为软件时,可以实现成多个软件或软件模块(例如用来提供分布式服务的多个软件或软件模块),也可以实现成单个软件或软件模块。在此不做具体限定。
应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意 性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。
继续参考图2,其示出了根据本申请的用于处理图像的方法的一个实施例的流程200。该用于处理图像的方法包括以下步骤:
步骤201,获取待处理图像。
在本实施例中,用于处理图像的方法的执行主体(如图1所示的服务器105)可以通过有线连接或无线连接的方式从本地或其他存储设备(如图1所示的终端设备101、102、103)获取待处理图像。其中,待处理图像可以是显示有眉毛的图像。
可选地,可以先获取目标图像,然后调整目标图像的尺寸为预设尺寸,以及将预设尺寸的目标图像确定为待处理图像。其中,目标图像可以是任意的图像。例如,目标图像可以是由技术人员预先所指定的图像,也可以是上述执行主体当前所获取到的图像等。
预设尺寸可以是由技术人员预先设置的。具体地,可以利用一些图像处理软件通过放大或缩小目图像的尺寸来实现对目标图像的尺寸的调整,也可以通过裁剪的方式来实现对目标图像的尺寸的调整。
步骤202,获取待处理图像的、显示眉毛的图像区域在待处理图像中的位置的位置信息。
在本实施例中,位置信息可以用来表示显示眉毛的图像区域相对于待处理图像的位置。根据实际的应用需求,位置信息可以有各种表示方式。
例如,位置信息可以包括显示眉毛的图像区域中的各个像素点的坐标。位置信息也可以包括显示眉毛的图像区域边缘的像素点的坐标,或者还可以是从显示眉毛的图像区域中,根据预设条件(例如,周围包含不显示眉毛的像素点)筛选出的像素点的坐标。位置信息还可以包括显示眉毛的图像区域的几何中心的坐标、显示眉毛的图像区域中过几何中心的最长的线段的长度、显示眉毛的图像区域中过几何中心的最短的线段的长度等等。
在本实施例中,可以通过各种方式获取显示眉毛的图像区域在待处理图像中的位置信息。例如,可以利用现有的一些图像处理软件来 获取位置信息,也可以先利用各种检测方法(如利用基于关键点的算法来定位显示眉毛的图像区域、利用基于语义分割的神经网络来定位显示眉毛的图像区域等)先检测出显示眉毛的图像区域。可以直接将检测结果作为位置信息,也可以在检测结果的基础上进一步提取位置信息。
步骤203,根据位置信息,对待处理图像中显示的眉毛进行更换,得到处理后的待处理图像。
在本实施例中,可以先获取目标眉毛图像,其中,目标眉毛图像可以是预先设置的,也可以是由用户从预设的眉毛图像集合中所选取的眉毛图像,还可以是根据位置信息所确定的眉毛图像(例如,与待处理图像的显示眉毛的图像区域的轮廓线最贴合的眉毛图像)。
之后,可以根据位置信息,将目标眉毛图像覆盖于显示眉毛的图像区域上。之后,可以根据位置信息和目标眉毛图像在待处理图像中的位置,确定目标眉毛图像无法覆盖的待处理图像中原本显示的眉毛图像区域。进一步地,对于这些无法覆盖的眉毛图像区域中的像素点,可以利用该像素点最接近的目标眉毛图像中的像素点进行替换,从而实现对待处理图像中原本显示的眉毛的更换。
可选地,还可以先对待处理图像的显示眉毛的图像区域进行处理,以得到不显示眉毛的待处理图像。然后根据位置信息,对不显示眉毛的待处理图像进行处理,以得到显示新的眉毛的待处理图像,并将所得到的显示新的眉毛的待处理图像确定为处理后的待处理图像。
其中,可以利用各种方式对待处理图像进行处理,以得到不显示眉毛的待处理图像。
可选地,可以调整待处理图像的显示眉毛的图像区域中的各个像素点的颜色或透明度来得到不显示眉毛的待处理图像。例如,可以将各个像素点的颜色统一调整为白色,也可以将各个像素点的颜色调整为距离各个像素点最近的且不显示眉毛的图像区域中的像素点的颜色。又例如,还可以将各个像素点的透明度都设置为完全透明,从而得到不显示眉毛的待处理图像。
本申请的上述实施例提供的方法根据待处理图像的显示眉毛的图 像区域在待处理图像中的位置来实现对待处理图像中显示的眉毛的更换,使得待处理图像中显示新的眉毛,而不再显示待处理图像中原有的眉毛,有助于提升处理后的待处理图像中显示的眉毛的可观性。
进一步参考图3,其示出了用于处理图像的方法的又一个实施例的流程300。该用于处理图像的方法的流程300,包括以下步骤:
步骤301,获取待处理图像。
步骤302,获取待处理图像的、显示眉毛的图像区域在待处理图像中的位置的位置信息。
步骤303,对图像区域进行处理,以得到不显示眉毛的待处理图像。
上述步骤301、302和303的具体的执行过程可参考图2对应实施例中的步骤201和202的相关说明,在此不再赘述。
步骤304,将不显示眉毛的待处理图像和位置信息输入至预先训练的眉毛更换模型,得到显示新的眉毛的待处理图像。
在本实施例中,眉毛更换模型可以用于根据位置信息对不显示眉毛的待处理图像进行处理,使得不显示眉毛的待处理图像显示新的眉毛。上述眉毛更换模型可以通过多种方式训练得到。
可选地,可以通过如下的步骤训练得到上述眉毛更换模型:
步骤一,获取训练样本集。其中,每个训练样本包括一个显示眉毛的图像。训练样本集可以是由技术人员根据实际的应用需求选取或生成的图像。例如,训练样本集可以是利用一些图像处理软件生成的,也可以是从一些第三方的图像库中下载的。实践中,应用需求若是想要对待处理图像中显示的眉毛进行美化,那么可以由相关人员选取一些认为显示的眉毛较好看的图像作为训练样本集。
步骤二,确定初始眉毛处理模型。其中,初始眉毛处理模型可以包括初始眉毛擦除模型和与初始眉毛擦除模型连接的初始眉毛更换模型。初始眉毛擦除模型可以用于对图像中显示的眉毛进行擦除,以得到不显示眉毛的图像。初始眉毛更换模型以初始眉毛擦除模型的输出作为输入。技术人员可以根据实际的应用需求(如需要包括哪些层、 每层的层数、卷积核的大小等)构建初始眉毛擦除模型和初始眉毛更换模型。
步骤三,训练初始眉毛处理模型。具体地,可以将训练样本集中的训练样本中的图像作为初始眉毛处理模型的输入和期望输出,基于预设的损失函数,对初始眉毛处理模型进行训练,得到训练完成的初始眉毛处理模型。
其中,损失函数的值可以用来表示初始眉毛处理模型的实际输出与训练样本中的图像之间的差异程度。然后,可以基于损失函数的值,采用反向传播的方法调整初始眉毛处理模型的参数,并在满足预设的训练结束条件的情况下,结束训练。训练完成后,可以将训练完成的初始眉毛处理模型包含的训练完成的初始眉毛更换模型确定为上述眉毛更换模型。
预设的训练结束条件可以包括但不限于以下至少一项:训练时间超过预设时长、训练次数超过预设次数、损失函数的值小于预设差异阈值等。
可选地,还可以通过如下的步骤训练得到上述眉毛更换模型:
步骤一,获取目标图像集合。其中,目标图像集合中的目标图像显示有眉毛。具体地,目标图像可以是由技术人员根据实际的应用需求选取或生成的图像。例如,目标图像可以是利用一些图像处理软件生成的,也可以是从一些第三方的图像库中下载的。实践中,应用需求若是想要对待处理图像中显示的眉毛进行美化,那么可以由相关人员选取认为显示的眉毛较好看的图像作为目标图像。
步骤二,针对目标图像集合中的目标图像,获取该目标图像的、显示眉毛的图像区域在该目标图像中的位置的位置信息。之后,可以对该目标图像中显示的眉毛进行处理,以得到对应的不显示眉毛的目标图像。
步骤三,确定初始眉毛更换模型。其中,初始眉毛更换模型可以是各种类型的未经训练的或未训练完成的人工神经网络,例如深度学习模型。初始眉毛更换模型也可以是对多种未经训练的或未训练完成的人工神经网络进行组合得到的模型。例如,初始眉毛更换模型可以 是对未经训练的卷积神经网络、未经训练的循环神经网络和未经训练的全连接层进行组合得到的模型。
可选地,可以先获取现有的一些网络模型(例如基于全卷积网络的语义分割网络U-net),之后技术人员可以根据需求对网络结构进行适应性的调整得到初始眉毛更换模型。
步骤四,利用机器学习的方法,将目标图像集合中的目标图像对应的位置信息和不显示眉毛的目标图像作为初始眉毛更换模型的输入,将该目标图像作为初始眉毛更换模型的期望输出,训练得到上述眉毛更换模型。
继续参见图4,图4是根据本实施例的用于处理图像的方法的应用场景的一个示意图。在图4的应用场景中,上述执行主体可以首先获取人脸图像401。然后基于关键点分析的方法获取表示人脸图像401中显示的眉毛的位置的眉毛位置信息402。之后,可以将人脸图像401中显示眉毛的像素点的颜色调整为白色,得到不显示眉毛的人脸图像403。之后,可以将不显示眉毛的人脸图像403和眉毛位置信息402输入至眉毛更换模型404,得到显示新的眉毛的人脸图像505。
从图3中可以看出,与图2对应的实施例相比,本实施例中的用于处理图像的方法的流程300突出了根据位置信息,对不显示眉毛的待处理图像进行处理的步骤。由此,本实施例描述的方案可以根据不显示眉毛的图像和对应的位置信息,利用预先训练的眉毛更换模型,得到显示新的眉毛的待处理图像,进一步也有助于提升显示的新的眉毛的多样性和灵活性,使得新的眉毛的生成不再受限于预先设置的待替换的眉毛图像的数量和样式。
进一步参考图5,作为对上述各图所示方法的实现,本申请提供了用于处理图像的装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。
如图5所示,本实施例提供的用于处理图像的装置500包括图像获取单元501、位置信息获取单元502和处理单元503。其中,图像获取单元501被配置成获取待处理图像;位置信息获取单元502被配置 成获取待处理图像的、显示眉毛的图像区域在待处理图像中的位置的位置信息;处理单元503被配置成根据位置信息,对待处理图像中显示的眉毛进行更换,得到处理后的待处理图像。
在本实施例中,用于处理图像的装置500中:图像获取单元501、位置信息获取单元502和处理单元503的具体处理及其所带来的技术效果可分别参考图2对应实施例中的步骤201、步骤202和步骤203的相关说明,在此不再赘述。
在本实施例的一些可选的实现方式中,上述处理单元503进一步被配置成:对图像区域进行处理,以得到不显示眉毛的待处理图像;根据位置信息,对不显示眉毛的待处理图像进行处理,以得到显示新的眉毛的待处理图像,以及将显示新的眉毛的待处理图像确定为处理后的待处理图像。
在本实施例的一些可选的实现方式中,上述处理单元503进一步被配置成:将不显示眉毛的待处理图像和位置信息输入至预先训练的眉毛更换模型,得到显示新的眉毛的待处理图像。
在本实施例的一些可选的实现方式中,上述处理单元503进一步被配置成:调整图像区域中的像素点的颜色或透明度,以得到不显示眉毛的待处理图像。
在本实施例的一些可选的实现方式中,上述图像获取单元501进一步被配置成:获取目标图像;调整目标图像的尺寸为预设尺寸,以及将预设尺寸的目标图像确定为待处理图像。
在本实施例的一些可选的实现方式中,眉毛更换模型通过如下步骤训练得到:获取目标图像集合,其中,目标图像集合中的目标图像显示有眉毛;针对目标图像集合中的目标图像,获取该目标图像的、显示眉毛的图像区域在该目标图像中的位置的位置信息;以及对该目标图像进行处理,以得到该目标图像对应的不显示眉毛的目标图像;确定初始眉毛更换模型;利用机器学习的方法,将目标图像集合中的目标图像对应的位置信息和不显示眉毛的目标图像作为初始眉毛更换模型的输入,将该目标图像作为初始眉毛更换模型的期望输出,训练得到眉毛更换模型。
本申请的上述实施例提供的装置,通过图像获取单元获取待处理图像;位置信息获取单元获取待处理图像的、显示眉毛的图像区域在待处理图像中的位置的位置信息;处理单元根据位置信息,对待处理图像中显示的眉毛进行更换,得到处理后的待处理图像,从而实现了对待处理图像中显示的眉毛的更换,使得待处理图像中显示新的眉毛,而不再显示待处理图像中原有的眉毛。
下面参考图6,其示出了适于用来实现本申请实施例的电子设备的计算机系统600的结构示意图。图6示出的电子设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。
如图6所示,计算机系统600包括中央处理单元(CPU)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储部分608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有系统600操作所需的各种程序和数据。CPU 601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。
以下部件连接至I/O接口605:包括键盘、鼠标等的输入部分606;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分607;包括硬盘等的存储部分608;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分609。通信部分609经由诸如因特网的网络执行通信处理。驱动器610也根据需要连接至I/O接口605。可拆卸介质611,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器610上,以便于从其上读出的计算机程序根据需要被安装入存储部分608。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分609从网络上被下载和安装,和/或从可拆卸介质611被安装。在该计算机程序被中央处理单元(CPU)601 执行时,执行本申请的方法中限定的上述功能。
需要说明的是,本申请的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本申请中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本申请中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。
附图中的流程图和框图,图示了按照本申请各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现, 或者可以用专用硬件与计算机指令的组合来实现。
描述于本申请实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器,包括图像获取单元、位置信息获取单元和处理单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,图像获取单元还可以被描述为“获取待处理图像的单元”。
作为另一方面,本申请还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取待处理图像;获取待处理图像的、显示眉毛的图像区域在待处理图像中的位置的位置信息;根据位置信息,对待处理图像中显示的眉毛进行更换,得到处理后的待处理图像。
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。

Claims (14)

  1. 一种用于处理图像的方法,包括:
    获取待处理图像;
    获取所述待处理图像的、显示眉毛的图像区域在所述待处理图像中的位置的位置信息;
    根据所述位置信息,对所述待处理图像中显示的眉毛进行更换,得到处理后的待处理图像。
  2. 根据权利要求1所述的方法,其中,所述根据所述位置信息,对所述待处理图像中显示的眉毛进行更换,得到处理后的待处理图像,包括:
    对所述图像区域进行处理,以得到不显示眉毛的待处理图像;
    根据所述位置信息,对所述不显示眉毛的待处理图像进行处理,以得到显示新的眉毛的待处理图像,以及将所述显示新的眉毛的待处理图像确定为所述处理后的待处理图像。
  3. 根据权利要求2所述的方法,其中,所述根据所述位置信息,对所述不显示眉毛的待处理图像进行处理,以得到显示新的眉毛的待处理图像,包括:
    将所述不显示眉毛的待处理图像和所述位置信息输入至预先训练的眉毛更换模型,得到显示新的眉毛的待处理图像。
  4. 根据权利要求2所述的方法,其中,所述对所述图像区域进行处理,以得到不显示眉毛的待处理图像,包括:
    调整所述图像区域中的像素点的颜色或透明度,以得到不显示眉毛的待处理图像。
  5. 根据权利要求1所述的方法,其中,所述获取待处理图像,包括:
    获取目标图像;
    调整所述目标图像的尺寸为预设尺寸,以及将预设尺寸的目标图像确定为所述待处理图像。
  6. 根据权利要求3所述的方法,其中,所述眉毛更换模型通过如下步骤训练得到:
    获取目标图像集合,其中,所述目标图像集合中的目标图像显示有眉毛;
    针对所述目标图像集合中的目标图像,获取该目标图像的、显示眉毛的图像区域在该目标图像中的位置的位置信息;以及对该目标图像进行处理,以得到该目标图像对应的不显示眉毛的目标图像;
    确定初始眉毛更换模型;
    利用机器学习的方法,将所述目标图像集合中的目标图像对应的位置信息和不显示眉毛的目标图像作为初始眉毛更换模型的输入,将该目标图像作为初始眉毛更换模型的期望输出,训练得到所述眉毛更换模型。
  7. 一种用于处理图像的装置,包括:
    图像获取单元,被配置成获取待处理图像;
    位置信息获取单元,被配置成获取所述待处理图像的、显示眉毛的图像区域在所述待处理图像中的位置的位置信息;
    处理单元,被配置成根据所述位置信息,对所述待处理图像中显示的眉毛进行更换,得到处理后的待处理图像。
  8. 根据权利要求7所述的装置,其中,所述处理单元进一步被配置成:
    对所述图像区域进行处理,以得到不显示眉毛的待处理图像;
    根据所述位置信息,对所述不显示眉毛的待处理图像进行处理,以得到显示新的眉毛的待处理图像,以及将所述显示新的眉毛的待处理图像确定为所述处理后的待处理图像。
  9. 根据权利要求8所述的装置,其中,所述处理单元进一步被配置成:
    将所述不显示眉毛的待处理图像和所述位置信息输入至预先训练的眉毛更换模型,得到显示新的眉毛的待处理图像。
  10. 根据权利要求8所述的装置,其中,所述处理单元进一步被配置成:
    调整所述图像区域中的像素点的颜色或透明度,以得到不显示眉毛的待处理图像。
  11. 根据权利要求7所述的装置,其中,所述图像获取单元进一步被配置成:
    获取目标图像;
    调整所述目标图像的尺寸为预设尺寸,以及将预设尺寸的目标图像确定为所述待处理图像。
  12. 根据权利要求9所述的装置,其中,所述眉毛更换模型通过如下步骤训练得到:
    获取目标图像集合,其中,所述目标图像集合中的目标图像显示有眉毛;
    针对所述目标图像集合中的目标图像,获取该目标图像的、显示眉毛的图像区域在该目标图像中的位置的位置信息;以及对该目标图像进行处理,以得到该目标图像对应的不显示眉毛的目标图像;
    确定初始眉毛更换模型;
    利用机器学习的方法,将所述目标图像集合中的目标图像对应的位置信息和不显示眉毛的目标图像作为初始眉毛更换模型的输入,将该目标图像作为初始眉毛更换模型的期望输出,训练得到所述眉毛更换模型。
  13. 一种电子设备,包括:
    一个或多个处理器;
    存储装置,其上存储有一个或多个程序;
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-6中任一所述的方法。
  14. 一种计算机可读介质,其上存储有计算机程序,其中,该程序被处理器执行时实现如权利要求1-6中任一所述的方法。
PCT/CN2018/115970 2018-09-20 2018-11-16 用于处理图像的方法和装置 WO2020056901A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811102337.8A CN109255814A (zh) 2018-09-20 2018-09-20 用于处理图像的方法和装置
CN201811102337.8 2018-09-20

Publications (1)

Publication Number Publication Date
WO2020056901A1 true WO2020056901A1 (zh) 2020-03-26

Family

ID=65048382

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/115970 WO2020056901A1 (zh) 2018-09-20 2018-11-16 用于处理图像的方法和装置

Country Status (2)

Country Link
CN (1) CN109255814A (zh)
WO (1) WO2020056901A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113256660A (zh) * 2021-06-04 2021-08-13 北京有竹居网络技术有限公司 图片处理方法、装置和电子设备
CN113590250A (zh) * 2021-07-29 2021-11-02 网易(杭州)网络有限公司 图像处理方法、装置、设备及存储介质
CN113642612A (zh) * 2021-07-19 2021-11-12 北京百度网讯科技有限公司 样本图像生成方法、装置、电子设备及存储介质
CN114565512A (zh) * 2022-03-03 2022-05-31 广州虎牙科技有限公司 眉形变形方法、装置、电子设备及可读存储介质

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112307245B (zh) * 2020-03-02 2024-03-26 北京字节跳动网络技术有限公司 用于处理图像的方法和装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107025629A (zh) * 2017-04-27 2017-08-08 维沃移动通信有限公司 一种图像处理方法及移动终端
CN107464253A (zh) * 2017-07-10 2017-12-12 北京小米移动软件有限公司 眉毛定位方法及装置
CN107895358A (zh) * 2017-12-25 2018-04-10 科大讯飞股份有限公司 人脸图像的增强方法及系统
CN107945188A (zh) * 2017-11-20 2018-04-20 北京奇虎科技有限公司 基于场景分割的人物装扮方法及装置、计算设备
CN108062742A (zh) * 2017-12-31 2018-05-22 广州二元科技有限公司 一种利用数字图像处理和变形的眉毛更换方法
CN108537725A (zh) * 2018-04-10 2018-09-14 光锐恒宇(北京)科技有限公司 一种视频处理方法和装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8538089B2 (en) * 2011-12-28 2013-09-17 Arcsoft (Hangzhou) Multimedia Technology Co., Ltd. Method of performing eyebrow shaping on an image and related computing device
CN104657974A (zh) * 2013-11-25 2015-05-27 腾讯科技(上海)有限公司 一种图像处理方法及装置
CN108022207A (zh) * 2017-11-30 2018-05-11 广东欧珀移动通信有限公司 图像处理方法、装置、存储介质和电子设备
CN108491780B (zh) * 2018-03-16 2021-05-04 Oppo广东移动通信有限公司 图像美化处理方法、装置、存储介质及终端设备

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107025629A (zh) * 2017-04-27 2017-08-08 维沃移动通信有限公司 一种图像处理方法及移动终端
CN107464253A (zh) * 2017-07-10 2017-12-12 北京小米移动软件有限公司 眉毛定位方法及装置
CN107945188A (zh) * 2017-11-20 2018-04-20 北京奇虎科技有限公司 基于场景分割的人物装扮方法及装置、计算设备
CN107895358A (zh) * 2017-12-25 2018-04-10 科大讯飞股份有限公司 人脸图像的增强方法及系统
CN108062742A (zh) * 2017-12-31 2018-05-22 广州二元科技有限公司 一种利用数字图像处理和变形的眉毛更换方法
CN108537725A (zh) * 2018-04-10 2018-09-14 光锐恒宇(北京)科技有限公司 一种视频处理方法和装置

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113256660A (zh) * 2021-06-04 2021-08-13 北京有竹居网络技术有限公司 图片处理方法、装置和电子设备
CN113642612A (zh) * 2021-07-19 2021-11-12 北京百度网讯科技有限公司 样本图像生成方法、装置、电子设备及存储介质
CN113590250A (zh) * 2021-07-29 2021-11-02 网易(杭州)网络有限公司 图像处理方法、装置、设备及存储介质
CN113590250B (zh) * 2021-07-29 2024-02-27 网易(杭州)网络有限公司 图像处理方法、装置、设备及存储介质
CN114565512A (zh) * 2022-03-03 2022-05-31 广州虎牙科技有限公司 眉形变形方法、装置、电子设备及可读存储介质

Also Published As

Publication number Publication date
CN109255814A (zh) 2019-01-22

Similar Documents

Publication Publication Date Title
WO2020056901A1 (zh) 用于处理图像的方法和装置
WO2020199931A1 (zh) 人脸关键点检测方法及装置、存储介质和电子设备
WO2020006961A1 (zh) 用于提取图像的方法和装置
CN110458918B (zh) 用于输出信息的方法和装置
WO2020155907A1 (zh) 用于生成漫画风格转换模型的方法和装置
CN107622240B (zh) 人脸检测方法和装置
WO2020056902A1 (zh) 用于处理嘴部图像的方法和装置
WO2019242222A1 (zh) 用于生成信息的方法和装置
CN108197618B (zh) 用于生成人脸检测模型的方法和装置
WO2020024484A1 (zh) 用于输出数据的方法和装置
WO2020062493A1 (zh) 图像处理方法和装置
WO2020029466A1 (zh) 图像处理方法和装置
US11042259B2 (en) Visual hierarchy design governed user interface modification via augmented reality
US20220277481A1 (en) Panoramic video processing method and apparatus, and storage medium
WO2022012179A1 (zh) 生成特征提取网络的方法、装置、设备和计算机可读介质
US20130070983A1 (en) Methods, apparatuses, and computer program products for controlling luminance of non-tissue objects within an image
WO2019080702A1 (zh) 图像处理方法和装置
WO2020062494A1 (zh) 图像处理方法和装置
CN111311480B (zh) 图像融合方法和装置
CN110298850B (zh) 眼底图像的分割方法和装置
WO2021093689A1 (zh) 面部图像变形方法、装置、电子设备和计算机可读介质
WO2020034981A1 (zh) 编码信息的生成方法和识别方法
CN112529913A (zh) 图像分割模型训练方法、图像处理方法及装置
CN108597034B (zh) 用于生成信息的方法和装置
AU2017206290B2 (en) Correspondence labels for improved patch match

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: 18934203

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 08.07.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18934203

Country of ref document: EP

Kind code of ref document: A1