WO2024037556A1 - Image processing method and apparatus, and device and storage medium - Google Patents

Image processing method and apparatus, and device and storage medium Download PDF

Info

Publication number
WO2024037556A1
WO2024037556A1 PCT/CN2023/113234 CN2023113234W WO2024037556A1 WO 2024037556 A1 WO2024037556 A1 WO 2024037556A1 CN 2023113234 W CN2023113234 W CN 2023113234W WO 2024037556 A1 WO2024037556 A1 WO 2024037556A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
target object
dividing line
pixel value
pixel
Prior art date
Application number
PCT/CN2023/113234
Other languages
French (fr)
Chinese (zh)
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 WO2024037556A1 publication Critical patent/WO2024037556A1/en

Links

Classifications

    • G06T3/04
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • 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/161Detection; Localisation; Normalisation
    • 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

  • the embodiments of the present disclosure relate to the field of image processing technology, such as an image processing method, device, equipment and storage medium.
  • Image processing applications have developed rapidly, entering users' lives and gradually enriching their spare time. Users can record their lives through videos, photos, etc., and process images through the special effects technology provided on the image processing APP, so that the images can be expressed in richer forms, such as beautification, stylization, expression editing, etc.
  • Embodiments of the present disclosure provide an image processing method, device, equipment and storage medium, which can generate images with mirror effects, enrich the display content of the image, and improve the interest of the image.
  • an embodiment of the present disclosure provides an image processing method, including:
  • Identify the target object in the original image to obtain the target object image and the dividing line of the target object; wherein the target object image is divided into a first side image and a second side image by the dividing line;
  • the second side image is mirrored based on the dividing line to obtain a first side mirror image; wherein the first side mirror image and the second side image are mirror images of each other.
  • embodiments of the present disclosure also provide an image processing device, including:
  • the target object recognition module is configured to identify the target object in the original image and obtain the target object image and the dividing line of the target object; wherein the target object image is divided into a first side image and a third side image by the dividing line. Bilateral image;
  • a pixel value replacement module configured to replace the pixel value of the first side image with a set pixel value
  • the mirror processing module is configured to perform mirror processing on the second side image based on the dividing line to obtain a first side mirror image; wherein the first side mirror image and the second side image are mirror images of each other.
  • embodiments of the present disclosure also provide an electronic device, where the electronic device includes:
  • processors one or more processors
  • a storage device for storing one or more programs
  • the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the image processing method as described in the embodiment of the present disclosure.
  • embodiments of the present disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the image processing method as described in the embodiments of the present disclosure.
  • Figure 1 is a schematic flowchart of an image processing method provided by an embodiment of the present disclosure
  • Figure 2 is a schematic diagram of determining a dividing line of a target object provided by an embodiment of the present disclosure
  • Figure 3a is a schematic diagram of a mirror target object provided by an embodiment of the present disclosure.
  • Figure 3b is a schematic diagram of another mirror target object provided by an embodiment of the present disclosure.
  • Figure 4 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure.
  • FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • the term “include” and its variations are open-ended, ie, “including but not limited to.”
  • the term “based on” means “based at least in part on.”
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one additional embodiment”; the term “some embodiments” “Examples” means “at least some examples”. Relevant definitions of other terms will be given in the description below.
  • a prompt message is sent to the user to clearly remind the user that the operation requested will require the acquisition and use of the user's personal information. Therefore, users can autonomously choose whether to provide personal information to software or hardware such as electronic devices, applications, servers or storage media that perform the operations of the technical solution of the present disclosure based on the prompt information.
  • the method of sending prompt information to the user may be, for example, a pop-up window, and the prompt information may be presented in the form of text in the pop-up window.
  • the pop-up window can also contain a selection control for the user to choose "agree” or "disagree” to provide personal information to the electronic device.
  • the data involved in this technical solution shall comply with the requirements of corresponding laws, regulations and related regulations.
  • Figure 1 is a schematic flowchart of an image processing method provided by an embodiment of the present disclosure.
  • the embodiment of the present disclosure is suitable for mirroring a target object in an image.
  • the method can be executed by an image processing device, and the device can It is implemented in the form of software and/or hardware, and optionally, it is implemented through electronic equipment.
  • the electronic equipment can be a mobile terminal, a personal computer (Personal Computer, PC) or a server, etc.
  • the method includes:
  • the target object image is divided by a dividing line, and the image on either side of the dividing line is regarded as the first side image, and the image on the other side of the dividing line is regarded as the second side image.
  • the target object can be any object such as human figures, animals, buildings, etc.
  • the target object image can be understood as an image in which the target object is extracted from the original image.
  • the dividing line of the target object can be the central axis of the target object, which is used as the symmetry line for subsequent mirroring processing.
  • the target object in the original image is identified and the target object image is obtained by: identifying the target object in the original image to obtain a mask image of the target object; and combining the mask image of the target object with The original images are fused to obtain the target object image.
  • the pixel value of each pixel in the mask image of the target object represents the confidence that the pixel belongs to the target object. It can be any value between 0 and 1, with 1 being white and 0 being black. It can be stored in the set color channel in the mask image of the target object, for example: it can be the red channel (R), green channel (G) or blue channel (B).
  • R red channel
  • G green channel
  • B blue channel
  • the method of fusing the mask image of the target object and the original image may be: multiplying the pixel value of the mask image of the target object by the color value (RGBA four-channel value) of the original image to obtain the target object image.
  • the target object image is obtained based on the mask image of the target object, which can improve the accuracy of extracting the target object from the original image.
  • the method of identifying the target object in the original image and obtaining the dividing line of the target object can be: determining two set key points of the target object in the original image; connecting the two set key points Determine the dividing line for the target object.
  • the key points can be two points located on the central axis of the target object.
  • the method of determining the two set key points of the target object in the original image may be: input the original image into the central axis determination module and output the coordinate information of the two set key points.
  • the method of determining the two key points of the target object in the original image may be: determining the key point between the eyebrows on the face of the portrait in the original image. and the chin key point; the way to determine the connection line between the two set key points as the dividing line of the target object can be: determine the connection line between the eyebrow key point and the chin key point as the dividing line of the portrait.
  • 68 facial key points are detected on the face of the portrait, and the eyebrow center is extracted from the 68 facial key points.
  • the dividing line of the portrait is determined through the key points of the eyebrows and the chin key point, which can improve the accuracy of determining the dividing line of the portrait.
  • the method of identifying the target object in the original image and obtaining the dividing line of the target object may be: determining the detection frame of the target object in the original image; determining the dividing line of the target object according to the central axis of the detection frame.
  • the method of determining the detection frame of the target object in the original image may be: input the original image into the target detection model and output the detection frame of the target object.
  • the way to determine the central axis of the detection frame as the dividing line of the target object can be: obtain the horizontal central axis or vertical central axis of the detection frame, then obtain the posture information of the target object in the original image, and then obtain the posture information of the target object based on the posture information of the target object.
  • FIG. 2 is a schematic diagram of determining the dividing line of the target object in this embodiment.
  • the dividing line of the target object is determined according to the vertical central axis of the detection frame.
  • the dividing line of the target object is determined based on the central axis of the detection frame, which can improve the efficiency of determining the dividing line.
  • the first side image can be an image on either side of the dividing line.
  • the first side image can be the image on the right side or the left side of the dividing line;
  • the dividing line is a horizontal dividing line, the first side image can be the image on the upper side of the dividing line Or the image below.
  • the set pixel value can be a pixel value set arbitrarily by the user or a pixel value selected from the background area of the original image.
  • the process of replacing the pixel values of the first side image with the set pixel values may be: first extracting the pixels belonging to the first side image in the target object image, and then converting the pixels belonging to the first side image into The pixel value is replaced with the set pixel value.
  • the method of replacing the pixel value of the first side image with the set pixel value can be: traverse the pixel points of the target object image, enter the coordinate information of each traversed pixel point into the expression of the dividing line, and obtain The result value of the traversed coordinate information of each pixel point; if the result value of the traversed coordinate information of each pixel point is greater than the set value, the pixel of each traversed pixel point will be The value is replaced with the set pixel value.
  • the expression of the dividing line can be understood as the functional expression of the dividing line.
  • the setting value can be 0.
  • the expression of inputting the coordinate information of the traversed pixel point into the dividing line can be understood as the functional expression of substituting the coordinate information of the traversed pixel point into the dividing line. If the result value is greater than 0, the traversed pixel point belongs to the first Side image, if the result value is equal to 0, the pixel is located on the dividing line, if the result value is less than 0, the pixel belongs to the second side image.
  • the method of replacing the pixel value of the first side image with the set pixel value can be: traverse the pixel points of the target object image, enter the coordinate information of each traversed pixel point into the expression of the dividing line, and obtain Result value; if the result value of the traversed coordinate information of each pixel is less than the set value, then the pixel value of each traversed pixel is replaced with the set pixel value.
  • the expression of the dividing line can be understood as the functional expression of the dividing line.
  • the setting value can be 0.
  • the expression of inputting the coordinate information of the traversed pixel point into the dividing line can be understood as the functional expression of substituting the coordinate information of the traversed pixel point into the dividing line. If the result value is less than 0, the traversed pixel point belongs to the first For the side image, if the result value is equal to 0, the pixel is located on the dividing line. If the result value is greater than 0, the pixel belongs to the second side image.
  • the coordinate information of the traversed pixel is input into the expression of the dividing line to obtain the result value to determine whether the pixel belongs to the first side image, which can improve the accuracy of replacing the pixel value.
  • the method of replacing the pixel value of the first side image with the set pixel value may be: selecting a pixel value from the background area of the original image as the set pixel value; replacing the pixel value of the first side image with the set pixel value. To set the pixel value.
  • replacing the pixel values of the first side image with pixel values selected from the background area of the original image can make the subsequently generated first side mirror image and the background area smoothly transition and improve the display effect of the mirror target object. .
  • the following step is also included: blurring the first side image after replacing the pixel values.
  • the blur processing method can be Gaussian blur.
  • the method of blurring the first side image after replacing the pixel values may be: performing multiple Gaussian blur on the first side image after replacing the pixel values to obtain a blurred first side image.
  • the first side image after replacing the pixel values is blurred, so that the first side image can be hidden and the first side image can be prevented from affecting the second side image. Display effect of mirrored image on one side.
  • the first side mirror image and the second side image are mirror images of each other, that is, the second side image and the first side mirror image are symmetrical with respect to the dividing line.
  • the method of mirroring the second side image based on the dividing line may be: determining the pixel points of each pixel in the second side image that are symmetrical with respect to the dividing line, and then converting the pixels of the second side image to The pixel value is used as the pixel value of the pixel point that is symmetrical with the pixel point of the second side image, and the first side image is rendered based on the determined pixel value to obtain the first side mirror image.
  • the second side image is mirrored based on the dividing line.
  • the method of obtaining the first side mirror image may be: for the pixel points of the second side image, determine the pixel points of the second side image that are symmetrical with respect to the dividing line. pixels of the first side image; determine the pixel values of the pixels of the second side image as target pixel values of the pixels of the first side image; render the first side image based on the target pixel value to obtain the first side mirror image.
  • the method of determining the pixel points of the first side image in which the pixel points of the second side image are symmetrical with respect to the dividing line may be: obtaining the coordinate information of the pixel points of the second side image and the functional expression of the dividing line, and determining the first side image based on the symmetry principle.
  • Figures 3a-3b are schematic diagrams of the mirror target object generated in this embodiment. As shown in Figures 3a-3b, the target object is a portrait, and the right side of the portrait is the generated first side mirror image. The portrait The left side of is the portrait of the original image.
  • mirror processing is performed on the second side image based on the dividing line, which can improve the accuracy of obtaining the mirror image.
  • the method before mirroring the second side image based on the dividing line, the method further includes the following steps: obtaining the screen ratio; transforming the dividing line based on the screen ratio; and mirroring the second side image based on the dividing line. , including: mirroring the second side image based on the transformed dividing line.
  • the screen ratio can be understood as the ratio between the height and width of the current terminal device screen.
  • the screen ratio can be: 16:9 or 4:3, etc.
  • the method of transforming the dividing line based on the screen ratio may be: transforming the slope of the dividing line based on the screen ratio. Assuming that the slope of the dividing line is k and the screen ratio is 16:9, the transformed slope is k*16/9.
  • the method of transforming the dividing line based on the screen ratio can also be: transforming the coordinates of two points on the dividing line based on the screen ratio, and generating a new dividing line based on the two points after the transformed coordinates.
  • transforming the dividing line based on the screen ratio can prevent the mirror target object from being stretched when displayed on the current screen.
  • the technical solution of the embodiment of the present disclosure is to identify the target object in the original image and obtain the target object image and the dividing line of the target object; wherein, the target object image is divided into a first side image and a second side image by the dividing line; The pixel value of the first side image is replaced with the set pixel value; the second side image is mirrored based on the dividing line to obtain the first side mirror image; wherein the first side mirror image and the second side image are mirror images of each other.
  • the image processing method provided by the embodiment of the present disclosure mirrors the target object on one side of the dividing line based on the dividing line of the target object to obtain a mirror image of the target object, which can generate an image with mirroring special effects and enrich the display content of the image. .
  • Figure 4 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure.
  • the device includes: a target object recognition module 410, configured to identify target objects in the original image, and obtain the target object.
  • the pixel value replacement module 420 is configured to replace the first side image The pixel value of is replaced with the set pixel value;
  • the mirror processing module 430 is configured to perform mirror processing on the second side image based on the dividing line to obtain a first side mirror image; wherein the first side mirror image and The second side images are mirror images of each other.
  • the target object identification module 410 is configured to identify the target object in the original image and obtain the target object image in the following manner: identify the target object in the original image and obtain a mask image of the target object; The mask image of the target object is fused with the original image to obtain the target object image.
  • the target object recognition module 410 is configured to identify the target object in the original image and obtain the dividing line of the target object in the following manner: determine two set key points of the target object in the original image; combine the two Set the connecting line of key points as the dividing line of the target object.
  • the target object identification module 410 is configured to determine two set key points of the target object in the original image in the following manner: determine The key point between the eyebrows and the key point on the chin in the portrait face; the target object recognition module 410 is configured to determine the connection line between the two set key points as the dividing line of the target object in the following way: the key point between the eyebrows and the key point on the chin The connecting line is determined as the dividing line of the portrait.
  • the target object identification module 410 is configured to identify the target object in the original image and obtain the dividing line of the target object in the following manner: determine the detection frame of the target object in the original image; determine the target according to the central axis of the detection frame. The dividing line of the object.
  • the pixel value replacement module 420 is configured to: traverse the pixel points of the target object image, input the coordinate information of each traversed pixel point into the expression of the dividing line, and obtain each of the traversed pixel points. The result value of the coordinate information of the pixel point; if the result value of the coordinate information of each pixel point traversed is greater than the set value, then the pixel value of each pixel point traversed is replaced with the set pixel value; or , if the result value of the traversed coordinate information of each pixel point is less than the set value, then the pixel value of each traversed pixel point is replaced with the set pixel value.
  • the pixel value replacement module 420 is configured to: select a pixel value from the background area of the original image as the set pixel value; and replace the pixel value of the first side image with the set pixel value.
  • the device further includes: a blur processing module configured to: blur the first side image after replacing the pixel values.
  • a blur processing module configured to: blur the first side image after replacing the pixel values.
  • the mirror processing module 430 is configured to: for the pixel points of the second side image, determine the pixel points of the first side image in which the pixel points of the second side image are symmetrical with respect to the dividing line; The pixel value of the point is determined as the target pixel value of the pixel point of the first side image; the first side image is rendered based on the target pixel value to obtain the first side mirror image.
  • the device also includes: a transformation module, configured to: obtain the screen ratio; transform the dividing line based on the screen ratio; optionally, the mirror processing module 430 is configured to: based on the transformed dividing line, the second The side image is mirrored.
  • a transformation module configured to: obtain the screen ratio; transform the dividing line based on the screen ratio
  • the mirror processing module 430 is configured to: based on the transformed dividing line, the second The side image is mirrored.
  • the image processing device provided by the embodiments of the present disclosure can execute the image processing method provided by any embodiment of the present disclosure, and has functional modules and effects corresponding to the execution method.
  • the multiple units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned divisions, as long as they can achieve the corresponding functions; in addition, the names of the multiple functional units are only for the convenience of distinguishing each other. , are not used to limit the protection scope of the embodiments of the present disclosure.
  • FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • Terminal devices in embodiments of the present disclosure may include, but are not limited to, mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (Personal Digital Assistant, PDA), tablet computers (Portable Android Device, PAD), portable multimedia players Mobile terminals such as (Portable Media Player, PMP), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital television (television, TV), desktop computers, etc.
  • PDA Personal Digital Assistant
  • PMP Portable Multimedia Player
  • vehicle-mounted terminals such as vehicle-mounted navigation terminals
  • fixed terminals such as digital television (television, TV), desktop computers, etc.
  • the electronic device shown in FIG. 5 is only an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
  • the electronic device 500 may include a processing device (such as a central processing unit, a graphics processor, etc.) 501 , which may process data according to a program stored in a read-only memory (Read-Only Memory, ROM) 502 or from a storage device. 508 loads the program in the random access memory (Random Access Memory, RAM) 503 to perform various appropriate actions and processes. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored.
  • Processing device 501, ROM 502 and RAM 503 are connected to each other via bus 504.
  • An input/output (I/O) interface 505 is also connected to bus 504.
  • input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a Liquid Crystal Display (LCD) , an output device 507 such as a speaker, a vibrator, etc.; a storage device 508 including a magnetic tape, a hard disk, etc.; and a communication device 509.
  • Communication device 509 may allow electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data.
  • FIG. 5 illustrates electronic device 500 with various means, it should be understood that implementation or availability of all illustrated means is not required. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product including a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart.
  • the computer program may be downloaded and installed from the network via communication device 509, or from storage device 508, or from ROM 502.
  • the processing device 501 When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
  • Embodiments of the present disclosure provide a computer storage medium on which a computer program is stored.
  • the program is executed by a processor, the image processing method provided by the above embodiments is implemented.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium may be, for example, but is not limited to, an electrical, 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 having one or more wires, portable computer disks, hard drives, RAM, ROM, Erasable Programmable Read-Only Memory Memory, EPROM) or flash memory, optical fiber, portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which It contains computer-readable program code. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, radio frequency (Radio Frequency, RF), etc., or any suitable combination of the above.
  • the client and server can communicate using any currently known or future developed network protocol, such as HyperText Transfer Protocol (HTTP), and can communicate with digital data in any form or medium.
  • HTTP HyperText Transfer Protocol
  • Communications e.g., communications network
  • Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any current network for knowledge or future research and development.
  • LANs local area networks
  • WANs wide area networks
  • the Internet e.g., the Internet
  • end-to-end networks e.g., ad hoc end-to-end networks
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; it may also exist independently without being assembled into the electronic device.
  • the computer-readable medium carries one or more programs.
  • the electronic device identifies the target object in the original image and obtains the target object image and the target.
  • the dividing line of the object wherein the target object image is divided by the dividing line, and the image on any side of the dividing line is used as the first side image, and the image on the other side of the dividing line is used as the second side image.
  • side image replace the pixel value of the first side image with a set pixel value; perform mirror processing on the second side image based on the dividing line to obtain a first side mirror image; wherein, the first side The mirror image and the second side image are mirror images of each other.
  • Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages—such as "C" or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer may be connected to the user computer through any kind of network, including a LAN or WAN, or may be connected to an external computer (eg, through the Internet using an Internet service provider).
  • each box in the flowchart or block diagram may represent a module, segment, or portion of code that Or a portion of the code contains one or more executable instructions for implementing specified logical functions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown one after another may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved.
  • each block of the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration can be implemented by special purpose hardware-based systems that perform the specified functions or operations. , or can be implemented using a combination of specialized hardware and computer instructions.
  • the units/modules described in the embodiments of the present disclosure may be implemented in software or hardware.
  • the name of the unit/module does not constitute a limitation on the unit itself under certain circumstances.
  • the target object recognition module can also be described as "identifying the target object in the original image, obtaining the target object image and the target Module of the object's dividing line".
  • exemplary types of hardware logic components include: field programmable gate array (Field Programmable Gate Array, FPGA), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), application specific standard product (Application Specific Standard Parts (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), etc.
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with an instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, RAM, ROM, EPROM or flash memory, optical fiber, portable CD-ROM, optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • an image processing method including: identifying a target object in an original image, and obtaining an image of the target object and a dividing line of the target object; wherein, the target object The image is divided by the dividing line, and the image on either side of the dividing line is taken as the first side image, and the image on the other side of the dividing line is taken as the second side image; The pixel value is replaced with the set pixel value; the second side image is mirrored based on the dividing line to obtain a first side mirror image; wherein the first side mirror image and the second side image are mutually exclusive Mirror.
  • identifying the target object in the original image and obtaining the target object image includes: identifying the target object in the original image and obtaining a mask image of the target object; The mask image is fused with the original image to obtain the target object image.
  • identifying the target object in the original image and obtaining the dividing line of the target object includes: determining two set key points of the target object in the original image; The line connecting the points is determined as the dividing line of the target object.
  • determining two set key points of the target object in the original image includes: determining the key point between the eyebrows and the chin key point on the face of the portrait in the original image; Determining the connection line between the two set key points as the dividing line of the target object includes: determining the connection line between the eyebrow key point and the chin key point as the dividing line of the portrait.
  • identifying the target object in the original image and obtaining the dividing line of the target object includes: determining the detection frame of the target object in the original image; determining the target object according to the central axis of the detection frame dividing line.
  • replacing the pixel value of the first side image with the set pixel value includes: traversing the pixel points of the target object image, and inputting the coordinate information of the traversed pixel point into the expression of the dividing line. , obtain the result value; if the result value is greater than the set value, replace the pixel value of the traversed pixel with the set pixel value; or, if the result value is less than the set value, replace the traversed pixel The pixel value of the point is replaced with the set pixel value.
  • replacing the pixel value of the first side image with a set pixel value includes: selecting a pixel value from the background area of the original image as the set pixel value; replacing the first side image with a set pixel value.
  • the pixel value is replaced with the set pixel value.
  • the method further includes: blurring the first side image after replacing the pixel values.
  • performing mirror processing on the second side image based on the dividing line to obtain the first side mirror image includes: for the pixel points of the second side image, determining the symmetry of the pixel points of the second side image. pixel points of the first side image; determining the pixel value of the pixel point of the second side image as the target pixel value of the pixel point of the first side image; rendering the first side image based on the target pixel value , obtain the first side mirror image.
  • the method before mirroring the second side image based on the dividing line, the method further includes: obtaining a screen ratio; transforming the dividing line based on the screen ratio; Mirroring the second side image includes mirroring the second side image based on the transformed dividing line.

Abstract

Disclosed in the embodiments of the present disclosure are an image processing method and apparatus, and a device and a storage medium. The method comprises: identifying a target object in an original image to obtain an image of the target object and a segmentation line of the target object, wherein the image of the target object is divided by the segmentation line, an image of any side of the segmentation line serves as a first side image, and the other side image of the segmentation line serves as a second side image; replacing a pixel value of the first side image with a set pixel value; and performing mirror image processing on the second side image on the basis of the segmentation line to obtain a first side mirror image, wherein the first side mirror image and the second side image are mirror images.

Description

图像处理方法、装置、设备及存储介质Image processing methods, devices, equipment and storage media
本申请要求在2022年08月17日提交中国专利局、申请号为202210988925.6的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application with application number 202210988925.6, which was submitted to the China Patent Office on August 17, 2022. The entire content of this application is incorporated into this application by reference.
技术领域Technical field
本公开实施例涉及图像处理技术领域,例如涉及一种图像处理方法、装置、设备及存储介质。The embodiments of the present disclosure relate to the field of image processing technology, such as an image processing method, device, equipment and storage medium.
背景技术Background technique
图像处理应用程序(Application,APP)迅速发展,走进了用户的生活,逐渐丰富了用户的业余生活。用户可以采用视频、照片等方式记录生活,并可以通过图像处理APP上提供的特效技术对图像进行加工,使得图像以更丰富的形式进行表达,比如美颜、风格化、表情编辑等。Image processing applications (Applications, APPs) have developed rapidly, entering users' lives and gradually enriching their spare time. Users can record their lives through videos, photos, etc., and process images through the special effects technology provided on the image processing APP, so that the images can be expressed in richer forms, such as beautification, stylization, expression editing, etc.
发明内容Contents of the invention
本公开实施例提供一种图像处理方法、装置、设备及存储介质,可以生成具有镜像特效的图像,可以丰富图像的显示内容,提高图像的趣味性。Embodiments of the present disclosure provide an image processing method, device, equipment and storage medium, which can generate images with mirror effects, enrich the display content of the image, and improve the interest of the image.
第一方面,本公开实施例提供了一种图像处理方法,包括:In a first aspect, an embodiment of the present disclosure provides an image processing method, including:
对原始图像中的目标对象进行识别,获得目标对象图像及所述目标对象的分割线;其中,所述目标对象图像被所述分割线分割为第一侧图像和第二侧图像;Identify the target object in the original image to obtain the target object image and the dividing line of the target object; wherein the target object image is divided into a first side image and a second side image by the dividing line;
将所述第一侧图像的像素值替换为设定像素值;Replace the pixel value of the first side image with the set pixel value;
基于所述分割线对所述第二侧图像进行镜像处理,获得第一侧镜像图像;其中,所述第一侧镜像图像与所述第二侧图像互为镜像。The second side image is mirrored based on the dividing line to obtain a first side mirror image; wherein the first side mirror image and the second side image are mirror images of each other.
第二方面,本公开实施例还提供了一种图像处理装置,包括:In a second aspect, embodiments of the present disclosure also provide an image processing device, including:
目标对象识别模块,设置为对原始图像中的目标对象进行识别,获得目标对象图像及所述目标对象的分割线;其中,所述目标对象图像被所述分割线分割为第一侧图像和第二侧图像;The target object recognition module is configured to identify the target object in the original image and obtain the target object image and the dividing line of the target object; wherein the target object image is divided into a first side image and a third side image by the dividing line. Bilateral image;
像素值替换模块,设置为将所述第一侧图像的像素值替换为设定像素值; A pixel value replacement module configured to replace the pixel value of the first side image with a set pixel value;
镜像处理模块,设置为基于所述分割线对所述第二侧图像进行镜像处理,获得第一侧镜像图像;其中,所述第一侧镜像图像与所述第二侧图像互为镜像。The mirror processing module is configured to perform mirror processing on the second side image based on the dividing line to obtain a first side mirror image; wherein the first side mirror image and the second side image are mirror images of each other.
第三方面,本公开实施例还提供了一种电子设备,所述电子设备包括:In a third aspect, embodiments of the present disclosure also provide an electronic device, where the electronic device includes:
一个或多个处理器;one or more processors;
存储装置,用于存储一个或多个程序,a storage device for storing one or more programs,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如本公开实施例所述的图像处理方法。When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the image processing method as described in the embodiment of the present disclosure.
第四方面,本公开实施例还提供了一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如本公开实施例所述的图像处理方法。In a fourth aspect, embodiments of the present disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the image processing method as described in the embodiments of the present disclosure.
附图说明Description of drawings
贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It is to be understood that the drawings are schematic and that elements and elements are not necessarily drawn to scale.
图1是本公开实施例所提供的一种图像处理方法的流程示意图;Figure 1 is a schematic flowchart of an image processing method provided by an embodiment of the present disclosure;
图2是本公开实施例所提供的一种确定目标对象的分割线的示意图;Figure 2 is a schematic diagram of determining a dividing line of a target object provided by an embodiment of the present disclosure;
图3a是本公开实施例所提供的一种镜像目标对象的示意图;Figure 3a is a schematic diagram of a mirror target object provided by an embodiment of the present disclosure;
图3b是本公开实施例所提供的另一种镜像目标对象的示意图;Figure 3b is a schematic diagram of another mirror target object provided by an embodiment of the present disclosure;
图4是本公开实施例所提供的一种图像处理装置的结构示意图;Figure 4 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure;
图5是本公开实施例所提供的一种电子设备的结构示意图。FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
下面将参照附图描述本公开的实施例。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described below with reference to the accompanying drawings. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of the present disclosure.
应当理解,本公开的方法实施方式中记载的多个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。It should be understood that multiple steps described in the method implementations of the present disclosure may be executed in different orders and/or in parallel. Furthermore, method embodiments may include additional steps and/or omit performance of illustrated steps. The scope of the present disclosure is not limited in this regard.
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实 施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。As used herein, the term "include" and its variations are open-ended, ie, "including but not limited to." The term "based on" means "based at least in part on." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" "Examples" means "at least some examples". Relevant definitions of other terms will be given in the description below.
本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。Concepts such as "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units. relation.
本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。The modifications of "one" and "plurality" mentioned in this disclosure are illustrative and not restrictive. Those skilled in the art will understand that unless the context clearly indicates otherwise, it should be understood as "one or more" .
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are for illustrative purposes only and are not used to limit the scope of these messages or information.
在使用本公开的多个实施例公开的技术方案之前,均应当依据相关法律法规通过恰当的方式对本公开所涉及个人信息的类型、使用范围、使用场景等告知用户并获得用户的授权。Before using the technical solutions disclosed in the multiple embodiments of this disclosure, users should be informed of the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and their authorization should be obtained.
例如,在响应于接收到用户的主动请求时,向用户发送提示信息,以明确地提示用户,其请求执行的操作将需要获取和使用到用户的个人信息。从而,使得用户可以根据提示信息来自主地选择是否向执行本公开技术方案的操作的电子设备、应用程序、服务器或存储介质等软件或硬件提供个人信息。For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested will require the acquisition and use of the user's personal information. Therefore, users can autonomously choose whether to provide personal information to software or hardware such as electronic devices, applications, servers or storage media that perform the operations of the technical solution of the present disclosure based on the prompt information.
作为一种可选的但非限定性的实现方式,响应于接收到用户的主动请求,向用户发送提示信息的方式例如可以是弹窗的方式,弹窗中可以以文字的方式呈现提示信息。此外,弹窗中还可以承载供用户选择“同意”或者“不同意”向电子设备提供个人信息的选择控件。As an optional but non-limiting implementation method, in response to receiving the user's active request, the method of sending prompt information to the user may be, for example, a pop-up window, and the prompt information may be presented in the form of text in the pop-up window. In addition, the pop-up window can also contain a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
上述通知和获取用户授权过程仅是示意性的,不对本公开的实现方式构成限定,其它满足相关法律法规的方式也可应用于本公开的实现方式中。The above notification and user authorization processes are only illustrative and do not limit the implementation of this disclosure. Other methods that satisfy relevant laws and regulations can also be applied to the implementation of this disclosure.
本技术方案所涉及的数据(包括但不限于数据本身、数据的获取或使用)应当遵循相应法律法规及相关规定的要求。The data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of corresponding laws, regulations and related regulations.
图1为本公开实施例所提供的一种图像处理方法的流程示意图,本公开实施例适用于对图像中的目标对象进行镜像处理的情形,该方法可以由图像处理装置来执行,该装置可以通过软件和/或硬件的形式实现,可选的,通过电子设备来实现,该电子设备可以是移动终端、个人计算机(Personal Computer,PC)或服务器等。Figure 1 is a schematic flowchart of an image processing method provided by an embodiment of the present disclosure. The embodiment of the present disclosure is suitable for mirroring a target object in an image. The method can be executed by an image processing device, and the device can It is implemented in the form of software and/or hardware, and optionally, it is implemented through electronic equipment. The electronic equipment can be a mobile terminal, a personal computer (Personal Computer, PC) or a server, etc.
如图1所示,所述方法包括:As shown in Figure 1, the method includes:
S110,对原始图像中的目标对象进行识别,获得目标对象图像及目标对象的分割线。 S110, identify the target object in the original image, and obtain the target object image and the dividing line of the target object.
目标对象图像被分割线所分割,且将分割线的任意一侧的图像作为第一侧图像,分割线的另一侧图像作为第二侧图像。目标对象可以是人像、动物、建筑物等任意的物体。目标对象图像可以理解为从原始图像中将目标对象扣取处理的图像。目标对象的分割线可以是目标对象的中轴线,用作后续镜像处理的对称线。The target object image is divided by a dividing line, and the image on either side of the dividing line is regarded as the first side image, and the image on the other side of the dividing line is regarded as the second side image. The target object can be any object such as human figures, animals, buildings, etc. The target object image can be understood as an image in which the target object is extracted from the original image. The dividing line of the target object can be the central axis of the target object, which is used as the symmetry line for subsequent mirroring processing.
本实施例中,对原始图像中的目标对象进行识别,获得目标对象图像的方式可以是:对原始图像中的目标对象进行识别,获得目标对象的掩膜图;将目标对象的掩膜图和原始图像进行融合,获得目标对象图像。In this embodiment, the target object in the original image is identified and the target object image is obtained by: identifying the target object in the original image to obtain a mask image of the target object; and combining the mask image of the target object with The original images are fused to obtain the target object image.
目标对象的掩膜(mask)图中每个像素点的像素值表征该像素点属于目标对象的置信度,可以是0-1之间的任意值,1为白色,0为黑色。可以存储在目标对象的掩膜图中的设定颜色通道中,如:可以是红色通道(R)、绿色通道(G)或者蓝色通道(B)。对原始图像中的目标对象进行识别,获得目标对象的掩膜图的方式可以是:将原始图像输入目标对象识别模型中,以对原始图像中的每个像素点是否属于目标对象进行识别,获得每个像素点属于目标对象的置信度,从而获得目标对象的掩膜图。将目标对象的掩膜图和原始图像进行融合的方式可以是:将目标对象的掩膜图的像素值与原始图像的颜色值(RGBA四通道值)进行相乘,获得目标对象图像。本实施例中,基于目标对象的掩膜图获取目标对象图像,可以提高从原始图像提取目标对象的精度。The pixel value of each pixel in the mask image of the target object represents the confidence that the pixel belongs to the target object. It can be any value between 0 and 1, with 1 being white and 0 being black. It can be stored in the set color channel in the mask image of the target object, for example: it can be the red channel (R), green channel (G) or blue channel (B). To identify the target object in the original image and obtain the mask map of the target object, you can input the original image into the target object recognition model to identify whether each pixel in the original image belongs to the target object, and obtain The confidence that each pixel belongs to the target object, thereby obtaining the mask image of the target object. The method of fusing the mask image of the target object and the original image may be: multiplying the pixel value of the mask image of the target object by the color value (RGBA four-channel value) of the original image to obtain the target object image. In this embodiment, the target object image is obtained based on the mask image of the target object, which can improve the accuracy of extracting the target object from the original image.
可选的,对原始图像中的目标对象进行识别,获得目标对象的分割线的方式可以是:确定原始图像中的目标对象的两个设定关键点;将两个设定关键点的连线确定为目标对象的分割线。Optionally, the method of identifying the target object in the original image and obtaining the dividing line of the target object can be: determining two set key points of the target object in the original image; connecting the two set key points Determine the dividing line for the target object.
设定关键点可以是位于目标对象的中轴线上的两个点。确定原始图像中的目标对象的两个设定关键点的方式可以是:将原始图像输入中轴线确定模块,输出两个设定关键点的坐标信息。将两个设定关键点的连线确定为目标对象的分割线的方式可以是:基于两个设定关键点的坐标信息确定分割线的表达式。示例性的,假设两个设定关键点中一个设定关键点的坐标信息为(x1,y1),另一个设定关键点的坐标信息为(x2,y2),则分割线的表达式可以为:(x-x1)/(x2-x1)=(y-y1)/(y2-y1)。本实施例中,基于两个设定关键点确定分割线,可以减少计算量,提高计算效率。The key points can be two points located on the central axis of the target object. The method of determining the two set key points of the target object in the original image may be: input the original image into the central axis determination module and output the coordinate information of the two set key points. The method of determining the connection line between the two set key points as the dividing line of the target object may be: determining the expression of the dividing line based on the coordinate information of the two set key points. For example, assuming that the coordinate information of one of the two set key points is (x1, y1), and the coordinate information of the other set key point is (x2, y2), then the expression of the dividing line can be It is: (x-x1)/(x2-x1)=(y-y1)/(y2-y1). In this embodiment, the dividing line is determined based on two set key points, which can reduce the amount of calculation and improve calculation efficiency.
可选的,若目标对象为人像,人像包括面部和/或人体,则确定原始图像中的目标对象的两个设定关键点的方式可以是:确定原始图像中人像的面部中的眉心关键点和下巴关键点;将两个设定关键点的连线确定为目标对象的分割线的方式可以是:将眉心关键点和下巴关键点的连线确定为人像的分割线。Optionally, if the target object is a portrait, and the portrait includes a face and/or a human body, the method of determining the two key points of the target object in the original image may be: determining the key point between the eyebrows on the face of the portrait in the original image. and the chin key point; the way to determine the connection line between the two set key points as the dividing line of the target object can be: determine the connection line between the eyebrow key point and the chin key point as the dividing line of the portrait.
首先对人像的面部进行68面部关键点检测,从68面部关键点提取出眉心 关键点(第49号关键点)和下巴关键点(第16号关键点),最后眉心关键点和下巴关键点的连线确定为人像的分割线。本实施例中,通过眉心关键点和下巴关键点确定人像的分割线,可以提高确定人像分割线的准确性。First, 68 facial key points are detected on the face of the portrait, and the eyebrow center is extracted from the 68 facial key points. The key point (No. 49 key point) and the chin key point (No. 16 key point), and finally the line connecting the eyebrow key point and the chin key point is determined as the dividing line of the portrait. In this embodiment, the dividing line of the portrait is determined through the key points of the eyebrows and the chin key point, which can improve the accuracy of determining the dividing line of the portrait.
可选的,对原始图像中的目标对象进行识别,获得目标对象的分割线的方式可以是:确定原始图像中目标对象的检测框;根据检测框的中轴线确定目标对象的分割线。Optionally, the method of identifying the target object in the original image and obtaining the dividing line of the target object may be: determining the detection frame of the target object in the original image; determining the dividing line of the target object according to the central axis of the detection frame.
确定原始图像中目标对象的检测框的方式可以是:将原始图像输入目标检测模型,输出目标对象的检测框。将检测框的中轴线确定为目标对象的分割线的方式可以是:获取检测框的水平中轴线或者竖直中轴线,然后获取目标对象在原始图像中的姿态信息,再根据目标对象的姿态信息对水平中轴线或者竖直中轴线进行旋转,将旋转后的水平中轴线或者竖直中轴线确定为目标对象的分割线。The method of determining the detection frame of the target object in the original image may be: input the original image into the target detection model and output the detection frame of the target object. The way to determine the central axis of the detection frame as the dividing line of the target object can be: obtain the horizontal central axis or vertical central axis of the detection frame, then obtain the posture information of the target object in the original image, and then obtain the posture information of the target object based on the posture information of the target object. Rotate the horizontal central axis or vertical central axis, and determine the rotated horizontal central axis or vertical central axis as the dividing line of the target object.
示例性的,图2是本实施例中的确定目标对象的分割线的示意图。如图2所示,根据检测框的竖直中轴线确定目标对象的分割线。本实施例中,根据检测框的中轴线确定目标对象的分割线,可以提高确定分割线的效率。For example, FIG. 2 is a schematic diagram of determining the dividing line of the target object in this embodiment. As shown in Figure 2, the dividing line of the target object is determined according to the vertical central axis of the detection frame. In this embodiment, the dividing line of the target object is determined based on the central axis of the detection frame, which can improve the efficiency of determining the dividing line.
S120,将第一侧图像的像素值替换为设定像素值。S120: Replace the pixel value of the first side image with the set pixel value.
第一侧图像可以是分割线的任意一侧的图像。例如:假设分割线为竖直分割线,则第一侧图像可以是分割线的右侧图像或者左侧图像;假设分割线为水平分割线,则第一侧图像可以是分割线的上侧图像或者下侧图像。设定像素值可以是用户任意设置的像素值或者是从原始图像的背景区域中选择的像素值。The first side image can be an image on either side of the dividing line. For example: assuming the dividing line is a vertical dividing line, the first side image can be the image on the right side or the left side of the dividing line; assuming the dividing line is a horizontal dividing line, the first side image can be the image on the upper side of the dividing line Or the image below. The set pixel value can be a pixel value set arbitrarily by the user or a pixel value selected from the background area of the original image.
本实施例中,将第一侧图像的像素值替换为设定像素值的过程可以是:首先提取出目标对象图像中属于第一侧图像的像素点,然后将属于第一侧图像的像素点的像素值替换为设定像素值。In this embodiment, the process of replacing the pixel values of the first side image with the set pixel values may be: first extracting the pixels belonging to the first side image in the target object image, and then converting the pixels belonging to the first side image into The pixel value is replaced with the set pixel value.
可选的,将第一侧图像的像素值替换为设定像素值的方式可以是:遍历目标对象图像的像素点,将遍历到的每个像素点的坐标信息输入分割线的表达式,获得遍历到的所述每个像素点的坐标信息的结果值;若遍历到的所述每个像素点的坐标信息的结果值大于设定值,则将遍历到的所述每个像素点的像素值替换为设定像素值。Optionally, the method of replacing the pixel value of the first side image with the set pixel value can be: traverse the pixel points of the target object image, enter the coordinate information of each traversed pixel point into the expression of the dividing line, and obtain The result value of the traversed coordinate information of each pixel point; if the result value of the traversed coordinate information of each pixel point is greater than the set value, the pixel of each traversed pixel point will be The value is replaced with the set pixel value.
分割线的表达式可以理解为分割线的函数表达式,该函数表达式为二元一次方程,可以表示为f(x,y)=a*x+b*y+c,其中,a、b和c为常量。设定值可以是0。将遍历到的像素点的坐标信息输入分割线的表达式可以理解为将遍历到的像素点的坐标信息代入分割线的函数表达式,若结果值大于0,则遍历到的像素点属于第一侧图像,若结果值等于0,则像素点位于分割线上,若结果值小于 0,则像素点属于第二侧图像。示例性的,假设遍历到的像素点的坐标信息为(x0,y0),则结果值为f(x0,y0)=a*x0+b*y0+c,若f(x0,y0)>0,则遍历到的像素点属于第一侧图像,将遍历到的像素点的像素值替换为设定像素值。The expression of the dividing line can be understood as the functional expression of the dividing line. The functional expression is a linear equation of two variables, which can be expressed as f(x, y)=a*x+b*y+c, where a, b and c are constants. The setting value can be 0. The expression of inputting the coordinate information of the traversed pixel point into the dividing line can be understood as the functional expression of substituting the coordinate information of the traversed pixel point into the dividing line. If the result value is greater than 0, the traversed pixel point belongs to the first Side image, if the result value is equal to 0, the pixel is located on the dividing line, if the result value is less than 0, the pixel belongs to the second side image. For example, assuming that the coordinate information of the traversed pixel is (x0, y0), the result value is f(x0, y0)=a*x0+b*y0+c, if f(x0, y0)>0 , then the traversed pixel belongs to the first side image, and the pixel value of the traversed pixel is replaced with the set pixel value.
可选的,将第一侧图像的像素值替换为设定像素值的方式可以是:遍历目标对象图像的像素点,将遍历到的每个像素点的坐标信息输入分割线的表达式,获得结果值;若遍历到的所述每个像素点的坐标信息的结果值小于设定值,则将遍历到的所述每个像素点的像素值替换为设定像素值。Optionally, the method of replacing the pixel value of the first side image with the set pixel value can be: traverse the pixel points of the target object image, enter the coordinate information of each traversed pixel point into the expression of the dividing line, and obtain Result value; if the result value of the traversed coordinate information of each pixel is less than the set value, then the pixel value of each traversed pixel is replaced with the set pixel value.
分割线的表达式可以理解为分割线的函数表达式,该函数表达式为二元一次方程,可以表示为f(x,y)=a*x+b*y+c,其中,a、b和c为常量。设定值可以是0。将遍历到的像素点的坐标信息输入分割线的表达式可以理解为将遍历到的像素点的坐标信息代入分割线的函数表达式,若结果值小于0,则遍历到的像素点属于第一侧图像,若结果值等于0,则像素点位于分割线上,若结果值大于0,则像素点属于第二侧图像。示例性的,假设遍历到的像素点的坐标信息为(x0,y0),则结果值为f(x0,y0)=a*x0+b*y0+c,若f(x0,y0)<0,则遍历到的像素点属于第一侧图像,将遍历到的像素点的像素值替换为设定像素值。本实施例中,将遍历到的像素点的坐标信息输入分割线的表达式获得的结果值来确定像素点是否属于第一侧图像,可以提高替换像素值的准确性。The expression of the dividing line can be understood as the functional expression of the dividing line. The functional expression is a linear equation of two variables, which can be expressed as f(x, y)=a*x+b*y+c, where a, b and c are constants. The setting value can be 0. The expression of inputting the coordinate information of the traversed pixel point into the dividing line can be understood as the functional expression of substituting the coordinate information of the traversed pixel point into the dividing line. If the result value is less than 0, the traversed pixel point belongs to the first For the side image, if the result value is equal to 0, the pixel is located on the dividing line. If the result value is greater than 0, the pixel belongs to the second side image. For example, assuming that the coordinate information of the traversed pixel is (x0, y0), the result value is f(x0, y0)=a*x0+b*y0+c, if f(x0, y0)<0 , then the traversed pixel belongs to the first side image, and the pixel value of the traversed pixel is replaced with the set pixel value. In this embodiment, the coordinate information of the traversed pixel is input into the expression of the dividing line to obtain the result value to determine whether the pixel belongs to the first side image, which can improve the accuracy of replacing the pixel value.
可选的,将第一侧图像的像素值替换为设定像素值的方式可以是:从原始图像的背景区域中选择一像素值,作为设定像素值;将第一侧图像的像素值替换为设定像素值。Optionally, the method of replacing the pixel value of the first side image with the set pixel value may be: selecting a pixel value from the background area of the original image as the set pixel value; replacing the pixel value of the first side image with the set pixel value. To set the pixel value.
从原始图像的背景区域中选择一像素值,作为设定像素值的方式可以是:从背景区域任意选择一像素点,将该像素点的像素值作为设定像素值;或者,将背景区域中像素点的像素值求取平均值,将该平均像素值作为设定像素值;或者,从位于目标对象边缘且处于背景区域的像素点中选择一像素点,将该像素点的像素值作为设定像素值;或者将位于目标对象边缘且处于背景区域的像素点的像素值求平均,将该平均像素值作为设定像素值。本实施例中,将第一侧图像的像素值替换为从原始图像的背景区域中选择的像素值,可以使得后续生成的第一侧镜像图像与背景区域平滑过渡,提高镜像目标对象的显示效果。Select a pixel value from the background area of the original image as a way to set the pixel value: arbitrarily select a pixel point from the background area and use the pixel value of the pixel point as the set pixel value; or, set the pixel value in the background area Calculate the average of the pixel values of the pixels, and use the average pixel value as the set pixel value; or, select a pixel from the pixels located on the edge of the target object and in the background area, and use the pixel value of the pixel as the set pixel value. Set the pixel value; or average the pixel values of the pixels located on the edge of the target object and in the background area, and use the average pixel value as the set pixel value. In this embodiment, replacing the pixel values of the first side image with pixel values selected from the background area of the original image can make the subsequently generated first side mirror image and the background area smoothly transition and improve the display effect of the mirror target object. .
可选的,在将第一侧图像的像素值替换为设定像素值之后,还包括如下步骤:对替换像素值后的第一侧图像进行模糊处理。Optionally, after replacing the pixel values of the first side image with the set pixel values, the following step is also included: blurring the first side image after replacing the pixel values.
模糊处理的方式可以是高斯模糊。本实施例中,对替换像素值后的第一侧图像进行模糊处理的方式可以是:对替换像素值后的第一侧图像进行多重高斯模糊,获得模糊处理后的第一侧图像。本实施例中,对替换像素值后的第一侧图像进行模糊处理,可以将第一侧图像进行隐藏,可以防止第一侧图像影响第 一侧镜像图像的显示效果。The blur processing method can be Gaussian blur. In this embodiment, the method of blurring the first side image after replacing the pixel values may be: performing multiple Gaussian blur on the first side image after replacing the pixel values to obtain a blurred first side image. In this embodiment, the first side image after replacing the pixel values is blurred, so that the first side image can be hidden and the first side image can be prevented from affecting the second side image. Display effect of mirrored image on one side.
S130,基于分割线对第二侧图像进行镜像处理,获得第一侧镜像图像。S130: Mirror the second side image based on the dividing line to obtain the first side mirror image.
第一侧镜像图像与第二侧图像互为镜像,即第二侧图像与第一侧镜像图像相对于分割线相对称。The first side mirror image and the second side image are mirror images of each other, that is, the second side image and the first side mirror image are symmetrical with respect to the dividing line.
本实施例中,基于分割线对第二侧图像进行镜像处理的方式可以是:确定第二侧图像中每个像素点相对于分割线对称的像素点,然后将第二侧图像的像素点的像素值作为与第二侧图像的像素点对称的像素点的像素值,基于确定后的像素值渲染第一侧图像,获得第一侧镜像图像。In this embodiment, the method of mirroring the second side image based on the dividing line may be: determining the pixel points of each pixel in the second side image that are symmetrical with respect to the dividing line, and then converting the pixels of the second side image to The pixel value is used as the pixel value of the pixel point that is symmetrical with the pixel point of the second side image, and the first side image is rendered based on the determined pixel value to obtain the first side mirror image.
可选的,基于分割线对第二侧图像进行镜像处理,获得第一侧镜像图像的方式可以是:对于第二侧图像的像素点,确定第二侧图像的像素点相对于分割线对称的第一侧图像的像素点;将第二侧图像的像素点的像素值确定为第一侧图像的像素点的目标像素值;基于目标像素值渲染第一侧图像,获得第一侧镜像图像。Optionally, the second side image is mirrored based on the dividing line. The method of obtaining the first side mirror image may be: for the pixel points of the second side image, determine the pixel points of the second side image that are symmetrical with respect to the dividing line. pixels of the first side image; determine the pixel values of the pixels of the second side image as target pixel values of the pixels of the first side image; render the first side image based on the target pixel value to obtain the first side mirror image.
确定第二侧图像的像素点相对于分割线对称的第一侧图像的像素点的方式可以是:获取第二侧图像的像素点的坐标信息及分割线的函数表达式,基于对称原理确定第二侧图像的像素点相对于分割线对称的第一侧图像的像素点的坐标信息。其中,对称原理的实现过程,此处不再赘述。示例性的,图3a-图3b是本实施例中生成的镜像目标对象的示意图,如图3a-图3b所示,目标对象为人像,人像的右侧为生成的第一侧镜像图像,人像的左侧是原始图像的人像。本实施例中,基于分割线对所述第二侧图像进行镜像处理,可以提高获取镜像图像的精度。The method of determining the pixel points of the first side image in which the pixel points of the second side image are symmetrical with respect to the dividing line may be: obtaining the coordinate information of the pixel points of the second side image and the functional expression of the dividing line, and determining the first side image based on the symmetry principle. The coordinate information of the pixel points of the first side image where the pixel points of the two side images are symmetrical with respect to the dividing line. Among them, the implementation process of the symmetry principle will not be described again here. Exemplarily, Figures 3a-3b are schematic diagrams of the mirror target object generated in this embodiment. As shown in Figures 3a-3b, the target object is a portrait, and the right side of the portrait is the generated first side mirror image. The portrait The left side of is the portrait of the original image. In this embodiment, mirror processing is performed on the second side image based on the dividing line, which can improve the accuracy of obtaining the mirror image.
可选的,在基于分割线对第二侧图像进行镜像处理之前,所述方法还包括如下步骤:获取屏幕比例;基于屏幕比例对分割线进行变换;基于分割线对第二侧图像进行镜像处理,包括:基于变换后的分割线对第二侧图像进行镜像处理。Optionally, before mirroring the second side image based on the dividing line, the method further includes the following steps: obtaining the screen ratio; transforming the dividing line based on the screen ratio; and mirroring the second side image based on the dividing line. , including: mirroring the second side image based on the transformed dividing line.
屏幕比例可以理解为当前终端设备屏幕的高和宽间的比例,例如屏幕比例可以是:16:9或者4:3等。本实施例中,基于屏幕比例对分割线进行变换的方式可以是:基于屏幕比例对分割线的斜率进行变换。假设分割线的斜率为k,屏幕比例为16:9,则变换后的斜率为k*16/9。可选的,基于屏幕比例对分割线进行变换的方式还可以是:基于屏幕比例对分割线上的两点坐标进行变换,基于变换坐标后的两点生成新的分割线。示例性的,假设分割线上的两点坐标分别为A(x1,y1)和B(x2,y2),屏幕比例为16:9,变换后的两点坐标为A1(x1,y1*16/9),B1(x2,y2*16/9),最后将A1和B1的连线作为变换后的分割线。 本实施例中,基于屏幕比例对分割线进行变换,可以防止镜像目标对象在显示于当前屏幕时被拉伸。The screen ratio can be understood as the ratio between the height and width of the current terminal device screen. For example, the screen ratio can be: 16:9 or 4:3, etc. In this embodiment, the method of transforming the dividing line based on the screen ratio may be: transforming the slope of the dividing line based on the screen ratio. Assuming that the slope of the dividing line is k and the screen ratio is 16:9, the transformed slope is k*16/9. Optionally, the method of transforming the dividing line based on the screen ratio can also be: transforming the coordinates of two points on the dividing line based on the screen ratio, and generating a new dividing line based on the two points after the transformed coordinates. For example, assume that the coordinates of the two points on the dividing line are A(x1, y1) and B(x2, y2), the screen ratio is 16:9, and the transformed coordinates of the two points are A1(x1, y1*16/ 9), B1 (x2, y2*16/9), and finally the connection between A1 and B1 is used as the transformed dividing line. In this embodiment, transforming the dividing line based on the screen ratio can prevent the mirror target object from being stretched when displayed on the current screen.
本公开实施例的技术方案,对原始图像中的目标对象进行识别,获得目标对象图像及目标对象的分割线;其中,目标对象图像被分割线分割为第一侧图像和第二侧图像;将第一侧图像的像素值替换为设定像素值;基于分割线对第二侧图像进行镜像处理,获得第一侧镜像图像;其中,第一侧镜像图像与第二侧图像互为镜像。本公开实施例提供的图像处理方法,基于目标对象的分割线对处于分割线一侧的目标对象进行镜像处理,获得目标对象的镜像图像,可以生成具有镜像特效的图像,可以丰富图像的显示内容。The technical solution of the embodiment of the present disclosure is to identify the target object in the original image and obtain the target object image and the dividing line of the target object; wherein, the target object image is divided into a first side image and a second side image by the dividing line; The pixel value of the first side image is replaced with the set pixel value; the second side image is mirrored based on the dividing line to obtain the first side mirror image; wherein the first side mirror image and the second side image are mirror images of each other. The image processing method provided by the embodiment of the present disclosure mirrors the target object on one side of the dividing line based on the dividing line of the target object to obtain a mirror image of the target object, which can generate an image with mirroring special effects and enrich the display content of the image. .
图4为本公开实施例所提供的一种图像处理装置的结构示意图,如图4所示,所述装置包括:目标对象识别模块410,设置为对原始图像中的目标对象进行识别,获得目标对象图像及所述目标对象的分割线;其中,所述目标对象图像被所述分割线分割为第一侧图像和第二侧图像;像素值替换模块420,设置为将所述第一侧图像的像素值替换为设定像素值;镜像处理模块430,设置为基于所述分割线对所述第二侧图像进行镜像处理,获得第一侧镜像图像;其中,所述第一侧镜像图像与所述第二侧图像互为镜像。Figure 4 is a schematic structural diagram of an image processing device provided by an embodiment of the present disclosure. As shown in Figure 4, the device includes: a target object recognition module 410, configured to identify target objects in the original image, and obtain the target object. The object image and the dividing line of the target object; wherein the target object image is divided into a first side image and a second side image by the dividing line; the pixel value replacement module 420 is configured to replace the first side image The pixel value of is replaced with the set pixel value; the mirror processing module 430 is configured to perform mirror processing on the second side image based on the dividing line to obtain a first side mirror image; wherein the first side mirror image and The second side images are mirror images of each other.
可选的,目标对象识别模块410是设置为通过如下方式对对原始图像中的目标对象进行识别,获得目标对象图像:对原始图像中的目标对象进行识别,获得目标对象的掩膜图;将目标对象的掩膜图和原始图像进行融合,获得目标对象图像。Optionally, the target object identification module 410 is configured to identify the target object in the original image and obtain the target object image in the following manner: identify the target object in the original image and obtain a mask image of the target object; The mask image of the target object is fused with the original image to obtain the target object image.
可选的,目标对象识别模块410是设置为通过如下方式对原始图像中的目标对象进行识别,获得目标对象的分割线:确定原始图像中的目标对象的两个设定关键点;将两个设定关键点的连线确定为目标对象的分割线。Optionally, the target object recognition module 410 is configured to identify the target object in the original image and obtain the dividing line of the target object in the following manner: determine two set key points of the target object in the original image; combine the two Set the connecting line of key points as the dividing line of the target object.
可选的,若目标对象为人像,所述人像包括面部和/或人体,目标对象识别模块410是设置为通过如下方式确定原始图像中的目标对象的两个设定关键点:确定原始图像中人像面部中的眉心关键点和下巴关键点;目标对象识别模块410是设置为通过如下方式将两个设定关键点的连线确定为目标对象的分割线:将眉心关键点和下巴关键点的连线确定为人像的分割线。Optionally, if the target object is a portrait, and the portrait includes a face and/or a human body, the target object identification module 410 is configured to determine two set key points of the target object in the original image in the following manner: determine The key point between the eyebrows and the key point on the chin in the portrait face; the target object recognition module 410 is configured to determine the connection line between the two set key points as the dividing line of the target object in the following way: the key point between the eyebrows and the key point on the chin The connecting line is determined as the dividing line of the portrait.
可选的,目标对象识别模块410是设置为通过如下方式对原始图像中的目标对象进行识别,获得目标对象的分割线:确定原始图像中目标对象的检测框;根据检测框的中轴线确定目标对象的分割线。Optionally, the target object identification module 410 is configured to identify the target object in the original image and obtain the dividing line of the target object in the following manner: determine the detection frame of the target object in the original image; determine the target according to the central axis of the detection frame. The dividing line of the object.
可选的,像素值替换模块420是设置为:遍历目标对象图像的像素点,将遍历到的每个像素点的坐标信息输入分割线的表达式,获得遍历到的所述每个 像素点的坐标信息的结果值;若遍历到的每个像素点的坐标信息的结果值大于设定值,则将遍历到的所述每个像素点的像素值替换为设定像素值;或者,若遍历到的所述每个像素点的坐标信息的结果值小于设定值,则将遍历到的所述每个像素点的像素值替换为设定像素值。Optionally, the pixel value replacement module 420 is configured to: traverse the pixel points of the target object image, input the coordinate information of each traversed pixel point into the expression of the dividing line, and obtain each of the traversed pixel points. The result value of the coordinate information of the pixel point; if the result value of the coordinate information of each pixel point traversed is greater than the set value, then the pixel value of each pixel point traversed is replaced with the set pixel value; or , if the result value of the traversed coordinate information of each pixel point is less than the set value, then the pixel value of each traversed pixel point is replaced with the set pixel value.
可选的,像素值替换模块420是设置为:从原始图像的背景区域中选择一像素值,作为设定像素值;将第一侧图像的像素值替换为设定像素值。Optionally, the pixel value replacement module 420 is configured to: select a pixel value from the background area of the original image as the set pixel value; and replace the pixel value of the first side image with the set pixel value.
可选的,所述装置还包括:模糊处理模块,设置为:对替换像素值后的第一侧图像进行模糊处理。Optionally, the device further includes: a blur processing module configured to: blur the first side image after replacing the pixel values.
可选的,镜像处理模块430是设置为:对于第二侧图像的像素点,确定第二侧图像的像素点相对于分割线对称的第一侧图像的像素点;将第二侧图像的像素点的像素值确定为第一侧图像的像素点的目标像素值;基于目标像素值渲染第一侧图像,获得第一侧镜像图像。Optionally, the mirror processing module 430 is configured to: for the pixel points of the second side image, determine the pixel points of the first side image in which the pixel points of the second side image are symmetrical with respect to the dividing line; The pixel value of the point is determined as the target pixel value of the pixel point of the first side image; the first side image is rendered based on the target pixel value to obtain the first side mirror image.
可选的,所述装置还包括:变换模块,设置为:获取屏幕比例;基于屏幕比例对分割线进行变换;可选的,镜像处理模块430是设置为:基于变换后的分割线对第二侧图像进行镜像处理。Optionally, the device also includes: a transformation module, configured to: obtain the screen ratio; transform the dividing line based on the screen ratio; optionally, the mirror processing module 430 is configured to: based on the transformed dividing line, the second The side image is mirrored.
本公开实施例所提供的图像处理装置可执行本公开任意实施例所提供的图像处理方法,具备执行方法相应的功能模块和效果。The image processing device provided by the embodiments of the present disclosure can execute the image processing method provided by any embodiment of the present disclosure, and has functional modules and effects corresponding to the execution method.
上述装置所包括的多个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,多个功能单元的名称也只是为了便于相互区分,并不用于限制本公开实施例的保护范围。The multiple units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned divisions, as long as they can achieve the corresponding functions; in addition, the names of the multiple functional units are only for the convenience of distinguishing each other. , are not used to limit the protection scope of the embodiments of the present disclosure.
图5为本公开实施例所提供的一种电子设备的结构示意图。下面参考图5,其示出了适于用来实现本公开实施例的电子设备(例如图5中的终端设备或服务器)500的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、个人数字助理(Personal Digital Assistan,PDA)、平板电脑(Portable Android Device,PAD)、便携式多媒体播放器(Portable Media Player,PMP)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字电视(television,TV)、台式计算机等等的固定终端。图5示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. Referring now to FIG. 5 , a schematic structural diagram of an electronic device (such as the terminal device or server in FIG. 5 ) 500 suitable for implementing embodiments of the present disclosure is shown. Terminal devices in embodiments of the present disclosure may include, but are not limited to, mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (Personal Digital Assistant, PDA), tablet computers (Portable Android Device, PAD), portable multimedia players Mobile terminals such as (Portable Media Player, PMP), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital television (television, TV), desktop computers, etc. The electronic device shown in FIG. 5 is only an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
如图5所示,电子设备500可以包括处理装置(例如中央处理器、图形处理器等)501,其可以根据存储在只读存储器(Read-Only Memory,ROM)502中的程序或者从存储装置508加载到随机访问存储器(Random Access Memory,RAM)503中的程序而执行各种适当的动作和处理。在RAM 503中,还存储有电子设备500操作所需的各种程序和数据。处理装置501、ROM 502以及RAM  503通过总线504彼此相连。输入/输出(Input/Output,I/O)接口505也连接至总线504。As shown in FIG. 5 , the electronic device 500 may include a processing device (such as a central processing unit, a graphics processor, etc.) 501 , which may process data according to a program stored in a read-only memory (Read-Only Memory, ROM) 502 or from a storage device. 508 loads the program in the random access memory (Random Access Memory, RAM) 503 to perform various appropriate actions and processes. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. Processing device 501, ROM 502 and RAM 503 are connected to each other via bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
通常,以下装置可以连接至I/O接口505:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置506;包括例如液晶显示器(Liquid Crystal Display,LCD)、扬声器、振动器等的输出装置507;包括例如磁带、硬盘等的存储装置508;以及通信装置509。通信装置509可以允许电子设备500与其他设备进行无线或有线通信以交换数据。虽然图5示出了具有各种装置的电子设备500,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。Generally, the following devices can be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a Liquid Crystal Display (LCD) , an output device 507 such as a speaker, a vibrator, etc.; a storage device 508 including a magnetic tape, a hard disk, etc.; and a communication device 509. Communication device 509 may allow electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although FIG. 5 illustrates electronic device 500 with various means, it should be understood that implementation or availability of all illustrated means is not required. More or fewer means may alternatively be implemented or provided.
根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置509从网络上被下载和安装,或者从存储装置508被安装,或者从ROM 502被安装。在该计算机程序被处理装置501执行时,执行本公开实施例的方法中限定的上述功能。According to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product including a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such embodiments, the computer program may be downloaded and installed from the network via communication device 509, or from storage device 508, or from ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are for illustrative purposes only and are not used to limit the scope of these messages or information.
本公开实施例提供的电子设备与上述实施例提供的图像处理方法属于同一发明构思,未在本实施例中详尽描述的技术细节可参见上述实施例,并且本实施例与上述实施例具有相同的效果。The electronic device provided by the embodiments of the present disclosure and the image processing method provided by the above embodiments belong to the same inventive concept. Technical details that are not described in detail in this embodiment can be referred to the above embodiments, and this embodiment has the same features as the above embodiments. Effect.
本公开实施例提供了一种计算机存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述实施例所提供的图像处理方法。Embodiments of the present disclosure provide a computer storage medium on which a computer program is stored. When the program is executed by a processor, the image processing method provided by the above embodiments is implemented.
本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、RAM、ROM、可擦式可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)或闪存、光纤、便携式紧凑磁盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其 中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、射频(Radio Frequency,RF)等等,或者上述的任意合适的组合。The computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium may be, for example, but is not limited to, an electrical, 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 having one or more wires, portable computer disks, hard drives, RAM, ROM, Erasable Programmable Read-Only Memory Memory, EPROM) or flash memory, optical fiber, portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In this disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. While in this disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which It contains computer-readable program code. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device . Program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, radio frequency (Radio Frequency, RF), etc., or any suitable combination of the above.
在一些实施方式中,客户端、服务器可以利用诸如超文本传输协议(HyperText Transfer Protocol,HTTP)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(Local Area Network,LAN),广域网(Local Area Network,WAN),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HyperText Transfer Protocol (HTTP), and can communicate with digital data in any form or medium. Communications (e.g., communications network) interconnections. Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any current network for knowledge or future research and development.
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; it may also exist independently without being assembled into the electronic device.
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:对原始图像中的目标对象进行识别,获得目标对象图像及所述目标对象的分割线;其中,所述目标对象图像被所述分割线所分割,且将所述分割线的任意一侧的图像作为第一侧图像,所述分割线的另一侧图像作为第二侧图像;将所述第一侧图像的像素值替换为设定像素值;基于所述分割线对所述第二侧图像进行镜像处理,获得第一侧镜像图像;其中,所述第一侧镜像图像与所述第二侧图像互为镜像。The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: identifies the target object in the original image and obtains the target object image and the target. The dividing line of the object; wherein the target object image is divided by the dividing line, and the image on any side of the dividing line is used as the first side image, and the image on the other side of the dividing line is used as the second side image. side image; replace the pixel value of the first side image with a set pixel value; perform mirror processing on the second side image based on the dividing line to obtain a first side mirror image; wherein, the first side The mirror image and the second side image are mirror images of each other.
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括LAN或WAN—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages—such as "C" or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In situations involving remote computers, the remote computer may be connected to the user computer through any kind of network, including a LAN or WAN, or may be connected to an external computer (eg, through the Internet using an Internet service provider).
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、 或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, segment, or portion of code that Or a portion of the code contains one or more executable instructions for implementing specified logical functions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown one after another may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved. It will also be noted that each block of the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or operations. , or can be implemented using a combination of specialized hardware and computer instructions.
描述于本公开实施例中所涉及到的单元/模块可以通过软件的方式实现,也可以通过硬件的方式来实现。单元/模块的名称在某种情况下并不构成对该单元本身的限定,例如,目标对象识别模块还可以被描述为“对原始图像中的目标对象进行识别,获得目标对象图像及所述目标对象的分割线的模块”。The units/modules described in the embodiments of the present disclosure may be implemented in software or hardware. The name of the unit/module does not constitute a limitation on the unit itself under certain circumstances. For example, the target object recognition module can also be described as "identifying the target object in the original image, obtaining the target object image and the target Module of the object's dividing line".
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(Field Programmable Gate Array,FPGA)、专用集成电路(Application Specific Integrated Circuit,ASIC)、专用标准产品(Application Specific Standard Parts,ASSP)、片上系统(System on Chip,SOC)、复杂可编程逻辑设备(Complex Programmable Logic Device,CPLD)等等。The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: field programmable gate array (Field Programmable Gate Array, FPGA), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), application specific standard product (Application Specific Standard Parts (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), etc.
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、RAM、ROM、EPROM或快闪存储器、光纤、便捷式CD-ROM、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of this disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, RAM, ROM, EPROM or flash memory, optical fiber, portable CD-ROM, optical storage device, magnetic storage device, or any suitable combination of the foregoing.
根据本公开的一个或多个实施例,提供了一种图像处理方法,包括:对原始图像中的目标对象进行识别,获得目标对象图像及所述目标对象的分割线;其中,所述目标对象图像被所述分割线所分割,且将所述分割线的任意一侧的图像作为第一侧图像,所述分割线的另一侧图像作为第二侧图像;将所述第一侧图像的像素值替换为设定像素值;基于所述分割线对所述第二侧图像进行镜像处理,获得第一侧镜像图像;其中,所述第一侧镜像图像与所述第二侧图像互为镜像。According to one or more embodiments of the present disclosure, an image processing method is provided, including: identifying a target object in an original image, and obtaining an image of the target object and a dividing line of the target object; wherein, the target object The image is divided by the dividing line, and the image on either side of the dividing line is taken as the first side image, and the image on the other side of the dividing line is taken as the second side image; The pixel value is replaced with the set pixel value; the second side image is mirrored based on the dividing line to obtain a first side mirror image; wherein the first side mirror image and the second side image are mutually exclusive Mirror.
可选的,对原始图像中的目标对象进行识别,获得目标对象图像,包括:对原始图像中的目标对象进行识别,获得目标对象的掩膜图;将所述目标对象 的掩膜图和所述原始图像进行融合,获得目标对象图像。Optionally, identifying the target object in the original image and obtaining the target object image includes: identifying the target object in the original image and obtaining a mask image of the target object; The mask image is fused with the original image to obtain the target object image.
可选的,对原始图像中的目标对象进行识别,获得所述目标对象的分割线,包括:确定所述原始图像中的目标对象的两个设定关键点;将所述两个设定关键点的连线确定为所述目标对象的分割线。Optionally, identifying the target object in the original image and obtaining the dividing line of the target object includes: determining two set key points of the target object in the original image; The line connecting the points is determined as the dividing line of the target object.
可选的,若所述目标对象为人像,则确定所述原始图像中的目标对象的两个设定关键点,包括:确定所述原始图像中人像面部中的眉心关键点和下巴关键点;将所述两个设定关键点的连线确定为所述目标对象的分割线,包括:将所述眉心关键点和所述下巴关键点的连线确定为所述人像的分割线。Optionally, if the target object is a portrait, determining two set key points of the target object in the original image includes: determining the key point between the eyebrows and the chin key point on the face of the portrait in the original image; Determining the connection line between the two set key points as the dividing line of the target object includes: determining the connection line between the eyebrow key point and the chin key point as the dividing line of the portrait.
可选的,对原始图像中的目标对象进行识别,获得所述目标对象的分割线,包括:确定所述原始图像中目标对象的检测框;根据所述检测框的中轴线确定所述目标对象的分割线。Optionally, identifying the target object in the original image and obtaining the dividing line of the target object includes: determining the detection frame of the target object in the original image; determining the target object according to the central axis of the detection frame dividing line.
可选的,将所述第一侧图像的像素值替换为设定像素值,包括:遍历所述目标对象图像的像素点,将遍历到的像素点的坐标信息输入所述分割线的表达式,获得结果值;若所述结果值大于设定值,则将遍历到的像素点的像素值替换为设定像素值;或者,若所述结果值小于设定值,则将遍历到的像素点的像素值替换为设定像素值。Optionally, replacing the pixel value of the first side image with the set pixel value includes: traversing the pixel points of the target object image, and inputting the coordinate information of the traversed pixel point into the expression of the dividing line. , obtain the result value; if the result value is greater than the set value, replace the pixel value of the traversed pixel with the set pixel value; or, if the result value is less than the set value, replace the traversed pixel The pixel value of the point is replaced with the set pixel value.
可选的,将所述第一侧图像的像素值替换为设定像素值,包括:从所述原始图像的背景区域中选择一像素值,作为设定像素值;将所述第一侧图像的像素值替换为设定像素值。Optionally, replacing the pixel value of the first side image with a set pixel value includes: selecting a pixel value from the background area of the original image as the set pixel value; replacing the first side image with a set pixel value. The pixel value is replaced with the set pixel value.
可选的,在将所述第一侧图像的像素值替换为设定像素值之后,还包括:对替换像素值后的第一侧图像进行模糊处理。Optionally, after replacing the pixel values of the first side image with the set pixel values, the method further includes: blurring the first side image after replacing the pixel values.
可选的,基于所述分割线对所述第二侧图像进行镜像处理,获得第一侧镜像图像,包括:对于所述第二侧图像的像素点,确定第二侧图像的像素点对称的第一侧图像的像素点;将所述第二侧图像的像素点的像素值确定为所述第一侧图像的像素点的目标像素值;基于所述目标像素值渲染所述第一侧图像,获得第一侧镜像图像。Optionally, performing mirror processing on the second side image based on the dividing line to obtain the first side mirror image includes: for the pixel points of the second side image, determining the symmetry of the pixel points of the second side image. pixel points of the first side image; determining the pixel value of the pixel point of the second side image as the target pixel value of the pixel point of the first side image; rendering the first side image based on the target pixel value , obtain the first side mirror image.
可选的,在基于所述分割线对所述第二侧图像进行镜像处理之前,所述方法还包括:获取屏幕比例;基于所述屏幕比例对所述分割线进行变换;基于所述分割线对所述第二侧图像进行镜像处理,包括:基于变换后的分割线对所述第二侧图像进行镜像处理。Optionally, before mirroring the second side image based on the dividing line, the method further includes: obtaining a screen ratio; transforming the dividing line based on the screen ratio; Mirroring the second side image includes mirroring the second side image based on the transformed dividing line.
虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了具体实现细节,但是这些不 应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。Although operations are depicted in a specific order, this should not be understood as requiring that the operations be performed in the specific order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, although specific implementation details are included in the discussion above, these are not should be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。 Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. The specific features and acts described above are merely example forms of implementing the claims.

Claims (13)

  1. 一种图像处理方法,包括:An image processing method including:
    对原始图像中的目标对象进行识别,获得目标对象图像及所述目标对象的分割线;其中,所述目标对象图像被所述分割线所分割,且将所述分割线的任意一侧的图像作为第一侧图像,所述分割线的另一侧的图像作为第二侧图像;Identify the target object in the original image to obtain the target object image and the dividing line of the target object; wherein the target object image is divided by the dividing line, and the image on either side of the dividing line is As the first side image, the image on the other side of the dividing line serves as the second side image;
    将所述第一侧图像的像素值替换为设定像素值;Replace the pixel value of the first side image with the set pixel value;
    基于所述分割线对所述第二侧图像进行镜像处理,获得第一侧镜像图像;其中,所述第一侧镜像图像与所述第二侧图像互为镜像。The second side image is mirrored based on the dividing line to obtain a first side mirror image; wherein the first side mirror image and the second side image are mirror images of each other.
  2. 根据权利要求1所述的方法,其中,对原始图像中的目标对象进行识别,获得目标对象图像,包括:The method according to claim 1, wherein identifying the target object in the original image and obtaining the target object image includes:
    对原始图像中的目标对象进行识别,获得目标对象的掩膜图;Recognize the target object in the original image and obtain the mask image of the target object;
    将所述目标对象的掩膜图和所述原始图像进行融合,获得目标对象图像。The mask image of the target object and the original image are fused to obtain an image of the target object.
  3. 根据权利要求1所述的方法,其中,对原始图像中的目标对象进行识别,获得所述目标对象的分割线,包括:The method according to claim 1, wherein identifying the target object in the original image and obtaining the dividing line of the target object includes:
    确定所述原始图像中的目标对象的两个设定关键点;Determine two set key points of the target object in the original image;
    将所述两个设定关键点的连线确定为所述目标对象的分割线。The connecting line between the two set key points is determined as the dividing line of the target object.
  4. 根据权利要求3所述的方法,其中,在所述目标对象为人像的情况下,所述人像包括面部和人体中的至少之一;The method according to claim 3, wherein when the target object is a portrait, the portrait includes at least one of a face and a human body;
    确定所述原始图像中的目标对象的两个设定关键点,包括:确定所述原始图像中人像的面部中的眉心关键点和下巴关键点;Determining two set key points of the target object in the original image includes: determining the eyebrow key point and the chin key point in the face of the portrait in the original image;
    将所述两个设定关键点的连线确定为所述目标对象的分割线,包括:将所述眉心关键点和所述下巴关键点的连线确定为所述人像的分割线。Determining the connection line between the two set key points as the dividing line of the target object includes: determining the connection line between the eyebrow key point and the chin key point as the dividing line of the portrait.
  5. 根据权利要求1所述的方法,其中,对原始图像中的目标对象进行识别,获得所述目标对象的分割线,包括:The method according to claim 1, wherein identifying the target object in the original image and obtaining the dividing line of the target object includes:
    确定所述原始图像中目标对象的检测框;Determine the detection frame of the target object in the original image;
    根据所述检测框的中轴线确定所述目标对象的分割线。The dividing line of the target object is determined according to the central axis of the detection frame.
  6. 根据权利要求1所述的方法,其中,将所述第一侧图像的像素值替换为设定像素值,包括:The method according to claim 1, wherein replacing the pixel value of the first side image with a set pixel value includes:
    遍历所述目标对象图像的像素点,将遍历到的每个像素点的坐标信息输入所述分割线的表达式,获得遍历到的所述每个像素点的坐标信息的结果值;Traverse the pixel points of the target object image, input the coordinate information of each traversed pixel point into the expression of the dividing line, and obtain the result value of the traversed coordinate information of each pixel point;
    在所述遍历到的所述每个像素点的坐标信息的结果值大于设定值的情况 下,将遍历到的所述每个像素点的像素值替换为设定像素值;或者,在所述遍历到的所述每个像素点的坐标信息的结果值小于设定值的情况下,则将遍历到的所述每个像素点的像素值替换为设定像素值。When the result value of the traversed coordinate information of each pixel is greater than the set value , replace the pixel value of each traversed pixel point with the set pixel value; or, in the case where the result value of the coordinate information of each traversed pixel point is less than the set value, Then replace the pixel value of each traversed pixel point with the set pixel value.
  7. 根据权利要求1所述的方法,其中,将所述第一侧图像的像素值替换为设定像素值,包括:The method according to claim 1, wherein replacing the pixel value of the first side image with a set pixel value includes:
    从所述原始图像的背景区域中选择一像素值,作为设定像素值;Select a pixel value from the background area of the original image as the set pixel value;
    将所述第一侧图像的像素值替换为设定像素值。Replace the pixel values of the first side image with the set pixel values.
  8. 根据权利要求1或7所述的方法,在将所述第一侧图像的像素值替换为设定像素值之后,还包括:The method according to claim 1 or 7, after replacing the pixel value of the first side image with the set pixel value, further comprising:
    对替换像素值后的第一侧图像进行模糊处理。Blur the first side image after replacing the pixel values.
  9. 根据权利要求1所述的方法,其中,基于所述分割线对所述第二侧图像进行镜像处理,获得第一侧镜像图像,包括:The method according to claim 1, wherein performing mirror processing on the second side image based on the dividing line to obtain the first side mirror image includes:
    确定所述第二侧图像的像素点相对于所述分割线对称的所述第一侧图像的像素点;Determine the pixel points of the first side image in which the pixel points of the second side image are symmetrical with respect to the dividing line;
    将所述第二侧图像的像素点的像素值确定为所述所述第一侧图像的像素点的目标像素值;Determine the pixel value of the pixel point of the second side image as the target pixel value of the pixel point of the first side image;
    基于所述目标像素值渲染所述第一侧图像,获得第一侧镜像图像。The first side image is rendered based on the target pixel value to obtain a first side mirror image.
  10. 根据权利要求1所述的方法,在基于所述分割线对所述第二侧图像进行镜像处理之前,还包括:The method according to claim 1, before mirroring the second side image based on the dividing line, further comprising:
    获取屏幕比例;Get the screen ratio;
    基于所述屏幕比例对所述分割线进行变换;Transform the dividing line based on the screen ratio;
    基于所述分割线对所述第二侧图像进行镜像处理,包括:基于变换后的分割线对所述第二侧图像进行镜像处理。Mirroring the second side image based on the dividing line includes: mirroring the second side image based on the transformed dividing line.
  11. 一种图像处理装置,包括:An image processing device, including:
    目标对象识别模块,设置为对原始图像中的目标对象进行识别,获得目标对象图像及所述目标对象的分割线;其中,所述目标对象图像被所述分割线分割为第一侧图像和第二侧图像;The target object recognition module is configured to identify the target object in the original image and obtain the target object image and the dividing line of the target object; wherein the target object image is divided into a first side image and a third side image by the dividing line. Bilateral image;
    像素值替换模块,设置为将所述第一侧图像的像素值替换为设定像素值;A pixel value replacement module configured to replace the pixel value of the first side image with a set pixel value;
    镜像处理模块,设置为基于所述分割线对所述第二侧图像进行镜像处理,获得第一侧镜像图像;其中,所述第一侧镜像图像与所述第二侧图像互为镜像。 The mirror processing module is configured to perform mirror processing on the second side image based on the dividing line to obtain a first side mirror image; wherein the first side mirror image and the second side image are mirror images of each other.
  12. 一种电子设备,包括:An electronic device including:
    至少一个处理器;at least one processor;
    存储装置,设置为存储至少一个程序,a storage device arranged to store at least one program,
    当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1-10中任一所述的图像处理方法。When the at least one program is executed by the at least one processor, the at least one processor implements the image processing method according to any one of claims 1-10.
  13. 一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如权利要求1-10中任一所述的图像处理方法。 A storage medium containing computer-executable instructions, which when executed by a computer processor are used to perform the image processing method according to any one of claims 1-10.
PCT/CN2023/113234 2022-08-17 2023-08-16 Image processing method and apparatus, and device and storage medium WO2024037556A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210988925.6 2022-08-17
CN202210988925.6A CN115358919A (en) 2022-08-17 2022-08-17 Image processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2024037556A1 true WO2024037556A1 (en) 2024-02-22

Family

ID=84001852

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/113234 WO2024037556A1 (en) 2022-08-17 2023-08-16 Image processing method and apparatus, and device and storage medium

Country Status (2)

Country Link
CN (1) CN115358919A (en)
WO (1) WO2024037556A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115358919A (en) * 2022-08-17 2022-11-18 北京字跳网络技术有限公司 Image processing method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105959564A (en) * 2016-06-15 2016-09-21 维沃移动通信有限公司 Photographing method and mobile terminal
CN111145189A (en) * 2019-12-26 2020-05-12 成都市喜爱科技有限公司 Image processing method, image processing device, electronic equipment and computer readable storage medium
CN111754528A (en) * 2020-06-24 2020-10-09 Oppo广东移动通信有限公司 Portrait segmentation method, portrait segmentation device, electronic equipment and computer-readable storage medium
EP3982288A1 (en) * 2020-10-09 2022-04-13 Fresenius Medical Care Deutschland GmbH Method for identifying an object, computer program for carrying out the method and system
CN115358919A (en) * 2022-08-17 2022-11-18 北京字跳网络技术有限公司 Image processing method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105959564A (en) * 2016-06-15 2016-09-21 维沃移动通信有限公司 Photographing method and mobile terminal
CN111145189A (en) * 2019-12-26 2020-05-12 成都市喜爱科技有限公司 Image processing method, image processing device, electronic equipment and computer readable storage medium
CN111754528A (en) * 2020-06-24 2020-10-09 Oppo广东移动通信有限公司 Portrait segmentation method, portrait segmentation device, electronic equipment and computer-readable storage medium
EP3982288A1 (en) * 2020-10-09 2022-04-13 Fresenius Medical Care Deutschland GmbH Method for identifying an object, computer program for carrying out the method and system
CN115358919A (en) * 2022-08-17 2022-11-18 北京字跳网络技术有限公司 Image processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN115358919A (en) 2022-11-18

Similar Documents

Publication Publication Date Title
WO2021139408A1 (en) Method and apparatus for displaying special effect, and storage medium and electronic device
WO2022166872A1 (en) Special-effect display method and apparatus, and device and medium
CN110070496B (en) Method and device for generating image special effect and hardware device
US20240119082A1 (en) Method, apparatus, device, readable storage medium and product for media content processing
WO2024037556A1 (en) Image processing method and apparatus, and device and storage medium
EP4258165A1 (en) Two-dimensional code displaying method and apparatus, device, and medium
WO2024016930A1 (en) Special effect processing method and apparatus, electronic device, and storage medium
WO2023193642A1 (en) Video processing method and apparatus, device and storage medium
US20230140558A1 (en) Method for converting a picture into a video, device, and storage medium
US20220139016A1 (en) Sticker generating method and apparatus, and medium and electronic device
WO2024041637A1 (en) Special effect image generation method and apparatus, device, and storage medium
WO2024051639A1 (en) Image processing method, apparatus and device, and storage medium and product
WO2023231918A1 (en) Image processing method and apparatus, and electronic device and storage medium
WO2024032752A1 (en) Method and apparatus for generating transition special effect image, device, and storage medium
WO2024061064A1 (en) Display effect processing method and apparatus, electronic device, and storage medium
WO2024051540A1 (en) Special effect processing method and apparatus, electronic device, and storage medium
WO2023232056A1 (en) Image processing method and apparatus, and storage medium and electronic device
WO2024051541A1 (en) Special-effect image generation method and apparatus, and electronic device and storage medium
WO2024016923A1 (en) Method and apparatus for generating special effect graph, and device and storage medium
WO2023231926A1 (en) Image processing method and apparatus, device, and storage medium
WO2023193639A1 (en) Image rendering method and apparatus, readable medium and electronic device
WO2023169287A1 (en) Beauty makeup special effect generation method and apparatus, device, storage medium, and program product
WO2023138441A1 (en) Video generation method and apparatus, and device and storage medium
CN116596748A (en) Image stylization processing method, apparatus, device, storage medium, and program product
US20220245920A1 (en) Object display method and apparatus, electronic device, and computer readable storage medium

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

Country of ref document: EP

Kind code of ref document: A1