CN110796664B - Image processing method, device, electronic equipment and computer readable storage medium - Google Patents

Image processing method, device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN110796664B
CN110796664B CN201910974930.XA CN201910974930A CN110796664B CN 110796664 B CN110796664 B CN 110796664B CN 201910974930 A CN201910974930 A CN 201910974930A CN 110796664 B CN110796664 B CN 110796664B
Authority
CN
China
Prior art keywords
target object
image
frame
image frame
rectangular frame
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201910974930.XA
Other languages
Chinese (zh)
Other versions
CN110796664A (en
Inventor
吕绍辉
李小奇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201910974930.XA priority Critical patent/CN110796664B/en
Publication of CN110796664A publication Critical patent/CN110796664A/en
Application granted granted Critical
Publication of CN110796664B publication Critical patent/CN110796664B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/66Analysis of geometric attributes of image moments or centre of gravity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • 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/107Static hand or arm
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/07Target detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Geometry (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

The present disclosure discloses an image processing method, an image processing apparatus, an electronic device, and a computer-readable storage medium. The image processing method comprises the following steps: acquiring a first image frame of a video image, wherein the first image frame is an image frame played by the video image at the current moment; in response to detecting that the first image frame comprises a target object, dividing the target object from the first image frame to obtain a target object image; acquiring an external rectangular frame of the target object in the first image frame; calculating the drawing size and the drawing position of the target object image in the first image frame according to the circumscribed rectangular frame; and storing the target object image, the drawing size of the target object image and the drawing position of the target object image into a cache. By the method, the technical problem that the video effect cannot be simply and rapidly generated in the prior art is solved.

Description

Image processing method, device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of image processing, and in particular, to an image processing method, an image processing device, an electronic device, and a computer readable storage medium.
Background
With the development of computer networks and the popularization of smart phones, common users have not been satisfied with expressing their emotion by only monotonous pictures and words. Video is deeply favored by users to present more abundant and various contents and forms and visual feelings, and is gradually popular, and the common users are gradually becoming a trend to make original video. But on the other hand, the original self-timer video expression form is flat and odorless, meanwhile, the application of the video special effect in the film and television works is more and more abundant, the content expression form is more diversified, and the video lasting effect is the support and guarantee of the successful film and television works.
However, the existing video special effect production is generally finished through post production after video is recorded, the displayed special effect is fixed, and the special effect can only be logically played according to the preset time until the special effect is finished; and the threshold of post-production is higher, and ordinary user can't be quick the production special effect or make the special effect of complicacy. Therefore, how to simply and quickly generate the video effect is a technical problem to be solved.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, an embodiment of the present disclosure provides an image processing method, including:
acquiring a first image frame of a video image, wherein the first image frame is an image frame played by the video image at the current moment;
in response to detecting that the first image frame comprises a target object, dividing the target object from the first image frame to obtain a target object image;
acquiring an external rectangular frame of the target object in the first image frame;
calculating the drawing size and the drawing position of the target object image in the first image frame according to the circumscribed rectangular frame;
and storing the target object image, the drawing size of the target object image and the drawing position of the target object image into a cache.
In a second aspect, an embodiment of the present disclosure provides an image processing apparatus including:
The first image frame acquisition module is used for acquiring a first image frame of a video image, wherein the first image frame is an image frame played by the video image at the current moment;
the target object image segmentation module is used for responding to the fact that the first image frame comprises a target object, and segmenting the target object from the first image frame to obtain a target object image;
the rectangular frame acquisition module is used for acquiring an external rectangular frame of the target object in the first image frame;
the drawing attribute calculation module is used for calculating the drawing size and the drawing position of the target object image in the first image frame according to the circumscribed rectangular frame;
and the target object image storage module is used for storing the target object image, the drawing size of the target object image and the drawing position of the target object image into a cache.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including: at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any one of the image processing methods of the first aspect.
In a fourth aspect, embodiments of the present disclosure provide a non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium stores computer instructions for causing a computer to perform any one of the image processing methods of the first aspect.
The present disclosure discloses an image processing method, an image processing apparatus, an electronic device, and a computer-readable storage medium. The image processing method comprises the following steps: acquiring a first image frame of a video image, wherein the first image frame is an image frame played by the video image at the current moment; in response to detecting that the first image frame comprises a target object, dividing the target object from the first image frame to obtain a target object image; acquiring an external rectangular frame of the target object in the first image frame; calculating the drawing size and the drawing position of the target object image in the first image frame according to the circumscribed rectangular frame; and storing the target object image, the drawing size of the target object image and the drawing position of the target object image into a cache. By the method, the technical problem that the video effect cannot be simply and rapidly generated in the prior art is solved.
The foregoing description is only an overview of the disclosed technology, and may be implemented in accordance with the disclosure of the present disclosure, so that the above-mentioned and other objects, features and advantages of the present disclosure can be more clearly understood, and the following detailed description of the preferred embodiments is given with reference to the accompanying drawings.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a flowchart of an embodiment of an image processing method provided by the present disclosure;
fig. 2 is a flowchart of a specific example of step S104 in an embodiment of an image processing method provided in the present disclosure;
fig. 3 is a flowchart of a specific example of step S201 in an embodiment of an image processing method provided in the present disclosure;
FIG. 4 is a flowchart of a specific example of calculating a rendering offset in an embodiment of an image processing method provided in the present disclosure;
FIG. 5 is a flowchart of a further embodiment of an image processing method embodiment provided by the present disclosure;
Fig. 6 is a flowchart of a specific example of step S503 in an embodiment of an image processing method provided in the present disclosure;
fig. 7 is a schematic structural view of an embodiment of an image processing apparatus provided in an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is 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" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Fig. 1 is a flowchart of an embodiment of an image processing method according to an embodiment of the present disclosure, where the image processing method according to the embodiment may be performed by an image processing apparatus, and the image processing apparatus may be implemented as software, or as a combination of software and hardware, and the image processing apparatus may be integrally provided in a device in an image processing system, such as an image processing server or an image processing terminal device. As shown in fig. 1, the method comprises the steps of:
Step S101, acquiring a first image frame of a video image;
the first image frame is an image frame played by the video image at the current moment;
optionally, in this step, the video image is a video image received from an image sensor. The image sensor refers to various devices capable of acquiring images, and typical image sensors are video cameras, cameras and the like. In this embodiment, the image sensor may be a camera on the terminal device, such as a front or rear camera on the smart phone, and the image collected by the camera may be directly displayed on the display screen of the smart phone.
Optionally, in this step, the video image is a video image file received from a memory, and the video image file is a video recorded in advance and stored in the memory. Optionally, the memory is a local memory or a network memory. Prior to this step, the video image file transmitted from the memory is received and displayed on the display means of the device.
In this step, a first image frame of the video image is acquired, where the first image frame refers to an image frame played by the video image at the current time. The video image includes a plurality of image frames, the image frames are played at a certain speed to form the video image, typically 30 frames of image frames are played every second, when the video image starts to be played, the image frames are replaced every 33 milliseconds, the first image frame refers to the image frame played at the current moment, such as 0 seconds just after the video image starts to be played, the first image frame is the first frame of the whole video image, when the video image starts to be played to 1 second, the first image frame is the 31 st frame of the whole video image, and so on. It will be appreciated that the frame rate (number of frames played per second) of the video image may be any value, and that the above examples are merely examples and do not limit the present disclosure in any way.
Step S102, in response to detecting that the first image frame comprises a target object, dividing the target object from the first image frame to obtain a target object image;
wherein the target object may be any preset object that needs to be identified from the video image, and a typical target object may be a palm.
Any object recognition algorithm may be used to identify the target object in the video image. Typically, if the target object is a palm based on deep learning, training a neural network by using an image with the palm, classifying a first image frame in the acquired video image by using the trained neural network to determine whether the first image frame contains the palm, and detecting key points of the palm by using a palm detection algorithm to determine the outline of the palm when the first image frame is determined to contain the palm; or training the neural network by using the image marked with the palm external frame, carrying out external frame regression on each image frame in the video image by using the trained neural network to reduce the range of the palm, and then detecting key points of the palm by using a palm detection algorithm to determine the outline of the palm; or training the neural network by using the image marked with the palm key points, carrying out palm key point regression on each image frame in the video image by using the trained neural network so as to determine whether the image frame contains the palm or not and determining the outline of the palm according to the key points.
It will be appreciated that the palm and recognition method described above are merely examples and do not constitute a limitation of the present disclosure, and that the target object and the appropriate recognition algorithm for the target object may be actually selected in advance according to the effect and scene to be achieved.
After determining that a target object is included in the first image frame, the target object is segmented from the first image frame. While determining whether the target object is included in the first image frame, it is determined whether certain features of the target object are included in the first image frame, and based on these features, a contour of the target object may be determined to segment the target object from the first image frame.
Alternatively, the above-mentioned identification and segmentation may be performed in the same step, typically, for example, by using a trained convolutional neural network to classify each pixel in the first image frame, and determine whether it is a pixel in the palm, when all the pixels are classified, if the first image frame includes the palm, the image of the palm is already segmented.
In this step, only an image of a target object is identified, in which the position information and the size information are not recorded, the image of the target object being the same as the size of the first image frame, and the size and the position of the image of the target object in the first image frame cannot be known at this time, so that the subsequent further processing is inconvenient, and therefore, the size and the position of the target object in the first image frame need to be further determined in the subsequent step.
Step S103, obtaining an external rectangular frame of the target object in the first image frame;
in this step, a circumscribed rectangular frame of the target object in the first image frame may typically be generated using a target object detection algorithm that generates a plurality of rectangular frames in the first image frame, and then calculates how many features of the target object are included in the rectangular frames, and takes the rectangular frame including the most features of the target object as the circumscribed rectangular frame of the target object in the first image frame. The circumscribed rectangle includes global position information and size information of the circumscribed rectangle in the first image frame.
Optionally, coordinates of four corner points of the circumscribed rectangular frame in the coordinate system of the first image frame are used to represent the position and the size of the circumscribed rectangular frame in the first image frame. Typically, the coordinates of the four corner points are the coordinates (left, top) of the upper left corner point, the coordinates (right, top) of the upper right corner point, the coordinates (right, bottom) of the lower right corner point, the coordinates (left, bottom) of the lower left corner point, and the obtaining the circumscribed rectangular frame of the target object in the first image frame is obtaining the coordinates of the four corner points. It will be appreciated that the coordinates of the four corner points are the absolute coordinates of the four corner points in the first image frame, typically the first image frame is a 720 x 1280 pixel image frame, and the range of values of left and right is [0,720], and the range of values of top and bottom is [0,1280].
Optionally, the acquiring the circumscribed rectangular frame of the target object in the first image frame is acquiring coordinates of a side length and a center position of the circumscribed frame. The side length and center position coordinates can be calculated from the coordinates or can be obtained directly through a target recognition algorithm, and are not described in detail herein.
It may be appreciated that, in this step, the circumscribed rectangle frame of the target object in the first image frame may be obtained by any method, and parameters indicating the size and position of the circumscribed rectangle may be obtained by any method, which is not repeated herein, and the above-mentioned alternative embodiments do not limit the disclosure.
Step S104, calculating the drawing size and the drawing position of the target object image in the first image frame according to the circumscribed rectangle frame;
optionally, the calculating the drawing size and the drawing position of the target object image in the first image frame according to the circumscribed rectangular frame includes the following steps:
step S201, calculating the width and the height of the circumscribed rectangular frame according to the rectangular information of the circumscribed rectangular frame;
step S202, setting a calculation matrix of the drawing size according to the width and the height;
And step S203, calculating a drawing offset according to the rectangular information of the circumscribed rectangular frame, wherein the drawing offset represents the offset from the center of the circumscribed rectangular frame to the coordinate center of the first image frame.
Optionally, the step S201 further includes:
step S301, coordinates of four corner points of an external rectangular frame are obtained;
step S302, carrying out normalization processing on coordinates of the four corner points;
and step S303, calculating the width and the height of the circumscribed rectangular frame under a normalized coordinate system according to the coordinates after the normalization processing.
Typically, the size of the first image frame is 720×1280 pixels, and the coordinates of the four corner points of the circumscribed rectangular frame obtained in step S301 are respectively: coordinates of upper left corner (left, top), coordinates of upper right corner (right, top), coordinates of lower right corner (right, bottom), coordinates of lower left corner (left, bottom); then in step S302, normalization processing is performed on the four coordinates, according to the following formula:
left1=left/720,
right1=right/720,
top1=top/1280,
bottom1=bottom/1280,
the above left1, right1, top1, bottom1 are values of left, right, top and bottom after normalization. From the above values, the width and height of the circumscribed rectangle frame after normalization can be calculated, and in step S303, it is calculated that:
w=right1-left1;
h=top1-bottom1;
Where w is the width of the circumscribed rectangular frame in the normalized coordinate system and h is the height of the circumscribed rectangular frame in the normalized coordinate system.
Optionally, the calculating matrix for setting the drawing size according to the width and the height includes:
setting a calculation matrix of the drawing size as follows:
Figure BDA0002233290510000071
the matrix is used in the following steps to scale the image of the target object.
Optionally, the calculating the drawing offset according to the rectangle information of the circumscribed rectangle frame includes:
step S401, calculating the center coordinates of the rectangular frame according to the coordinates after normalization;
step S402, calculating a position difference between the center coordinate and the coordinate of the origin of the coordinate system after normalization.
After normalization, the center coordinates of the rectangular frame are x1= (right 1+left 1)/2, y1= (top 1+bottom 1)/2, and after normalization of the coordinate system of the first image frame, the range of the coordinate system is limited between [0,1], so that the center point of the coordinate system is (0.5 ); from this, the position difference between the center coordinates and the coordinates of the origin of the coordinate system after normalization can be calculated, x= ((right 1+left 1)/2) -0.5, y= ((top 1+bottom 1)/2) -0.5. In particular, in some cases, the coordinate system is normalized to be [ -1,1] so that the position difference needs to be doubled with respect to the coordinates of [0,1], then x=right 1+left1-1, y=top 1+bottom1-1. When normalized to other coordinate ranges, the difference calculated on the coordinate system of [0,1] can be amplified in the above manner, and will not be described herein.
Step S105, saving the target object image, the drawing size of the target object image, and the drawing position of the target object image in a buffer memory.
In this step, the target image at the current time, the drawing size of the target image, and the drawing position of the target image are stored in a buffer memory.
Optionally, the buffer memory includes a plurality of buffer memory locations, the buffer memory is implemented using a data structure of a queue, the images of the target objects are stored in the queue according to a sequence (i.e. an immediate sequence) of the image frames, when the buffer memory locations are all full, the target object images at the head locations in the queue are deleted, the target object image at the second location in the queue is used as the head of the queue, and the target object image at the current moment is stored at the tail of the queue.
Also stored in the cache is the drawing size of the target object image and the drawing position of the target object image, which is optionally a calculation matrix of the drawing size according to step S104, the drawing position of the target object image being a position difference between the center coordinates of the rectangular frame and the coordinates of the origin of the coordinate system after normalization. Of course, the drawing size of the target object image may also be a scaling of the target object image, and the drawing position of the target object image may be a calculated coordinate value, which is not described herein.
In the above embodiment, the image processing method segments an image of a target object in a video image, and calculates a parameter indicating a size of the image of the target object in a first image frame and a parameter indicating a position of the image of the target object in the first image frame. Under the condition that the segmented target object image has no size and position information, the size and position information of the target object image in the first image frame can be calculated through the attribute of the circumscribed rectangular frame of the target object in the first image frame and stored, and the problem of acquiring and storing the attribute of the local image in the global image is solved.
Further, various effects in the video can be achieved by using the information stored in the cache. As shown in fig. 5, the image processing method further includes:
step S501, in response to the number of the target object images stored in the buffer at the current time reaching M, extracting N target object images from the M target object images as target object images to be processed;
step S502, obtaining the N target object images and drawing sizes and drawing positions of the N target object images in the first image frame from the cache;
Step S503, superposing the N target object images on the first image frame according to the drawing sizes and drawing positions of the N target object images in the first image frame.
In step S501, M and N are integers greater than 0, and M is greater than N. Typically, M is 30, N is 6, where M may be the size of the buffer, that is, the length of the queue in step S105, after the buffer is full of 30 buffer locations, the target object images in 6 locations are randomly acquired from the buffer, where the size of the target object image is the same as the size of the first image frame, for example, the size of the first image frame is 720×1280, and if the effect of superimposing the target object image before the current time in the first image frame is to be achieved, the size and the location of the target object image in the corresponding first image frame need to be known. Therefore, in step S502, the drawing size matrix and the position difference value corresponding to the 6 target object images and the 6 target object images, respectively, are acquired from the buffer memory. In step S503, the superimposing the N target object images on the first image frame according to the drawing sizes and the drawing positions of the N target object images in the first image frame includes: calculating N actual drawing images corresponding to the N target object images according to the calculation matrixes of the N drawing sizes corresponding to the N target object images; calculating N actual drawing positions of the N actual drawing images according to N position differences corresponding to the N target object images; and superposing the N actual drawing images on the first image frame according to the N actual drawing positions. Taking the above example as an example, scaling the 6 target object images according to the corresponding 6 drawing size matrixes to obtain 6 actual drawing images, calculating 6 actual drawing positions of the 6 target object images in the first frame image according to the 6 position difference values, and then drawing the 6 actual drawing images on the actual drawing positions to superimpose the target object images at 6 times before the current time in the first image frame at the current time so as to realize the double image effect of the target object. In the following, a scaling process of a target image is described according to a practical example, and in a coordinate system after normalization, coordinates of four corner points of the circumscribed rectangular frame are set to be (0.1,0.6), (0.3, 0.6), (0.1, 0.2), (0.3,0.2), and the width of the circumscribed rectangular frame can be calculated according to the coordinates of the four corner points as follows: w=0.3-0.1=0.2, h=0.6-0.2=0.4, i.e. the drawn size calculation matrix is:
Figure BDA0002233290510000091
Normalizing the image of the target object, and setting the position of each pixel point on the normalized image of the target object as pos
Figure BDA0002233290510000092
pos1 is coordinates of the pixel point after the image of the target object is scaled, and the set of pos1 is the image of the target object after scaling. And adding the position difference value to the position of each pixel point in the pos1 to obtain the drawing position of each pixel point in the scaled image of the target object, and drawing each pixel point in the scaled image of the target object on the calculated drawing position to draw the state of the image of the target object in the corresponding first image frame. The position difference may be calculated according to the method described in step S402, which is not described herein.
Further, in order to achieve a more realistic effect, the superimposing the N target object images on the first image frame according to the drawing sizes and drawing positions of the N target object images in the first image frame further includes:
step S601, N transparencies corresponding to the N target object images respectively are obtained;
step S602, scaling the N target object images to the corresponding drawing sizes respectively;
And step S603, drawing the N target object images after scaling on the position of the first image frame indicated by the drawing position according to the N transparency.
In the above step, N transparency corresponding to each of the N target object images is obtained, where the N transparency may be preset or may be calculated according to parameters. Typically, if N is 6, 6 transparency may be preset, the 6 target object images are ordered according to time, and the transparency corresponding to the target object image with earlier time is higher and the transparency corresponding to the target object image with later time is lower; thereafter, the 6 target object images are scaled in step S602, see the description in step S503 for details; in step S603, the 6 target object images are drawn on the drawing positions with their corresponding transparency. In this embodiment, since the transparency is added, the transparency of the target object image at an earlier time is made higher, and a more various and realistic ghost effects have been achieved.
It is to be understood that the above steps S501-S503 may not be performed after step S105, and as long as the target object is identified to be included in the first image frame, it may be determined whether the number of target object images stored in the buffer is M, and if M is reached, steps S502 and S503 may be performed next. The execution of the processing of the target object image in the image frame at the current moment does not conflict with the execution of the processing of the target object image in the image frame at the current moment, and the processing can be executed before or after any step after the target object is identified, so long as the storage of the target object image, the drawing size of the target object image and the drawing position of the target object image in the buffer memory, the acquisition of the N target object images from the buffer memory and the drawing size and the drawing position of the N target object images in the first image frame are ensured not to conflict, and the details are not repeated.
The present disclosure discloses an image processing method, an image processing apparatus, an electronic device, and a computer-readable storage medium. The image processing method comprises the following steps: acquiring a first image frame of a video image, wherein the first image frame is an image frame played by the video image at the current moment; in response to detecting that the first image frame comprises a target object, dividing the target object from the first image frame to obtain a target object image; acquiring an external rectangular frame of the target object in the first image frame; calculating the drawing size and the drawing position of the target object image in the first image frame according to the circumscribed rectangular frame; and storing the target object image, the drawing size of the target object image and the drawing position of the target object image into a cache. By the method, the technical problem that the video effect cannot be simply and rapidly generated in the prior art is solved.
In the foregoing, although the steps in the foregoing method embodiments are described in the foregoing order, it should be clear to those skilled in the art that the steps in the embodiments of the disclosure are not necessarily performed in the foregoing order, but may be performed in reverse order, parallel, cross, etc., and other steps may be further added to those skilled in the art on the basis of the foregoing steps, and these obvious modifications or equivalent manners are also included in the protection scope of the disclosure and are not repeated herein.
Fig. 7 is a schematic structural diagram of an embodiment of an image processing apparatus according to an embodiment of the disclosure, as shown in fig. 7, the apparatus 700 includes: a first image frame acquisition module 701, a target object image segmentation module 702, a rectangular frame acquisition module 703, a drawing attribute calculation module 704, and a target object image saving module 705. Wherein,,
a first image frame acquiring module 701, configured to acquire a first image frame of a video image, where the first image frame is an image frame played by the video image at a current moment;
a target object image segmentation module 702, configured to segment, in response to detecting that a target object is included in the first image frame, the target object from the first image frame to obtain a target object image;
a rectangular frame acquisition module 703, configured to acquire an circumscribed rectangular frame of the target object in the first image frame;
a drawing attribute calculation module 704, configured to calculate a drawing size and a drawing position of the target object image in the first image frame according to the circumscribed rectangle frame;
the target object image storage module 705 is configured to store the target object image, a drawing size of the target object image, and a drawing position of the target object image in a cache.
Further, the image processing apparatus 700 further includes:
the extraction module is used for extracting N target object images from the M target object images as target object images to be processed in response to the fact that the number of the target object images stored in the cache at the current moment reaches M, wherein M and N are integers larger than 0, and M is larger than N;
the drawing parameter acquisition module is used for acquiring the N target object images and drawing sizes and drawing positions of the N target object images in the first image frame from the cache;
and the superposition module is used for superposing the N target object images on the first image frame according to the drawing sizes and the drawing positions of the N target object images in the first image frame.
Further, the superposition module further includes:
the transparency acquisition module is used for acquiring N transparency corresponding to the N target object images respectively;
the scaling module is used for scaling the N target object images to the corresponding drawing sizes respectively;
and the first drawing module is used for drawing the N target object images after scaling on the position of the first image frame indicated by the drawing position according to the N transparency.
Further, the drawing attribute calculating module 704 further includes:
the width and height calculation module is used for calculating the width and the height of the circumscribed rectangular frame according to the rectangular information of the circumscribed rectangular frame;
the matrix setting module is used for setting a calculation matrix of the drawing size according to the width and the height;
and the offset calculation module is used for calculating a drawing offset according to the rectangular information of the circumscribed rectangular frame, wherein the drawing offset represents the offset from the center of the circumscribed rectangular frame to the coordinate center of the first image frame.
Further, the width and height calculation module further includes:
the corner coordinate acquisition module is used for acquiring coordinates of four corners of the circumscribed rectangular frame;
the corner point coordinate normalization module is used for normalizing the coordinates of the four corner points;
and the normalized width and height calculation module is used for calculating the width and the height of the circumscribed rectangular frame under a normalized coordinate system according to the coordinates after normalization processing.
Further, the matrix setting module is further configured to: setting a calculation matrix of the drawing size as follows:
Figure BDA0002233290510000121
where w is the width of the circumscribed rectangular frame in the normalized coordinate system and h is the height of the circumscribed rectangular frame in the normalized coordinate system.
Further, the offset calculation module further includes:
the center coordinate calculation module is used for calculating the center coordinate of the rectangular frame according to the normalized coordinates;
and the position difference value calculation module is used for calculating the position difference value between the center coordinate and the coordinate of the origin of the coordinate system after normalization.
Further, the superposition module further includes:
the actual drawing image calculation module is used for calculating N actual drawing images corresponding to the N target object images according to the calculation matrixes of the N drawing sizes corresponding to the N target object images;
the actual drawing position calculation module is used for calculating N actual drawing positions of the N actual drawing images according to N position difference values corresponding to the N target object images;
and the second drawing module is used for superposing the N actual drawing images on the first image frame according to the N actual drawing positions.
The apparatus of fig. 7 may perform the method of the embodiment of fig. 1-6, and reference is made to the relevant description of the embodiment of fig. 1-6 for parts of this embodiment that are not described in detail. The implementation process and the technical effect of this technical solution are described in the embodiments shown in fig. 1 to 6, and are not described herein.
Referring now to fig. 8, a schematic diagram of an electronic device 800 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 8 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 8, the electronic device 800 may include a processing means (e.g., a central processor, a graphics processor, etc.) 801, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage means 806 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
In general, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, etc.; storage 806 including, for example, magnetic tape, hard disk, etc.; communication means 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 shows an electronic device 800 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 809, or installed from storage device 806, or installed from ROM 802. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 801.
It should be noted that the computer readable medium described 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 can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving a video image, the video image comprising a plurality of image frames; identifying a target object in an image frame of the video image; in response to identifying the first target object, displaying a first virtual object having a first shape at a first location of the video image; in response to identifying a second target object, displaying the second virtual object having a second shape at a second location of the video image; and when the distance between the first target object and the second target object is smaller than a first threshold value, combining the first virtual object and the second virtual object to enable the first virtual object and the second virtual object to form a third shape, wherein the third shape is formed by combining the first shape and the second shape.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language 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 the case of a remote computer, the remote computer may 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 may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). 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 in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
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 may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can 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. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided an image processing method including:
acquiring a first image frame of a video image, wherein the first image frame is an image frame played by the video image at the current moment;
in response to detecting that the first image frame comprises a target object, dividing the target object from the first image frame to obtain a target object image;
acquiring an external rectangular frame of the target object in the first image frame;
calculating the drawing size and the drawing position of the target object image in the first image frame according to the circumscribed rectangular frame;
and storing the target object image, the drawing size of the target object image and the drawing position of the target object image into a cache.
Further, the method further comprises:
responding to the fact that the number of the target object images stored in the cache at the current moment reaches M, extracting N target object images from the M target object images to serve as target object images to be processed, wherein M and N are integers larger than 0, and M is larger than N;
acquiring the N target object images and the drawing sizes and drawing positions of the N target object images in the first image frame from the cache;
And superposing the N target object images on the first image frame according to the drawing sizes and drawing positions of the N target object images in the first image frame.
Further, the superimposing the N target object images on the first image frame according to the drawing sizes and drawing positions of the N target object images in the first image frame includes:
acquiring N transparencies respectively corresponding to the N target object images;
scaling the N target object images to the corresponding drawing sizes respectively;
and drawing the N target object images after scaling on the position of the first image frame indicated by the drawing position according to the N transparency.
Further, the calculating, according to the circumscribed rectangular frame, a drawing size and a drawing position of the target object image in the first image frame includes:
calculating the width and the height of the circumscribed rectangular frame according to the rectangular information of the circumscribed rectangular frame;
setting a calculation matrix of the drawing size according to the width and the height;
calculating a drawing offset according to the rectangular information of the circumscribed rectangular frame, wherein the drawing offset represents an offset from the center of the circumscribed rectangular frame to the coordinate center of the first image frame;
Calculating the drawing size according to the calculation matrix;
and calculating the drawing position according to the offset.
Further, the calculating the width and the height of the circumscribed rectangular frame according to the rectangular information of the circumscribed rectangular frame includes:
acquiring coordinates of four corner points of an external rectangular frame;
normalizing the coordinates of the four corner points;
and calculating the width and the height of the circumscribed rectangular frame under a normalized coordinate system according to the coordinates after the normalization processing.
Further, the calculating matrix for setting the drawing size according to the width and the height comprises:
setting a calculation matrix of the drawing size as follows:
Figure BDA0002233290510000171
where w is the width of the circumscribed rectangular frame in the normalized coordinate system and h is the height of the circumscribed rectangular frame in the normalized coordinate system.
Further, the calculating the drawing offset according to the rectangle information of the circumscribed rectangle frame includes:
calculating the center coordinates of the rectangular frame according to the coordinates after normalization;
a position difference between the center coordinates and coordinates of the origin of the coordinate system after normalization is calculated.
Further, the superimposing the N target object images on the first image frame according to the drawing sizes and drawing positions of the N target object images in the first image frame includes:
Calculating N actual drawing images corresponding to the N target object images according to the calculation matrixes of the N drawing sizes corresponding to the N target object images;
calculating N actual drawing positions of the N actual drawing images according to N position differences corresponding to the N target object images;
and superposing the N actual drawing images on the first image frame according to the N actual drawing positions.
According to one or more embodiments of the present disclosure, there is provided an image processing apparatus including:
the first image frame acquisition module is used for acquiring a first image frame of a video image, wherein the first image frame is an image frame played by the video image at the current moment;
the target object image segmentation module is used for responding to the fact that the first image frame comprises a target object, and segmenting the target object from the first image frame to obtain a target object image;
the rectangular frame acquisition module is used for acquiring an external rectangular frame of the target object in the first image frame;
the drawing attribute calculation module is used for calculating the drawing size and the drawing position of the target object image in the first image frame according to the circumscribed rectangular frame;
And the target object image storage module is used for storing the target object image, the drawing size of the target object image and the drawing position of the target object image into a cache.
Further, the image processing apparatus further includes:
the extraction module is used for extracting N target object images from the M target object images as target object images to be processed in response to the fact that the number of the target object images stored in the cache at the current moment reaches M, wherein M and N are integers larger than 0, and M is larger than N;
the drawing parameter acquisition module is used for acquiring the N target object images and drawing sizes and drawing positions of the N target object images in the first image frame from the cache;
and the superposition module is used for superposing the N target object images on the first image frame according to the drawing sizes and the drawing positions of the N target object images in the first image frame.
Further, the superposition module further includes:
the transparency acquisition module is used for acquiring N transparency corresponding to the N target object images respectively;
the scaling module is used for scaling the N target object images to the corresponding drawing sizes respectively;
And the first drawing module is used for drawing the N target object images after scaling on the position of the first image frame indicated by the drawing position according to the N transparency.
Further, the drawing attribute calculating module further includes:
the width and height calculation module is used for calculating the width and the height of the circumscribed rectangular frame according to the rectangular information of the circumscribed rectangular frame;
the matrix setting module is used for setting a calculation matrix of the drawing size according to the width and the height;
and the offset calculation module is used for calculating a drawing offset according to the rectangular information of the circumscribed rectangular frame, wherein the drawing offset represents the offset from the center of the circumscribed rectangular frame to the coordinate center of the first image frame.
Further, the width and height calculation module further includes:
the corner coordinate acquisition module is used for acquiring coordinates of four corners of the circumscribed rectangular frame;
the corner point coordinate normalization module is used for normalizing the coordinates of the four corner points;
and the normalized width and height calculation module is used for calculating the width and the height of the circumscribed rectangular frame under a normalized coordinate system according to the coordinates after normalization processing.
Further, the matrix setting module is further configured to: setting a calculation matrix of the drawing size as follows:
Figure BDA0002233290510000191
Where w is the width of the circumscribed rectangular frame in the normalized coordinate system and h is the height of the circumscribed rectangular frame in the normalized coordinate system.
Further, the offset calculation module further includes:
the center coordinate calculation module is used for calculating the center coordinate of the rectangular frame according to the normalized coordinates;
and the position difference value calculation module is used for calculating the position difference value between the center coordinate and the coordinate of the origin of the coordinate system after normalization.
Further, the superposition module further includes:
the actual drawing image calculation module is used for calculating N actual drawing images corresponding to the N target object images according to the calculation matrixes of the N drawing sizes corresponding to the N target object images;
the actual drawing position calculation module is used for calculating N actual drawing positions of the N actual drawing images according to N position difference values corresponding to the N target object images;
and the second drawing module is used for superposing the N actual drawing images on the first image frame according to the N actual drawing positions.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: at least one processor; the method comprises the steps of,
A memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any one of the image processing methods described above.
According to one or more embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, characterized in that the non-transitory computer-readable storage medium stores computer instructions for causing a computer to perform any one of the aforementioned image processing methods.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).

Claims (9)

1. An image processing method, comprising:
acquiring a first image frame of a video image, wherein the first image frame is an image frame played by the video image at a moment before the current moment;
in response to detecting that the first image frame comprises a target object, dividing the target object from the first image frame to obtain a target object image;
acquiring information of an external rectangular frame of the target object in the first image frame; the information of the circumscribed rectangular frame comprises global position information and size information of the target object in the first image frame;
calculating the drawing size and the drawing position of the target object image in the second image frame according to the information of the circumscribed rectangular frame, wherein the method comprises the following steps:
calculating the width and the height of the circumscribed rectangular frame according to the rectangular information of the circumscribed rectangular frame;
setting a calculation matrix of the drawing size according to the width and the height; wherein, the calculation matrix for setting the drawing size is: the main diagonal elements are second-order diagonal matrixes of the width and the height of the circumscribed rectangular frame under the normalized coordinate system in sequence;
calculating a drawing offset according to the rectangular information of the circumscribed rectangular frame, wherein the drawing offset represents an offset from the center of the circumscribed rectangular frame to the coordinate center of the second image frame;
Scaling the target object image according to the calculation matrix to obtain the drawing size of the scaled target object image;
calculating the drawing position according to the offset;
and storing the target object image, the drawing size of the target object image and the drawing position of the target object image into a cache.
2. The image processing method of claim 1, wherein the method further comprises:
responding to the fact that the number of the target object images stored in the cache at the current moment reaches M, extracting N target object images from the M target object images to serve as target object images to be processed, wherein M and N are integers larger than 0, and M is larger than N;
acquiring the N target object images and the drawing sizes and drawing positions of the N target object images in the second image frame from the cache;
and superposing the N target object images on the second image frame according to the drawing sizes and drawing positions of the N target object images in the second image frame.
3. The image processing method according to claim 2, wherein the superimposing the N target object images on the second image frame according to the drawing sizes, drawing positions of the N target object images in the second image frame includes:
Acquiring N transparencies respectively corresponding to the N target object images;
scaling the N target object images to the corresponding drawing sizes respectively;
and drawing the N target object images after scaling on the position of the second image frame indicated by the drawing position according to the N transparency.
4. The image processing method according to claim 1, wherein the calculating the width and the height of the circumscribed rectangular frame from the rectangular information of the circumscribed rectangular frame comprises:
acquiring coordinates of four corner points of an external rectangular frame;
normalizing the coordinates of the four corner points;
and calculating the width and the height of the circumscribed rectangular frame under a normalized coordinate system according to the coordinates after the normalization processing.
5. The image processing method according to claim 1, wherein the calculating of the drawing offset from the rectangular information of the circumscribed rectangular frame includes:
calculating the center coordinates of the rectangular frame according to the coordinates after normalization;
a position difference between the center coordinates and coordinates of the origin of the coordinate system after normalization is calculated.
6. The image processing method according to claim 5, wherein superimposing the N target object images on the second image frame according to a drawing size, drawing position of the N target object images in the second image frame, comprises:
Calculating N actual drawing images corresponding to the N target object images according to the calculation matrixes of the N drawing sizes corresponding to the N target object images;
calculating N actual drawing positions of the N actual drawing images according to N position differences corresponding to the N target object images;
and superposing the N actual drawing images on the second image frame according to the N actual drawing positions.
7. An image processing apparatus comprising:
the first image frame acquisition module is used for acquiring a first image frame of a video image, wherein the first image frame is an image frame played by the video image at a moment before the current moment;
the target object image segmentation module is used for responding to the fact that the first image frame comprises a target object, and segmenting the target object from the first image frame to obtain a target object image;
the rectangular frame acquisition module is used for acquiring information of an external rectangular frame of the target object in the first image frame; the information of the circumscribed rectangular frame comprises global position information and size information of the target object in the first image frame;
the drawing attribute calculating module is configured to calculate a drawing size and a drawing position of the target object image in the second image frame according to the information of the circumscribed rectangular frame, and includes:
Calculating the width and the height of the circumscribed rectangular frame according to the rectangular information of the circumscribed rectangular frame;
setting a calculation matrix of the drawing size according to the width and the height; wherein, the calculation matrix for setting the drawing size is: the main diagonal elements are second-order diagonal matrixes of the width and the height of the circumscribed rectangular frame under the normalized coordinate system in sequence;
calculating a drawing offset according to the rectangular information of the circumscribed rectangular frame, wherein the drawing offset represents an offset from the center of the circumscribed rectangular frame to the coordinate center of the second image frame;
scaling the target object image according to the calculation matrix to obtain the drawing size of the scaled target object image;
calculating the drawing position according to the offset;
and the target object image storage module is used for storing the target object image, the drawing size of the target object image and the drawing position of the target object image into a cache.
8. An electronic device, comprising:
a memory for storing computer readable instructions; and
a processor for executing the computer readable instructions such that the processor when run implements the image processing method according to any one of claims 1-6.
9. A non-transitory computer readable storage medium storing computer readable instructions which, when executed by a computer, cause the computer to perform the image processing method of any of claims 1-6.
CN201910974930.XA 2019-10-14 2019-10-14 Image processing method, device, electronic equipment and computer readable storage medium Active CN110796664B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910974930.XA CN110796664B (en) 2019-10-14 2019-10-14 Image processing method, device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910974930.XA CN110796664B (en) 2019-10-14 2019-10-14 Image processing method, device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110796664A CN110796664A (en) 2020-02-14
CN110796664B true CN110796664B (en) 2023-05-23

Family

ID=69440221

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910974930.XA Active CN110796664B (en) 2019-10-14 2019-10-14 Image processing method, device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110796664B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111698553B (en) * 2020-05-29 2022-09-27 维沃移动通信有限公司 Video processing method and device, electronic equipment and readable storage medium
CN111815656B (en) * 2020-07-22 2023-08-11 抖音视界有限公司 Video processing method, apparatus, electronic device and computer readable medium
CN113052226A (en) * 2021-03-22 2021-06-29 淮阴工学院 Time-sequence fire identification method and system based on single-step detector
CN113497973B (en) * 2021-09-06 2021-12-10 北京市商汤科技开发有限公司 Video processing method and device, computer readable storage medium and computer equipment
CN115423992B (en) * 2022-08-22 2023-11-14 惠州市海葵信息技术有限公司 Engineering drawing space arrangement method, controller and storage medium
CN116723265B (en) * 2022-09-14 2024-07-16 荣耀终端有限公司 Image processing method, readable storage medium, program product, and electronic device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6898306B1 (en) * 2001-05-14 2005-05-24 Ultratech, Inc. Machine-independent alignment system and method
CN101155263A (en) * 2006-09-27 2008-04-02 富士通株式会社 Image processing apparatus, image processing method, image processing program, and image pickup apparatus
CN106611412A (en) * 2015-10-20 2017-05-03 成都理想境界科技有限公司 Map video generation method and device
CN107169135A (en) * 2017-06-12 2017-09-15 广州市动景计算机科技有限公司 Image processing method, device and electronic equipment
CN108288088A (en) * 2018-01-17 2018-07-17 浙江大学 A kind of scene text detection method based on end-to-end full convolutional neural networks
CN109711399A (en) * 2018-11-05 2019-05-03 北京三快在线科技有限公司 Shop recognition methods based on image, device, electronic equipment
CN109862313A (en) * 2018-12-12 2019-06-07 科大讯飞股份有限公司 A kind of video concentration method and device
CN110070551A (en) * 2019-04-29 2019-07-30 北京字节跳动网络技术有限公司 Rendering method, device and the electronic equipment of video image

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7519234B2 (en) * 2004-11-17 2009-04-14 Seiko Epson Corporation Apparatuses and methods for incorporating a border region within an image region
MX2013002833A (en) * 2010-09-14 2013-04-05 Dynamic Digital Depth Res Pty A method for enhancing depth maps.

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6898306B1 (en) * 2001-05-14 2005-05-24 Ultratech, Inc. Machine-independent alignment system and method
CN101155263A (en) * 2006-09-27 2008-04-02 富士通株式会社 Image processing apparatus, image processing method, image processing program, and image pickup apparatus
CN106611412A (en) * 2015-10-20 2017-05-03 成都理想境界科技有限公司 Map video generation method and device
CN107169135A (en) * 2017-06-12 2017-09-15 广州市动景计算机科技有限公司 Image processing method, device and electronic equipment
CN108288088A (en) * 2018-01-17 2018-07-17 浙江大学 A kind of scene text detection method based on end-to-end full convolutional neural networks
CN109711399A (en) * 2018-11-05 2019-05-03 北京三快在线科技有限公司 Shop recognition methods based on image, device, electronic equipment
CN109862313A (en) * 2018-12-12 2019-06-07 科大讯飞股份有限公司 A kind of video concentration method and device
CN110070551A (en) * 2019-04-29 2019-07-30 北京字节跳动网络技术有限公司 Rendering method, device and the electronic equipment of video image

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于深度卷积神经网络的目标检测技术的研究进展;王慧玲等;《计算机科学》;20180930;全文 *

Also Published As

Publication number Publication date
CN110796664A (en) 2020-02-14

Similar Documents

Publication Publication Date Title
CN110796664B (en) Image processing method, device, electronic equipment and computer readable storage medium
CN110070063B (en) Target object motion recognition method and device and electronic equipment
CN110070551B (en) Video image rendering method and device and electronic equipment
CN110781823B (en) Screen recording detection method and device, readable medium and electronic equipment
CN112182299B (en) Method, device, equipment and medium for acquiring highlight in video
CN110062157B (en) Method and device for rendering image, electronic equipment and computer readable storage medium
US11924520B2 (en) Subtitle border-crossing processing method and apparatus, and electronic device
US20240112299A1 (en) Video cropping method and apparatus, storage medium and electronic device
WO2023138441A1 (en) Video generation method and apparatus, and device and storage medium
CN113255812B (en) Video frame detection method and device and electronic equipment
CN111833459B (en) Image processing method and device, electronic equipment and storage medium
CN111784726B (en) Portrait matting method and device
US11810336B2 (en) Object display method and apparatus, electronic device, and computer readable storage medium
US11651529B2 (en) Image processing method, apparatus, electronic device and computer readable storage medium
CN116596748A (en) Image stylization processing method, apparatus, device, storage medium, and program product
CN114332324B (en) Image processing method, device, equipment and medium
CN113963000B (en) Image segmentation method, device, electronic equipment and program product
CN111696041B (en) Image processing method and device and electronic equipment
CN111353929A (en) Image processing method and device and electronic equipment
CN112651909B (en) Image synthesis method, device, electronic equipment and computer readable storage medium
CN112668474B (en) Plane generation method and device, storage medium and electronic equipment
CN115134579B (en) Virtual viewpoint generation method and device, storage medium and electronic equipment
CN111738958B (en) Picture restoration method and device, electronic equipment and computer readable medium
CN117372240A (en) Display method and device of special effect image, electronic equipment and storage medium
CN118840467A (en) Image processing method, device, terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant