WO2021121237A1 - 视频流裁剪方法及电子设备 - Google Patents

视频流裁剪方法及电子设备 Download PDF

Info

Publication number
WO2021121237A1
WO2021121237A1 PCT/CN2020/136656 CN2020136656W WO2021121237A1 WO 2021121237 A1 WO2021121237 A1 WO 2021121237A1 CN 2020136656 W CN2020136656 W CN 2020136656W WO 2021121237 A1 WO2021121237 A1 WO 2021121237A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
cropping
area
video stream
cropping area
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.)
Ceased
Application number
PCT/CN2020/136656
Other languages
English (en)
French (fr)
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.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication 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 Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Publication of WO2021121237A1 publication Critical patent/WO2021121237A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • H04M1/7243User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality with interactive means for internal management of messages
    • H04M1/72439User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality with interactive means for internal management of messages for image or video messaging
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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

Definitions

  • the embodiments of the present invention relate to the field of communication technologies, and in particular, to a video stream cropping method and electronic equipment.
  • the video stream can be cropped by the electronic device to optimize the composition of the image in the video stream.
  • the video stream can be cropped by a cropping method with a fixed cropping area.
  • a cropping area can be set for a video stream first, and then the electronic device can crop each frame of the video stream, except for the cropping area.
  • the top area of each frame of the video stream can be set as a cropped area, and the electronic device can crop out other areas except the top area of each frame of the video stream.
  • Embodiments of the present invention provide a video stream cropping method and an electronic device, so as to solve the problem that the subject of one or some images in the cropped video stream is lost when the video stream is cropped.
  • an embodiment of the present invention provides a video stream cropping method, which can be applied to an electronic device.
  • the method may include: determining a first cropping area of a first image in a target video stream, and the first cropping area includes the first cropping area.
  • An object and according to the first cropping area and the first object, determine the second cropping area of the second image in the target video stream; and crop the image outside the first cropping area in the first image, and crop the second image
  • the cropped target video stream is obtained; wherein, the second cropping area includes the second object in the second image, and the matching degree between the second object and the first object is greater than or equal to the first preset Set the threshold.
  • an embodiment of the present invention provides an electronic device, which includes: a determining module and a cutting module.
  • the determining module is used to determine the first cropping area of the first image in the target video stream, the first cropping area includes the first object; and determining the second image in the target video stream according to the first cropping area and the first object
  • the second cropping area of the second cropping area includes the second object in the second image, and the matching degree between the second object and the first object is greater than or equal to the first preset threshold; the cropping module is used to crop the first image
  • the image outside the first cropping area determined by the determining module is cropped, and the image outside the second cropping area determined by the determining module in the second image is cropped to obtain the cropped target video stream.
  • an embodiment of the present invention provides an electronic device, including a processor, a memory, and a computer program stored on the memory and running on the processor.
  • the computer program can implement the above-mentioned first aspect when the computer program is executed by the processor.
  • the steps of the video stream cropping method can implement the above-mentioned first aspect when the computer program is executed by the processor.
  • an embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored.
  • the steps of the video stream cropping method of the first aspect can be implemented. .
  • the electronic device can determine the first cropping area (including the first object) of the first image in the target video stream; and according to the first cropping area and the first object, determine the second cropping area in the target video stream.
  • the second cropping area of the image including the second object in the second image, the matching degree between the second object and the first object is greater than or equal to the first preset threshold; and cropping the first image outside the first cropping area And crop the image outside the second cropping area in the second image to obtain the cropped target video stream.
  • the electronic device determines the cropped area of an image, it can refer to the cropped area determined in another image and the objects in the cropped area, so the cropped area of the one image determined by the electronic device can include The object that matches the object (for example, the two objects are the same object), that is, the video stream cropping method provided by the embodiment of the present invention is adopted, and the cropped regions of each image are determined to include the main body of the image, so that the video is cropped according to these cropped regions After each frame of image in the stream, the main body of the image in the cropped video stream can be avoided from being lost.
  • FIG. 1 is a schematic structural diagram of a possible Android operating system provided by an embodiment of the present invention
  • Figure 2 is one of the schematic diagrams of a video stream cropping method provided by an embodiment of the present invention.
  • FIG. 3 is one of the schematic diagrams of the interface of the application of the video stream cropping method provided by the embodiment of the present invention.
  • FIG. 4 is the second schematic diagram of the interface of the application of the video stream cropping method provided by the embodiment of the present invention.
  • FIG 5 is the third schematic diagram of the interface of the application of the video stream cropping method provided by the embodiment of the present invention.
  • FIG. 6 is the fourth schematic diagram of the interface of the application of the video stream cropping method provided by the embodiment of the present invention.
  • FIG. 7 is the fifth schematic diagram of the interface of the application of the video stream cropping method provided by the embodiment of the present invention.
  • FIG. 8 is a second schematic diagram of a video stream cropping method provided by an embodiment of the present invention.
  • FIG. 9 is one of structural schematic diagrams of an electronic device provided by an embodiment of the present invention.
  • FIG. 10 is a second structural diagram of an electronic device provided by an embodiment of the present invention.
  • FIG. 11 is a third structural diagram of an electronic device provided by an embodiment of the present invention.
  • FIG. 12 is a schematic diagram of hardware of an electronic device provided by an embodiment of the present invention.
  • first and second in this document are used to distinguish different objects, rather than to describe a specific order of objects.
  • first object and the second object are used to distinguish different objects, rather than to describe the specific order of the objects.
  • words such as “exemplary” or “for example” are used to represent examples, illustrations, or illustrations. Any embodiment or design solution described as “exemplary” or “for example” in the embodiments of the present invention should not be construed as being more preferable or advantageous than other embodiments or design solutions. To be precise, words such as “exemplary” or “for example” are used to present related concepts in a specific manner.
  • plural means two or more than two, for example, a plurality of elements means two or more elements, and so on.
  • Embodiments of the present invention provide a video stream cropping method and an electronic device.
  • the video stream cropping method can be applied to an electronic device, and the electronic device can determine a first cropping area (including a first object) of a first image in a target video stream. ); and according to the first cropping area and the first object, determine the second cropping area of the second image in the target video stream (including the second object in the second image, and the matching degree between the second object and the first object is greater than or Equal to the first preset threshold); and crop the image outside the first cropping area in the first image, and crop the image outside the second cropping area in the second image, to obtain the cropped target video stream.
  • the electronic device determines the cropped area of an image, it can refer to the cropped area determined in another image and the objects in the cropped area, so the cropped area of the one image determined by the electronic device can include The object that matches the object (for example, the two objects are the same object), that is, the video stream cropping method provided by the embodiment of the present invention is adopted, and the cropped regions of each image are determined to include the main body of the image, so that the video is cropped according to these cropped regions After each frame of image in the stream, the main body of the image in the cropped video stream can be avoided from being lost.
  • the electronic device in the embodiment of the present invention may be an electronic device with an operating system.
  • the operating system may be an Android operating system, an ios operating system, or other possible operating systems, which is not specifically limited in the embodiment of the present invention.
  • the following takes the Android operating system as an example to introduce the software environment to which the video stream cropping method provided by the embodiment of the present invention is applied.
  • FIG. 1 it is a schematic structural diagram of a possible Android operating system provided by an embodiment of the present invention.
  • the architecture of the Android operating system includes 4 layers, which are: application layer, application framework layer, system runtime library layer, and kernel layer (specifically, it may be the Linux kernel layer).
  • the application layer includes various applications (including system applications and third-party applications) in the Android operating system.
  • the application framework layer is the framework of the application. Developers can develop some applications based on the application framework layer while complying with the development principles of the application framework.
  • the system runtime layer includes a library (also called a system library) and an Android operating system runtime environment.
  • the library mainly provides various resources needed by the Android operating system.
  • the Android operating system operating environment is used to provide a software environment for the Android operating system.
  • the kernel layer is the operating system layer of the Android operating system and belongs to the lowest level of the Android operating system software level.
  • the kernel layer is based on the Linux kernel to provide core system services and hardware-related drivers for the Android operating system.
  • developers can develop a software program that implements the video stream cropping method provided by the embodiment of the present invention based on the system architecture of the Android operating system as shown in FIG.
  • the video stream cropping method can be run based on the Android operating system as shown in FIG. 1. That is, the processor or the electronic device can implement the video stream cropping method provided in the embodiment of the present invention by running the software program in the Android operating system.
  • the electronic device in the embodiment of the present invention may be a mobile electronic device or a non-mobile electronic device.
  • the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a handheld computer, a vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (personal digital assistant). Assistant, PDA), etc.
  • the non-mobile electronic device may be a personal computer (PC), television (television, TV), teller machine, or self-service machine, etc., which is not specifically limited in the embodiment of the present invention.
  • the execution subject of the video stream cropping method provided by the embodiments of the present invention may be the above-mentioned electronic device, or may be a functional module and/or functional entity in the electronic device that can implement the video stream cropping method, and may be specifically based on actual usage requirements. It is confirmed that the embodiment of the present invention is not limited.
  • the following takes an electronic device as an example to illustrate the video stream cropping method provided by the embodiment of the present invention.
  • cropping the video stream may include cropping the video stream in the temporal domain and cropping the video stream in the spatial domain.
  • cropping the video stream in the time domain can be cropping a video stream with a longer duration into a video stream with a shorter duration.
  • Cropping the video stream in the spatial domain can be to crop an image with a larger size in the video stream into an image with a smaller size.
  • the size in the embodiment of the present invention may be side length and/or area.
  • the size of the aforementioned image may be the side length of the image and/or the area of the image.
  • the video stream cropping method provided by the embodiment of the present invention can be applied to crop the video stream in the spatial domain through an electronic device to optimize the composition of the image in the video stream or to highlight the main body of the image in the video stream.
  • the subject in the embodiment of the present invention refers to a general meaning, and is not a specific thing.
  • the subject may be an image or a main part of an image in a video stream.
  • the electronic device may first determine the cropping area of an image (hereinafter referred to as image A1) in the video stream (for example, the first cropping area in the embodiment of the present invention, hereinafter referred to as cropping area 1); then, the electronic device
  • image A1 an image
  • image A2 the object in the cropped area 1 in the image A1
  • object B2 An object whose matching degree of the object B1 is greater than or equal to a preset threshold
  • object B2 and the object B1 can be the same subject in the video stream.
  • the object B2 and the object B1 can be the facial image of the same user; thus, when an image A2 includes the object B2, it means that the image A2 and The same subject is included in the image A1.
  • the electronic device may determine the area including the object B2 in the image A2 as the cropped area of the image A2 according to the cropped area 1 and the object B1 (for example, the second cropped area in the embodiment of the present invention, hereinafter referred to as cropped area 2) ).
  • the electronic device can determine the cropped areas of all images that include the same subject in the video stream.
  • the electronic device crops the images outside the cropped area in these images, for example, crops the image outside the cropped area 1 in the image A1, and crops the image outside the cropped area 2 in the image A2, the cropped video stream is obtained. All of these images include the same subject. Therefore, it is possible to avoid the loss of the main body of the image in the cropped video stream.
  • the electronic device can also crop the video stream in the time domain. For example, if the video stream includes 10 frames of images before cropping, and 2 frames of images do not include the subject, the electronic device can crop the video stream in the time domain.
  • the video stream is cropped in the domain, for example, the electronic device can discard these 2 frames of images.
  • the electronic device may also crop the frame of the image according to the cropped area of the previous frame of each of the two frames of images.
  • the details can be determined according to actual use requirements, and the embodiment of the present invention does not limit it.
  • the above-described cropping process is described by taking an object in the video stream as an example.
  • images including different objects can be cropped separately.
  • the electronic device can perform the video data provided by the embodiment of the present invention for each frame of image including subject 1 and each frame of image including subject 2.
  • the stream clipping method performs clipping. Specifically, it can be determined according to actual use requirements, and the embodiment of the present invention does not limit it.
  • an embodiment of the present invention provides a video stream cropping method, and the method may include the following S201 to S203.
  • the electronic device determines a first cropping area of a first image in a target video stream.
  • the above-mentioned first cropping area may include a first object.
  • the above-mentioned target video stream may be a video stream tailored according to user requirements.
  • the first object can be understood as the main body in the target video stream.
  • the subject may be an object that the user needs to keep in the target video stream after cropping.
  • the first object may be any object with a clear boundary in the first image.
  • the above-mentioned first object may include at least one of the following: a full-body image of a person, a face image of a person, an image of a house, an image of a tree, an image of an animal, etc., which can be specifically determined according to actual usage requirements. limited.
  • any object with a clear boundary in the first image can be determined according to at least one of color, pattern, and shape. For example, taking the determination of objects with clear boundaries in the first image based on color as an example, if the background color of the first image is white, then the objects in the first image are black, red and black, blue and black, and All green objects can be objects with clear boundaries in the first image.
  • the user before the electronic device determines the first object in the first image, the user can trigger the electronic device to select the target video stream and display the first image in the target video stream. It is understandable that this When, the target video stream can be in editable state.
  • the electronic device may first determine the first object in the first image, and then according to the area where the first object is located in the first image (for example, the following The first area), the first cropping area is determined.
  • the above S201 may be implemented by the following S201a and S201b.
  • the electronic device determines the first object in the first image.
  • the first object may be an object automatically recognized by the electronic device (implementation 1), or may be an object selected by the user (implementation 2), which can be specifically determined according to actual usage requirements, which is not limited in the embodiment of the present invention.
  • the first object is an object automatically recognized by the electronic device.
  • the electronic device may use image recognition technology to automatically recognize the object in the first image, and after recognizing the object in the first image, it will At least part of the object is determined to be the first object.
  • the electronic device can determine the 3 facial images as a whole and determine the first object; or , The electronic device may determine part of the facial images in the three facial images, for example, the facial image with the largest area, the smallest area, etc., as the first object. Specifically, it can be determined according to actual use requirements, and the embodiment of the present invention does not limit it.
  • the electronic device may display a prompt message to prompt the user that the subject is not recognized.
  • the prompt message may be "The subject is not recognized, please try another image.”
  • Implementation mode 2 The first object is the object selected by the user trigger.
  • the electronic device after the electronic device displays the first image, if the user inputs on the first image, the electronic device can obtain the input parameter input by the user, and determine the object corresponding to the input parameter in the first image For the first object.
  • the input parameter input by the user may be at least one of the following: input position, input area, input trajectory, and input duration, which may be specifically determined according to actual usage requirements, and the embodiment of the present invention does not limit it.
  • the electronic device displays a first image 40.
  • the first image 40 includes an image of a tree and an image of a house. If the user clicks on the image of the house, the electronic device can obtain the user The click position of the user (that is, the input position input by the user), and the image recognition technology is used to identify the image of the house at the click position, and the image of the house is determined as the first object.
  • the electronic device can display a prompt message to prompt the user that the subject currently selected cannot be recognized.
  • the prompt message can be "The subject currently selected cannot be recognized, please try selecting the subject again” .
  • the electronic device may display a first identification frame (for example, The identification box shown by 41 in (b) in Fig. 4).
  • the first identification frame may be used to indicate the first object determined by the electronic device.
  • the shape of the first area may be the same as the shape of the first identification frame; the size (for example, side length or area) of the first area may be the same as the size of the first identification frame, or The size of the first area may be smaller than the size of the aforementioned first identification frame.
  • the electronic device determines a first cropping area according to the first area where the first object is located in the first image.
  • the electronic device may determine an area including the first area in the first image as the first cropping area, so that the first cropping area includes the first object.
  • the area of the first cropping region may be larger than the area of the above-mentioned first identification frame.
  • the area of the first cropping region indicated by 42 is larger than the area of the first identification frame indicated by 41.
  • the aspect ratio of the first cropping area and the aspect ratio of the first image may be the same or different, and may be specifically determined according to actual usage requirements.
  • the electronic device may display the first cropping frame on the first cropping area (the cropping frame shown as 42 in (b) of FIG. 4) ) Is used to indicate the first cropping area, so that the user can confirm through the first cropping frame whether the first cropping area meets their actual usage requirements.
  • the shape of the first cropping frame is the same as the shape of the first cropping area
  • the size (side length or area) of the first cropping frame is the same as the size of the first cropping area.
  • the electronic device may use AI composition technology to determine the first cropping area. For example, the electronic device may determine one or more recommended cropping regions including the first object, and display multiple recommended cropping boxes for indicating the recommended cropping regions, and then the user can input one of the recommended cropping boxes to trigger the electronic device to select Compose the cropped area that meets its needs.
  • the electronic device can determine the first cropping area of the first image according to the area where the first object is located in the first image, it can be ensured that the first cropping area includes the user's requirements and remains in the cropped area.
  • the electronic device determines the second cropping area of the second image in the target video stream according to the first cropping area and the first object.
  • the second cropping area includes the second object in the second image, and the degree of matching between the second object and the first object is greater than or equal to a first preset threshold (specifically, it can be determined according to actual usage requirements.
  • a first preset threshold specifically, it can be determined according to actual usage requirements.
  • the implementation of the present invention The examples are not limited).
  • the degree of matching between the second object and the first object is greater than or equal to the first preset threshold, which can be understood as: the second object and the first object are the same subject in the target video stream, for example The second object and the first object are the same facial image (referring to facial images that include the same facial features) in the target video stream.
  • the number of second images in the target video stream may be one or multiple, and may be specifically determined according to actual use requirements, which is not limited in the embodiment of the present invention.
  • the number of second images in the target video stream is not limited.
  • the second image may be an image located after the first image in the target video stream; or it may be an image located before the first image in the target video stream, which can be specifically based on actual usage requirements. It is confirmed that the embodiment of the present invention is not limited.
  • the foregoing S202 may be specifically implemented by the following S202a and S202b.
  • the electronic device determines, according to the first object, that the target video stream includes a second image of the second object.
  • the above-mentioned second image may be an image in the at least one third image.
  • the electronic device can determine the degree of matching between each third image and the first object to determine whether each third image includes the second object; After the second object is included in a certain third image, the electronic device may determine the third image as the second image.
  • the electronic device may extract the first target characteristic information of the first object, and extract the second target characteristic information of each third image; then, the electronic device may sequentially compare each second target characteristic information with the first target characteristic information.
  • the feature information is compared to determine whether the degree of matching between each second target feature information and the first target feature information is greater than or equal to a preset threshold (for example, the aforementioned first preset threshold). If the degree of matching between a certain second target feature information and the first target feature information is greater than or equal to the first preset threshold, the electronic device may determine that the third image corresponding to the second target feature information includes the second object, and The object indicated by the second target feature information in the third image is the second object.
  • a preset threshold for example, the aforementioned first preset threshold
  • the electronic device may determine that the third image corresponding to the second target characteristic information does not include the second object. And so on, until the electronic device compares each second target characteristic information with the first target characteristic information. It can be understood that when the electronic device determines that a third image includes the second object, the electronic device can determine that the third image is the second image.
  • the electronic device can extract facial feature information in the first object (that is, the aforementioned first target feature information), and extract the third The feature information in the image (that is, the above-mentioned second target feature information), and the feature information is compared with the facial feature information. If the matching degree between the feature information and the facial feature information is greater than or equal to the preset matching degree threshold (that is, the aforementioned first preset threshold), the electronic device may determine that the third image includes the facial image of user A, and the electronic device The object corresponding to the second target feature information in the third image may be determined as the second object, and the electronic device may determine that the third image is the second image. If the degree of matching between the feature information and the facial feature information is less than the preset matching degree threshold, the electronic device may determine that the third image does not include the facial image of the user A, that is, the third image does not include the second object.
  • the preset matching degree threshold that is, the aforementioned first preset threshold
  • the electronic device may display the second recognition frame in the second area where the second object is located in the second image.
  • the second identification frame may be used to indicate the second object determined by the electronic device.
  • the description of the second area and the second identification frame reference may be made to the related description of the first area and the first identification frame in the foregoing embodiment. In order to avoid repetition, details are not repeated here.
  • the electronic device determines a second cropping area including the second object in the second image according to the first cropping area and the first object.
  • the electronic device may determine that the second image includes the second image through the following two possible implementation manners (ie, the first possible implementation manner and the second possible implementation manner described below) The second cropping area of the second object.
  • the electronic device may determine the second cropping area including the second object in the second image according to the size of the first cropping area and the relative position of the first object and the first cropping area.
  • the size (side length and/or area) of the second cropping area and the size of the first cropping area may be the same.
  • the electronic device may determine the relative position of the second object and the second cropping area (hereinafter referred to as the first relative position) according to the relative position of the first object and the first cropping area (hereinafter referred to as the first relative position). Is the second relative position). Wherein, the second relative position can be consistent with the first relative position.
  • the electronic device may determine the relative position between the center point of the first object and the center point of the first cropping area as the first relative position; or, the center of the first area may be determined as the first relative position.
  • the relative position between the point and the center point of the first cropping area is determined as the first relative position.
  • the first relative position is determined according to the center point of the first area and the center point of the first cropping area. Assuming that the center point of the first area is point A, and the center point of the first cropping area is point B, then, as shown in Figure 5, when point A is located to the left of point B, it means that the first relative position can be the first object It is located in the left area of the first cropping area, so that the electronic device can determine that the second relative position is that the second object is located in the left area of the second cropping area.
  • point A When point A is located to the right of point B, it means that the first relative position can be that the first object is located on the right side of the first cropping area, so the electronic device can determine that the second relative position is that the second object is located on the right of the second cropping area. Side area.
  • point A When point A is above point B, it means that the first relative position can be that the first object is located in the upper area of the first cropping area, so that the electronic device can determine that the second relative position is that the second object is located in the upper area of the second cropping area .
  • point A When point A is located below point B, it means that the first relative position may be that the first object is located at the lower side of the first cropping area, so the electronic device can determine that the second relative position is that the second object is located on the lower side of the second cropping area area.
  • point A and point B coincide or approximately coincide, it means that the first relative position is that the first object is located in the center area of the first cropping area, so the electronic device can determine that the second relative position is that the second object is located in the middle of the second cropping area. area.
  • it can be determined according to actual use requirements, and the embodiment of the present invention does not limit it.
  • the above-mentioned upper, lower, left, right, and middle are all based on that when the center point of the first cropping area is located at the origin of a coordinate system, the center point of the first area is relative to the origin. Take it as an example.
  • the above-mentioned relative position is determined by taking the relative positional relationship between the first object and the first cropping area as an example.
  • the relative position between the first object and the first cropping area can also be combined. The position relationship and distance are determined.
  • the size of the second cropping area is the same as the size of the first cropping area, it can be ensured that the size of each frame image in the target video stream after cropping can be kept consistent.
  • the relative position of the second object and the second cropping area is consistent with the relative position of the first object and the first cropping area, it can be ensured that the first object and the second object are in the target video stream after cropping.
  • the position in each frame of the image is basically fixed. In this way, not only can the composition effect of the image in the target video stream be optimized, but also it can be ensured that the target video stream after cropping has a better display effect.
  • the electronic device may determine that the second image includes the second crop of the second object according to the proportion of the area of the first object in the first cropping area and the relative position of the first object and the first cropping area. area.
  • the electronic device may determine the area ratio of the second object in the second cropping area according to the area ratio of the first object in the first cropping area; and may determine the area ratio of the second object in the second cropping area according to the The relative position of the first cropping area determines the relative position of the second object and the second cropping area.
  • the relative position of the object and the cropped area please refer to the related description of the first possible implementation manner. In order to avoid repetition, it will not be repeated here.
  • the area proportion of the first object in the first cropping region may be understood as the ratio of the area of the first object to the area of the first cropping region.
  • the electronic device may determine the area of the second object and the area of the second cropping area according to the ratio of the area of the first object to the area of the first cropping region (hereinafter referred to as the first ratio) Ratio (hereinafter referred to as the second ratio).
  • the second ratio can be the same as the first ratio.
  • the proportion of the second object in the second cropping area is the same as the proportion of the first object in the second cropping area, it can be ensured that the first object and the second object are cropped.
  • the proportion of each frame in the target video stream is the same.
  • the target video stream of the first object and the second object after cropping can be guaranteed.
  • the position in each frame of the image is basically fixed. In this way, not only the composition effect of each frame image in the target video stream can be optimized, but also the subject in the target video stream after cropping can be further highlighted, thereby improving the cropping effect.
  • the area of the first cropped area 61 of the first image 60 is 2 square centimeters, and the first cropped area 61 includes a facial image (Ie the first object), the facial image is located in the central area of the first cropping area, and the area of the facial image is 1 square centimeter; as shown in Figure 6 (b) or Figure 6 (c), and It is assumed that the second image 62 also includes a facial image, and the area of the facial image in the second image 62 is 0.5 square centimeters. Then, in the first possible implementation manner, as shown in (b) of FIG.
  • the area of the second cropping area 63 determined by the electronic device may be 2 square centimeters, and the center point of the second cropping area 63 and The center points of the facial images in the second image 62 coincide; that is, the electronic device determines the second cropping area according to the size of the first cropping area and the relative position of the first object and the first cropping area.
  • the electronic device determines the second cropping area according to the size of the first cropping area and the relative position of the first object and the first cropping area.
  • the area of the second cropping area 63 determined by the electronic device is 1 square centimeter, and the center point of the second cropping area 63 is the same as the second image
  • the center points of the facial images in 62 coincide; that is, the electronic device determines the second cropping area according to the area proportion of the first object in the first cropping area and the relative position of the first object and the first cropping area.
  • the electronic device may display the second cropping frame on the second cropping area, and the size of the second cropping frame Same size as the second crop area.
  • the electronic device may display the second cropping frame on the second cropping area, and the size of the second cropping frame Same size as the second crop area.
  • the electronic device may further divide the target video stream into at least A video segment, and mark each video segment. For example, you can set a flag mark in the first frame and the last frame of each video stream segment; or you can set the progress bar of the target video stream to correspond to each video segment The time periods are marked with different colors.
  • each frame of image of each video stream segment may include the first object or the second object, that is, it includes the main body in the target video stream.
  • the electronic device crops the image outside the first cropping area in the first image, and crops the image outside the second cropping area in the second image, to obtain a cropped target video stream.
  • the electronic device cropping the image outside the first cropping area in the first image can be understood as: the electronic device retains the image in the first image within the first cropping area, and discards the first image in the first image.
  • the electronic device cropping the image outside the second cropping area in the second image can be understood as: the electronic device retains the image within the second cropping area in the second image, and discards the image outside the second cropping area in the second image.
  • the target video stream cropped by the electronic device includes the image in the first cropping area and the image in the second cropping area.
  • the above-mentioned second image may be a multi-frame second image.
  • the cropped first image and the cropped multi-frame second image are then cropped.
  • the two images are combined into one video stream, and then the cropped target video stream can be obtained.
  • the electronic device when the electronic device determines the cropped area of an image, it can refer to the cropped area determined in another image and the objects in the cropped area, so that the electronic device can determine the cropped area.
  • the cropped area of an image may include objects that match the object (for example, two objects are the same object), that is, the video stream cropping method provided by the embodiment of the present invention is adopted, and the cropped areas of each image determined include the main body of the image. Therefore, after cropping each frame of the video stream according to these cropping regions, it is possible to avoid the loss of the main body of the image in the cropped video stream.
  • the electronic device may also use interpolation to perform pixel interpolation on each frame of the cropped target video stream to adjust the cropped target video stream.
  • the size of each frame of the target video stream For example, the size of each frame of image in the target video stream after cropping can be restored to the size before cropping.
  • the embodiment of the present invention when the position of the second object in the second image is close to the boundary of the second image, the boundary of the second cropping area determined by the electronic device may exceed the boundary of the second image, and so After the electronic device crops the image outside the second cropping area in the second image, the size of the obtained image may be smaller than the size of the second cropping area. Further, in order to ensure that the size of each frame image in the target video stream after cropping is consistent, the embodiment of the present invention may adjust the second cropping area when the boundary of the second cropping area exceeds the boundary of the second image, so that the adjusted The boundary of the second cropping area is located in the second image, that is, the boundary of the adjusted second cropping area does not exceed the boundary of the second image.
  • the method for the electronic device to determine whether the boundary of the second cropping area exceeds the boundary of the second image will be exemplarily described below.
  • the electronic device can obtain the coordinate range of the boundary of the second cropping area on the x-axis of the coordinate system (hereinafter referred to as the first coordinate range) and the boundary of the second cropping area at the coordinates
  • the coordinate range on the y-axis of the system (hereinafter referred to as the second coordinate range), and the coordinate range of the boundary of the second image on the x-axis of the coordinate system (hereinafter referred to as the third coordinate range) and the second image
  • the coordinate range of the boundary on the y-axis of the coordinate system hereinafter referred to as the fourth coordinate range).
  • the electronic device can compare the first coordinate range with the third coordinate range, and compare the second coordinate range with the fourth coordinate range. If all coordinates in the first coordinate range belong to the third coordinate range, and all coordinates in the second coordinate range belong to the fourth coordinate range, the electronic device may determine that the boundary of the second cropping area does not exceed the boundary of the second image . If at least one coordinate in the first coordinate range does not belong to the third coordinate range, or at least one coordinate in the second coordinate range does not belong to the fourth coordinate range, the electronic device may determine that the boundary of the second cropping area exceeds the boundary of the second image.
  • the electronic device can compare [X3, X4] with [X1, X2], and compare [Y3, Y4] with [Y1, Y2]. As shown in (a) in FIG.
  • the electronic device can determine that the boundary of the second cropping area 70 does not exceed the boundary of the second image 70 . As shown in (b) of FIG. 7, since Y4>Y2, the electronic device can determine that the boundary of the second cropping area 71 exceeds the boundary of the second image 70.
  • the method for adjusting the second cropping area of the electronic device will be described below as an example.
  • the video stream cropping method provided in the embodiment of the present invention may further include the following S204.
  • the boundary of the second crop area adjusted by the electronic device may be located in the second image; and the adjusted second crop area includes the second object.
  • the shape and size of the second cropping area may remain unchanged.
  • the electronic device may determine the offset direction of the boundary of the second cropping area relative to the center point of the second image, and determine that the boundary of the second cropping area is relative to the first offset direction in the offset direction.
  • the offset of the boundary of the second image so that the electronic device can adjust the second cropping area according to the offset direction and the offset.
  • the electronic device may keep the size of the second cropping area unchanged, and move the entire second cropping area in a direction opposite to the offset direction by the offset.
  • the electronic device when the boundary of the second cropping area exceeds the boundary of the second image, the electronic device can adjust the boundary of the second cropping area into the second image. Therefore, it can be ensured that the electronic device crops the second image. After the image outside the second cropping area, the size of the obtained image is equal to the size of the second cropping area, thereby ensuring that the cropped target video stream has a better display effect.
  • the electronic device may use a smoothing algorithm to adjust the second cropping area in the second image according to the position of the first cropping area in the first image.
  • a smoothing algorithm to adjust the position of the second cropping area in the second image to improve the smoothness between the frames of the cropped target video stream, so as to avoid the screen jitter of the cropped target video stream.
  • the electronic device may adjust the position of the second cropping area in the second image according to the position of the first cropping area in the first image after performing the above S204.
  • the above-mentioned smoothing algorithm may be a unary linear fitting algorithm, or may be a least squares method, or any other possible smoothing algorithm, which can be specifically determined according to actual usage requirements.
  • the embodiment of the present invention Not limited.
  • the electronic device may linearly fit the initial coordinates of the first cropping area with the initial coordinates of the second cropping area to update the initial cropping coordinates of the second cropping area, and use the updated initial cropping coordinates.
  • a second cropping area is re-determined.
  • the starting coordinate of a cropping area may be any coordinate on the boundary of the cropping area.
  • the starting cropping coordinates of the second cropping area can be any coordinates such as (X1, Y1), (X1, Y2), (X2, Y1) or (X2, Y2) .
  • the electronic device adopts a univariate linear fitting algorithm to adjust the position of the second cropping region in the second image.
  • the electronic device can linearly fit the coordinates of the starting clipping point of the first clipping region on the x-axis with the coordinates of the starting clipping point of the second clipping region on the x-axis to adjust the starting clipping of the second clipping region The coordinate of the point on the x-axis.
  • the electronic device can linearly fit the coordinates of the starting clipping point of the first clipping region on the y axis and the coordinates of the starting clipping point of the second clipping region on the y axis to adjust the size of the second clipping region.
  • the electronic device can adjust the starting cropping point of the second cropping area. Then, the electronic device can re-determine a second cropping area according to the original size of the second cropping area using the adjusted starting cropping point as the starting point. , The electronic device can adjust the position of the second cropping area in the second image.
  • the electronic device can adjust the smoothness of the cropped target video stream in advance by adjusting the position of the second cropped area in the second image, the smoothness of the cropped target video stream can be improved. , So as to ensure that the cropped target video stream has a better display effect.
  • the video stream cropping methods shown in the figures of the above methods are all exemplified in conjunction with a figure in the embodiment of the present invention.
  • the video stream cropping methods shown in the figures of the above methods can also be implemented in combination with any other figures that can be combined as illustrated in the above embodiments, and will not be repeated here.
  • an embodiment of the present invention provides an electronic device 900.
  • the electronic device 900 may include: a determining module 901 and a cutting module 902.
  • the determining module 901 may be used to determine the first cropping area of the first image in the target video stream, and the first cropping area may include the first object; and according to the first cropping area and the first object, determine the first cropping area in the target video stream.
  • the second cropping area of the second image may include: a determining module 901 and a cutting module 902.
  • the first cropping area may include the first object
  • the second cropping area may include the second object in the second image
  • the degree of matching between the second object and the first object may be greater than or equal to the first preset threshold
  • cropping The module 902 can be used to crop the image in the first image that is outside the first cropping area determined by the determining module 901, and crop the image in the second image that is outside the second cropping area determined by the determining module 901 to obtain the cropped target Video streaming.
  • the above-mentioned determining module 901 may be specifically configured to determine the second image including the second object in the target video stream according to the first object; and determine according to the first cropping area and the first object The second image includes the second cropped area of the second object.
  • the above-mentioned determining module 901 may be specifically configured to determine the second cropping area according to the size of the first cropping area and the relative position of the first object and the first cropping area.
  • the above-mentioned determining module 901 may be specifically configured to determine the second object according to the area ratio of the first object in the first cropping area and the relative position of the first object and the first cropping area. Cropping area.
  • the foregoing electronic device may further include an adjustment module 903.
  • the adjustment module 903 may be configured to, after the determining module 901 determines the second cropping area, and when the determining module 901 determines that the boundary of the second cropping area exceeds the boundary of the second image, the electronic device may, according to the boundary of the second image, The second cropping area is adjusted; wherein the boundary of the adjusted second cropping area is located in the second image.
  • the foregoing electronic device may further include an adjustment module 903.
  • the adjustment module 903 may be configured to, after the determining module 901 determines the second cropping area, use a smoothing algorithm to adjust the position of the second cropping area in the second image according to the position of the first cropping area in the first image.
  • the above-mentioned determining module 901 may be specifically used to determine the first object in the first image, and determine the first crop according to the first area where the first object is located in the first image. Area; the first object is an object automatically recognized by the electronic device or an object selected by the user.
  • the foregoing electronic device may further include a display module 904.
  • the display module 904 may be configured to display the first recognition frame in the first area after the determining module 901 determines the first object.
  • the first identification frame may be used to indicate the determined first object; the size (area and shape) of the first identification frame may be the same as the size of the first cropping area.
  • the electronic device 900 provided in the embodiment of the present invention can implement the various processes implemented by the electronic device shown in the foregoing method embodiments. In order to avoid repetition, details are not described herein again.
  • An embodiment of the present invention provides an electronic device that can determine a first cropped area (including a first object) of a first image in a target video stream; and determine the target video stream according to the first cropped area and the first object
  • the second cropping area of the second image in the second image including the second object in the second image, the matching degree between the second object and the first object is greater than or equal to the first preset threshold; and cropping the first image in the first image
  • the image outside the region is cropped, and the image outside the second cropping region in the second image is cropped to obtain the cropped target video stream.
  • the electronic device determines the cropped area of an image, it can refer to the cropped area determined in another image and the objects in the cropped area, so the cropped area of the one image determined by the electronic device can include The object that matches the object (for example, the two objects are the same object), that is, the video stream cropping method provided by the embodiment of the present invention is adopted, and the cropped regions of each image are determined to include the main body of the image, so that the video is cropped according to these cropped regions After each frame of image in the stream, the main body of the image in the cropped video stream can be avoided from being lost.
  • FIG. 12 is a schematic diagram of the hardware structure of an electronic device implementing various embodiments of the present invention.
  • the electronic device 100 includes but is not limited to: a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, and a memory 109 , Processor 110, and power supply 111 and other components.
  • Those skilled in the art can understand that the structure of the electronic device shown in FIG. 12 does not constitute a limitation on the electronic device.
  • the electronic device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. Layout.
  • electronic devices include, but are not limited to, mobile phones, tablet computers, notebook computers, palmtop computers, in-vehicle electronic devices, wearable devices, and pedometers.
  • the processor 110 is configured to determine a first cropping area of the first image in the target video stream, the first cropping area includes the first object; and according to the first cropping area and the first object, determine the first cropping area in the target video stream A second cropping area of the second image; and cropping an image outside the first cropping area in the first image, and cropping an image outside the second cropping area in the second image to obtain a cropped target video stream.
  • the second cropping area includes the second object in the second image, and the degree of matching between the second object and the first object is greater than or equal to the first preset threshold.
  • the determining module 901 and the cutting module 902 in the structural schematic diagrams of the foregoing electronic device may be implemented by the foregoing processor 110.
  • the adjustment module 903 in the above-mentioned structural schematic diagram of the electronic device may be implemented by the above-mentioned processor 110.
  • the display module 904 in the above-mentioned structural schematic diagram of the electronic device may be implemented by the above-mentioned display unit 106.
  • An embodiment of the present invention provides an electronic device.
  • the electronic device can determine a first cropping area (including a first object) of a first image in a target video stream; and according to the first cropping area and the first object, determine the target video stream
  • the second cropping area of the second image including the second object in the second image, the matching degree between the second object and the first object is greater than or equal to the first preset threshold; and cropping the first image in the first crop And crop the image outside the second cropping area in the second image to obtain the cropped target video stream.
  • the electronic device determines the cropped area of an image, it can refer to the cropped area determined in another image and the objects in the cropped area, so the cropped area of the one image determined by the electronic device can include The object that matches the object (for example, the two objects are the same object), that is, the video stream cropping method provided by the embodiment of the present invention is adopted, and the cropped regions of each image are determined to include the main body of the image, so that the video is cropped according to these cropped regions After each frame of image in the stream, the main body of the image in the cropped video stream can be avoided from being lost.
  • the radio frequency unit 101 can be used for receiving and sending signals in the process of sending and receiving information or talking. Specifically, the downlink data from the base station is received and processed by the processor 110; in addition, Uplink data is sent to the base station.
  • the radio frequency unit 101 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like.
  • the radio frequency unit 101 can also communicate with the network and other devices through a wireless communication system.
  • the electronic device provides users with wireless broadband Internet access through the network module 102, such as helping users to send and receive emails, browse web pages, and access streaming media.
  • the audio output unit 103 can convert the audio data received by the radio frequency unit 101 or the network module 102 or stored in the memory 109 into an audio signal and output it as sound. Moreover, the audio output unit 103 may also provide audio output related to a specific function performed by the electronic device 100 (for example, call signal reception sound, message reception sound, etc.).
  • the audio output unit 103 includes a speaker, a buzzer, a receiver, and the like.
  • the input unit 104 is used to receive audio or video signals.
  • the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042.
  • the graphics processor 1041 is configured to capture still pictures or video streams obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. Image data is processed.
  • the processed image frame can be displayed on the display unit 106.
  • the image frame processed by the graphics processor 1041 may be stored in the memory 109 (or other storage medium) or sent via the radio frequency unit 101 or the network module 102.
  • the microphone 1042 can receive sound, and can process such sound into audio data.
  • the processed audio data can be converted into a format that can be sent to a mobile communication base station via the radio frequency unit 101 for output in the case of a telephone call mode.
  • the electronic device 100 further includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors.
  • the light sensor includes an ambient light sensor and a proximity sensor.
  • the ambient light sensor can adjust the brightness of the display panel 1061 according to the brightness of the ambient light.
  • the proximity sensor can close the display panel 1061 and the display panel 1061 when the electronic device 100 is moved to the ear. / Or backlight.
  • the accelerometer sensor can detect the magnitude of acceleration in various directions (usually three axes), and can detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of electronic devices (such as horizontal and vertical screen switching, related games) , Magnetometer attitude calibration), vibration recognition related functions (such as pedometer, percussion), etc.; sensor 105 can also include fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, Infrared sensors, etc., will not be repeated here.
  • the display unit 106 is used to display information input by the user or information provided to the user.
  • the display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • the user input unit 107 may be used to receive inputted numeric or character information, and generate key signal input related to user settings and function control of the electronic device.
  • the user input unit 107 includes a touch panel 1071 and other input devices 1072.
  • the touch panel 1071 also called a touch screen, can collect the user's touch operations on or near it (for example, the user uses any suitable objects or accessories such as fingers, stylus, etc.) on the touch panel 1071 or near the touch panel 1071. operating).
  • the touch panel 1071 may include two parts: a touch detection device and a touch controller.
  • the touch detection device detects the user's touch position, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it To the processor 110, the command sent by the processor 110 is received and executed.
  • the touch panel 1071 can be implemented in multiple types such as resistive, capacitive, infrared, and surface acoustic wave.
  • the user input unit 107 may also include other input devices 1072.
  • other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackball, mouse, and joystick, which will not be repeated here.
  • the touch panel 1071 can be overlaid on the display panel 1061.
  • the touch panel 1071 detects a touch operation on or near it, it transmits it to the processor 110 to determine the type of the touch event, and then the processor 110 determines the type of the touch event according to the touch.
  • the type of event provides corresponding visual output on the display panel 1061.
  • the touch panel 1071 and the display panel 1061 are used as two independent components to implement the input and output functions of the electronic device, in some embodiments, the touch panel 1071 and the display panel 1061 can be integrated
  • the implementation of the input and output functions of the electronic device is not specifically limited here.
  • the interface unit 108 is an interface for connecting an external device with the electronic device 100.
  • the external device may include a wired or wireless headset port, an external power source (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, audio input/output (I/O) port, video I/O port, headphone port, etc.
  • the interface unit 108 can be used to receive input (for example, data information, power, etc.) from an external device and transmit the received input to one or more elements in the electronic device 100 or can be used to connect to the electronic device 100 and the external device. Transfer data between devices.
  • the memory 109 can be used to store software programs and various data.
  • the memory 109 may mainly include a program storage area and a data storage area.
  • the program storage area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.), etc.; Data created by the use of mobile phones (such as audio data, phone book, etc.), etc.
  • the memory 109 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the processor 110 is the control center of the electronic device, which uses various interfaces and lines to connect the various parts of the entire electronic device, runs or executes software programs and/or modules stored in the memory 109, and calls data stored in the memory 109 , Perform various functions of electronic equipment and process data, so as to monitor the electronic equipment as a whole.
  • the processor 110 may include one or more processing units; optionally, the processor 110 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface, and application programs, etc.
  • the adjustment processor mainly deals with wireless communication. It can be understood that the foregoing modem processor may not be integrated into the processor 110.
  • the electronic device 100 may also include a power source 111 (such as a battery) for supplying power to various components.
  • a power source 111 such as a battery
  • the power source 111 may be logically connected to the processor 110 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. Management and other functions.
  • the electronic device 100 includes some functional modules not shown, which will not be repeated here.
  • an embodiment of the present invention also provides an electronic device, including a processor 110 as shown in FIG. 12, a memory 109, a computer program stored in the memory 109 and running on the processor 110, the computer
  • the program is executed by the processor 110, each process of the foregoing method embodiment is realized, and the same technical effect can be achieved. In order to avoid repetition, details are not described herein again.
  • the embodiment of the present invention also provides a computer-readable storage medium, and a computer program is stored on the computer-readable storage medium.
  • a computer program is stored on the computer-readable storage medium.
  • the computer program is executed by a processor, each process of the foregoing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, I won’t repeat them here.
  • the computer-readable storage medium may include read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc.
  • the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better. ⁇
  • the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to make an electronic device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the method described in each embodiment of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Human Computer Interaction (AREA)
  • Business, Economics & Management (AREA)
  • Multimedia (AREA)
  • Image Processing (AREA)
  • Studio Devices (AREA)

Abstract

一种视频流裁剪方法及电子设备,涉及通信技术领域,以解决裁剪视频流时导致裁剪后的视频流中的某个或某些图像中的主体丢失的问题。该方案包括:确定目标视频流中的第一图像的第一裁剪区域,第一裁剪区域中包括第一对象;根据第一裁剪区域和第一对象,确定目标视频流中的第二图像的第二裁剪区域,第二裁剪区域中包括第二图像中的第二对象,第二对象与第一对象的匹配度大于或等于第一预设阈值;裁剪第一图像中处于第一裁剪区域外的图像,并裁剪第二图像中处于第二裁剪区域外的图像,得到裁剪后的目标视频流。

Description

视频流裁剪方法及电子设备
相关申请的交叉引用
本申请主张在2020年12月19日在中国提交的中国专利申请号No.201911320804.9的优先权,其全部内容通过引用包含于此。
技术领域
本发明实施例涉及通信技术领域,尤其涉及一种视频流裁剪方法及电子设备。
背景技术
随着通信技术的发展,电子设备的功能越来越丰富,例如,可以通过电子设备裁剪视频流,以优化视频流中图像的构图。
通常,可以采用固定裁剪区域的裁剪方式裁剪视频流。具体的,可以先针对一个视频流设置一个裁剪区域,然后电子设备可以将视频流的每帧图像中,除该裁剪区域之外的其他区域裁剪掉。例如,可以将视频流的每一帧图像的顶部区域设置为裁剪区域,那么电子设备可以将该视频流的每一帧图像中,除顶部区域之外的其它区域裁剪掉。
然而,按照上述方法,当视频流中的主体(例如:面部图像等)在各帧图像中的位置变化幅度较大,例如,当上一帧图像中的主体位于图像的顶部区域,下一帧图像中的主体位于图像的底部区域时,若通过上述固定裁剪区域的方式对视频流进行裁剪,则可能导致裁剪后的视频流中的某个或某些图像中的主体丢失。
发明内容
本发明实施例提供一种视频流裁剪方法及电子设备,以解决裁剪视频流时裁剪后的视频流中的某个或某些图像中的主体丢失的问题。
为了解决上述技术问题,本申请是这样实现的:
第一方面,本发明实施例提供了一种视频流裁剪方法,可以应用于电子设备,该方法可以包括:确定目标视频流中的第一图像的第一裁剪区域,第一裁剪区域中包括第一对象;并根据第一裁剪区域和第一对象,确定目标视频流中的第二图像的第二裁剪区域;以及裁剪第一图像中处于第一裁剪区域外的图像,并裁剪第二图像中处于第二裁剪区域外的图像,得到裁剪后的目标视频流;其中,第二裁剪区域中包括第二图像中的第二对象,第二对象与第一对象的匹配度大于或等于第一预设阈值。
第二方面,本发明实施例提供了一种电子设备,该电子设备包括:确定模块和裁剪模块。确定模块,用于确定目标视频流中的第一图像的第一裁剪区域,第一裁剪区域中包括第一对象;且根据第一裁剪区域和第一对象,确定目标视频流中的第二图像 的第二裁剪区域,第二裁剪区域中包括第二图像中的第二对象,第二对象与第一对象的匹配度大于或等于第一预设阈值;裁剪模块,用于裁剪第一图像中处于确定模块确定的第一裁剪区域外的图像,并裁剪第二图像中处于确定模块确定的第二裁剪区域外的图像,得到裁剪后的目标视频流。
第三方面,本发明实施例提供了一种电子设备,包括处理器、存储器及存储在存储器上并可在处理器上运行的计算机程序,计算机程序被处理器执行时可以实现上述第一方面的视频流裁剪方法的步骤。
第四方面,本发明实施例提供了一种计算机可读存储介质,该计算机可读存储介质上存储计算机程序,该计算机程序被处理器执行时可以实现上述第一方面的视频流裁剪方法的步骤。
在本发明实施例中,电子设备可以确定目标视频流中的第一图像的第一裁剪区域(包括第一对象);且根据第一裁剪区域和第一对象,确定目标视频流中的第二图像的第二裁剪区域(包括第二图像中的第二对象,第二对象与第一对象的匹配度大于或等于第一预设阈值);以及裁剪第一图像中处于第一裁剪区域外的图像,并裁剪第二图像中处于第二裁剪区域外的图像,得到裁剪后的目标视频流。通过该方案,由于电子设备确定一个图像的裁剪区域时,可以参考另一个图像中已确定的裁剪区域和该裁剪区域中的对象,因此可以使得电子设备确定的该一个图像的裁剪区域中可以包括与该对象匹配的对象(例如两个对象为同一对象),即采用本发明实施例提供的视频流裁剪方法,确定的各个图像的裁剪区域中均包括图像的主体,从而按照这些裁剪区域裁剪视频流中的各帧图像后,可以避免裁剪后的视频流中图像的主体丢失。
附图说明
图1为本发明实施例提供的一种可能的安卓操作系统的架构示意图;
图2为本发明实施例提供的视频流裁剪方法的示意图之一;
图3为本发明实施例提供的视频流裁剪方法应用的界面示意图之一;
图4为本发明实施例提供的视频流裁剪方法应用的界面示意图之二;
图5为本发明实施例提供的视频流裁剪方法应用的界面示意图之三;
图6为本发明实施例提供的视频流裁剪方法应用的界面示意图之四;
图7为本发明实施例提供的视频流裁剪方法应用的界面示意图之五;
图8为本发明实施例提供的视频流裁剪方法的示意图之二;
图9为本发明实施例提供的电子设备的结构示意图之一;
图10为本发明实施例提供的电子设备的结构示意图之二;
图11为本发明实施例提供的电子设备的结构示意图之三;
图12为本发明实施例提供的电子设备的硬件示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本文中术语“和/或”,是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。本文中符号“/”表示关联对象是或者的关系,例如A/B表示A或者B。
本文中的术语“第一”和“第二”等是用于区别不同的对象,而不是用于描述对象的特定顺序。例如,第一对象和第二对象等是用于区别不同的对象,而不是用于描述对象的特定顺序。
在本发明实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本发明实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
在本发明实施例的描述中,除非另有说明,“多个”的含义是指两个或者两个以上,例如,多个元件是指两个或者两个以上的元件等。
本发明实施例提供一种视频流裁剪方法及电子设备,该视频流裁剪方法可以应用于电子设备中,该电子设备可以确定目标视频流中的第一图像的第一裁剪区域(包括第一对象);且根据第一裁剪区域和第一对象,确定目标视频流中的第二图像的第二裁剪区域(包括第二图像中的第二对象,第二对象与第一对象的匹配度大于或等于第一预设阈值);以及裁剪第一图像中处于第一裁剪区域外的图像,并裁剪第二图像中处于第二裁剪区域外的图像,得到裁剪后的目标视频流。通过该方案,由于电子设备确定一个图像的裁剪区域时,可以参考另一个图像中已确定的裁剪区域和该裁剪区域中的对象,因此可以使得电子设备确定的该一个图像的裁剪区域中可以包括与该对象匹配的对象(例如两个对象为同一对象),即采用本发明实施例提供的视频流裁剪方法,确定的各个图像的裁剪区域中均包括图像的主体,从而按照这些裁剪区域裁剪视频流中的各帧图像后,可以避免裁剪后的视频流中图像的主体丢失。
本发明实施例中的电子设备可以为具有操作系统的电子设备。该操作系统可以为安卓(Android)操作系统,可以为ios操作系统,还可以为其他可能的操作系统,本发明实施例不作具体限定。
下面以安卓操作系统为例,介绍本发明实施例提供的视频流裁剪方法所应用的软件环境。
如图1所示,为本发明实施例提供的一种可能的安卓操作系统的架构示意图。在图1中,安卓操作系统的架构包括4层,分别为:应用程序层、应用程序框架层、系统运行库层和内核层(具体可以为Linux内核层)。
其中,应用程序层包括安卓操作系统中的各个应用程序(包括系统应用程序和第三方应用程序)。
应用程序框架层是应用程序的框架,开发人员可以在遵守应用程序的框架的开发原则的情况下,基于应用程序框架层开发一些应用程序。
系统运行库层包括库(也称为系统库)和安卓操作系统运行环境。库主要为安卓操作系统提供其所需的各类资源。安卓操作系统运行环境用于为安卓操作系统提供软件环境。
内核层是安卓操作系统的操作系统层,属于安卓操作系统软件层次的最底层。内核层基于Linux内核为安卓操作系统提供核心系统服务和与硬件相关的驱动程序。
以安卓操作系统为例,本发明实施例中,开发人员可以基于上述如图1所示的安卓操作系统的系统架构,开发实现本发明实施例提供的视频流裁剪方法的软件程序,从而使得该视频流裁剪方法可以基于如图1所示的安卓操作系统运行。即处理器或者电子设备可以通过在安卓操作系统中运行该软件程序实现本发明实施例提供的视频流裁剪方法。
本发明实施例中的电子设备可以为移动电子设备,也可以为非移动电子设备。示例性的,移动电子设备可以为手机、平板电脑、笔记本电脑、掌上电脑、车载电子设备、可穿戴设备、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本或者个人数字助理(personal digital assistant,PDA)等,非移动电子设备可以为个人计算机(personal computer,PC)、电视机(television,TV)、柜员机或者自助机等,本发明实施例不作具体限定。
本发明实施例提供的视频流裁剪方法的执行主体可以为上述的电子设备,也可以为该电子设备中能够实现该视频流裁剪方法的功能模块和/或功能实体,具体的可以根据实际使用需求确定,本发明实施例不作限定。下面以电子设备为例,对本发明实施例提供的视频流裁剪方法进行示例性的说明。
通常,裁剪视频流可以包括在时间域上裁剪视频流和在空间域上裁剪视频流。其中,在时间域上裁剪视频流,可以为将一个时长较长的视频流裁剪为时长较短的视频流。在空间域上裁剪视频流,可以为将视频流中的尺寸较大的图像裁剪为尺寸较小的图像。
其中,本发明实施例中的尺寸可以为边长和/或面积。例如,上述图像的尺寸可以为图像的边长和/或图像的面积。
本发明实施例提供的视频流裁剪方法可以应用于通过电子设备,在空间域上裁剪视频流,以优化该视频流中图像的构图或突出该视频流中图像的主体的场景中。其中,本发明实施例中的主体是泛指的含义,并不是具体的某个事物,例如,主体可以为一个图像或者一个视频流中的主要部分的图像。
具体的,电子设备可以先确定该视频流中的一个图像(以下称为图像A1)的裁剪区域(例如本发明实施例中的第一裁剪区域,以下称为裁剪区域1);然后,电子设备可以以该图像A1中处于该裁剪区域1中的对象(以下称为对象B1)为参考,判断该视频流中除该图像A1之外的其他图像(以下称为图像A2)中是否包括与该对象B1的匹配度大于或 等于一个预设阈值的对象(以下称为对象B2)。可以理解,对象B2和对象B1可以为该视频流中的同一主体,例如,对象B2和对象B1可以为同一用户的面部图像;从而,当一个图像A2中包括对象B2时,即表示图像A2和图像A1中包括同一主体。那么,电子设备可以根据裁剪区域1和对象B1,将该图像A2中包括对象B2的区域确定为该图像A2的裁剪区域(例如本发明实施例中的第二裁剪区域,以下称为裁剪区域2)。以此类推,电子设备可以确定该视频流中包括同一主体的所有图像的裁剪区域。从而,在电子设备裁剪这些图像中处于裁剪区域以外的图像,例如裁剪图像A1中处于裁剪区域1以外的图像,并裁剪图像A2中处于裁剪区域2以外的图像之后,得到的裁剪后的视频流的这些图像中均包括同一主体。从而可以避免裁剪后的视频流中图像的主体丢失。
可以理解,当采用本发明实施例提供的视频流裁剪方法裁剪一个视频流时,若该视频流中的某些图像中不包括上述主体(即这些图像中的对象与上述对象B1的匹配度小于预设阈值),则电子设备还可以在时间域上裁剪该视频流,例如,假设该视频流在裁剪前包括10帧图像,且其中2帧图像中不包括该主体,则电子设备可以在时间域上裁剪该视频流,例如电子设备可以丢弃这2帧图像。或者,为了保证裁剪后的视频流的流畅性,电子设备还可以分别以这2帧图像中每帧图像的上一帧图像的裁剪区域,对该帧图像进行裁剪。具体可以根据实际使用需求确定,本发明实施例不作限定。
需要说明的是,上述描述的裁剪过程是以视频流中的一个对象为例进行描述的,实际裁剪过程中,可以分别对包括不同对象的图像进行裁剪。例如,假设一个视频流中包括2个主体,分别为主体1和主体2,那么电子设备可以对包括主体1的各帧图像和包括主体2的各帧图像,分别按照本发明实施例提供的视频流裁剪方法进行裁剪。具体可以根据实际使用需求确定,本发明实施例不作限定。
下面具体结合各个附图对本发明实施例提供的视频流裁剪方法进行示例性的描述。
如图2所示,本发明实施例提供一种视频流裁剪方法,该方法可以包括下述的S201至S203。
S201、电子设备确定目标视频流中的第一图像的第一裁剪区域。
其中,上述第一裁剪区域中可以包括第一对象。
本发明实施例中,上述目标视频流可以为用户需求裁剪的视频流。第一对象可以理解为目标视频流中的主体。该主体可以为用户需求在裁剪后的目标视频流中保留的对象。
可选的,本发明实施例中,第一对象可以为第一图像中具有清晰边界的任意对象。例如,上述第一对象可以包括以下至少一项:人的全身图像、人的面部图像、房子的图像、树的图像、动物的图像等等,具体可以根据实际使用需求确定,本发明实施例不作限定。
其中,上述第一图像中具有清晰边界的任意对象可以根据颜色、图案和形状中的至少一项确定。例如,以根据颜色确定第一图像中具有清晰边界的对象为例,若第一图像的背景颜色为白色,那么第一图像中颜色为黑色的对象、红色黑色的对象、蓝色黑色的对象和绿色的对象均可以为第一图像中具有清晰边界的对象。
可选的,本发明实施例中,在电子设备确定第一图像中的第一对象之前,用户可以先触发电子设备选中目标视频流,并显示目标视频流中的第一图像,可以理解,此时,目标视频流可以处于可编辑状态。
可选的,本发明实施例中,电子设备显示第一图像之后,电子设备可以先确定第一图像中的第一对象,然后根据第一对象在第一图像中所处的区域(例如下述第一区域),确定第一裁剪区域。具体的,上述S201可以通过下述S201a和S201b实现。
S201a、电子设备确定第一图像中的第一对象。
其中,第一对象可以为电子设备自动识别的对象(实现方式一),或者,可以为用户触发选中的对象(实现方式二),具体可以根据实际使用需求确定,本发明实施例不作限定。
下面分别对上述实现方式一和实现方式二进行示例性的说明。
实现方式一、第一对象为电子设备自动识别的对象。
本发明实施例中,在电子设备显示第一图像之后,电子设备可以采用图像识别技术自动识别第一图像中的对象,并在识别出第一图像中的对象之后,将识别出的对象中的至少部分对象确定为第一对象。
例如,如图3所示,假设电子设备采用面部识别技术,识别出第一图像30中包括3个面部图像,那么电子设备可以将该3个面部图像作为一个整体,确定为第一对象;或者,电子设备可以将该3个面部图像中的部分面部图像,例如面积最大、面积最小等的面部图像,确定为第一对象。具体可以根据实际使用需求确定,本发明实施例不作限定。
可选的,本发明实施例中,在实现方式一中,若电子设备无法识别第一图像中的对象,例如第一图像中的各个对象与第一图像的背景颜色均相似,或该各个对象在第一图像中无清晰边界;则电子设备可以显示一个提示信息,提示用户未识别到主体,例如该提示信息可以为“未识别到主体,请换张图像试试”。
实现方式二、第一对象为用户触发选中的对象。
本发明实施例中,在电子设备显示第一图像之后,若用户在第一图像上输入,则电子设备可以获取用户输入的输入参数,并将第一图像中,与该输入参数对应的对象确定为第一对象。
可选的,本发明实施例中,用户输入的输入参数可以为以下至少一项:输入位置、输入区域、输入轨迹和输入时长,具体可以根据实际使用需求确定,本发明实施例不作限定。
例如,如图4中的(a)所示,电子设备显示第一图像40,第一图像40中包括树的图像和房子的图像,若用户在房子的图像上点击,那么电子设备可以获取用户的点击位置(即用户输入的输入位置),且采用图像识别技术,识别出该点击位置处的房子的图像,并将该房子的图像确定为第一对象。
可选的,本发明实施例中,在实现方式二中,若电子设备无法识别用户输入的输入参数对应的对象,例如,用户输入的输入参数对应的对象与第一图像的背景颜色相似,或该 对象在第一图像中无清晰边界;则电子设备可以显示一个提示信息,提示用户当前选择的主体无法识别,例如该提示信息可以为“当前所选主体无法识别,请重新选取主体试试”。
可选的,本发明实施例中,在上述实现方式一和实现方式二中,在电子设备确定第一对象之后,电子设备可以在第一对象所在的第一区域显示第一识别框(例如,如图4中的(b)中的41所示的识别框)。其中,第一识别框可以用于指示电子设备确定的第一对象。
本发明实施例中,上述第一区域的形状与上述第一识别框的形状可以相同;上述第一区域的尺寸(例如边长或面积)与上述第一识别框的尺寸可以相同,或者,上述第一区域的尺寸可以小于上述第一识别框的尺寸。
S201b、电子设备根据第一对象在第一图像中所处的第一区域,确定第一裁剪区域。
可选的,本发明实施例中,电子设备可以将第一图像中包括第一区域的区域确定为第一裁剪区域,以使第一裁剪区域中包括第一对象。
可选的,本发明实施例中,第一裁剪区域的面积可以大于上述第一识别框的面积。例如,如图4中的(b)所示,42指示的第一裁剪区域的面积大于41所示的第一识别框的面积。
可选的,本发明实施例中,第一裁剪区域的宽高比与第一图像的宽高比可以相同,也可以不同,具体可以根据实际使用需求确定。
可选的,本发明实施例中,电子设备确定第一裁剪区域之后,电子设备可以在第一裁剪区域上显示第一裁剪框(如图4中的(b)中的42所示的裁剪框),以用于指示第一裁剪区域,从而用户可以通过第一裁剪框确认第一裁剪区域是否符合其实际使用需求。其中,第一裁剪框的形状与第一裁剪区域的形状相同,且第一裁剪框的尺寸(边长或面积)与第一裁剪区域的尺寸相同。
其中,当上述第一对象为电子设备自动识别的对象时,电子设备可以采用AI构图技术确定上述第一裁剪区域。例如,电子设备可以确定一个或多个包括第一对象的推荐裁剪区域,并显示多个用于指示推荐裁剪区域的推荐裁剪框,然后用户可以通过对其中一个推荐裁剪框输入,触发电子设备选中构图符合其需求的裁剪区域。
本发明实施例中,由于电子设备可以根据第一对象在第一图像中所处的区域,确定第一图像的第一裁剪区域,因此可以确保第一裁剪区域中包括用户需求保留在裁剪后的图像(或裁剪后的视频流)中的主体,从而可以提高裁剪视频流中的各帧图像的准确性。
S202、电子设备根据第一裁剪区域和第一对象,确定目标视频流中的第二图像的第二裁剪区域。
其中,上述第二裁剪区域中包括第二图像中的第二对象,且第二对象与上述第一对象的匹配度大于或等于第一预设阈值(具体可以根据实际使用需求确定,本发明实施例不作限定)。
需要说明的是,本发明实施例中,第二对象与第一对象的匹配度大于或等于第一预设阈值可以理解为:第二对象与第一对象为目标视频流中的同一主体,例如第二对象与第一 对象为目标视频流中的同一个面部图像(指包括相同面部特征的面部图像)。
可选的,本发明实施例中,目标视频流中的第二图像的数量可以为一个,也可以为多个,具体可以根据实际使用需求确定,本发明实施例不作限定。
需要说明的是,本发明实施例中,在下述实施例中,除特别说明外,不限定目标视频流中第二图像的数量。
可选的,本发明实施例中,第二图像可以为目标视频流中,位于第一图像之后的图像;或者可以为目标视频流中,位于第一图像之前的图像,具体可以根据实际使用需求确定,本发明实施例不作限定。
可选的,本发明实施例中,上述S202具体可以通过下述的S202a和S202b实现。
S202a、电子设备根据第一对象,确定目标视频流中包括第二对象的第二图像。
可选的,本发明实施例中,假设目标视频流中除第一图像之外的其它图像为至少一个第三图像,那么上述第二图像可以为该至少一个第三图像中的图像。
本发明实施例中,在电子设备确定第一对象之后,电子设备可以判断每个第三图像与第一对象的匹配度,以确定每个第三图像中是否包括第二对象;在电子设备确定某个第三图像中包括第二对象之后,电子设备可以将该第三图像确定为第二图像。
具体的,电子设备可以提取第一对象的第一目标特征信息,并提取每个第三图像的第二目标特征信息;然后,电子设备可以依次将每个第二目标特征信息分别与第一目标特征信息比对,判断每个第二目标特征信息与第一目标特征信息的匹配度是否大于或等于一个预设阈值(例如上述第一预设阈值)。若某个第二目标特征信息与第一目标特征信息的匹配度大于或等于第一预设阈值,则电子设备可以确定与该第二目标特征信息对应的第三图像中包括第二对象,且该第三图像中该第二目标特征信息指示的对象即为第二对象。若某个第二目标特征信息与第一目标特征信息的匹配度小于第一预设阈值,则电子设备可以确定该第二目标特征信息对应的第三图像中不包括第二对象。以此类推,直至电子设备将每个第二目标特征信息与第一目标特征信息均比对完成。可以理解,当电子设备确定一个第三图像中包括第二对象时,电子设备即可确定该第三图像为第二图像。
例如,以一个第三图像为例,假设第一对象为用户A的面部图像,那么,电子设备可以提取第一对象中的面部特征信息(即上述第一目标特征信息),且提取该第三图像中的特征信息(即上述第二目标特征信息),并将该特征信息与该面部特征信息比对。若该特征信息与该面部特征信息的匹配度大于或等于该预设匹配度阈值(即上述第一预设阈值),则电子设备可以确定第三图像中包括用户A的面部图像,且电子设备可以将第三图像中,第二目标特征信息对应的对象确定为第二对象,以及电子设备可以确定该第三图像为第二图像。若该特征信息与该面部特征信息的匹配度小于预设匹配度阈值,则电子设备可以确定该第三图像中不包括用户A的面部图像,即该第三图像中不包括第二对象。
可选的,本发明实施例中,在电子设备确定一个第二图像之后,电子设备可以在该第二图像中第二对象所处的第二区域显示第二识别框。其中,第二识别框可以用于指示电子 设备确定的第二对象。对第二区域和第二识别框的描述,具体可以参见上述实施例中对第一区域和第一识别框的相关描述,为了避免重复,此处不再赘述。
S202b、电子设备根据第一裁剪区域和第一对象,确定第二图像中包括第二对象的第二裁剪区域。
可选的,本发明实施例中,电子设备可以通过下述两种可能的实现方式(即下述第一种可能的实现方式和第二种可能的实现方式),确定第二图像中包括第二对象的第二裁剪区域。
第一种可能的实现方式
本发明实施例中,电子设备可以根据第一裁剪区域的尺寸,和第一对象与第一裁剪区域的相对位置,确定第二图像中包括第二对象的第二裁剪区域。
可选的,本发明实施例中,第二裁剪区域的尺寸(边长和/或面积)和第一裁剪区域的尺寸可以相同。
可选的,本发明实施例中,电子设备可以根据第一对象与第一裁剪区域的相对位置(以下称为第一相对位置),确定第二对象与第二裁剪区域的相对位置(以下称为第二相对位置)。其中,第二相对位置与第一相对位置可以保持一致。
可选的,本发明实施例中,电子设备可以将第一对象的中心点与第一裁剪区域的中心点之间的相对位置,确定为第一相对位置;或者,可以将第一区域的中心点与第一裁剪区域的中心点之间的相对位置,确定为第一相对位置。
例如,以第一相对位置为根据第一区域的中心点与第一裁剪区域的中心点确定的为例。假设第一区域的中心点为点A,第一裁剪区域的中心点为点B,那么,如图5所示,当点A位于点B左侧时,表示第一相对位置可以为第一对象位于第一裁剪区域的左侧区域,从而电子设备可以确定第二相对位置为第二对象位于第二裁剪区域的左侧区域。当点A位于点B右侧时,表示第一相对位置可以为第一对象位于第一裁剪区域的右侧区域,从而电子设备可以确定第二相对位置为第二对象位于第二裁剪区域的右侧区域。点A位于点B上方时,表示第一相对位置可以为第一对象位于第一裁剪区域的上侧区域,从而电子设备可以确定第二相对位置为第二对象位于第二裁剪区域的上侧区域。当点A位于点B下方时,表示第一相对位置可以为第一对象位于第一裁剪区域的下侧区域,从而电子设备可以确定第二相对位置为第二对象位于第二裁剪区域的下侧区域。当点A与点B重合或近似重合时,表示第一相对位置为第一对象位于第一裁剪区域的中心区域,从而电子设备可以确定第二相对位置为第二对象位于第二裁剪区域的中间区域。具体可以根据实际使用需求确定,本发明实施例不作限定。
需要说明的是,本发明实施例中,上述上、下、左、右和中,均是以第一裁剪区域的中心点位于一个坐标系的原点时,第一区域的中心点相对于该原点为例进行示意的。
此外,本发明实施例中,上述相对位置是以第一对象和第一裁剪区域的相对位置关系为例进行确定的,实际实现中,还可以结合第一对象和第一裁剪区域之间的相对位置关系 和距离确定。
本发明实施例中,一方面,由于第二裁剪区域的尺寸与第一裁剪区域的尺寸相同,因此可以保证裁剪后的目标视频流中的各帧图像的尺寸可以保持一致。另一方面,由于第二对象与第二裁剪区域的相对位置,和第一对象与第一裁剪区域的相对位置保持一致,因此可以保证第一对象和第二对象在裁剪后的目标视频流的各帧图像中所处的位置基本固定。如此,不但可以优化目标视频流中图像的构图效果,而且可以保证裁剪后的目标视频流具有较好的显示效果。
第二种可能的实现方式
本发明实施例中,电子设备可以根据第一对象在第一裁剪区域中的面积占比,和第一对象与第一裁剪区域的相对位置,确定第二图像中包括第二对象的第二裁剪区域。
可选的,本发明实施例中,电子设备可以根据第一对象在第一裁剪区域中的面积占比,确定第二对象在第二裁剪区域中的面积占比;并可以根据第一对象与第一裁剪区域的相对位置,确定第二对象与第二裁剪区域的相对位置。对于对象与裁剪区域的相对位置的描述具体可以参见上述第一种可能的实现方式的相关描述,为了避免重复,此处不再赘述。
可选的,本发明实施例中,第一对象在第一裁剪区域中的面积占比可以理解为,第一对象的面积与第一裁剪区域的面积的比例。
可选的,本发明实施例中,电子设备可以根据第一对象的面积与第一裁剪区域的面积的比例(以下称为第一比例),确定第二对象的面积与第二裁剪区域的面积的比例(以下称为第二比例)。其中,第二比例与第一比例可以相同。
示例性的,假设第一对象的面积为1平方厘米,第一裁剪区域的面积为2平方厘米;又假设第二对象的面积为0.8平方厘米,第二裁剪区域的面积为X;那么电子设备可以确定第一比例P1=1:2,且第二比例P2=1:2,从而电子设备可以确定第二裁剪区域的面积X=0.8/P2=1.6平方厘米。
本发明实施例中,一方面,由于第二对象在第二裁剪区域中的占比和第一对象在第二裁剪区域中的占比相同,因此可以保证第一对象和第二对象在裁剪后的目标视频流中的各帧图像中的占比相同。另一方面,由于第二对象与第二裁剪区域的相对位置,和第一对象与第一裁剪区域的相对位置可以保持一致,因此可以保证第一对象和第二对象在裁剪后的目标视频流的各帧图像中所处的位置基本固定。如此,不仅可以优化目标视频流中的各帧图像的构图效果,而且可以进一步突出裁剪后的目标视频流中的主体,进而提高裁剪效果。
下面再结合图6对上述第一种可能的实现方式和第二种可能的实现方式进行示例性的说明。
示例性的,本法明实施例中,如图6中的(a)所示,假设第一图像60的第一裁剪区域61的面积为2平方厘米,且第一裁剪区域61中包括面部图像(即第一对象),该面部图像位于第一裁剪区域的中心区域,且该面部图像的面积为1平方厘米;如图6中的(b)或图6中的(c)所示,又假设第二图像62中也包括面部图像,且第二图像62中的面部图 像的面积0.5平方厘米。那么,在第一种可能的实现方式中,如图6中的(b)所示,电子设备确定的第二裁剪区域63的面积可以为2平方厘米,以及第二裁剪区域63的中心点与第二图像62中的面部图像的中心点重合;即电子设备根据第一裁剪区域的尺寸,和第一对象与第一裁剪区域的相对位置,确定二裁剪区域。在第二种可能的实现方式中,如图6中的(c)所示,电子设备确定的第二裁剪区域63的面积为1平方厘米,且第二裁剪区域63的中心点与第二图像62中的面部图像的中心点重合;即电子设备根据第一对象在第一裁剪区域中的面积占比,和第一对象与第一裁剪区域的相对位置,确定第二裁剪区域。
可选的,本发明实施例中,在电子设备确定第二裁剪区域之后,当电子设备显示第二图像时,电子设备可以在第二裁剪区域上显示第二裁剪框,第二裁剪框的尺寸与第二裁剪区域的尺寸相同。对于第二裁剪框的其他描述具体可以参见上述实施例中对第二裁剪框的相关描述,此处不再赘述。
可选的,本发明实施例中,电子设备确定第二裁剪区域之后,还可以根据主体(例如上述第一对象或第二对象)在目标视频流中的分布情况,将目标视频流分为至少一个视频片段,并对每个视频片段进行标记,例如,可以在每个视频流片段的首帧和尾帧各设置一个旗子标记;或者可以将目标视频流的进度条中对应于每个视频片段的时间段用不同颜色标记出来。
其中,每个视频流片段的每帧图像中均可以包括第一对象或第二对象,即包括目标视频流中的主体。
S203、电子设备裁剪第一图像中处于第一裁剪区域外的图像,并裁剪第二图像中处于第二裁剪区域外的图像,得到裁剪后的目标视频流。
本发明实施例中,电子设备裁剪第一图像中处于第一裁剪区域外的图像可以理解为:电子设备保留第一图像中处于第一裁剪区域内的图像,且丢弃第一图像中处于第一裁剪区域之外的图像。电子设备裁剪第二图像中处于第二裁剪区域外的图像可以理解为:电子设备保留第二图像中处于第二裁剪区域内的图像,且丢弃第二图像中处于第二裁剪区域外的图像。如此,电子设备裁剪后的目标视频流中包括第一裁剪区域中的图像和第二裁剪区域中的图像。
可以理解,实际实现中,上述第二图像可以为多帧第二图像,如此,在对第一图像和多帧第二图像裁剪后,再将裁剪后的第一图像和裁剪后的多帧第二图像合成为一个视频流,即可得到裁剪后的目标视频流。
本发明实施例中,上述电子设备裁剪一个图像(如上述第一图像或第二图像)中处于裁剪区域(如上述第一裁剪区域或第二裁剪区域)外的图像时,可以采用Cohen-Sutherland裁剪算法、中点分割算法或Sutherland-Hodgeman裁剪算法等进行裁剪。
本发明实施例提供的视频流裁剪方法中,由于电子设备确定一个图像的裁剪区域时,可以参考另一个图像中已确定的裁剪区域和该裁剪区域中的对象,因此可以使得电子设备确定的该一个图像的裁剪区域中可以包括与该对象匹配的对象(例如两个对象为同一对 象),即采用本发明实施例提供的视频流裁剪方法,确定的各个图像的裁剪区域中均包括图像的主体,从而按照这些裁剪区域裁剪视频流中的各帧图像后,可以避免裁剪后的视频流中图像的主体丢失。
可选的,本发明实施例中,在电子设备得到裁剪后的目标视频流之后,电子设备还可以采用插值法对裁剪后的目标视频流中的各帧图像进行像素插值,以调整裁剪后的目标视频流中的各帧图像的尺寸。例如,可以将裁剪后的目标视频流中的各帧图像的尺寸恢复至裁剪之前的尺寸。
可选的,本发明实施例中,当第二对象在第二图像中所处的位置靠近第二图像的边界时,电子设备确定的第二裁剪区域的边界可能超出第二图像的边界,如此,在电子设备裁剪第二图像中处于第二裁剪区域之外的图像之后,得到的图像的尺寸可能小于第二裁剪区域的尺寸。进一步的,为了保证裁剪后目标视频流中的各帧图像的尺寸一致,本发明实施例可以在第二裁剪区域的边界超出第二图像的边界时,调整第二裁剪区域,以使得调整后的第二裁剪区域的边界位于第二图像中,即调整后的第二裁剪区域的边界不超出第二图像的边界。
下面首先对电子设备确定第二裁剪区域的边界是否超出第二图像的边界的方法进行示例性的说明。
示例性的,假设第二图像和第二裁剪区域处于同一坐标系中。在电子设备确定第二裁剪区域之后,电子设备可以获取第二裁剪区域的边界在该坐标系的x轴上的坐标范围(以下称为第一坐标范围)和第二裁剪区域的边界在该坐标系的y轴上的坐标范围(以下称为第二坐标范围),并获取第二图像的边界在该坐标系的x轴上的坐标范围(以下称为第三坐标范围)和第二图像的边界在该坐标系的y轴上的坐标范围(以下称为第四坐标范围)。然后电子设备可以将第一坐标范围与第三坐标范围比对,并将第二坐标范围与第四坐标范围比对。若第一坐标范围中的所有坐标均属于第三坐标范围,且第二坐标范围中的所有坐标均属于第四坐标范围,则电子设备可以确定第二裁剪区域的边界未超出第二图像的边界。若第一坐标范围中至少一个坐标不属于第三坐标范围,或第二坐标范围中至少一个坐标不属于第四坐标范围,则电子设备可以确定第二裁剪区域的边界超出第二图像的边界。
例如,假设第二图像在平面坐标系的x轴上的坐标范围为[X1,X2],第二图像在平面坐标系的y轴上的坐标范围为[Y1,Y2];第二裁剪区域在该坐标系的x轴上的坐标范围为[X3,X4],第二裁剪区域在平面坐标系的y轴上的坐标范围为[Y3,Y4]。那么电子设备可以将[X3,X4]与[X1,X2],且将[Y3,Y4]与[Y1,Y2]将比对。如图7中的(a)所示,由于X3>X1且X4<X2,以及Y3>Y1且Y4<Y2,因此,电子设备可以确定第二裁剪区域70的边界未超出第二图像70的边界。如图7中的(b)所示,由于Y4>Y2,因此电子设备可以确定第二裁剪区域71的边界超出第二图像70的边界。
下面再对电子设备调整第二裁剪区域的方法进行示例性的说明。
示例性的,结合上述图2,如图8所示,在上述S202之后,本发明实施例提供的视频 流裁剪方法还可以包括下述的S204。
S204、若电子设备确定第二裁剪区域的边界超出第二图像的边界,则调整第二裁剪区域。
其中,电子设备调整后的第二裁剪区域的边界可以位于第二图像中;且调整后的第二裁剪区域中包括第二对象。
可选的,本发明实施例中,电子设备调整第二裁剪区域前后,第二裁剪区域的形状和尺寸可以保持不变。
可选的,本发明实施例中,电子设备可以确定第二裁剪区域的边界相对于第二图像的中心点的偏移方向,并确定第二裁剪区域的边界在该偏移方向上相对于第二图像的边界的偏移量,从而电子设备可以根据该偏移方向和偏移量,调整第二裁剪区域。
例如,电子设备可以保持第二裁剪区域的尺寸不变,将第二裁剪区域整体沿与上述偏移方向相反的方向移动上述偏移量。
本发明实施例中,由于当第二裁剪区域的边界超出第二图像的边界时,电子设备可以将第二裁剪区域的边界调整到第二图像内,因此可以保证电子设备裁剪第二图像中处于第二裁剪区域外的图像之后,得到的图像的尺寸等于第二裁剪区域的尺寸,从而可以保证裁剪后的目标视频流具有较好的显示效果。
可选的,本发明实施例中,在电子设备确定第二裁剪区域之后,电子设备可以采用平滑算法,根据第一裁剪区域在第一图像中的位置,调整第二裁剪区域在第二图像中的位置,以调整第二裁剪区域在第二图像中的位置,以提高裁剪后的目标视频流中的各帧图像之间的平滑度,从而避免裁剪后的目标视频流的画面出现抖动。
需要说明的是,本发明实施例中,电子设备可以在执行上述S204之后,再根据第一裁剪区域在第一图像中的位置,调整第二裁剪区域在第二图像中的位置。
可选的,本发明实施例中,上述平滑算法可以为一元线性拟合算法,或者可以为最小二乘法,还可以为其它任意可能的平滑算法,具体可以根据实际使用需求确定,本发明实施例不作限定。
具体的,电子设备可以将第一裁剪区域的起始坐标与第二裁剪区域的起始坐标进行线性拟合,以更新第二裁剪区域的起始裁剪坐标,并以更新后的起始裁坐标为起点,按照第二裁剪区域的原尺寸,重新确定一个第二裁剪区域。
其中,一个裁剪区域(例如上述第一裁剪区域或第二裁剪区域)的起始坐标可以为该裁剪区域的边界上的任意一个坐标。例如,如图7中的(a)所示,第二裁剪区域的起始裁剪坐标可以为(X1,Y1)、(X1,Y2)、(X2,Y1)或者(X2,Y2)等任意坐标。
示例性的,以电子设备采用一元线性拟合算法,调整第二裁剪区域在第二图像中的位置为例。电子设备可以将第一裁剪区域的起始裁剪点在x轴上的坐标与第二裁剪区域的起始裁剪点在x轴上的坐标进行线性拟合,以调整第二裁剪区域的起始裁剪点的在x轴上的坐标。相应的,电子设备可以将第一裁剪区域的起始裁剪点在y轴上的坐标与第二裁剪区 域的起始裁剪点在y轴上的坐标进行线性拟合,以调整第二裁剪区域的起始裁剪点的在y轴上的坐标。从而,电子设备可以调整第二裁剪区域的起始裁剪点,然后,电子设备可以以调整后的起始裁剪点为起点,按照第二裁剪区域的原尺寸,重新确定一个第二裁剪区域,如此,电子设备可以调整第二裁剪区域在第二图像中的位置。
本发明实施例中,由于电子设备可以通过调整第二裁剪区域在第二图像中的位置的方式,预先调整裁剪后的目标视频流的平滑度,因此可以提高裁剪后的目标视频流的流畅性,从而保证裁剪后的目标视频流具有较好的显示效果。
需要说明的是,本发明实施例中,上述各个方法附图所示的视频流裁剪方法均是以结合本发明实施例中的一个附图为例示例性的说明的。具体实现时,上述各个方法附图所示的视频流裁剪方法还可以结合上述实施例中示意的其它可以结合的任意附图实现,此处不再赘述。
如图9所示,本发明实施例提供一种电子设备900,该电子设备900可以包括:确定模块901和裁剪模块902。确定模块901,可以用于确定目标视频流中的第一图像的第一裁剪区域,第一裁剪区域中可以包括第一对象;且根据第一裁剪区域和第一对象,确定目标视频流中的第二图像的第二裁剪区域。其中,第一裁剪区域中可以包括第一对象,第二裁剪区域中可以包括第二图像中的第二对象,第二对象与第一对象的匹配度可以大于或等于第一预设阈值;裁剪模块902,可以用于裁剪第一图像中处于确定模块901确定的第一裁剪区域外的图像,并裁剪第二图像中处于确定模块901确定的第二裁剪区域外的图像,得到裁剪后的目标视频流。
可选的,本发明实施例中,上述确定模块901,具体可以用于根据第一对象,确定目标视频流中包括第二对象的第二图像;并根据第一裁剪区域和第一对象,确定第二图像中包括第二对象的第二裁剪区域。
可选的,本发明实施例中,上述确定模块901,具体可以用于根据第一裁剪区域的尺寸,和第一对象与第一裁剪区域的相对位置,确定第二裁剪区域。
可选的,本发明实施例中,上述确定模块901,具体可以用于根据第一对象在第一裁剪区域中的面积占比,和第一对象与第一裁剪区域的相对位置,确定第二裁剪区域。
可选的,本发明实施例中,结合上述图9,如图10所示,上述电子设备还可以包括调整模块903。调整模块903,可以用于在确定模块901确定第二裁剪区域之后,在确定模块901确定第二裁剪区域的边界超出第二图像的边界的情况下,可以电子设备可以根据第二图像的边界,调整第二裁剪区域;其中,调整后的第二裁剪区域的边界位于第二图像中。
可选的,本发明实施例中,结合上述图9,如图10所示,上述电子设备还可以包括调整模块903。调整模块903,可以用于在确定模块901确定第二裁剪区域之后,采用平滑算法,根据第一裁剪区域在第一图像中的位置,调整第二裁剪区域在第二图像中的位置。
可选的,本发明实施例中,上述确定模块901,具体可以用于确定第一图像中的第一对象,且根据第一对象在第一图像中所处的第一区域,确定第一裁剪区域;第一对象为电 子设备自动识别的对象或为用户触发选中的对象。
可选的,本发明实施例中,结合上述图9,如图11所示,上述电子设备还可以包括显示模块904。显示模块904,可以用于在确定模块901确定第一对象之后,在第一区域显示第一识别框。其中,第一识别框可以用于指示确定的第一对象;第一识别框的尺寸(面积和形状)与第一裁剪区域的尺寸可以相同。
本发明实施例提供的电子设备900能够实现上述方法实施例所示的电子设备实现的各个过程,为避免重复,这里不再赘述。
本发明实施例提供一种电子设备,该电子设备可以确定目标视频流中的第一图像的第一裁剪区域(包括第一对象);且根据第一裁剪区域和第一对象,确定目标视频流中的第二图像的第二裁剪区域(包括第二图像中的第二对象,第二对象与第一对象的匹配度大于或等于第一预设阈值);以及裁剪第一图像中处于第一裁剪区域外的图像,并裁剪第二图像中处于第二裁剪区域外的图像,得到裁剪后的目标视频流。通过该方案,由于电子设备确定一个图像的裁剪区域时,可以参考另一个图像中已确定的裁剪区域和该裁剪区域中的对象,因此可以使得电子设备确定的该一个图像的裁剪区域中可以包括与该对象匹配的对象(例如两个对象为同一对象),即采用本发明实施例提供的视频流裁剪方法,确定的各个图像的裁剪区域中均包括图像的主体,从而按照这些裁剪区域裁剪视频流中的各帧图像后,可以避免裁剪后的视频流中图像的主体丢失。
图12为实现本发明各个实施例的一种电子设备的硬件结构示意图。如图12所示,该电子设备100包括但不限于:射频单元101、网络模块102、音频输出单元103、输入单元104、传感器105、显示单元106、用户输入单元107、接口单元108、存储器109、处理器110、以及电源111等部件。本领域技术人员可以理解,图12中示出的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。在本发明实施例中,电子设备包括但不限于手机、平板电脑、笔记本电脑、掌上电脑、车载电子设备、可穿戴设备、以及计步器等。
其中,处理器110,用于确定目标视频流中的第一图像的第一裁剪区域,第一裁剪区域中包括第一对象;并根据第一裁剪区域和第一对象,确定目标视频流中的第二图像的第二裁剪区域;以及裁剪第一图像中处于第一裁剪区域外的图像,并裁剪第二图像中处于第二裁剪区域外的图像,以得到裁剪后的目标视频流。其中,第二裁剪区域中包括第二图像中的第二对象,第二对象与第一对象的匹配度大于或等于第一预设阈值。
可以理解,本发明实施例中,上述电子设备的结构示意图(例如图9至图11)中的确定模块901和裁剪模块902可以通过上述处理器110实现。上述电子设备的结构示意图(例如图10)中的调整模块903可以通过上述处理器110实现。上述电子设备的结构示意图(例如图11)中的显示模块904可以通过上述显示单元106实现。
本发明实施例提供一种电子设备,电子设备可以确定目标视频流中的第一图像的第一裁剪区域(包括第一对象);且根据第一裁剪区域和第一对象,确定目标视频流中的第二 图像的第二裁剪区域(包括第二图像中的第二对象,第二对象与第一对象的匹配度大于或等于第一预设阈值);以及裁剪第一图像中处于第一裁剪区域外的图像,并裁剪第二图像中处于第二裁剪区域外的图像,得到裁剪后的目标视频流。通过该方案,由于电子设备确定一个图像的裁剪区域时,可以参考另一个图像中已确定的裁剪区域和该裁剪区域中的对象,因此可以使得电子设备确定的该一个图像的裁剪区域中可以包括与该对象匹配的对象(例如两个对象为同一对象),即采用本发明实施例提供的视频流裁剪方法,确定的各个图像的裁剪区域中均包括图像的主体,从而按照这些裁剪区域裁剪视频流中的各帧图像后,可以避免裁剪后的视频流中图像的主体丢失。
应理解的是,本发明实施例中,射频单元101可用于收发信息或通话过程中,信号的接收和发送,具体的,将来自基站的下行数据接收后,给处理器110处理;另外,将上行的数据发送给基站。通常,射频单元101包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器、双工器等。此外,射频单元101还可以通过无线通信系统与网络和其他设备通信。
电子设备通过网络模块102为用户提供了无线的宽带互联网访问,如帮助用户收发电子邮件、浏览网页和访问流式媒体等。
音频输出单元103可以将射频单元101或网络模块102接收的或者在存储器109中存储的音频数据转换成音频信号并且输出为声音。而且,音频输出单元103还可以提供与电子设备100执行的特定功能相关的音频输出(例如,呼叫信号接收声音、消息接收声音等等)。音频输出单元103包括扬声器、蜂鸣器以及受话器等。
输入单元104用于接收音频或视频信号。输入单元104可以包括图形处理器(graphics processing unit,GPU)1041和麦克风1042,图形处理器1041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频流的图像数据进行处理。处理后的图像帧可以显示在显示单元106上。经图形处理器1041处理后的图像帧可以存储在存储器109(或其它存储介质)中或者经由射频单元101或网络模块102进行发送。麦克风1042可以接收声音,并且能够将这样的声音处理为音频数据。处理后的音频数据可以在电话通话模式的情况下转换为可经由射频单元101发送到移动通信基站的格式输出。
电子设备100还包括至少一种传感器105,比如光传感器、运动传感器以及其他传感器。具体地,光传感器包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板1061的亮度,接近传感器可在电子设备100移动到耳边时,关闭显示面板1061和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别电子设备姿态(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;传感器105还可以包括指纹传感器、压力传感器、虹膜传感器、分子传感器、陀螺仪、气压计、湿度计、温度计、红外线传感器等,在此不再赘述。
显示单元106用于显示由用户输入的信息或提供给用户的信息。显示单元106可包括 显示面板1061,可以采用液晶显示器(liquid crystal display,LCD)、有机发光二极管(organic light-emitting diode,OLED)等形式来配置显示面板1061。
用户输入单元107可用于接收输入的数字或字符信息,以及产生与电子设备的用户设置以及功能控制有关的键信号输入。具体地,用户输入单元107包括触控面板1071以及其他输入设备1072。触控面板1071,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板1071上或在触控面板1071附近的操作)。触控面板1071可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器110,接收处理器110发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板1071。除了触控面板1071,用户输入单元107还可以包括其他输入设备1072。具体地,其他输入设备1072可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。
进一步的,触控面板1071可覆盖在显示面板1061上,当触控面板1071检测到在其上或附近的触摸操作后,传送给处理器110以确定触摸事件的类型,随后处理器110根据触摸事件的类型在显示面板1061上提供相应的视觉输出。虽然在图12中,触控面板1071与显示面板1061是作为两个独立的部件来实现电子设备的输入和输出功能,但是在某些实施例中,可以将触控面板1071与显示面板1061集成而实现电子设备的输入和输出功能,具体此处不做限定。
接口单元108为外部装置与电子设备100连接的接口。例如,外部装置可以包括有线或无线头戴式耳机端口、外部电源(或电池充电器)端口、有线或无线数据端口、存储卡端口、用于连接具有识别模块的装置的端口、音频输入/输出(I/O)端口、视频I/O端口、耳机端口等等。接口单元108可以用于接收来自外部装置的输入(例如,数据信息、电力等等)并且将接收到的输入传输到电子设备100内的一个或多个元件或者可以用于在电子设备100和外部装置之间传输数据。
存储器109可用于存储软件程序以及各种数据。存储器109可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器109可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
处理器110是电子设备的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器109内的软件程序和/或模块,以及调用存储在存储器109内的数据,执行电子设备的各种功能和处理数据,从而对电子设备进行整体监控。处理器110可包括一个或多个处理单元;可选的,处理器110可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器 主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器110中。
电子设备100还可以包括给各个部件供电的电源111(比如电池),可选的,电源111可以通过电源管理系统与处理器110逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。
另外,电子设备100包括一些未示出的功能模块,在此不再赘述。
可选的,本发明实施例还提供一种电子设备,包括如图12所示的处理器110,存储器109,存储在存储器109上并可在所述处理器110上运行的计算机程序,该计算机程序被处理器110执行时实现上述方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。
本发明实施例还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现上述方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。其中,该计算机可读存储介质可以包括只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台电子设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。

Claims (16)

  1. 一种视频流裁剪方法,应用于电子设备,所述方法包括:
    确定目标视频流中的第一图像的第一裁剪区域,所述第一裁剪区域中包括第一对象;
    根据所述第一裁剪区域和所述第一对象,确定所述目标视频流中的第二图像的第二裁剪区域,所述第二裁剪区域中包括所述第二图像中的第二对象,所述第二对象与所述第一对象的匹配度大于或等于第一预设阈值;
    裁剪所述第一图像中处于所述第一裁剪区域外的图像,并裁剪所述第二图像中处于所述第二裁剪区域外的图像,得到裁剪后的所述目标视频流。
  2. 根据权利要求1所述的方法,其中,所述根据所述第一裁剪区域和所述第一对象,确定所述目标视频流中的第二图像的第二裁剪区域,包括:
    根据所述第一对象,确定所述目标视频流中包括所述第二对象的所述第二图像;
    根据所述第一裁剪区域和所述第一对象,确定所述第二图像中包括所述第二对象的所述第二裁剪区域。
  3. 根据权利要求2所述的方法,其中,所述根据所述第一裁剪区域和所述第一对象,确定所述第二图像中包括所述第二对象的所述第二裁剪区域,包括:
    根据所述第一裁剪区域的尺寸,和所述第一对象与所述第一裁剪区域的相对位置,确定所述第二裁剪区域。
  4. 根据权利要求2所述的方法,其中,所述根据所述第一裁剪区域和所述第一对象,确定所述第二图像中包括所述第二对象的所述第二裁剪区域,包括:
    根据所述第一对象在所述第一裁剪区域中的面积占比,和所述第一对象与所述第一裁剪区域的相对位置,确定所述第二裁剪区域。
  5. 根据权利要求1至4中任一项所述的方法,其中,在确定所述目标视频流中的第二图像的第二裁剪区域之后,所述方法还包括:
    若确定所述第二裁剪区域的边界超出所述第二图像的边界,则调整所述第二裁剪区域;
    其中,调整后的所述第二裁剪区域的边界位于所述第二图像中。
  6. 根据权利要求1所述的方法,其中,在确定所述目标视频流中的第二图像的第二裁剪区域之后,所述方法还包括:
    采用平滑算法,根据所述第一裁剪区域在所述第一图像中的位置,调整所述第二裁剪区域在所述第二图像中的位置。
  7. 一种电子设备,所述电子设备包括:确定模块和裁剪模块;
    所述确定模块,用于确定目标视频流中的第一图像的第一裁剪区域,所述第一裁剪区域中包括第一对象;且根据所述第一裁剪区域和所述第一对象,确定所述目标视频流中的第二图像的第二裁剪区域,所述第二裁剪区域中包括所述第二图像中的第二 对象,第二对象与所述第一对象的匹配度大于或等于第一预设阈值;
    所述裁剪模块,用于裁剪所述第一图像中处于所述确定模块确定的所述第一裁剪区域外的图像,并裁剪所述第二图像中处于所述确定模块确定的所述第二裁剪区域外的图像,得到裁剪后的所述目标视频流。
  8. 根据权利要求7所述的电子设备,其中,
    所述确定模块,具体用于根据所述第一对象,确定所述目标视频流中包括所述第二对象的所述第二图像;并根据所述第一裁剪区域和所述第一对象,确定所述第二图像中包括所述第二对象的所述第二裁剪区域。
  9. 根据权利要求8所述的电子设备,其中,
    所述确定模块,具体用于根据所述第一裁剪区域的尺寸,和所述第一对象与所述第一裁剪区域的相对位置,确定所述第二裁剪区域。
  10. 根据权利要求8所述的电子设备,其中,
    所述确定模块,具体用于根据所述第一对象在所述第一裁剪区域中的面积占比,和所述第一对象与所述第一裁剪区域的相对位置,确定所述第二裁剪区域。
  11. 根据权利要求7至10中任一项所述的电子设备,其中,所述电子设备还包括调整模块;
    所述调整模块,用于在所述确定模块确定所述第二裁剪区域之后,在所述确定模块确定所述第二裁剪区域的边界超出所述第二图像的边界的情况下,调整所述第二裁剪区域;
    其中,调整后的所述第二裁剪区域的边界位于所述第二图像中。
  12. 根据权利要求7所述的电子设备,其中,所述电子设备还包括调整模块;
    所述调整模块,用于在所述确定模块确定所述第二裁剪区域之后,采用平滑算法,根据所述第一裁剪区域在所述第一图像中的位置,调整所述第二裁剪区域在所述第二图像中的位置。
  13. 一种移动终端,包括处理器.存储器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现如权利要求1至6中任一项所述的视频流裁剪方法的步骤。
  14. 一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现如权利要求1至6中任一项所述的视频流裁剪方法的步骤。
  15. 一种计算机程序产品,所述程序产品被至少一个处理器执行以实现如权利要求1至6中任一项所述的视频流裁剪方法。
  16. 一种视频流裁剪装置/设备,其中,包括所述装置/设备被配置成用于执行如权利要求1至6中任一项所述的视频流裁剪方法。
PCT/CN2020/136656 2019-12-19 2020-12-16 视频流裁剪方法及电子设备 Ceased WO2021121237A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911320804.9A CN111031178A (zh) 2019-12-19 2019-12-19 一种视频流裁剪方法及电子设备
CN201911320804.9 2019-12-19

Publications (1)

Publication Number Publication Date
WO2021121237A1 true WO2021121237A1 (zh) 2021-06-24

Family

ID=70212189

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/136656 Ceased WO2021121237A1 (zh) 2019-12-19 2020-12-16 视频流裁剪方法及电子设备

Country Status (2)

Country Link
CN (1) CN111031178A (zh)
WO (1) WO2021121237A1 (zh)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111031178A (zh) * 2019-12-19 2020-04-17 维沃移动通信有限公司 一种视频流裁剪方法及电子设备
CN112132836A (zh) * 2020-08-14 2020-12-25 咪咕文化科技有限公司 视频图像裁剪方法、装置、电子设备及存储介质
CN112561840B (zh) * 2020-12-02 2024-05-28 北京有竹居网络技术有限公司 视频裁剪方法、装置、存储介质及电子设备
CN116342639A (zh) * 2021-12-22 2023-06-27 华为技术有限公司 图像显示方法及其电子设备和介质
CN115018704B (zh) * 2022-05-27 2024-09-20 浙江大华技术股份有限公司 一种图像处理方法、装置、电子设备和存储介质
CN119068380A (zh) * 2023-06-01 2024-12-03 北京字跳网络技术有限公司 图像处理方法、装置、电子设备以及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017114211A1 (zh) * 2015-12-30 2017-07-06 株式会社日立制作所 用于对视频场景切换进行检测的方法和装置
CN107786812A (zh) * 2017-10-31 2018-03-09 维沃移动通信有限公司 一种拍摄方法、移动终端及计算机可读存储介质
CN108447021A (zh) * 2018-03-19 2018-08-24 河北工业大学 基于分块和逐帧优化的视频缩放方法
CN108776970A (zh) * 2018-06-12 2018-11-09 北京字节跳动网络技术有限公司 图像处理方法和装置
CN110223301A (zh) * 2019-03-01 2019-09-10 华为技术有限公司 一种图像裁剪方法和电子设备
CN110322472A (zh) * 2018-03-30 2019-10-11 华为技术有限公司 一种多目标跟踪方法以及终端设备
CN111031178A (zh) * 2019-12-19 2020-04-17 维沃移动通信有限公司 一种视频流裁剪方法及电子设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6627861B2 (ja) * 2015-03-26 2020-01-08 ソニー株式会社 画像処理システムおよび画像処理方法、並びにプログラム
CN105263049B (zh) * 2015-10-28 2019-10-29 努比亚技术有限公司 一种基于帧坐标的视频裁剪装置、方法及移动终端
CN107911748A (zh) * 2017-11-24 2018-04-13 南京融升教育科技有限公司 一种基于人脸识别的视频裁剪方法
CN109089157B (zh) * 2018-06-15 2021-12-07 广州华多网络科技有限公司 视频画面的裁剪方法、显示设备以及装置
CN109040780A (zh) * 2018-08-07 2018-12-18 北京优酷科技有限公司 一种视频处理方法及服务器

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017114211A1 (zh) * 2015-12-30 2017-07-06 株式会社日立制作所 用于对视频场景切换进行检测的方法和装置
CN107786812A (zh) * 2017-10-31 2018-03-09 维沃移动通信有限公司 一种拍摄方法、移动终端及计算机可读存储介质
CN108447021A (zh) * 2018-03-19 2018-08-24 河北工业大学 基于分块和逐帧优化的视频缩放方法
CN110322472A (zh) * 2018-03-30 2019-10-11 华为技术有限公司 一种多目标跟踪方法以及终端设备
CN108776970A (zh) * 2018-06-12 2018-11-09 北京字节跳动网络技术有限公司 图像处理方法和装置
CN110223301A (zh) * 2019-03-01 2019-09-10 华为技术有限公司 一种图像裁剪方法和电子设备
CN111031178A (zh) * 2019-12-19 2020-04-17 维沃移动通信有限公司 一种视频流裁剪方法及电子设备

Also Published As

Publication number Publication date
CN111031178A (zh) 2020-04-17

Similar Documents

Publication Publication Date Title
US20220276909A1 (en) Screen projection control method and electronic device
WO2021121237A1 (zh) 视频流裁剪方法及电子设备
US11604567B2 (en) Information processing method and terminal
CN111562896B (zh) 投屏方法及电子设备
WO2021057267A1 (zh) 图像处理方法及终端设备
CN110134356A (zh) 一种投屏方法及终端
CN109032486B (zh) 一种显示控制方法及终端设备
WO2020238497A1 (zh) 图标移动方法及终端设备
CN111401463B (zh) 检测结果输出的方法、电子设备及介质
WO2020151525A1 (zh) 消息发送方法及终端设备
WO2021082772A1 (zh) 截屏方法及电子设备
CN110445984A (zh) 一种拍摄提示方法及电子设备
WO2020192298A1 (zh) 图像处理方法及终端设备
WO2021036623A1 (zh) 显示方法及电子设备
CN111031253A (zh) 一种拍摄方法及电子设备
CN108037966A (zh) 一种界面显示方法、装置及移动终端
WO2021104266A1 (zh) 对象显示方法及电子设备
WO2021017785A1 (zh) 数据传输方法及终端设备
WO2021017730A1 (zh) 截图方法及终端设备
CN109343811B (zh) 一种显示调整方法及终端设备
WO2020211602A1 (zh) 应用控制方法及终端设备
WO2021185254A1 (zh) 内容共享方法及电子设备
CN110851098B (zh) 一种视频窗口显示方法及电子设备
CN110602390B (zh) 一种图像处理方法及电子设备
CN109859718B (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: 20903606

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20903606

Country of ref document: EP

Kind code of ref document: A1

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 22.02.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20903606

Country of ref document: EP

Kind code of ref document: A1