WO2021052095A1 - 图像处理方法及装置 - Google Patents

图像处理方法及装置 Download PDF

Info

Publication number
WO2021052095A1
WO2021052095A1 PCT/CN2020/110182 CN2020110182W WO2021052095A1 WO 2021052095 A1 WO2021052095 A1 WO 2021052095A1 CN 2020110182 W CN2020110182 W CN 2020110182W WO 2021052095 A1 WO2021052095 A1 WO 2021052095A1
Authority
WO
WIPO (PCT)
Prior art keywords
matrix
dimensional
preset number
key points
display area
Prior art date
Application number
PCT/CN2020/110182
Other languages
English (en)
French (fr)
Inventor
杨清帅
Original Assignee
北京字节跳动网络技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Priority to US17/761,173 priority Critical patent/US20230300385A1/en
Publication of WO2021052095A1 publication Critical patent/WO2021052095A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2181Source of audio or video content, e.g. local disk arrays comprising remotely distributed storage units, e.g. when movies are replicated over a plurality of video servers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/23412Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs for generating or manipulating the scene composition of objects, e.g. MPEG-4 objects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/23418Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • H04N21/234345Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements the reformatting operation being performed only on part of the stream, e.g. a region of the image or a time segment
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/41Structure of client; Structure of client peripherals
    • H04N21/414Specialised client platforms, e.g. receiver in car or embedded in a mobile appliance
    • H04N21/41407Specialised client platforms, e.g. receiver in car or embedded in a mobile appliance embedded in a portable device, e.g. video client on a mobile phone, PDA, laptop
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
    • H04N21/47205End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for manipulating displayed content, e.g. interacting with MPEG-4 objects, editing locally
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/81Monomedia components thereof
    • H04N21/8146Monomedia components thereof involving graphical data, e.g. 3D object, 2D graphics

Definitions

  • the present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, and computer-readable storage medium.
  • a two-dimensional sticker is usually attached to a video, that is, the two-dimensional sticker is stretched to a fixed area in the video for display.
  • the above-mentioned sticker display method makes the video image lacks flexibility and human-computer interaction is not smart enough.
  • the technical problem solved by the present disclosure is to provide an image processing method to at least partially solve the technical problems in the prior art that video images lack flexibility and human-computer interaction is not intelligent enough.
  • an image processing device, an image processing hardware device, a computer-readable storage medium, and an image processing terminal are also provided.
  • An image processing method including:
  • the video image includes a two-dimensional sticker, and the two-dimensional sticker includes a target area;
  • the two-dimensional sticker is drawn on the display area.
  • An image processing device including:
  • An image acquisition module for acquiring a video image; wherein the video image includes a two-dimensional sticker, and the two-dimensional sticker includes a target area;
  • a key point detection module configured to perform key point detection on the video image to obtain a preset number of first key points associated with the target area
  • a key point acquisition module configured to acquire the preset number of marked second key points associated with the target area
  • a display area determining module configured to determine the display area of the two-dimensional sticker in the video image according to the preset number of first key points and the preset number of second key points;
  • the sticker display module is used to draw the two-dimensional sticker in the display area.
  • An electronic device including:
  • Memory for storing non-transitory computer readable instructions
  • the processor is configured to run the computer-readable instructions so that the processor implements the image processing method described in any one of the foregoing when executed.
  • a computer-readable storage medium is used to store non-transitory computer-readable instructions.
  • the computer executes the image processing method described in any one of the above.
  • An image processing terminal includes any image processing device described above.
  • the embodiment of the present disclosure obtains the preset number of first key points associated with the target area in the two-dimensional sticker by detecting the key points of the video image, and obtains the marked presets associated with the target area Number of second key points; according to the preset number of first key points and the preset number of second key points, it is determined that the two-dimensional sticker is in the display area of the video image, Drawing the two-dimensional sticker in the display area can adaptively adjust the display area of the video image according to the target area of the two-dimensional sticker, so that the video picture is more flexible and the human-computer interaction is more intelligent.
  • Fig. 1 is a schematic flowchart of an image processing method according to an embodiment of the present disclosure
  • Fig. 2 is a schematic flowchart of an image processing method according to an embodiment of the present disclosure
  • Fig. 3 is a schematic flowchart of an image processing apparatus according to an embodiment of the present disclosure
  • Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
  • the image processing method mainly includes the following steps S11 to S15.
  • Step S11 Obtain a video image; wherein the video image includes a two-dimensional sticker, and the two-dimensional sticker includes a target area.
  • the video image may be a video stream input in real time, for example, a live video in a short video application, or a video image pre-stored in the terminal.
  • the terminal may be a mobile terminal, such as a smart phone, a tablet computer, or a fixed terminal, such as a desktop computer.
  • two-dimensional stickers are the wallpapers that users want their videos to be more personalized and perfect, and they add their favorite wallpapers to the video images.
  • it may be a sticker containing a person (such as a favorite star, a selfie photo, a friend photo, etc.), a beautiful scenery, or a favorite animal.
  • the two-dimensional sticker may be a triangular sticker, a rectangular sticker, a circular sticker, or a polygonal sticker, etc., which is not specifically limited here.
  • the target area can be customized by the user. Specifically, a person image area, a landscape image area, or an animal image area in the two-dimensional sticker can be selected as the target area.
  • the target area may be a triangular area, a rectangular area, a circular area, or a polygonal area (greater than or equal to a quadrilateral), etc., which is not specifically limited here.
  • Step S12 Perform key point detection on the video image to obtain a preset number of first key points associated with the target area.
  • the preset number can be customized by the user or set according to the shape of the target area. For example, when the target area is a triangular area, the corresponding preset number is three; when the target area is a rectangular area, the corresponding preset number is four; when the target area is a circular area, the corresponding preset number is four The number is at least three; when the target area is a polygonal area, the corresponding preset number is the number of vertices of the polygonal area.
  • the first key point may be a point on the target area, such as a vertex of the target area, or a point on the boundary of the target area; it may also be a point around the target area, and the surrounding points have a certain position with the target area Relations, for example, the neighbors of the vertices of the target area.
  • augmented reality (Augmented Reality, AR) scanning may be used to perform key point detection on the video image to obtain a preset number of first key points associated with the target area.
  • the AR scan can be implemented by any of the following key point detection algorithms: detection algorithm based on Gaussian Laplacian operator (LOG), detection algorithm based on pixel Hessian matrix (second-order differential) and its determinant value ( DOH), Scale Invariant Feature Transformation Detection Algorithm (SIFT), SIFT Detection Algorithm for Accelerating Robust Features (SURF), etc.
  • Step S13 Obtain the second key points of the preset number that are marked and associated with the target area.
  • the second key point is a point associated with the target area in the marked two-dimensional sticker.
  • the number and position of the second key point correspond to the first key point.
  • the second key point is also a point on the target area, such as the vertex of the target area, or a point on the boundary of the target area;
  • the first key point is When the point is a point around the target area, the second key point is also a point around the target area, for example, an adjacent point of a vertex of the target area.
  • manual pre-marking of the preset number of second key points associated with the target area in the two-dimensional sticker may be used.
  • the marked second key point is stored in a local database, or sent to a server for storage, and the server may be a server corresponding to the short video application.
  • the server may be a server corresponding to the short video application.
  • Step S14 Determine the display area of the two-dimensional sticker in the video image according to the preset number of first key points and the preset number of second key points.
  • the shape of the display area corresponds to the shape of the two-dimensional sticker.
  • the corresponding display area is a triangular area
  • the corresponding display area is a rectangle Area
  • the shape of the two-dimensional sticker is a circle
  • the corresponding display area is a circular area
  • the shape of the two-dimensional sticker is a polygon
  • the corresponding display area is a polygonal area, etc., which are not specifically limited here.
  • Step S15 Draw the two-dimensional sticker on the display area.
  • a preset number of first key points associated with the target area in the two-dimensional sticker are obtained, and the marked preset number associated with the target area is obtained.
  • the preset number of first key points and the preset number of second key points it is determined that the two-dimensional sticker is in the display area of the video image, in the display area of the video image, according to the preset number of first key points and the preset number of second key points.
  • the two-dimensional sticker is drawn on the display area, and the display area of the video image can be adaptively adjusted according to the target area of the two-dimensional sticker, so that the video picture is more smart and the human-computer interaction is more intelligent.
  • step S14 specifically includes:
  • Step S141 Determine a perspective transformation matrix according to the correspondence between the preset number of first key points and the preset number of second key points.
  • the perspective transformation matrix is a square matrix, and the dimension of the square matrix may be 3.
  • Step S142 Determine the preset number of third key points corresponding to the two-dimensional sticker in the video image according to the perspective transformation matrix.
  • the perspective transformation matrix records the correspondence between the key points in the marked two-dimensional sticker and the key points in the two-dimensional sticker detected in the video image.
  • the corresponding key points in the video image can be determined according to the perspective transformation matrix.
  • the preset number can be customized by the user or set according to the shape of the two-dimensional sticker.
  • the corresponding preset number is three; when the two-dimensional sticker is a rectangular area, the corresponding preset number is four; when the two-dimensional sticker is a circular area, the corresponding The preset number is at least three; when the two-dimensional sticker is a polygonal area, the corresponding preset number is the number of vertices of the polygonal area.
  • the third key point is a point on the two-dimensional sticker, such as the vertex of the two-dimensional sticker, or a point on the boundary of the two-dimensional sticker.
  • Step S143 Determine the display area of the two-dimensional sticker in the video image according to the preset number of third key points.
  • the determined preset number of third key points are connected in sequence, and the formed closed area is used as the display area.
  • the shape of the display area corresponds to the shape of the two-dimensional sticker.
  • the corresponding display area is a triangular area
  • the corresponding display area is a rectangle Area
  • the shape of the two-dimensional sticker is a circle
  • the corresponding display area is a circular area
  • the shape of the two-dimensional sticker is a polygon
  • the corresponding display area is a polygonal area, etc., which are not specifically limited here.
  • a perspective transformation matrix is determined according to the corresponding relationship between the preset number of first key points and the preset number of second key points, and further based on the perspective transformation matrix in the video image
  • the two-dimensional sticker is determined in the display area of the video image according to the preset number of third key points, so that The two-dimensional sticker drawn in the display area has a three-dimensional effect.
  • step S141 specifically includes:
  • Step S1411 Construct a coefficient matrix according to the coordinates of the preset number of first key points and the coordinates of the preset number of second key points.
  • the coefficient matrix is a square matrix, and the dimension of the square matrix depends on the preset number.
  • the coordinates corresponding to the 4 first key points are marked as (u1, v1), (u2, v2), (u3, v3), (u4, v4)), 4
  • the coordinates corresponding to the second key point are (x1, y1), (x2, y2), (x3, y3), (x4, y4)), and the following coefficient matrix can be constructed:
  • Step S1412 Construct a first one-dimensional matrix according to the coordinates of the preset number of first key points.
  • the coordinates corresponding to the four first key points are (u1, v1), (u2, v2), (u3, v3), (u4, v4)), and the four coordinates are arranged vertically in turn, and the following can be obtained One-dimensional matrix:
  • Step S1413 Use the perspective transformation matrix as an unknown matrix and transform it into a second one-dimensional matrix.
  • the perspective transformation matrix may be the following 3*3 square matrix:
  • m0, m1, m2, m3, m4, m5, m6, and m7 are unknown numbers, which can be converted into the following one-dimensional matrix:
  • Step S1414 Form a first matrix equation according to the coefficient matrix, the first one-dimensional matrix, and the second one-dimensional matrix; wherein, the first matrix equation is that the first one-dimensional matrix is equal to the coefficient The matrix is multiplied by the second one-dimensional matrix.
  • the following first matrix equation can be formed according to the above coefficient matrix, the first one-dimensional matrix, and the second one-dimensional matrix:
  • Step S1415 Obtain the second one-dimensional matrix by solving the first matrix equation.
  • Step S1416 Determine the perspective transformation matrix according to the second one-dimensional matrix.
  • the second one-dimensional matrix is converted from the perspective transformation matrix, and after the second one-dimensional matrix is solved, the perspective transformation matrix is restored according to the second one-dimensional matrix.
  • step S1415 specifically includes:
  • Step A Decompose the coefficient matrix into the product of the first matrix and the second matrix.
  • Step B Use the product of the second matrix and the second one-dimensional matrix as a third matrix.
  • Step C Convert the first matrix equation into a second matrix equation according to the third matrix; wherein, the second matrix equation is that the first one-dimensional matrix is equal to the first matrix multiplied by the first matrix.
  • Step D Obtain the third matrix by solving the second matrix equation.
  • the third matrix c can be obtained by solving the second matrix equation.
  • Step E Determine the second one-dimensional matrix according to the third matrix and the second matrix.
  • step S15 specifically includes:
  • Step S151 Determine the mapping relationship between the pixel points in each position in the display area and the pixel points in the two-dimensional sticker.
  • the pixel point of each position in the display area has a certain corresponding relationship with the pixel point in the two-dimensional sticker.
  • a pixel in one position in the display area corresponds to pixels in multiple adjacent positions in the two-dimensional sticker.
  • the pixel values of the pixels in multiple adjacent positions in the two-dimensional sticker that is, the color values, are averaged to obtain the pixel values of the pixels in the corresponding positions in the display area.
  • a pixel point in a position in the display area corresponds to a pixel point in a corresponding position in the two-dimensional sticker.
  • Step S152 Draw the two-dimensional sticker in the display area according to the mapping relationship.
  • step S151 specifically includes:
  • Step S1511 Construct a third one-dimensional matrix for each pixel at each position in the display area.
  • the coordinate of the pixel is marked as (u, v), and it is converted into the following one-dimensional column matrix:
  • w m6x+m7y+1, where (x, y) are the coordinates of the corresponding pixel in the two-dimensional sticker.
  • Step S1512 Use the product of the third one-dimensional matrix and the inverse matrix of the perspective transformation matrix as the corresponding pixel in the two-dimensional sticker.
  • the corresponding pixels in the two-dimensional sticker can be further determined according to the following perspective transformation formula:
  • step S152 specifically includes:
  • Step S1521 For the pixel point of each position in the display area, obtain the corresponding pixel point in the two-dimensional sticker.
  • Step S1522 Draw a pixel at each position in the display area according to the pixel value of the corresponding pixel in the two-dimensional sticker.
  • the two-dimensional sticker is a rectangular sticker and the corresponding key points are vertices as an example to explain the present disclosure.
  • the image processing method mainly includes the following steps S21 to Step S25.
  • Step S21 Obtain a video image; wherein the video image includes a two-dimensional sticker, and the two-dimensional sticker includes a rectangular area.
  • Step S22 Perform vertex detection on the video image to obtain 4 vertices associated with the rectangular area.
  • the closed area formed by the 4 vertices may be a rectangular area or a quadrilateral area.
  • Step S23 Obtain 4 vertices of the marked rectangular area.
  • Step S24 Determine the perspective transformation matrix according to the 4 vertices of the detected rectangular area and the 4 vertices of the marked rectangular area.
  • the coordinates corresponding to the four vertices of the detected rectangular area are respectively marked as (u1, v1), (u2, v2), (u3, v3), (u4, v4)), and the coordinates of the marked rectangular area
  • the coordinates of the 4 vertices are marked as (x1, y1), (x2, y2), (x3, y3), (x4, y4)), and the following coefficient matrix can be constructed:
  • the perspective transformation matrix is further obtained by solving the following matrix equation:
  • Step S25 Determine 4 vertices of the two-dimensional sticker according to the perspective transformation matrix.
  • Step S26 Determine the display area of the two-dimensional sticker in the video image according to the four vertices of the two-dimensional sticker.
  • Step S27 Draw the two-dimensional sticker on the display area.
  • the device embodiments of the present disclosure can be used to perform the steps implemented by the method embodiments of the present disclosure.
  • an embodiment of the present disclosure provides an image processing device.
  • the device can execute the steps in the image processing method embodiment described in the first embodiment.
  • the device mainly includes: an image acquisition module 31, a key point detection module 32, a key point acquisition module 33, a display area determination module 34, and a sticker display module 35; among them,
  • the image acquisition module 31 is used to acquire a video image; wherein the video image includes a two-dimensional sticker, and the two-dimensional sticker includes a target area;
  • the key point detection module 32 is configured to perform key point detection on the video image to obtain a preset number of first key points associated with the target area;
  • the key point acquisition module 33 is configured to acquire the preset number of marked second key points associated with the target area
  • the display area determining module 34 is configured to determine the display area of the two-dimensional sticker in the video image according to the preset number of first key points and the preset number of second key points;
  • the sticker display module 35 is used for drawing the two-dimensional sticker on the display area.
  • the display area determination module 34 includes: a matrix determination unit 341, a key point determination unit 342, and a display area determination unit 343; wherein,
  • the matrix determining unit 341 is configured to determine the perspective transformation matrix according to the correspondence between the preset number of first key points and the preset number of second key points;
  • the key point determining unit 342 is configured to determine the preset number of third key points corresponding to the two-dimensional sticker in the video image according to the perspective transformation matrix;
  • the display area determining unit 343 is configured to determine the display area of the two-dimensional sticker in the video image according to the preset number of third key points.
  • the matrix determining unit 341 is specifically configured to: construct a coefficient matrix according to the coordinates of the preset number of first key points and the coordinates of the preset number of second key points; Construct a first one-dimensional matrix with the coordinates of the first key point of the number; take the perspective transformation matrix as an unknown matrix and convert it into a second one-dimensional matrix; according to the coefficient matrix, the first one-dimensional matrix, and the The second one-dimensional matrix forms a first matrix equation; wherein, the first matrix equation is that the first one-dimensional matrix is equal to the coefficient matrix multiplied by the second one-dimensional matrix; by solving the first matrix The second one-dimensional matrix is obtained by the equation; the perspective transformation matrix is determined according to the second one-dimensional matrix.
  • the matrix determining unit 341 is specifically configured to: decompose the coefficient matrix into the product of a first matrix and a second matrix; and use the product of the second matrix and the second one-dimensional matrix as the third matrix Convert the first matrix equation to a second matrix equation according to the third matrix; wherein, the second matrix equation is that the first one-dimensional matrix is equal to the first matrix multiplied by the third matrix
  • the third matrix is obtained by solving the second matrix equation; the second one-dimensional matrix is determined according to the third matrix and the second matrix.
  • the display area determining unit 343 is specifically configured to: determine the mapping relationship between the pixel points of each position in the display area and the pixels in the two-dimensional sticker; The two-dimensional sticker is drawn in the area.
  • the display area determining unit 343 is specifically configured to: construct a third one-dimensional matrix for each pixel at each position in the display area; and combine the third one-dimensional matrix with the perspective transformation matrix.
  • the product of the inverse matrix is used as the corresponding pixel in the two-dimensional sticker.
  • the display area determining unit 343 is specifically configured to: for a pixel point at each position in the display area, obtain a corresponding pixel point in the two-dimensional sticker; according to the corresponding pixel point in the two-dimensional sticker The pixel value of the pixel draws the pixel of each position in the display area.
  • the preset number of first key points associated with the target area are four vertices of the detected target area; the preset number associated with the target area The second key point of the number is the four vertices of the marked target area.
  • Terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), vehicle-mounted terminals (e.g. Mobile terminals such as car navigation terminals) and fixed terminals such as digital TVs, desktop computers, etc.
  • the electronic device shown in FIG. 4 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
  • the electronic device 400 may include a processing device (such as a central processing unit, a graphics processor, etc.) 401, which may be loaded into a random access device according to a program stored in a read-only memory (ROM) 402 or from a storage device 406.
  • the program in the memory (RAM) 403 executes various appropriate actions and processing.
  • various programs and data required for the operation of the electronic device 400 are also stored.
  • the processing device 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404.
  • An input/output (I/O) interface 405 is also connected to the bus 404.
  • the following devices can be connected to the I/O interface 405: including input devices 406 such as touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; including, for example, liquid crystal displays (LCD), speakers, vibration An output device 407 such as a device; a storage device 406 such as a magnetic tape, a hard disk, etc.; and a communication device 409.
  • the communication device 409 may allow the electronic device 400 to perform wireless or wired communication with other devices to exchange data.
  • FIG. 4 shows an electronic device 400 having various devices, it should be understood that it is not required to implement or have all of the illustrated devices. It may alternatively be implemented or provided with more or fewer devices.
  • the process described above with reference to the flowchart can be implemented as a computer software program.
  • the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, and the computer program contains program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from the network through the communication device 409, or installed from the storage device 406, or installed from the ROM 402.
  • the processing device 401 the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
  • the aforementioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or a combination of any of the above. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable removable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, and a computer-readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium.
  • the computer-readable signal medium may send, propagate, or transmit the program for use by or in combination with the instruction execution system, apparatus, or device .
  • the program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wire, optical cable, RF (Radio Frequency), etc., or any suitable combination of the above.
  • the client and server can communicate with any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with digital data in any form or medium.
  • Communication e.g., communication network
  • Examples of communication networks include local area networks (“LAN”), wide area networks (“WAN”), the Internet (for example, the Internet), and end-to-end networks (for example, ad hoc end-to-end networks), as well as any currently known or future research and development network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist alone without being assembled into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs.
  • the electronic device obtains a video image; wherein the video image contains a two-dimensional sticker, and The two-dimensional sticker includes a target area; key points are detected on the video image to obtain a preset number of first key points associated with the target area; all marked points associated with the target area are obtained The preset number of second key points; according to the preset number of first key points and the preset number of second key points, it is determined that the two-dimensional sticker is in the display area of the video image Draw the two-dimensional sticker in the display area.
  • the computer program code used to perform the operations of the present disclosure can be written in one or more programming languages or a combination thereof.
  • the above-mentioned programming languages include but are not limited to object-oriented programming languages such as Java, Smalltalk, C++, and Including conventional procedural programming languages-such as "C" language or similar programming languages.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to pass Internet connection).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagram may represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logical function Executable instructions.
  • the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments described in the present disclosure can be implemented in software or hardware. Wherein, the name of the unit does not constitute a limitation on the unit itself under certain circumstances.
  • the first obtaining unit can also be described as "a unit for obtaining at least two Internet Protocol addresses.”
  • exemplary types of hardware logic components include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Product (ASSP), System on Chip (SOC), Complex Programmable Logical device (CPLD) and so on.
  • FPGA Field Programmable Gate Array
  • ASIC Application Specific Integrated Circuit
  • ASSP Application Specific Standard Product
  • SOC System on Chip
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may be a tangible medium, which may contain or store a program for use by the instruction execution system, apparatus, or device or in combination with the instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • the machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing.
  • machine-readable storage media would include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read-only memory
  • EPROM or flash memory erasable programmable read-only memory
  • CD-ROM compact disk read only memory
  • magnetic storage device or any suitable combination of the foregoing.
  • an image processing method including:
  • the video image includes a two-dimensional sticker, and the two-dimensional sticker includes a target area;
  • the two-dimensional sticker is drawn on the display area.
  • the determining the display area of the two-dimensional sticker in the video image according to the preset number of first key points and the preset number of second key points includes:
  • the display area of the two-dimensional sticker in the video image is determined according to the preset number of third key points.
  • the determining the perspective transformation matrix according to the correspondence between the preset number of first key points and the preset number of second key points includes:
  • the perspective transformation matrix is determined according to the second one-dimensional matrix.
  • the obtaining the second one-dimensional matrix by solving the first matrix equation includes:
  • the second one-dimensional matrix is determined according to the third matrix and the second matrix.
  • drawing the two-dimensional sticker in the display area includes:
  • the determining the mapping relationship between the pixels in each position in the display area and the pixels in the two-dimensional sticker includes:
  • the product of the third one-dimensional matrix and the inverse matrix of the perspective transformation matrix is used as the corresponding pixel in the two-dimensional sticker.
  • drawing the two-dimensional sticker in the display area according to the mapping relationship includes:
  • the preset number of first key points associated with the target area are four vertices of the detected target area; the preset number associated with the target area The second key point of the number is the four vertices of the marked target area.
  • an image processing apparatus including:
  • An image acquisition module for acquiring a video image; wherein the video image includes a two-dimensional sticker, and the two-dimensional sticker includes a target area;
  • a key point detection module configured to perform key point detection on the video image to obtain a preset number of first key points associated with the target area
  • a key point acquisition module configured to acquire the preset number of marked second key points associated with the target area
  • a display area determining module configured to determine the display area of the two-dimensional sticker in the video image according to the preset number of first key points and the preset number of second key points;
  • the sticker display module is used to draw the two-dimensional sticker in the display area.
  • the display area determination module includes:
  • a matrix determining unit configured to determine a perspective transformation matrix according to the correspondence between the preset number of first key points and the preset number of second key points;
  • a key point determining unit configured to determine the preset number of third key points corresponding to the two-dimensional sticker in the video image according to the perspective transformation matrix
  • the display area determining unit is configured to determine the display area of the two-dimensional sticker in the video image according to the preset number of third key points.
  • the matrix determining unit is specifically configured to: construct a coefficient matrix according to the coordinates of the preset number of first key points and the coordinates of the preset number of second key points; Construct a first one-dimensional matrix with the coordinates of the first key point of the number; take the perspective transformation matrix as an unknown matrix and convert it into a second one-dimensional matrix; according to the coefficient matrix, the first one-dimensional matrix, the The second one-dimensional matrix forms a first matrix equation; wherein, the first matrix equation is that the first one-dimensional matrix is equal to the coefficient matrix multiplied by the second one-dimensional matrix; by solving the first matrix equation Obtain the second one-dimensional matrix; determine the perspective transformation matrix according to the second one-dimensional matrix.
  • the matrix determining unit is specifically configured to: decompose the coefficient matrix into a product of a first matrix and a second matrix; use the product of the second matrix and the second one-dimensional matrix as the third matrix; Transforming the first matrix equation into a second matrix equation according to the third matrix; wherein, the second matrix equation is that the first one-dimensional matrix is equal to the first matrix multiplied by the third matrix; The third matrix is obtained by solving the second matrix equation; the second one-dimensional matrix is determined according to the third matrix and the second matrix.
  • the display area determining unit is specifically configured to: determine the mapping relationship between pixels in each position in the display area and the pixels in the two-dimensional sticker; according to the mapping relationship in the display area Draw the two-dimensional sticker.
  • the display area determining unit is specifically configured to: construct a third one-dimensional matrix for each pixel at each position in the display area; and combine the third one-dimensional matrix with the inverse of the perspective transformation matrix The product of the matrix is used as the corresponding pixel in the two-dimensional sticker.
  • the display area determining unit is specifically configured to: for a pixel point at each position in the display area, obtain a corresponding pixel point in the two-dimensional sticker; according to the corresponding pixel point in the two-dimensional sticker The pixel value of the point draws the pixel point of each position in the display area.
  • the preset number of first key points associated with the target area are four vertices of the detected target area; the preset number associated with the target area The second key point of the number is the four vertices of the marked target area.
  • an electronic device including:
  • Memory for storing non-transitory computer readable instructions
  • the processor is configured to run the computer-readable instructions so that the processor implements the above-mentioned image processing method when executed.
  • a computer-readable storage medium for storing non-transitory computer-readable instructions.
  • the non-transitory computer-readable instructions are executed by a computer, the The computer executes the above-mentioned image processing method.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Processing Or Creating Images (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

本公开公开了一种图像处理方法、装置、电子设备和计算机可读存储介质。其中方法包括:获取视频图像;视频图像中包含二维贴纸,且二维贴纸中包含目标区域;对视频图像进行关键点检测得到目标区域的第一关键点;获取标记的目标区域的第二关键点;根据第一关键点和第二关键点确定二维贴纸在视频图像的显示区域;在显示区域绘制二维贴纸。本公开实施例通过对视频图像进行关键点检测得到与二维贴纸中目标区域的第一关键点,并获取标记的目标区域的第二关键点;根据第一关键点和第二关键点确定二维贴纸在视频图像的显示区域,在显示区域绘制二维贴纸,可以根据二维贴纸的目标区域自适应调整在视频图像的显示区域,使视频画面更加灵动,人机交互更加智能。

Description

图像处理方法及装置
相关申请的交叉引用
本申请要求于2019年09月17日提交的,申请号为201910876526.9、发明名称为“图像处理方法及装置”的中国专利申请的优先权,该申请的全文通过引用结合在本申请中。
技术领域
本公开涉及图像处理技术领域,特别是涉及一种图像处理方法、装置和计算机可读存储介质。
背景技术
随着互联网及计算机技术的不断发展,各式各样的终端营运而生,由于终端中的一些应用程序,尤其是视频播放类应用程序(例如抖音短视频、快手等),是用户休闲娱乐的首选。而在一些应用场景下通常对视频进行特效处理,以增强视频互动效果,例如,贴上一些有趣的贴纸。
在现有技术中,通常在视频中贴上二维贴纸,即将二维贴纸拉伸到视频中的固定区域中显示,但是上述贴纸显示方法,使得视频画面缺少灵动性,人机交互不够智能。
发明内容
提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。
本公开解决的技术问题是提供一种图像处理方法,以至少部分地解决现有技术中视频画面缺少灵动性,人机交互不够智能的技术问题。此外,还提供一种图像处理装置、图像处理硬件装置、计算机可读存储介质和图像处理终端。
为了实现上述目的,根据本公开的一个方面,提供以下技术方案:
一种图像处理方法,包括:
获取视频图像;其中,所述视频图像中包含二维贴纸,且所述二维贴纸中包含目标区域;
对所述视频图像进行关键点检测,得到与所述目标区域相关联的预设个数的第一关键点;
获取标记的与所述目标区域相关联的所述预设个数的第二关键点;
根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域;
在所述显示区域绘制所述二维贴纸。
为了实现上述目的,根据本公开的一个方面,提供以下技术方案:
一种图像处理装置,包括:
图像获取模块,用于获取视频图像;其中,所述视频图像中包含二维贴纸,且所述二维贴纸中包含目标区域;
关键点检测模块,用于对所述视频图像进行关键点检测,得到与所述目标区域相关联的预设个数的第一关键点;
关键点获取模块,用于获取标记的与所述目标区域相关联的所述预设个数的第二关键点;
显示区域确定模块,用于根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域;
贴纸显示模块,用于在所述显示区域绘制所述二维贴纸。
为了实现上述目的,根据本公开的一个方面,提供以下技术方案:
一种电子设备,包括:
存储器,用于存储非暂时性计算机可读指令;以及
处理器,用于运行所述计算机可读指令,使得所述处理器执行时实现上述任一项所述的图像处理方法。
为了实现上述目的,根据本公开的一个方面,提供以下技术方案:
一种计算机可读存储介质,用于存储非暂时性计算机可读指令,当所述非暂时性计算机可读指令由计算机执行时,使得所述计算机执行上述任一项所述的图像处理方法。
为了实现上述目的,根据本公开的又一个方面,还提供以下技术方案:
一种图像处理终端,包括上述任一图像处理装置。
本公开实施例通过对视频图像进行关键点检测,得到与二维贴纸中目标区域相关联的预设个数的第一关键点,并获取标记的与所述目标区域相关联的所述预设个数的第二关键点;根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域,在所述显示区域绘制所述二维贴纸,可以根据二维贴纸的目标区域自适应调整在视频图像的显示区域,使视频画面更加灵动,人机交互更加智能。
上述说明仅是本公开技术方案的概述,为了能更清楚了解本公开的技术手段,而可依照说明书的内容予以实施,并且为让本公开的上述和其他目的、特征和优点能够更明显易懂,以下特举较佳实施例,并配合附图,详细说明如下。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。
图1为根据本公开一个实施例的图像处理方法的流程示意图;
图2为根据本公开一个实施例的图像处理方法的流程示意图;
图3为根据本公开一个实施例的图像处理装置的流程示意图;
图4为根据本公开一个实施例的电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
实施例一
为了解决现有技术中视频画面缺少灵动性,人机交互不够智能的技术问题,本公开实施例提供一种图像处理方法。如图1所示,该图像处理方法主要包括如下步骤S11至步骤S15。
步骤S11:获取视频图像;其中,所述视频图像中包含二维贴纸,且所述二维贴纸中包含目标区域。
其中,视频图像可以为实时输入的视频流,例如,短视频应用中的直播视频,也可以为预先存储在终端中的视频图像。其中,终端可以为移动终端,例如智能手机、平板电脑,也可以为固定终端,例如台式电脑。
其中,二维贴纸为用户希望自己的视频更有个性,更加完美,在视频图像里添加的自己喜欢的壁纸。具体可以为包含人物(例如喜欢的明星、自拍照片、好友照片等)、或优美风景、或喜欢的动物的贴纸。该二维贴纸可以为三角形贴纸、矩形贴纸、圆形贴纸、或多边形贴纸等,这里不做具体限定。
其中,目标区域可以由用户自定义设置,具体可以选择二维贴纸中的人物图像区域、或风景图像区域、或动物图像区域作为目标区域。该目标区域可以为三角区域、矩形区域、圆形区域、或多边形区域(大于或等于四边形)等,这里不做具体限定。
步骤S12:对所述视频图像进行关键点检测,得到与所述目标区域相关联的预设个数的第一关键点。
其中,预设个数可以由用户自定义设置,或根据目标区域的形状设定。例如,当目标区域为三角区域时,对应的预设个数为三;当目标区域为矩形区域时,对应的预设个数为四;当目标区域为圆形区域时,对应的预设个数为至少三个;当目标区域为多边形区域时,对应的预设个数为多边形区域的顶点个数。
其中,第一关键点可以为目标区域上的点,例如目标区域的顶点,或目标区域边界上的点;也可以为目标区域周围的点,该周围的点与所述目标区域具有一定的位置关系,例如,目标区域的顶点的邻点。
具体的,可采用增强现实(Augmented Reality,AR)扫一扫对所述视频图像进行关键点检测,得到与所述目标区域相关联的预设个数的第一关键点。该AR扫一扫可采用以下任意一种关键点检测算法实现:基于高斯拉普拉斯算子检测算法(LOG)、基于像素点Hessian矩阵(二阶微分)及其行列式值的检测算法(DOH)、尺度不变特征变换 检测算法(SIFT)、加速鲁棒特征的SIFT检测算法(SURF)等。
步骤S13:获取标记的与所述目标区域相关联的所述预设个数的第二关键点。
其中,第二关键点为标记的二维贴纸中与所述目标区域相关联的点。该第二关键点的数量和位置与所述第一关键点相对应。例如,当所述第一关键点为目标区域上的点时,该第二关键点也为目标区域上的点,例如目标区域的顶点,或目标区域边界上的点;当所述第一关键点为目标区域周围的点时,该第二关键点也为目标区域周围的点,例如,目标区域的顶点的邻点。
具体的,可以采用人工预先标记二维贴纸中与所述目标区域相关联的所述预设个数的第二关键点。将标记的第二关键点存储在本地数据库,或者发送至服务器进行存储,该服务器可以为短视频应用对应的服务器。本步骤在获取时,从本地库或服务器获取。
步骤S14:根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域。
其中,显示区域的形状与二维贴纸的形状相对应,例如当二维贴纸的形状为三角形时,对应的显示区域为三角区域;当二维贴纸的形状为矩形时,对应的显示区域为矩形区域;当二维贴纸的形状为圆形时,对应的显示区域为圆形区域;当二维贴纸的形状为多边形时,对应的显示区域为多边形区域,等等,这里不做具体限定。
步骤S15:在所述显示区域绘制所述二维贴纸。
具体的,在绘制时,将二维贴纸上包含的各种元素(包括人物、文字、背景灯)绘制在在所述显示区域的相应位置。
本实施例通过对视频图像进行关键点检测,得到与二维贴纸中目标区域相关联的预设个数的第一关键点,并获取标记的与所述目标区域相关联的所述预设个数的第二关键点;根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域,在所述显示区域绘制所述二维贴纸,可以根据二维贴纸的目标区域自适应调整在视频图像的显示区域,使视频画面更加灵动,人机交互更加智能。
在一个可选的实施例中,步骤S14具体包括:
步骤S141:根据所述预设个数的第一关键点和所述预设个数的第二关键点的对应关系,确定透视变换矩阵。
其中,透视变换矩阵为一个方形矩阵,该方形矩阵的维度可以为3。
步骤S142:根据所述透视变换矩阵在所述视频图像中确定所述二维贴纸对应的所述预设个数的第三关键点。
其中,透视变换矩阵记录了标记的二维贴纸中的关键点与视频图像中检测到的二维贴纸中的关键点的对应关系,在已知标记的二维贴纸中的关键点的情况下,可以根据透视变换矩阵确定其在视频图像中对应的的关键点。
其中,预设个数可以由用户自定义设置,或根据二维贴纸的形状设定。例如,当二维贴纸为三角区域时,对应的预设个数为三;当二维贴纸为矩形区域时,对应的预设个数为四;当二维贴纸为圆形区域时,对应的预设个数为至少三个;当二维贴纸为多边形区域时,对应的预设个数为多边形区域的顶点个数。
其中,第三关键点为二维贴纸上的点,例如二维贴纸的顶点,或二维贴纸边界上的点。
步骤S143:根据所述预设个数的第三关键点确定所述二维贴纸在所述视频图像的显示区域。
具体的,将确定的预设个数的第三关键点依次连线,将形成的闭合区域作为显示区域。其中,显示区域的形状与二维贴纸的形状相对应,例如当二维贴纸的形状为三角形时,对应的显示区域为三角区域;当二维贴纸的形状为矩形时,对应的显示区域为矩形区域;当二维贴纸的形状为圆形时,对应的显示区域为圆形区域;当二维贴纸的形状为多边形时,对应的显示区域为多边形区域,等等,这里不做具体限定。
本实施例通过根据所述预设个数的第一关键点和所述预设个数的第二关键点的对应关系,确定透视变换矩阵,并进一步根据所述透视变换矩阵在所述视频图像中确定所述二维贴纸对应的所述预设个数的第三关键点,根据所述预设个数的第三关键点确定所述二维贴纸在所述视频图像的显示区域,可以使得在该显示区域绘制的二维贴纸具有三维效果。
在一个可选的实施例中,步骤S141具体包括:
步骤S1411:根据所述预设个数的第一关键点的坐标和所述预设个数的第二关键点的坐标构造系数矩阵。
其中,该系数矩阵为一个方形矩阵,该方形矩阵的维度取决于所述预设个数。
例如,当预设个数为4时,4个第一关键点对应的坐标分别标记 为(u1,v1)、(u2,v2)、(u3,v3)、(u4,v4)),4个第二关键点对应的坐标分别为(x1,y1)、(x2,y2)、(x3,y3)、(x4,y4)),可以构造如下系数矩阵:
Figure PCTCN2020110182-appb-000001
步骤S1412:根据所述预设个数的第一关键点的坐标构造第一一维矩阵。
例如,4个第一关键点对应的坐标分别为(u1,v1)、(u2,v2)、(u3,v3)、(u4,v4)),将该4个坐标依次纵向排列,可以得到如下一维矩阵:
Figure PCTCN2020110182-appb-000002
步骤S1413:将所述透视变换矩阵作为未知矩阵,并转换为第二一维矩阵。
例如,所述透视变换矩阵可以为如下3*3的方形矩阵:
Figure PCTCN2020110182-appb-000003
其中,m0、m1、m2、m3、m4、m5、m6、m7为未知数,可以将其转换为如下一维矩阵:
Figure PCTCN2020110182-appb-000004
步骤S1414:根据所述系数矩阵、所述第一一维矩阵、所述第二一维矩阵组建第一矩阵方程;其中,所述第一矩阵方程为所述第一一维矩阵等于所述系数矩阵乘以所述第二一维矩阵。
例如,根据上述步骤中的例子,可以根据上述系数矩阵、第一一维矩阵、第二一维矩阵组建如下第一矩阵方程:
Figure PCTCN2020110182-appb-000005
步骤S1415:通过求解所述第一矩阵方程得到所述第二一维矩阵。
步骤S1416:根据所述第二一维矩阵确定所述透视变换矩阵。
其中,所述第二一维矩阵由透视变换矩阵转换而来,在求解出第二一维矩阵后,再根据其还原透视变换矩阵。
在一个可选的实施例中,步骤S1415具体包括:
步骤A:将所述系数矩阵分解为第一矩阵和第二矩阵的乘积。
例如,将系数矩阵记为A,可以将A作如下分解:A=L*U,其中,L为第一矩阵,U为第二矩阵。
步骤B:将所述第二矩阵与所述第二一维矩阵的乘积作为第三矩阵。
例如,将第三矩阵记为c,将所述第二一维矩阵记为B,则c=U*B。
步骤C:根据所述第三矩阵将所述第一矩阵方程转换为第二矩阵方程;其中,所述第二矩阵方程为所述第一一维矩阵等于所述第一矩阵乘以所述第三矩阵。
例如,将第一一维矩阵记为b,则对应的第一矩阵方程为A*B=b,由于A=L*U及c=U*B,则可以得到第二矩阵方程L*c=b。
步骤D:通过求解所述第二矩阵方程得到所述第三矩阵。
在所述第二矩阵方程中,由于L和b均为已知矩阵,因此可以通过求解所述第二矩阵方程得到所述第三矩阵c。
步骤E:根据所述第三矩阵和所述第二矩阵确定所述第二一维矩阵。
在步骤D已经通过求解所述第二矩阵方程得到所述第三矩阵c,又由于c=U*B,而U为已知矩阵,因此可以计算出第二一维矩阵B为U的逆矩阵乘以c。
在一个可选的实施例中,步骤S15具体包括:
步骤S151:确定所述显示区域内的每个位置的像素点与所述二维贴纸中的像素点的映射关系。
其中,显示区域内的每个位置的像素点与所述二维贴纸中的像素点具有一定的对应关系。例如,当显示区域内的像素点小于二维贴纸 中的像素点个数时,显示区域内的一个位置的像素点对应二维贴纸中的相邻多个位置的像素点。例如,对二维贴纸中的相邻多个位置的像素点的像素值即颜色值求平均,得到显示区域内对应位置的像素点的像素值。当显示区域内的像素点等于二维贴纸中的像素点个数时,显示区域内的一个位置的像素点对应二维贴纸中的相应位置的像素点。当显示区域内的像素点多于二维贴纸中的像素点个数时,对二维贴纸中像素点进行插值,使其多于或等于显示区域内的像素点个数,进而再确定两者像素点的对应关系。
步骤S152:根据所述映射关系在所述显示区域绘制所述二维贴纸。
在一个可选的实施例中,步骤S151具体包括:
步骤S1511:对于所述显示区域内的每个位置的像素点,构造第三一维矩阵。
具体的,针对显示区域内的任一位置的像素点,将该像素点的坐标记为(u,v),将其转换为如下一维列矩阵:
Figure PCTCN2020110182-appb-000006
其中,w=m6x+m7y+1,其中,(x,y)为在所述二维贴纸中对应的像素点的坐标。
步骤S1512:将所述第三一维矩阵与所述透视变换矩阵的逆矩阵的乘积作为在所述二维贴纸中对应的像素点。
由于第三一维矩阵为已知矩阵,可以进一步根据如下透视变换公式确定在所述二维贴纸中对应的像素点:
Figure PCTCN2020110182-appb-000007
在一个可选的实施例中,步骤S152具体包括:
步骤S1521:对于所述显示区域内的每个位置的像素点,获取在所述二维贴纸中对应的像素点。
步骤S1522:根据所述二维贴纸中对应的像素点的像素值绘制所述显示区域内的每个位置的像素点。
实施例二
本实施例为一具体实现,本实施例以二维贴纸为矩形贴纸、对应的关键点为顶点为例,对本公开进行解释说明,如图2所示,该图像处理方法主要包括如下步骤S21至步骤S25。
步骤S21:获取视频图像;其中,所述视频图像中包含二维贴纸,且所述二维贴纸中包含矩形区域。
步骤S22:对所述视频图像进行顶点检测,得到与所述矩形区域相关联的4个顶点。
其中,该4个顶点形成的闭合区域可以为矩形区域,也可以为四边形区域。
步骤S23:获取标记的所述矩形区域的4个顶点。
步骤S24:根据检测的矩形区域的4个顶点和标记的矩形区域的4个顶点,确定透视变换矩阵。
具体的,将检测到的矩形区域的4个顶点对应的坐标分别标记为(u1,v1)、(u2,v2)、(u3,v3)、(u4,v4)),将标记的矩形区域的4个顶点的坐标标记为(x1,y1)、(x2,y2)、(x3,y3)、(x4,y4)),可以构造如下系数 矩阵:
Figure PCTCN2020110182-appb-000008
进一步,根据检测到的矩形区域的4个顶点的坐标得到如下一维矩阵:
Figure PCTCN2020110182-appb-000009
将所述透视变换矩阵作为如下未知矩阵:
Figure PCTCN2020110182-appb-000010
并将其转换为如下一维矩阵:
Figure PCTCN2020110182-appb-000011
进一步根据如下矩阵方程求解得到所述透视变换矩阵:
Figure PCTCN2020110182-appb-000012
具体求解方法如下:将系数矩阵记为A,将所述透视变换矩阵转换的一维矩阵记为B,则得到如下矩形方程A*B=b。在这里可以将A作如下分解:A=L*U,则L*U*B=b,并将c=U*B,则L*c=b,由于L和b均为已知矩阵,因此可以通过求解得到c。
又由于c=U*B,而U为已知矩阵,因此可以计算出B为U的逆矩阵乘以c,进一步将b还原得到透视变换矩阵。
步骤S25:根据所述透视变换矩阵确定所述二维贴纸的4个顶点。
步骤S26:根据所述二维贴纸的4个顶点确定所述二维贴纸在所述视频图像的显示区域。
步骤S27:在所述显示区域绘制所述二维贴纸。
关于本实施例各步骤的详细描述参见上述实施例,这里不再赘述。
本领域技术人员应能理解,在上述各个实施例的基础上,还可以进行明显变型(例如,对所列举的模式进行组合)或等同替换。
在上文中,虽然按照上述的顺序描述了图像处理方法实施例中的各个步骤,本领域技术人员应清楚,本公开实施例中的步骤并不必然按照上述顺序执行,其也可以倒序、并行、交叉等其他顺序执行,而且,在上述步骤的基础上,本领域技术人员也可以再加入其他步骤,这些明显变型或等同替换的方式也应包含在本公开的保护范围之内, 在此不再赘述。
下面为本公开装置实施例,本公开装置实施例可用于执行本公开方法实施例实现的步骤,为了便于说明,仅示出了与本公开实施例相关的部分,具体技术细节未揭示的,请参照本公开方法实施例。
实施例三
为了解决现有技术中视频画面缺少灵动性,人机交互不够智能的技术问题,本公开实施例提供一种图像处理装置。该装置可以执行上述实施例一所述的图像处理方法实施例中的步骤。如图3所示,该装置主要包括:图像获取模块31、关键点检测模块32、关键点获取模块33、显示区域确定模块34和贴纸显示模块35;其中,
图像获取模块31用于获取视频图像;其中,所述视频图像中包含二维贴纸,且所述二维贴纸中包含目标区域;
关键点检测模块32用于对所述视频图像进行关键点检测,得到与所述目标区域相关联的预设个数的第一关键点;
关键点获取模块33用于获取标记的与所述目标区域相关联的所述预设个数的第二关键点;
显示区域确定模块34用于根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域;
贴纸显示模块35用于在所述显示区域绘制所述二维贴纸。
进一步的,所述显示区域确定模块34包括:矩阵确定单元341、关键点确定单元342和显示区域确定单元343;其中,
矩阵确定单元341用于根据所述预设个数的第一关键点和所述 预设个数的第二关键点的对应关系,确定透视变换矩阵;
关键点确定单元342用于根据所述透视变换矩阵在所述视频图像中确定所述二维贴纸对应的所述预设个数的第三关键点;
显示区域确定单元343用于根据所述预设个数的第三关键点确定所述二维贴纸在所述视频图像的显示区域。
进一步的,所述矩阵确定单元341具体用于:根据所述预设个数的第一关键点的坐标和所述预设个数的第二关键点的坐标构造系数矩阵;根据所述预设个数的第一关键点的坐标构造第一一维矩阵;将所述透视变换矩阵作为未知矩阵,并转换为第二一维矩阵;根据所述系数矩阵、所述第一一维矩阵、所述第二一维矩阵组建第一矩阵方程;其中,所述第一矩阵方程为所述第一一维矩阵等于所述系数矩阵乘以所述第二一维矩阵;通过求解所述第一矩阵方程得到所述第二一维矩阵;根据所述第二一维矩阵确定所述透视变换矩阵。
进一步的,所述矩阵确定单元341具体用于:将所述系数矩阵分解为第一矩阵和第二矩阵的乘积;将所述第二矩阵与所述第二一维矩阵的乘积作为第三矩阵;根据所述第三矩阵将所述第一矩阵方程转换为第二矩阵方程;其中,所述第二矩阵方程为所述第一一维矩阵等于所述第一矩阵乘以所述第三矩阵;通过求解所述第二矩阵方程得到所述第三矩阵;根据所述第三矩阵和所述第二矩阵确定所述第二一维矩阵。
进一步的,所述显示区域确定单元343具体用于:确定所述显示区域内的每个位置的像素点与所述二维贴纸中的像素点的映射关系;根据所述映射关系在所述显示区域绘制所述二维贴纸。
进一步的,所述显示区域确定单元343具体用于:对于所述显示 区域内的每个位置的像素点,构造第三一维矩阵;将所述第三一维矩阵与所述透视变换矩阵的逆矩阵的乘积作为在所述二维贴纸中对应的像素点。
进一步的,所述显示区域确定单元343具体用于:对于所述显示区域内的每个位置的像素点,获取在所述二维贴纸中对应的像素点;根据所述二维贴纸中对应的像素点的像素值绘制所述显示区域内的每个位置的像素点。
进一步的,所述与所述目标区域相关联的预设个数的第一关键点为检测出的所述目标区域的四个顶点;所述与所述目标区域相关联的所述预设个数的第二关键点为标记的所述目标区域的四个顶点。
实施例四
下面参考图4,其示出了适于用来实现本公开实施例的电子设备400的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图4示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图4所示,电子设备400可以包括处理装置(例如中央处理器、图形处理器等)401,其可以根据存储在只读存储器(ROM)402中的程序或者从存储装置406加载到随机访问存储器(RAM)403中的程序而执行各种适当的动作和处理。在RAM 403中,还存储有电子 设备400操作所需的各种程序和数据。处理装置401、ROM 402以及RAM 403通过总线404彼此相连。输入/输出(I/O)接口405也连接至总线404。
通常,以下装置可以连接至I/O接口405:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置406;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置407;包括例如磁带、硬盘等的存储装置406;以及通信装置409。通信装置409可以允许电子设备400与其他设备进行无线或有线通信以交换数据。虽然图4示出了具有各种装置的电子设备400,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置409从网络上被下载和安装,或者从存储装置406被安装,或者从ROM 402被安装。在该计算机程序被处理装置401执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算 机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端 网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取视频图像;其中,所述视频图像中包含二维贴纸,且所述二维贴纸中包含目标区域;对所述视频图像进行关键点检测,得到与所述目标区域相关联的预设个数的第一关键点;获取标记的与所述目标区域相关联的所述预设个数的第二关键点;根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域;在所述显示区域绘制所述二维贴纸。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定,例如,第一获取单元还可以被描述为“获取至少两个网际协议地址的单元”。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以 包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,提供了一种图像处理方法,包括:
获取视频图像;其中,所述视频图像中包含二维贴纸,且所述二维贴纸中包含目标区域;
对所述视频图像进行关键点检测,得到与所述目标区域相关联的预设个数的第一关键点;
获取标记的与所述目标区域相关联的所述预设个数的第二关键点;
根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域;
在所述显示区域绘制所述二维贴纸。
进一步的,所述根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域,包括:
根据所述预设个数的第一关键点和所述预设个数的第二关键点的对应关系,确定透视变换矩阵;
根据所述透视变换矩阵在所述视频图像中确定所述二维贴纸对应的所述预设个数的第三关键点;
根据所述预设个数的第三关键点确定所述二维贴纸在所述视频图像的显示区域。
进一步的,所述根据所述预设个数的第一关键点和所述预设个数的第二关键点的对应关系,确定透视变换矩阵,包括:
根据所述预设个数的第一关键点的坐标和所述预设个数的第二关键点的坐标构造系数矩阵;
根据所述预设个数的第一关键点的坐标构造第一一维矩阵;
将所述透视变换矩阵作为未知矩阵,并转换为第二一维矩阵;
根据所述系数矩阵、所述第一一维矩阵、所述第二一维矩阵组建第一矩阵方程;其中,所述第一矩阵方程为所述第一一维矩阵等于所述系数矩阵乘以所述第二一维矩阵;
通过求解所述第一矩阵方程得到所述第二一维矩阵;
根据所述第二一维矩阵确定所述透视变换矩阵。
进一步的,所述通过求解所述第一矩阵方程得到所述第二一维矩阵,包括:
将所述系数矩阵分解为第一矩阵和第二矩阵的乘积;
将所述第二矩阵与所述第二一维矩阵的乘积作为第三矩阵;
根据所述第三矩阵将所述第一矩阵方程转换为第二矩阵方程;其 中,所述第二矩阵方程为所述第一一维矩阵等于所述第一矩阵乘以所述第三矩阵;
通过求解所述第二矩阵方程得到所述第三矩阵;
根据所述第三矩阵和所述第二矩阵确定所述第二一维矩阵。
进一步的,所述在所述显示区域绘制所述二维贴纸,包括:
确定所述显示区域内的每个位置的像素点与所述二维贴纸中的像素点的映射关系;
根据所述映射关系在所述显示区域绘制所述二维贴纸。
进一步的,所述确定所述显示区域内的每个位置的像素点与所述二维贴纸中的像素点的映射关系,包括:
对于所述显示区域内的每个位置的像素点,构造第三一维矩阵;
将所述第三一维矩阵与所述透视变换矩阵的逆矩阵的乘积作为在所述二维贴纸中对应的像素点。
进一步的,所述根据所述映射关系在所述显示区域绘制所述二维贴纸,包括:
对于所述显示区域内的每个位置的像素点,获取在所述二维贴纸中对应的像素点;
根据所述二维贴纸中对应的像素点的像素值绘制所述显示区域内的每个位置的像素点。
进一步的,所述与所述目标区域相关联的预设个数的第一关键点为检测出的所述目标区域的四个顶点;所述与所述目标区域相关联的所述预设个数的第二关键点为标记的所述目标区域的四个顶点。
根据本公开的一个或多个实施例,提供了一种图像处理装置,包括:
图像获取模块,用于获取视频图像;其中,所述视频图像中包含二维贴纸,且所述二维贴纸中包含目标区域;
关键点检测模块,用于对所述视频图像进行关键点检测,得到与所述目标区域相关联的预设个数的第一关键点;
关键点获取模块,用于获取标记的与所述目标区域相关联的所述预设个数的第二关键点;
显示区域确定模块,用于根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域;
贴纸显示模块,用于在所述显示区域绘制所述二维贴纸。
进一步的,所述显示区域确定模块包括:
矩阵确定单元,用于根据所述预设个数的第一关键点和所述预设个数的第二关键点的对应关系,确定透视变换矩阵;
关键点确定单元,用于根据所述透视变换矩阵在所述视频图像中确定所述二维贴纸对应的所述预设个数的第三关键点;
显示区域确定单元,用于根据所述预设个数的第三关键点确定所述二维贴纸在所述视频图像的显示区域。
进一步的,所述矩阵确定单元具体用于:根据所述预设个数的第一关键点的坐标和所述预设个数的第二关键点的坐标构造系数矩阵;根据所述预设个数的第一关键点的坐标构造第一一维矩阵;将所述透 视变换矩阵作为未知矩阵,并转换为第二一维矩阵;根据所述系数矩阵、所述第一一维矩阵、所述第二一维矩阵组建第一矩阵方程;其中,所述第一矩阵方程为所述第一一维矩阵等于所述系数矩阵乘以所述第二一维矩阵;通过求解所述第一矩阵方程得到所述第二一维矩阵;根据所述第二一维矩阵确定所述透视变换矩阵。
进一步的,所述矩阵确定单元具体用于:将所述系数矩阵分解为第一矩阵和第二矩阵的乘积;将所述第二矩阵与所述第二一维矩阵的乘积作为第三矩阵;根据所述第三矩阵将所述第一矩阵方程转换为第二矩阵方程;其中,所述第二矩阵方程为所述第一一维矩阵等于所述第一矩阵乘以所述第三矩阵;通过求解所述第二矩阵方程得到所述第三矩阵;根据所述第三矩阵和所述第二矩阵确定所述第二一维矩阵。
进一步的,所述显示区域确定单元具体用于:确定所述显示区域内的每个位置的像素点与所述二维贴纸中的像素点的映射关系;根据所述映射关系在所述显示区域绘制所述二维贴纸。
进一步的,所述显示区域确定单元具体用于:对于所述显示区域内的每个位置的像素点,构造第三一维矩阵;将所述第三一维矩阵与所述透视变换矩阵的逆矩阵的乘积作为在所述二维贴纸中对应的像素点。
进一步的,所述显示区域确定单元具体用于:对于所述显示区域内的每个位置的像素点,获取在所述二维贴纸中对应的像素点;根据所述二维贴纸中对应的像素点的像素值绘制所述显示区域内的每个位置的像素点。
进一步的,所述与所述目标区域相关联的预设个数的第一关键点为检测出的所述目标区域的四个顶点;所述与所述目标区域相关联的 所述预设个数的第二关键点为标记的所述目标区域的四个顶点。
根据本公开的一个或多个实施例,提供了一种电子设备,包括:
存储器,用于存储非暂时性计算机可读指令;以及
处理器,用于运行所述计算机可读指令,使得所述处理器执行时实现上述的图像处理方法。
根据本公开的一个或多个实施例,提供了一种计算机可读存储介质,用于存储非暂时性计算机可读指令,当所述非暂时性计算机可读指令由计算机执行时,使得所述计算机执行上述的图像处理方法。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主 题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。

Claims (11)

  1. 一种图像处理方法,其特征在于,包括:
    获取视频图像;其中,所述视频图像中包含二维贴纸,且所述二维贴纸中包含目标区域;
    对所述视频图像进行关键点检测,得到与所述目标区域相关联的预设个数的第一关键点;
    获取标记的与所述目标区域相关联的所述预设个数的第二关键点;
    根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域;
    在所述显示区域绘制所述二维贴纸。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域,包括:
    根据所述预设个数的第一关键点和所述预设个数的第二关键点的对应关系,确定透视变换矩阵;
    根据所述透视变换矩阵在所述视频图像中确定所述二维贴纸对应的所述预设个数的第三关键点;
    根据所述预设个数的第三关键点确定所述二维贴纸在所述视频图像的显示区域。
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述预设个数的第一关键点和所述预设个数的第二关键点的对应关系,确定 透视变换矩阵,包括:
    根据所述预设个数的第一关键点的坐标和所述预设个数的第二关键点的坐标构造系数矩阵;
    根据所述预设个数的第一关键点的坐标构造第一一维矩阵;
    将所述透视变换矩阵作为未知矩阵,并转换为第二一维矩阵;
    根据所述系数矩阵、所述第一一维矩阵、所述第二一维矩阵组建第一矩阵方程;其中,所述第一矩阵方程为所述第一一维矩阵等于所述系数矩阵乘以所述第二一维矩阵;
    通过求解所述第一矩阵方程得到所述第二一维矩阵;
    根据所述第二一维矩阵确定所述透视变换矩阵。
  4. 根据权利要求3所述的方法,其特征在于,所述通过求解所述第一矩阵方程得到所述第二一维矩阵,包括:
    将所述系数矩阵分解为第一矩阵和第二矩阵的乘积;
    将所述第二矩阵与所述第二一维矩阵的乘积作为第三矩阵;
    根据所述第三矩阵将所述第一矩阵方程转换为第二矩阵方程;其中,所述第二矩阵方程为所述第一一维矩阵等于所述第一矩阵乘以所述第三矩阵;
    通过求解所述第二矩阵方程得到所述第三矩阵;
    根据所述第三矩阵和所述第二矩阵确定所述第二一维矩阵。
  5. 根据权利要求2-4任一项所述的方法,其特征在于,所述在所述显示区域绘制所述二维贴纸,包括:
    确定所述显示区域内的每个位置的像素点与所述二维贴纸中的像素点的映射关系;
    根据所述映射关系在所述显示区域绘制所述二维贴纸。
  6. 根据权利要求5所述的方法,其特征在于,所述确定所述显示区域内的每个位置的像素点与所述二维贴纸中的像素点的映射关系,包括:
    对于所述显示区域内的每个位置的像素点,构造第三一维矩阵;
    将所述第三一维矩阵与所述透视变换矩阵的逆矩阵的乘积作为在所述二维贴纸中对应的像素点。
  7. 根据权利要求5所述的方法,其特征在于,所述根据所述映射关系在所述显示区域绘制所述二维贴纸,包括:
    对于所述显示区域内的每个位置的像素点,获取在所述二维贴纸中对应的像素点;
    根据所述二维贴纸中对应的像素点的像素值绘制所述显示区域内的每个位置的像素点。
  8. 根据权利要求1-4和6-7任一项所述的方法,其特征在于,所述与所述目标区域相关联的预设个数的第一关键点为检测出的所述目标区域的四个顶点;所述与所述目标区域相关联的所述预设个数的第二关键点为标记的所述目标区域的四个顶点。
  9. 一种图像处理装置,其特征在于,包括:
    图像获取模块,用于获取视频图像;其中,所述视频图像中包含二维贴纸,且所述二维贴纸中包含目标区域;
    关键点检测模块,用于对所述视频图像进行关键点检测,得到与所述目标区域相关联的预设个数的第一关键点;
    关键点获取模块,用于获取标记的与所述目标区域相关联的所述预设个数的第二关键点;
    显示区域确定模块,用于根据所述预设个数的第一关键点和所述预设个数的第二关键点,确定所述二维贴纸在所述视频图像的显示区域;
    贴纸显示模块,用于在所述显示区域绘制所述二维贴纸。
  10. 一种电子设备,包括:
    存储器,用于存储非暂时性计算机可读指令;以及
    处理器,用于运行所述计算机可读指令,使得所述处理器执行时实现根据权利要求1-8任一项所述的图像处理方法。
  11. 一种计算机可读存储介质,用于存储非暂时性计算机可读指令,当所述非暂时性计算机可读指令由计算机执行时,使得所述计算机执行权利要求1-8任一项所述的图像处理方法。
PCT/CN2020/110182 2019-09-17 2020-08-20 图像处理方法及装置 WO2021052095A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/761,173 US20230300385A1 (en) 2019-09-17 2020-08-20 Image processing method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910876526.9A CN112529985A (zh) 2019-09-17 2019-09-17 图像处理方法及装置
CN201910876526.9 2019-09-17

Publications (1)

Publication Number Publication Date
WO2021052095A1 true WO2021052095A1 (zh) 2021-03-25

Family

ID=74882993

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/110182 WO2021052095A1 (zh) 2019-09-17 2020-08-20 图像处理方法及装置

Country Status (3)

Country Link
US (1) US20230300385A1 (zh)
CN (1) CN112529985A (zh)
WO (1) WO2021052095A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530594A (zh) * 2013-11-05 2014-01-22 深圳市幻实科技有限公司 一种提供增强现实的方法、系统及终端
CN107770602A (zh) * 2016-08-19 2018-03-06 北京市商汤科技开发有限公司 视频图像处理方法和装置
CN107770603A (zh) * 2016-08-19 2018-03-06 北京市商汤科技开发有限公司 视频图像处理方法和装置
CN109819316A (zh) * 2018-12-28 2019-05-28 北京字节跳动网络技术有限公司 处理视频中人脸贴纸的方法、装置、存储介质及电子设备

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100470452C (zh) * 2006-07-07 2009-03-18 华为技术有限公司 一种实现三维增强现实的方法及系统
US9314692B2 (en) * 2012-09-21 2016-04-19 Luxand, Inc. Method of creating avatar from user submitted image
WO2018033137A1 (zh) * 2016-08-19 2018-02-22 北京市商汤科技开发有限公司 在视频图像中展示业务对象的方法、装置和电子设备
WO2019051832A1 (zh) * 2017-09-18 2019-03-21 深圳市大疆创新科技有限公司 可移动物体控制方法、设备及系统
CN107679497B (zh) * 2017-10-11 2023-06-27 山东新睿信息科技有限公司 视频面部贴图特效处理方法及生成系统
CN108717719A (zh) * 2018-05-23 2018-10-30 腾讯科技(深圳)有限公司 卡通人脸图像的生成方法、装置及计算机存储介质
CN108876713B (zh) * 2018-06-28 2022-07-22 北京字节跳动网络技术有限公司 二维模板图像的映射方法、装置、终端设备和存储介质
CN108958610A (zh) * 2018-07-27 2018-12-07 北京微播视界科技有限公司 基于人脸的特效生成方法、装置和电子设备
CN109684911B (zh) * 2018-10-30 2021-05-11 百度在线网络技术(北京)有限公司 表情识别方法、装置、电子设备及存储介质
CN109522910B (zh) * 2018-12-25 2020-12-11 浙江商汤科技开发有限公司 关键点检测方法及装置、电子设备和存储介质
US10795527B1 (en) * 2019-04-26 2020-10-06 Capital One Services, Llc Systems and methods configured to provide the improved real time user experience involving mobile computing devices, a back-end server and NFC-coupled interactive posters including encryption, network operation and/or other features

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530594A (zh) * 2013-11-05 2014-01-22 深圳市幻实科技有限公司 一种提供增强现实的方法、系统及终端
CN107770602A (zh) * 2016-08-19 2018-03-06 北京市商汤科技开发有限公司 视频图像处理方法和装置
CN107770603A (zh) * 2016-08-19 2018-03-06 北京市商汤科技开发有限公司 视频图像处理方法和装置
CN109819316A (zh) * 2018-12-28 2019-05-28 北京字节跳动网络技术有限公司 处理视频中人脸贴纸的方法、装置、存储介质及电子设备

Also Published As

Publication number Publication date
CN112529985A (zh) 2021-03-19
US20230300385A1 (en) 2023-09-21

Similar Documents

Publication Publication Date Title
WO2020024483A1 (zh) 用于处理图像的方法和装置
WO2021027631A1 (zh) 图像特效处理方法、装置、电子设备和计算机可读存储介质
WO2020062494A1 (zh) 图像处理方法和装置
WO2021170013A1 (zh) 图像特效处理方法及装置
WO2021197024A1 (zh) 视频特效配置文件生成方法、视频渲染方法及装置
US20240289999A1 (en) Method, apparatus, device and storage medium for image generation
WO2022028254A1 (zh) 定位模型优化方法、定位方法和定位设备
US20220159197A1 (en) Image special effect processing method and apparatus, and electronic device and computer readable storage medium
CN110070496A (zh) 图像特效的生成方法、装置和硬件装置
US12041379B2 (en) Image special effect processing method, apparatus, and electronic device, and computer-readable storage medium
CN110070495B (zh) 图像的处理方法、装置和电子设备
US20220392129A1 (en) Sticker processing method and apparatus
CN110188782B (zh) 图像相似性确定方法、装置、电子设备及可读存储介质
WO2021227953A1 (zh) 图像特效配置方法、图像识别方法、装置及电子设备
WO2021052095A1 (zh) 图像处理方法及装置
US11805219B2 (en) Image special effect processing method and apparatus, electronic device and computer-readable storage medium
US20240007590A1 (en) Image processing method and apparatus, and electronic device, and computer readable medium
CN110070482A (zh) 图像处理方法、装置和计算机可读存储介质
CN111292247A (zh) 图像处理方法和装置
CN111221444A (zh) 分屏特效处理方法、装置、电子设备和存储介质
CN116360661A (zh) 特效处理方法、装置、电子设备及存储介质
WO2021027632A1 (zh) 图像特效处理方法、装置、电子设备和计算机可读存储介质
WO2022061723A1 (zh) 一种图像处理方法、设备、终端及存储介质
CN110189279B (zh) 模型训练方法、装置、电子设备及存储介质
CN114092362A (zh) 一种全景图片加载方法和装置

Legal Events

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

Ref document number: 20865592

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

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

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

122 Ep: pct application non-entry in european phase

Ref document number: 20865592

Country of ref document: EP

Kind code of ref document: A1