WO2017016069A1 - Photographing method and terminal - Google Patents

Photographing method and terminal Download PDF

Info

Publication number
WO2017016069A1
WO2017016069A1 PCT/CN2015/091344 CN2015091344W WO2017016069A1 WO 2017016069 A1 WO2017016069 A1 WO 2017016069A1 CN 2015091344 W CN2015091344 W CN 2015091344W WO 2017016069 A1 WO2017016069 A1 WO 2017016069A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
person
area
image frame
person image
Prior art date
Application number
PCT/CN2015/091344
Other languages
French (fr)
Chinese (zh)
Inventor
周渝东
Original Assignee
宇龙计算机通信科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 宇龙计算机通信科技(深圳)有限公司 filed Critical 宇龙计算机通信科技(深圳)有限公司
Publication of WO2017016069A1 publication Critical patent/WO2017016069A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/61Control of cameras or camera modules based on recognised objects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof

Definitions

  • the present invention relates to the field of image processing, and in particular, to a photographing method and a terminal.
  • the camera equipment installed on various communication terminals is more and more advanced, and has been developed from a single camera to a dual camera.
  • the front and rear dual camera modes of a camera mounted on the front and back of the communication terminal enable users to take self-portraits or photograph scenes at any time and place, record and share their own living conditions and beautiful things around them, and are well received by users.
  • the communication terminal can provide a mode for the user to take photos simultaneously with the front and rear dual cameras, and provide the user with a photo with a picture-in-picture effect, but does not further synthesize the photos collected by the front and rear cameras; in the actual photographing process, the user It is often the case that a picture of a companion needs to be taken in a particular scene, but no one else can help take a picture at this time, so the user needs to first take a picture of the companion and then take a picture of himself. The photo is then combined with the image processing software to synthesize the image of the character into the photo taken by the companion. This process is inferior in real time and the steps are cumbersome and time consuming.
  • the embodiment of the invention provides a photographing method and a terminal, which can quickly obtain a photograph of a photograph taken by a photographer through image synthesizing technology, save user time, and adjust the proportion of a person image in the photograph, so that the character image in the photograph is more Coordinated and beautiful.
  • An embodiment of the present invention provides a photographing method, and the method includes:
  • the adjusted first person image region is synthesized into the second image frame to generate a combined image.
  • an embodiment of the present invention provides a terminal, where the terminal includes:
  • the image frame collecting unit is configured to receive a photographing instruction, and collect the first image frame and the second image frame through the front camera and the rear camera;
  • a person image acquiring unit configured to acquire a person image area in the first image frame and the second image frame as a first person image area and a second person image area, respectively;
  • An image parameter adjustment unit configured to adjust the first person image region according to the long parameter and the wide parameter of the second person image region, so that the first person image region matches the second person image region;
  • the illuminating image synthesizing unit is configured to synthesize the adjusted first person image region into the second image frame to generate a illuminating image.
  • the first image frame and the second image frame may be acquired by the front camera and the rear camera when receiving the photographing instruction; and the first image frame and the second image frame may also be acquired.
  • a person image area respectively, as a first person image area and a second person image area; and further adjusting the first person image area according to the long parameter and the wide parameter of the second person image area, so that the first person The image area is matched with the second person image area; finally, the adjusted first person image area is synthesized into the second image frame to generate a combined image, and the photo-synthesis technique can be used to quickly obtain the photo of the photographer.
  • the photo saves user time, and can also adjust the proportion of the person image in the photo, so that the image of the person in the photo is more harmonious and beautiful.
  • FIG. 1 is a schematic flowchart of a photographing method according to an embodiment of the present invention.
  • FIG. 2 is a schematic flow chart of another photographing method according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of an image parameter adjustment unit according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a combined image synthesizing unit according to an embodiment of the present invention.
  • the terminal mentioned in the embodiment of the present invention includes, but is not limited to, an electronic device such as a smart phone (such as an Android mobile phone or an IOS mobile phone), a tablet computer, a notebook computer, a palmtop computer, and a wearable smart device.
  • a smart phone such as an Android mobile phone or an IOS mobile phone
  • a tablet computer such as an iPad, Samsung Galaxy Tabs, Samsung Galaxy Tabs, Samsung Galaxy Tabs, Samsung Galaxy Tabs, a smart phone, a smart phone, a tablet computer, a notebook computer, a palmtop computer, and a wearable smart device.
  • the method described in the present invention is performed by a set of code stored in a memory that is executed in a computer system based on the von Neumann system.
  • a photographing method and terminal provided by the embodiment of the present invention will be specifically described below with reference to FIG. 1 to FIG.
  • FIG. 1 is a schematic flowchart of a photographing method according to an embodiment of the present invention.
  • the photographing method shown in the figure may include the following steps:
  • pressing the shutter button is regarded as inputting a photographing instruction by the user, and the photographing instruction is usually input by the user through an input device (physical keyboard or touch screen) of the terminal.
  • the camera mentioned in this embodiment may be a built-in camera of the terminal, such as a mobile phone with a front camera and a rear camera; this step starts the simultaneous acquisition of the front camera and the rear camera when the terminal receives the camera instruction.
  • the terminal does not include a built-in camera, but is connected to an external camera, such as a PC (Personal Computer), the camera is not set in the PC, but the PC is connected to two external cameras (one is the front camera, the other is the other For the rear camera); this step starts the camera connected to the PC when receiving the camera instruction, and simultaneously acquires the first image frame and the second image frame acquired by the camera.
  • an external camera such as a PC (Personal Computer)
  • the camera is not set in the PC, but the PC is connected to two external cameras (one is the front camera, the other is the other For the rear camera); this step starts the camera connected to the PC when receiving the camera instruction, and simultaneously acquires the first image frame and the second image frame acquired by the
  • the second image frame is a background image frame
  • the first image frame is a bitmap image frame
  • the image area of the person in the first image frame needs to be acquired
  • the person image area in the first image frame is adjusted according to the person image area in the second image frame, and then the person image area in the adjusted first image frame is synthesized into the second image frame.
  • the background of the last generated composite image is the background in the second image frame
  • the character includes the first image frame and the person captured in the second image frame.
  • the step S101 may specifically include: receiving a photographing instruction, respectively acquiring a forward image frame and a back image frame by using a front camera and a rear camera; and setting the forward image frame as the first image frame, And setting the back image frame as a second image frame.
  • the rear camera usually takes more landscapes and can adjust the distance from the photographer arbitrarily, so that the whole body or the majority of the body of the photographer can be photographed; and the front camera is usually at a distance from the photographer. Closer, only the part of the photographer's head and shoulders can be captured and occupy more image areas in the image frame, so that the landscape area is smaller. Therefore, setting the image frame acquired by the rear camera as the second image frame can provide more background position to the image area of the person in the first image frame, and avoid the image area of the person in the two image frames during image synthesis. Severe overlapping intersections occur and more landscape areas can be preserved, making the resulting combined image more aesthetically pleasing.
  • the step S101 may specifically include: receiving a photographing instruction, respectively acquiring a forward image frame and a back image frame by the front camera and the rear camera; and receiving the frame for the foreground image and the frame of the back image
  • the first image frame confirmation command input by the target image frame sets the target image frame as a first image frame and another image frame as a second image frame.
  • the terminal may provide the user with the function of randomly selecting an image frame that needs to retain the background as the second image frame.
  • the user may select an image frame as the second image frame according to the intention of the front camera and the rear camera respectively in the foreground image and the back image frame respectively collected by the front camera and the rear camera, and the other image frame is the first image frame. Image frame.
  • the image area of the person in the first image frame and the second image frame may be acquired by an image recognition technology, where the character image area includes an avatar area of the character and the photographed body area.
  • the edge detection technique may be further combined to determine the outline of the person image, and the image area within the outline is set as the person image area.
  • S103 Adjust the first character according to the long parameter and the wide parameter of the second person image area. An image area to match the first person image area with the second person image area.
  • the long parameter and the wide parameter of the first person image area and the second person image area may be first acquired, wherein the long parameter refers to the maximum length of the height direction of the person image area, and the wide parameter refers to the shoulder width direction of the image area of the person. The maximum length.
  • the image area of the person in the captured image frame can only capture the head and shoulder portions, and occupy most of the image frame (larger parameter);
  • the camera can capture the half body or the whole body of the subject because the distance is far from the photographer, and the image area of the person occupies a small area in the image frame (the long parameter is large). If the person image area in the first image frame is directly acquired into the second image frame, each character in the person image area in the last synthesized combined image may appear to be particularly uncoordinated. Therefore, the long parameter and the parameter of the first image region can be adjusted according to the long parameter and the wide parameter of the second person image region, so that the first person image region and the second person image region appear more harmonious and beautiful.
  • the long parameter and the wide parameter of the first person image region may be respectively adjusted to be the same as the first person image region long parameter and the wide parameter, and the aspect ratio value (long parameter and wide parameter) of the first person image region may also be The scale value is adjusted to be the same as the aspect ratio value of the second person image area.
  • a composite position area of the first person image area in the second image frame (the combined position area is the same as the contour and size of the first person image area) may be determined, and the synthesis is performed.
  • the pigmentation of the location area is then faded to the adjusted first person image area to the location; alternatively, the first person image area can be directly overlaid to the location.
  • the step S104 may specifically include: determining a composite location area of the first person image region in the second image frame; and synthesizing the first character image region and synthesizing into the composite location region to generate a combined image .
  • an area having the same size and contour as the first person image area may be acquired as a composite position area at a position adjacent to and not intersecting the second person image area in the second image frame.
  • the user can freely select a certain area as the composite location area in the second image frame, for example, the user inputs a closed sliding track in the second image frame through the touch screen of the terminal,
  • the closed sliding track contains the image area as the center, and the area having the same size and contour as the first person image area is the composite position area.
  • the first image frame and the second image frame may be acquired by the front camera and the rear camera when receiving the photographing instruction; and the first image frame and the second image frame may also be acquired.
  • a person image area respectively, as a first person image area and a second person image area; and further adjusting the first person image area according to the long parameter and the wide parameter of the second person image area, so that the first person The image area is matched with the second person image area; finally, the adjusted first person image area is synthesized into the second image frame to generate a combined image, and the photographed photo can be quickly obtained by the image synthesis technology. It saves user time, and can also adjust the proportion of the characters in the photo, so that the image of the person in the photo is more harmonious and beautiful.
  • FIG. 2 is a schematic flowchart of another photographing method according to an embodiment of the present invention.
  • the photographing method shown in the figure may include the following steps:
  • S201 Receive a photographing instruction, and collect the first image frame and the second image frame by using a front camera and a rear camera.
  • pressing the shutter button is regarded as inputting a photographing instruction by the user, and the photographing instruction is usually input by the user through an input device (physical keyboard or touch screen) of the terminal.
  • the terminal Upon receiving the photographing instruction, the terminal simultaneously starts the front camera and the rear camera to acquire the first image frame and the second image frame.
  • the image area of the person in the first image frame and the second image frame may be acquired by an image recognition technology, where the character image area includes an avatar area of the character and the photographed body area.
  • the edge detection technique may be further combined to determine the outline of the person image, and the image area within the outline is set as the person image area.
  • the long parameter refers to the maximum length in the height direction of the image area of the person
  • the wide parameter refers to the maximum length in the shoulder width direction of the image area of the person.
  • S204 Determine whether an aspect ratio value of the first person image region is greater than or equal to a length to width ratio value of the second person image region, and the aspect ratio value is a value of a long parameter ratio width parameter.
  • the aspect ratio value refers to the ratio of the long parameter and the wide parameter, when the character image area When the aspect ratio of the domain is large, the length of the person's height direction or the length of the shoulder width direction is small, and the entire character is relatively thin in terms of image effect; When the aspect ratio value is small, the length of the person's height direction photographed on the representative image area is small or the length of the shoulder width direction is large, and the entire character is relatively fat in terms of image effect.
  • Step S205 is executed to keep the width parameter of the first person image region unchanged, and adjust the long parameter of the first person image region such that the aspect ratio values of the first person image region and the second person image region are equal.
  • the characters in the first person image area and the second person image area appear to be relatively fat and thin as a whole.
  • step S206 may be performed. Go to step S208 to adjust the first person image area.
  • step S204 when the result of the determination in step S204 is NO, it is indicated that the character in the first person image region is generally fatter than the person in the second person image region, and is likely to be photographed in the first image region at this time.
  • the length in the height direction is small, that is, the first image area may only capture the head and shoulders, and the second person image area is likely to take more than half of the body or the whole body.
  • directly synthesizing the first person image region into the second image frame may cause the first person image region and the second person image region to be very uncoordinated, and the first person image region may completely cover the second person image region.
  • the first person image area and the character avatar area in the second person image area are obtained as the first avatar area and the second avatar area, respectively, and the first avatar area is acquired by step S206.
  • the long and wide parameters of the domain and the second avatar area are respectively adjusted to be the same as the long parameter and the wide parameter of the second avatar area by step S207, so that the first avatar area and the second avatar area appear to be the same size.
  • the body region in the second person image region and the adjusted first avatar region are combined in step S208, and the previously acquired first person image is replaced, so that the first person image region and the second person image region are
  • the image of the character has the same body area and different avatars. It looks more beautiful and harmonious, and has certain interest.
  • a composite position area of the first person image area in the second image frame (the combined position area is the same as the contour and size of the first person image area) may be determined, and the synthesis is performed.
  • the pigmentation of the location area is then faded to the adjusted first person image area to the location; alternatively, the first person image area can be directly overlaid to the location.
  • the first image frame and the second image frame are collected by the front camera and the rear camera, and then the first person image region is adjusted according to the length and width ratio of the second person image region.
  • the aspect ratio value when the photographing instruction is received, the first image frame and the second image frame are collected by the front camera and the rear camera, and then the first person image region is adjusted according to the length and width ratio of the second person image region. The aspect ratio value.
  • the terminal may include at least an image frame acquiring unit 301, a character image acquiring unit 302, an image parameter adjusting unit 303, and a combined image synthesizing unit 304.
  • the image frame collecting unit 301 is configured to receive a photographing instruction, and collect the first image frame and the second image frame through the front camera and the rear camera.
  • the camera mentioned in this embodiment can be a built-in camera of the terminal, such as a front camera and a rear camera.
  • the mobile phone of the camera is set; in this step, when the image frame acquisition unit 301 receives the photographing instruction, the first image frame and the second image frame simultaneously acquired by the front camera and the rear camera are activated.
  • the terminal does not include a built-in camera, but is connected to an external camera, such as a PC (Personal Computer), the camera is not set in the PC, but the PC is connected to two external cameras (one is the front camera, the other is the other For the rear camera); this step starts the camera connected to the PC when receiving the camera instruction, and simultaneously acquires the first image frame and the second image frame acquired by the camera.
  • an external camera such as a PC (Personal Computer)
  • the camera is not set in the PC, but the PC is connected to two external cameras (one is the front camera, the other is the other For the rear camera)
  • this step starts the camera connected to the PC when receiving the camera instruction,
  • the second image frame is a background image frame
  • the first image frame is a bitmap image frame
  • the image area of the person in the first image frame needs to be acquired, and according to the second
  • the person image area in the image frame adjusts the person image area in the first image frame, and then the character image area in the adjusted first image frame is synthesized into the second image frame.
  • the background of the last generated composite image is the background in the second image frame
  • the character includes the first image frame and the person captured in the second image frame.
  • the image frame collection unit 301 in this embodiment may be specifically configured to: receive a photographing instruction, and respectively acquire a pre-shooting image frame and a post-shooting image frame through a front camera and a rear camera; and set the proactive image frame It is a first image frame, and the back image frame is set as a second image frame.
  • the rear camera usually takes more landscapes and can adjust the distance from the photographer arbitrarily, so that the whole body or the majority of the body of the photographer can be photographed; and the front camera is usually at a distance from the photographer. Closer, only the part of the photographer's head and shoulders can be captured and occupy more image areas in the image frame, so that the landscape area is smaller. Therefore, setting the image frame acquired by the rear camera as the second image frame can provide more background position to the image area of the person in the first image frame, and avoid the image area of the person in the two image frames during image synthesis. Severe overlapping intersections occur and more landscape areas can be preserved, making the resulting combined image more aesthetically pleasing.
  • the image frame collection unit 301 in this embodiment may be specifically configured to: receive a photographing instruction, and respectively acquire a proactive image frame and a post-image frame by using a front camera and a rear camera; and receive a frame for the proactive image And a first image frame confirmation instruction inputting the target image frame in the back image frame, setting the target image frame as a first image frame and setting another image frame as a second image frame.
  • the terminal may provide the user with the function of randomly selecting an image frame that needs to retain the background as the second image frame.
  • the user may select an image frame as the second image frame according to the intention of the terminal in the forward image frame and the back image frame respectively collected by the front camera and the rear camera according to the prompt of the terminal. Then another image frame is the first image frame.
  • the character image obtaining unit 302 is configured to acquire the person image regions in the first image frame and the second image frame as the first person image region and the second person image region, respectively.
  • the character image acquiring unit 302 may acquire a person image region in the first image frame and the second image frame by using an image recognition technology, where the character image region includes an avatar region of the character and the photographed body region. .
  • the edge detection technique may be further combined to determine the outline of the person image, and the image area within the outline is set as the person image area.
  • the image parameter adjustment unit 303 is configured to adjust the first person image region according to the long parameter and the wide parameter of the second person image region to match the first person image region with the second person image region.
  • the long parameter and the wide parameter of the first person image area and the second person image area may be first acquired, wherein the long parameter refers to the maximum length of the height direction of the person image area, and the wide parameter refers to the shoulder width direction of the image area of the person. The maximum length.
  • the image area of the person in the captured image frame can only capture the head and shoulder portions, and occupy most of the image frame (larger parameter);
  • the camera can capture the half body or the whole body of the subject because the distance is far from the photographer, and the image area of the person occupies a small area in the image frame (the long parameter is large). If the person image area in the first image frame is directly acquired into the second image frame, each character in the person image area in the last synthesized combined image may appear to be particularly uncoordinated.
  • the image parameter adjustment unit 303 can adjust the long parameter and the section parameter of the first image region according to the long parameter and the wide parameter of the second person image region, so that the first person image region and the second person image region appear more harmonious and beautiful.
  • the long parameter and the wide parameter of the first person image region may be respectively adjusted to be the same as the first person image region long parameter and the wide parameter
  • the aspect ratio value (long parameter and wide parameter) of the first person image region may also be The scale value is adjusted to be the same as the aspect ratio value of the second person image area.
  • the parameter adjustment unit 303 in the embodiment shown in the figure may include: a parameter acquisition subunit 3301, a parameter determination subunit 3302, and Parameter adjustment subunit 3303.
  • a parameter obtaining subunit 3301 configured to acquire long parameters and wide parameters of the first person image region and the second person image region;
  • the parameter determining sub-unit 3302 is configured to determine whether the aspect ratio value of the first person image area is greater than or equal to a length-to-width ratio value of the second person image area, and the aspect ratio is a long parameter ratio parameter Value
  • a parameter adjustment subunit 3303 configured to adjust a long parameter of the first person image region when the determination result of the parameter determination subunit is YES, such that the first person image region and the second person image region The length to width ratio values are equal.
  • the aspect ratio refers to the ratio of the long parameter and the wide parameter.
  • the aspect ratio of the image area of the person is large, the length of the person's height direction or the shoulder width of the person image area is larger.
  • the length of the direction is small, and the whole character is relatively thin in terms of image effect; and when the aspect ratio of the image area of the person is small, the length of the person's height direction photographed on the representative image area is small or the shoulder width direction is small.
  • the length is large, and the whole character is fatter in terms of image effect.
  • the aspect ratio value of the first person image region is greater than or equal to the aspect ratio value of the second person image region, indicating that the person in the first person image region as a whole It is thinner than the character in the image area of the second person.
  • the parameter adjustment sub-unit 3303 keeps the width parameter of the first person image region unchanged, and adjusts the long parameter of the first person image region such that the aspect ratio values of the first person image region and the second person image region are equal. At this time, the characters in the first person image area and the second person image area appear to be relatively fat and thin as a whole.
  • the illuminating image synthesizing unit 304 is configured to synthesize the adjusted first person image region into the second image frame to generate a illuminating image.
  • the combined image synthesizing unit 304 may first determine a composite position region of the first person image region in the second image frame (the composite position is an area having the same contour and size as the first person image region) And dimming the pigment of the composite position area and then synthesizing the adjusted first person image area to the position; or, the first person image area may be directly covered to the position.
  • the combined image synthesizing unit 304 in the present embodiment as shown in the figure may include: a position determining subunit 3401 and a combined synthesizing subunit 3402. .
  • a location determining sub-unit 3401 configured to determine a composite location area of the first person image region in the second image frame
  • a composite synthesis sub-unit 3402 for synthesizing the first person image region and synthesizing to the composite bit Set the area to generate a composite image.
  • the position determining sub-unit 3401 may select, as the composite position area, an area having the same size and contour as the first person image area at a position adjacent to the left and right of the second person image area and not intersecting in the second image frame. Or providing the user with the function of randomly selecting the composite location area, the user can freely select a certain area as the composite location area in the second image frame, for example, the user inputs a closed sliding track in the second image frame through the touch screen of the terminal, the position The determining sub-unit 3401 is centered on the image area included in the closed sliding track, and acquires an area of the same size and contour as the first person image area as a combined position area.
  • the person image acquiring unit 302 is further configured to: when the determining result of the parameter determining subunit is negative, acquiring the character avatar area in the first person image area and the second person image area, As the first avatar area and the second avatar area respectively;
  • the image parameter adjustment unit 303 is further configured to adjust the long parameter and the wide parameter of the first avatar area to be the same as the long parameter and the wide parameter of the second avatar area, respectively;
  • the character image obtaining unit 302 is further configured to acquire a body region in the second person image region;
  • the terminal further includes:
  • the character image processing unit 305 is configured to replace the first person image area by combining the adjusted first avatar area with the body area of the second person image area.
  • the person in the first person image area is generally fatter than the person in the second person image area, and is It may be that the length of the height direction photographed in the first image area itself is small, that is, it is possible that the first image area only captures the head and the shoulder and the second person image area is likely to take more than half of the body or the whole body.
  • directly synthesizing the first person image region into the second image frame may cause the first person image region and the second person image region to be very uncoordinated, and the first person image region may completely cover the second person image region.
  • the person image acquisition unit 302 can acquire the first character image area and the character avatar area in the second person image area, respectively, as the first avatar area and the second avatar area, and acquire the first avatar area and the second Long and wide parameters of the avatar area. Then, the long parameter and the wide parameter of the first avatar area are respectively adjusted to be the same as the long parameter and the wide parameter of the second avatar area by the image parameter adjusting unit 303, so that the first avatar area and the second avatar area appear to be the same size.
  • the character image processing unit 305 combines the body region in the second person image region and the adjusted first avatar region, and replaces the previously acquired first person image such that the first person image region and the second person image region
  • the characters in the image have the same body area and different avatars, which look more beautiful and harmonious, and have a certain interest.
  • the image frame acquiring unit 301 when the image frame acquiring unit 301 receives the photographing instruction, the first image frame and the second image frame are collected by the front camera and the rear camera; and the first image is acquired by the character image acquiring unit 302.
  • the image frame and the person image area in the second image frame are respectively used as the first person image area and the second person image area; and further, the image parameter adjustment unit 303 is configured according to the long parameter and the wide parameter of the second person image area. Adjusting the first person image area to match the first person image area with the second person image area; finally, synthesizing the adjusted first person image area to the first by the combined image synthesizing unit 304
  • a composite image is generated in two image frames.
  • the photo-synthesis technique can be used to quickly obtain a photo of the photographer, which saves the user's time, and can also adjust the proportion of the person image in the photo, so that the image of the person in the photo is more harmonious and beautiful.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)
  • Processing Or Creating Images (AREA)

Abstract

Disclosed are a photographing method and a terminal. The method comprises: receiving a photographing instruction, and acquiring a first image frame and a second image frame by using a front camera and a rear camera; obtaining person image areas in the first image frame and the second image frame, and using the person image areas as a first person image area and a second person image area respectively; adjusting the first person image area according to a length parameter and a width parameter of the second person image area, so that the first person image area matches the second person image area; and synthesizing the adjusted first person image area into the second image frame to generate a group photograph. By means of the embodiments of the present invention, a group photograph comprising a photographer can be rapidly obtained by using an image synthesis technology when a photograph is taken, so as to save a user's time. Moreover, a ratio of person images in the photograph can further be adjusted, so that the person images in the group photograph are more harmony and artistically appealing.

Description

一种拍照方法及终端Photographing method and terminal 技术领域Technical field
本发明涉及图像处理领域,尤其涉及一种拍照方法及终端。The present invention relates to the field of image processing, and in particular, to a photographing method and a terminal.
背景技术Background technique
随着通信技术的不断发展,各种通信终端的上安装的拍照设备越来越先进,已经由原来的单摄像头发展为双摄像头。尤其是在通信终端的正面和背面各安装一个摄像头的前后双摄像头模式,可使用户随时随地进行自拍或者拍摄景物,记录并分享自己的生活状态及身边美丽的事物,深受广大用户的喜爱。With the continuous development of communication technology, the camera equipment installed on various communication terminals is more and more advanced, and has been developed from a single camera to a dual camera. In particular, the front and rear dual camera modes of a camera mounted on the front and back of the communication terminal enable users to take self-portraits or photograph scenes at any time and place, record and share their own living conditions and beautiful things around them, and are well received by users.
目前通信终端可提供给用户前后双摄像头同时拍照的模式,提供给用户具有画中画效果的照片,但是并未对前后摄像头采集到的照片进行进一步的合成处理;而在实际拍照过程中,用户往往会遭遇这样的情况:在某一特殊场景下需要和同伴拍摄一张合照,但是此时并无其他人能够帮忙拍照,因此用户需要首先给同伴拍摄拍摄一张照片,再给自己拍摄一张照片,然后再用图像处理软件将自己的人物图像合成到给同伴拍摄的照片中,这个过程实时性差且步骤繁琐,浪费时间。At present, the communication terminal can provide a mode for the user to take photos simultaneously with the front and rear dual cameras, and provide the user with a photo with a picture-in-picture effect, but does not further synthesize the photos collected by the front and rear cameras; in the actual photographing process, the user It is often the case that a picture of a companion needs to be taken in a particular scene, but no one else can help take a picture at this time, so the user needs to first take a picture of the companion and then take a picture of himself. The photo is then combined with the image processing software to synthesize the image of the character into the photo taken by the companion. This process is inferior in real time and the steps are cumbersome and time consuming.
发明内容Summary of the invention
本发明实施例提供了一种拍照方法及终端,可在拍照时通过图像合成技术快速获得包含拍摄者合照照片,节约用户时间,还可调整照片中的人物图像比例,使得合照中的人物图像更加协调、美观。The embodiment of the invention provides a photographing method and a terminal, which can quickly obtain a photograph of a photograph taken by a photographer through image synthesizing technology, save user time, and adjust the proportion of a person image in the photograph, so that the character image in the photograph is more Coordinated and beautiful.
本发明实施例提供了一种拍照方法,所述方法包括:An embodiment of the present invention provides a photographing method, and the method includes:
接收拍照指令,通过前置摄像头和后置摄像头采集第一图像帧和第二图像帧;Receiving a photographing instruction, and acquiring the first image frame and the second image frame through the front camera and the rear camera;
获取所述第一图像帧和所述第二图像帧中的人物图像区域,分别作为第一人物图像区域和第二人物图像区域;Obtaining a person image area in the first image frame and the second image frame as a first person image area and a second person image area, respectively;
根据所述第二人物图像区域的长参数和宽参数,调整所述第一人物图像区 域,以使所述第一人物图像区域与第二人物图像区域匹配;Adjusting the first person image area according to the long parameter and the wide parameter of the second person image area a field to match the first person image area with the second person image area;
将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像。The adjusted first person image region is synthesized into the second image frame to generate a combined image.
相应的,本发明实施例提供了一种终端,所述终端包括:Correspondingly, an embodiment of the present invention provides a terminal, where the terminal includes:
图像帧采集单元,用于接收拍照指令,通过前置摄像头和后置摄像头采集第一图像帧和第二图像帧;The image frame collecting unit is configured to receive a photographing instruction, and collect the first image frame and the second image frame through the front camera and the rear camera;
人物图像获取单元,用于获取所述第一图像帧和所述第二图像帧中的人物图像区域,分别作为第一人物图像区域和第二人物图像区域;a person image acquiring unit, configured to acquire a person image area in the first image frame and the second image frame as a first person image area and a second person image area, respectively;
图像参数调整单元,用于根据所述第二人物图像区域的长参数和宽参数,调整所述第一人物图像区域,以使所述第一人物图像区域与第二人物图像区域匹配;An image parameter adjustment unit, configured to adjust the first person image region according to the long parameter and the wide parameter of the second person image region, so that the first person image region matches the second person image region;
合照图像合成单元,用于将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像。The illuminating image synthesizing unit is configured to synthesize the adjusted first person image region into the second image frame to generate a illuminating image.
本发明实施例,可在接收到拍照指令时,通过前置摄像头和后置摄像头采集第一图像帧和第二图像帧;还可获取所述第一图像帧和所述第二图像帧中的人物图像区域,分别作为第一人物图像区域和第二人物图像区域;进而根据所述第二人物图像区域的长参数和宽参数,调整所述第一人物图像区域,以使所述第一人物图像区域与第二人物图像区域匹配;最后将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像,可在拍照时通过图像合成技术快速获得包含拍摄者的合照照片,节约用户时间,并且还可调整照片中的人物图像比例,使得合照中的人物图像更加协调、美观。In the embodiment of the present invention, the first image frame and the second image frame may be acquired by the front camera and the rear camera when receiving the photographing instruction; and the first image frame and the second image frame may also be acquired. a person image area, respectively, as a first person image area and a second person image area; and further adjusting the first person image area according to the long parameter and the wide parameter of the second person image area, so that the first person The image area is matched with the second person image area; finally, the adjusted first person image area is synthesized into the second image frame to generate a combined image, and the photo-synthesis technique can be used to quickly obtain the photo of the photographer. The photo saves user time, and can also adjust the proportion of the person image in the photo, so that the image of the person in the photo is more harmonious and beautiful.
附图说明DRAWINGS
为了更清楚地说明本发明实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are some embodiments of the present invention. For the ordinary technicians, other drawings can be obtained based on these drawings without any creative work.
图1是本发明实施例提供的一种拍照方法流程示意图;1 is a schematic flowchart of a photographing method according to an embodiment of the present invention;
图2是本发明实施例提供的另一种拍照方法流程示意图;2 is a schematic flow chart of another photographing method according to an embodiment of the present invention;
图3是本发明实施例提供的一种终端结构示意图; 3 is a schematic structural diagram of a terminal according to an embodiment of the present invention;
图4是本发明实施例提供的图像参数调整单元的结构示意图;4 is a schematic structural diagram of an image parameter adjustment unit according to an embodiment of the present invention;
图5是本发明实施例提供的合照图像合成单元的结构示意图。FIG. 5 is a schematic structural diagram of a combined image synthesizing unit according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
具体实现中,本发明实施例中所提及的终端包括但不限于:智能手机(如Android手机、IOS手机)、平板电脑、笔记本电脑、掌上电脑、穿戴式智能设备等电子设备。本发明所描述的方法是由存储在存储器中的一组代码执行,该代码执行于基于冯诺依曼体系的计算机系统中。In a specific implementation, the terminal mentioned in the embodiment of the present invention includes, but is not limited to, an electronic device such as a smart phone (such as an Android mobile phone or an IOS mobile phone), a tablet computer, a notebook computer, a palmtop computer, and a wearable smart device. The method described in the present invention is performed by a set of code stored in a memory that is executed in a computer system based on the von Neumann system.
下面将结合图1到图5对本发明实施例提供的一种拍照方法及终端进行具体描述。A photographing method and terminal provided by the embodiment of the present invention will be specifically described below with reference to FIG. 1 to FIG.
参见图1,是本发明实施例提供的一种拍照方法流程示意图,如图所示的拍照方法可包括以下步骤:FIG. 1 is a schematic flowchart of a photographing method according to an embodiment of the present invention. The photographing method shown in the figure may include the following steps:
S101,接收拍照指令,通过前置摄像头和后置摄像头采集第一图像帧和第二图像帧。S101. Receive a photographing instruction, and collect the first image frame and the second image frame by using the front camera and the rear camera.
具体实现中,打开终端中的拍照应用启动拍照功能后,按下快门键则视为用户输入拍照指令,该拍照指令通常为用户通过终端的输入装置(物理键盘或者触摸屏)输入的。In a specific implementation, after the camera application in the terminal is started to activate the photographing function, pressing the shutter button is regarded as inputting a photographing instruction by the user, and the photographing instruction is usually input by the user through an input device (physical keyboard or touch screen) of the terminal.
本实施例所提及的摄像头可为终端内置的摄像头,如自带前置摄像头和后置摄像头的手机;本步骤在终端接收到拍照指令时,启动前置摄像头和后置摄像头同时采集的第一图像帧和第二图像帧。若终端未包含内置的摄像头,但与外部摄像头相连,如终端为PC(Personal Computer,个人计算机),PC内未设置摄像头,但PC与外部两个摄像头相连接(一个为前置摄像头,另一个为后置摄像头);本步骤在接收到拍照指令时,启动与PC相连的摄像头,并同时获取摄像头采集的第一图像帧和第二图像帧。The camera mentioned in this embodiment may be a built-in camera of the terminal, such as a mobile phone with a front camera and a rear camera; this step starts the simultaneous acquisition of the front camera and the rear camera when the terminal receives the camera instruction. An image frame and a second image frame. If the terminal does not include a built-in camera, but is connected to an external camera, such as a PC (Personal Computer), the camera is not set in the PC, but the PC is connected to two external cameras (one is the front camera, the other is the other For the rear camera); this step starts the camera connected to the PC when receiving the camera instruction, and simultaneously acquires the first image frame and the second image frame acquired by the camera.
需要说明的是,在实际实施本发明实施例中第二图像帧为背景图像帧,而第一图像帧为抠图图像帧,因此需要获取第一图像帧中的人物图像区域,并根 据第二图像帧中的人物图像区域调整第一图像帧中的人物图像区域,然后将调整后的第一图像帧中的人物图像区域合成到第二图像帧中。因此最后生成的合照图像的背景为第二图像帧中的背景,而人物包括第一图像帧和第二图像帧中拍摄到的人物。It should be noted that, in the embodiment of the present invention, the second image frame is a background image frame, and the first image frame is a bitmap image frame, so the image area of the person in the first image frame needs to be acquired, and The person image area in the first image frame is adjusted according to the person image area in the second image frame, and then the person image area in the adjusted first image frame is synthesized into the second image frame. Thus the background of the last generated composite image is the background in the second image frame, and the character includes the first image frame and the person captured in the second image frame.
可选的,所述步骤S101具体可包括:接收拍照指令,通过前置摄像头和后置摄像头分别采集前摄图像帧和后摄图像帧;将所述前摄图像帧设置为第一图像帧,并将所述后摄图像帧设置为第二图像帧。Optionally, the step S101 may specifically include: receiving a photographing instruction, respectively acquiring a forward image frame and a back image frame by using a front camera and a rear camera; and setting the forward image frame as the first image frame, And setting the back image frame as a second image frame.
具体实现中,通常后置摄像头拍摄的风景面积更多,而且可以任意调节与被拍摄者的距离,因此可以拍摄到被拍摄者的全身或者大半个身子;而前置摄像头由于通常距离拍摄者距离较近,只能拍摄到拍摄者的头部和肩部等部分而且占据了图像帧中较多的图像区域,使得拍摄的风景面积较少。因此,将后置摄像头采集到的图像帧设置为第二图像帧,可以提供更多的背景位置给第一图像帧中的人物图像区域,避免在图像合成时两张图像帧中的人物图像区域出现严重的重叠交叉,并且可以保留更多的风景区域,使得最终生成的合照图像更加美观。In the specific implementation, the rear camera usually takes more landscapes and can adjust the distance from the photographer arbitrarily, so that the whole body or the majority of the body of the photographer can be photographed; and the front camera is usually at a distance from the photographer. Closer, only the part of the photographer's head and shoulders can be captured and occupy more image areas in the image frame, so that the landscape area is smaller. Therefore, setting the image frame acquired by the rear camera as the second image frame can provide more background position to the image area of the person in the first image frame, and avoid the image area of the person in the two image frames during image synthesis. Severe overlapping intersections occur and more landscape areas can be preserved, making the resulting combined image more aesthetically pleasing.
可选的,步骤S101具体可包括:接收拍照指令,通过前置摄像头和后置摄像头分别采集前摄图像帧和后摄图像帧;接收针对所述前摄图像帧和所述后摄图像帧中的目标图像帧输入的第一图像帧确认指令,将所述目标图像帧设置为第一图像帧,将另一图像帧设置为第二图像帧。Optionally, the step S101 may specifically include: receiving a photographing instruction, respectively acquiring a forward image frame and a back image frame by the front camera and the rear camera; and receiving the frame for the foreground image and the frame of the back image The first image frame confirmation command input by the target image frame sets the target image frame as a first image frame and another image frame as a second image frame.
具体实现中,终端可提供给用户随意选择需要保留背景的图像帧作为第二图像帧的功能。用户可根据终端的提示在前置摄像头和后置摄像头分别采集的前摄图像帧和后摄图像帧中,按照自己的意愿选择一图像帧作为第二图像帧,则另一图像帧为第一图像帧。In a specific implementation, the terminal may provide the user with the function of randomly selecting an image frame that needs to retain the background as the second image frame. The user may select an image frame as the second image frame according to the intention of the front camera and the rear camera respectively in the foreground image and the back image frame respectively collected by the front camera and the rear camera, and the other image frame is the first image frame. Image frame.
S102,获取所述第一图像帧和所述第二图像帧中的人物图像区域,分别作为第一人物图像区域和第二人物图像区域。S102. Acquire a person image area in the first image frame and the second image frame as a first person image area and a second person image area, respectively.
具体实现中,可通过图像识别技术,获取所述第一图像帧和所述第二图像帧中的人物图像区域,该人物图像区域包括人物的头像区域和拍摄到的身体区域。为了获取较为精准的人物图像区域(只包含人物部分),可进一步结合边缘检测技术确定人物图像的轮廓,将轮廓以内的图像区域设置为人物图像区域。In a specific implementation, the image area of the person in the first image frame and the second image frame may be acquired by an image recognition technology, where the character image area includes an avatar area of the character and the photographed body area. In order to obtain a more accurate image area of the person (including only the character part), the edge detection technique may be further combined to determine the outline of the person image, and the image area within the outline is set as the person image area.
S103,根据所述第二人物图像区域的长参数和宽参数,调整所述第一人物 图像区域,以使所述第一人物图像区域与第二人物图像区域匹配。S103. Adjust the first character according to the long parameter and the wide parameter of the second person image area. An image area to match the first person image area with the second person image area.
具体实现中,可首先获取第一人物图像区域和第二人物图像区域的长参数和宽参数,其中长参数指人物图像区域中身高方向的最大长度,宽参数是指人物图像区域肩宽方向的最大长度。In a specific implementation, the long parameter and the wide parameter of the first person image area and the second person image area may be first acquired, wherein the long parameter refers to the maximum length of the height direction of the person image area, and the wide parameter refers to the shoulder width direction of the image area of the person. The maximum length.
在实际拍摄时,由于前置摄像头距离拍摄者近使得采集的图像帧中人物图像区域只能拍摄到头部和肩部部分,并且占据图像帧中的大部分区域(宽参数较大);而后置摄像头由于距离被拍摄者较远能拍摄到被拍摄者半身或者全身,并且人物图像区域占据图像帧中的较小区域(长参数较大)。若直接获取其中第一图像帧中的人物图像区域合成到第二图像帧中,最后合成的合照图像中的人物图像区域中的各人物会看起来特别不协调。因此可根据第二人物图像区域的长参数和宽参数调节第一图像区域的长参数和款参数,使得第一人物图像区域和第二人物图像区域看起来更加协调、美观。例如,可分别将第一人物图像区域的长参数和宽参数调整为与第一人物图像区域长参数和宽参数相同,还可将第一人物图像区域的长宽比例值(长参数和宽参数的比例值),调整为与第二人物图像区域的长宽比例值相同。In actual shooting, since the front camera is close to the photographer, the image area of the person in the captured image frame can only capture the head and shoulder portions, and occupy most of the image frame (larger parameter); The camera can capture the half body or the whole body of the subject because the distance is far from the photographer, and the image area of the person occupies a small area in the image frame (the long parameter is large). If the person image area in the first image frame is directly acquired into the second image frame, each character in the person image area in the last synthesized combined image may appear to be particularly uncoordinated. Therefore, the long parameter and the parameter of the first image region can be adjusted according to the long parameter and the wide parameter of the second person image region, so that the first person image region and the second person image region appear more harmonious and beautiful. For example, the long parameter and the wide parameter of the first person image region may be respectively adjusted to be the same as the first person image region long parameter and the wide parameter, and the aspect ratio value (long parameter and wide parameter) of the first person image region may also be The scale value is adjusted to be the same as the aspect ratio value of the second person image area.
S104,将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像。S104. Synthesize the adjusted first person image region into the second image frame to generate a combined image.
具体实现中,进行图像合成时,可首先确定第一人物图像区域在第二图像帧中的合成位置区域(该合成位置区域为与第一人物图像区域轮廓和大小相同的区域),将该合成位置区域的色素淡化然后将调整后的第一人物图像区域合成到该位置处;或者,可直接将第一人物图像区域覆盖到该位置处。In a specific implementation, when performing image synthesis, first, a composite position area of the first person image area in the second image frame (the combined position area is the same as the contour and size of the first person image area) may be determined, and the synthesis is performed. The pigmentation of the location area is then faded to the adjusted first person image area to the location; alternatively, the first person image area can be directly overlaid to the location.
可选的,步骤S104可具体包括:确定所述第一人物图像区域在所述第二图像帧中的合成位置区域;将所述第一人物图像区域和合成到所述合成位置区域生成合照图像。Optionally, the step S104 may specifically include: determining a composite location area of the first person image region in the second image frame; and synthesizing the first character image region and synthesizing into the composite location region to generate a combined image .
具体实现中,可在第二图像帧中选择与第二人物图像区域左右相邻并且不相交的位置处获取与第一人物图像区域相同大小和轮廓的区域作为合成位置区域。或者给用户提供随意选择合成位置区域的功能,用户在第二图像帧中可随意选择某一区域作为合成位置区域,例如,用户通过终端的触摸屏在第二图像帧中输入闭合的滑动轨迹,以该闭合的滑动轨迹包含的图像区域为中心,获取与第一人物图像区域相同大小和轮廓的区域为合成位置区域。 In a specific implementation, an area having the same size and contour as the first person image area may be acquired as a composite position area at a position adjacent to and not intersecting the second person image area in the second image frame. Or providing the user with the function of arbitrarily selecting the composite location area, the user can freely select a certain area as the composite location area in the second image frame, for example, the user inputs a closed sliding track in the second image frame through the touch screen of the terminal, The closed sliding track contains the image area as the center, and the area having the same size and contour as the first person image area is the composite position area.
本发明实施例,可在接收到拍照指令时,通过前置摄像头和后置摄像头采集第一图像帧和第二图像帧;还可获取所述第一图像帧和所述第二图像帧中的人物图像区域,分别作为第一人物图像区域和第二人物图像区域;进而根据所述第二人物图像区域的长参数和宽参数,调整所述第一人物图像区域,以使所述第一人物图像区域与第二人物图像区域匹配;最后将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像,可在拍照通过图像合成技术快速获得包含拍摄者的合照照片,节约用户时间,并且还可调整照片中的人物图像比例,使得合照中的人物图像更加协调、美观。In the embodiment of the present invention, the first image frame and the second image frame may be acquired by the front camera and the rear camera when receiving the photographing instruction; and the first image frame and the second image frame may also be acquired. a person image area, respectively, as a first person image area and a second person image area; and further adjusting the first person image area according to the long parameter and the wide parameter of the second person image area, so that the first person The image area is matched with the second person image area; finally, the adjusted first person image area is synthesized into the second image frame to generate a combined image, and the photographed photo can be quickly obtained by the image synthesis technology. It saves user time, and can also adjust the proportion of the characters in the photo, so that the image of the person in the photo is more harmonious and beautiful.
参见图2,是本发明实施例提供的另一种拍照法流程示意图,如图所示的拍照方法可包括以下步骤:FIG. 2 is a schematic flowchart of another photographing method according to an embodiment of the present invention. The photographing method shown in the figure may include the following steps:
S201,接收拍照指令,通过前置摄像头和后置摄像采集第一图像帧和第二图像帧。S201. Receive a photographing instruction, and collect the first image frame and the second image frame by using a front camera and a rear camera.
具体实现中,打开终端中的拍照应用启动拍照功能后,按下快门键则视为用户输入拍照指令,该拍照指令通常为用户通过终端的输入装置(物理键盘或者触摸屏)输入的。接收到该拍照指令时,终端同时启动前置摄像头和后置摄像采集第一图像帧和第二图像帧。In a specific implementation, after the camera application in the terminal is started to activate the photographing function, pressing the shutter button is regarded as inputting a photographing instruction by the user, and the photographing instruction is usually input by the user through an input device (physical keyboard or touch screen) of the terminal. Upon receiving the photographing instruction, the terminal simultaneously starts the front camera and the rear camera to acquire the first image frame and the second image frame.
S202,获取所述第一图像帧和所述第二图像帧中的人物图像区域,分别作为第一人物图像区域和第二人物图像区域。S202. Acquire a person image area in the first image frame and the second image frame as a first person image area and a second person image area, respectively.
具体实现中,可通过图像识别技术,获取所述第一图像帧和所述第二图像帧中的人物图像区域,该人物图像区域包括人物的头像区域和拍摄到的身体区域。为了获取较为精准的人物图像区域(只包含人物部分),可进一步结合边缘检测技术确定人物图像的轮廓,将轮廓以内的图像区域设置为人物图像区域。In a specific implementation, the image area of the person in the first image frame and the second image frame may be acquired by an image recognition technology, where the character image area includes an avatar area of the character and the photographed body area. In order to obtain a more accurate image area of the person (including only the character part), the edge detection technique may be further combined to determine the outline of the person image, and the image area within the outline is set as the person image area.
S203,获取所述第一人物图像区域和所述第二人物图像区域的长参数和宽参数。S203. Acquire long parameters and wide parameters of the first person image region and the second person image region.
具体实现中,长参数指人物图像区域中身高方向的最大长度,宽参数是指人物图像区域肩宽方向的最大长度。In a specific implementation, the long parameter refers to the maximum length in the height direction of the image area of the person, and the wide parameter refers to the maximum length in the shoulder width direction of the image area of the person.
S204,判断所述第一人物图像区域的长宽比例值是否大于或者等于所述第二人物图像区域的长宽比例值,所述长宽比例值为长参数比宽参数的值。S204. Determine whether an aspect ratio value of the first person image region is greater than or equal to a length to width ratio value of the second person image region, and the aspect ratio value is a value of a long parameter ratio width parameter.
具体实现中,长宽比例值指的是长参数和宽参数的比例值,当人物图像区 域的长宽比例值较大时,代表人物图像区域拍摄到的人物身高方向的长度较大或者肩宽方向的长度较小,整个人物从图像效果上来看是比较瘦的;而当人物图像区域的长宽比例值较小时,代表人物图像区域拍摄到的人物身高方向的长度较小或者肩宽方向的长度较大,整个人物从图像效果上来看是比较胖的。In the specific implementation, the aspect ratio value refers to the ratio of the long parameter and the wide parameter, when the character image area When the aspect ratio of the domain is large, the length of the person's height direction or the length of the shoulder width direction is small, and the entire character is relatively thin in terms of image effect; When the aspect ratio value is small, the length of the person's height direction photographed on the representative image area is small or the length of the shoulder width direction is large, and the entire character is relatively fat in terms of image effect.
因此,当第一人物图像区域的长宽比例值大于或者等于第二人物图像区域的长宽比例值说明第一人物图像区域中的人物整体上比第二人物图像区域的人物要显瘦。执行步骤S205,保持第一人物图像区域的宽参数不变,调整第一人物图像区域的长参数,使得第一人物图像区域和第二人物图像区域的长宽比例值相等。此时,第一人物图像区域和第二人物图像区域中的人物在整体上看上去胖瘦程度就会比较协调了。Therefore, when the aspect ratio value of the first person image region is greater than or equal to the aspect ratio value of the second person image region, the person in the first person image region as a whole is thinner than the person in the second person image region. Step S205 is executed to keep the width parameter of the first person image region unchanged, and adjust the long parameter of the first person image region such that the aspect ratio values of the first person image region and the second person image region are equal. At this time, the characters in the first person image area and the second person image area appear to be relatively fat and thin as a whole.
当第一人物图像区域的长宽比例值小于第二人物图像区域的长宽比例值时,说明第一人物图像区域中的人物整体上比第二人物图像区域的人物要胖,可执行步骤S206到步骤S208,去调整第一人物图像区域。When the aspect ratio value of the first person image region is smaller than the aspect ratio value of the second person image region, it is indicated that the character in the first person image region is generally fatter than the person in the second person image region, and step S206 may be performed. Go to step S208 to adjust the first person image area.
S205,若是,调整所述第一人物图像区域的长参数,使得所述第一人物图像区域和所述第二人物图像区域的长宽比例值相等。S205. If yes, adjust the long parameter of the first person image area such that the aspect ratio values of the first person image area and the second person image area are equal.
S206,若否,获取所述第一人物图像区域和所述第二人物图像区域中的人物头像区域,分别作为第一头像区域和第二头像区域。S206. If not, acquiring the character avatar area in the first person image area and the second person image area as the first avatar area and the second avatar area, respectively.
S207,将所述第一头像区域的长参数和宽参数分别调整为与所述第二头像区域的长参数和宽参数相同。S207. Adjust the long parameter and the wide parameter of the first avatar area to be the same as the long parameter and the wide parameter of the second avatar area.
S208,获取所述第二人物图像区域中的身体区域,将调整后的所述第一头像区域与所述第二人物图像区域中的身体区域结合后替换所述第一人物图像区域。S208. Acquire a body region in the second person image region, and replace the first person image region by combining the adjusted first avatar region with the body region in the second person image region.
具体实现中,在步骤S204中判断结果为否时,说明第一人物图像区域中的人物整体上比第二人物图像区域的人物要胖,并且此时很可能本身第一图像区域中拍摄到的身高方向的长度较小,也就是可能第一图像区域只拍摄到了头部和肩部,而第二人物图像区域很可能拍了大半个身子或者全身。此时将第一人物图像区域直接合成到第二图像帧中,会使得第一人物图像区域和第二人物图像区域很不协调,并且可能第一人物图像区域会完全覆盖第二人物图像区域。In a specific implementation, when the result of the determination in step S204 is NO, it is indicated that the character in the first person image region is generally fatter than the person in the second person image region, and is likely to be photographed in the first image region at this time. The length in the height direction is small, that is, the first image area may only capture the head and shoulders, and the second person image area is likely to take more than half of the body or the whole body. At this time, directly synthesizing the first person image region into the second image frame may cause the first person image region and the second person image region to be very uncoordinated, and the first person image region may completely cover the second person image region.
因此,可通过步骤S206获取第一人物图像区域和所述第二人物图像区域中的人物头像区域,分别作为第一头像区域和第二头像区域,并获取第一头像区 域和第二头像区域的长参数和宽参数。然后通过步骤S207将第一头像区域的长参数和宽参数分别调整为与第二头像区域的长参数和宽参数相同,使得第一头像区域和第二头像区域看起来一样大小。进而通过步骤S208将第二人物图像区域中的身体区域和调整后的第一头像区域向相结合,并替换之前获取到的第一人物图像,使得第一人物图像区域和第二人物图像区域里的人物图像身体区域相同而头像不同,看起来更加美观协调,并具有一定的趣味性。Therefore, the first person image area and the character avatar area in the second person image area are obtained as the first avatar area and the second avatar area, respectively, and the first avatar area is acquired by step S206. The long and wide parameters of the domain and the second avatar area. Then, the long parameter and the wide parameter of the first avatar area are respectively adjusted to be the same as the long parameter and the wide parameter of the second avatar area by step S207, so that the first avatar area and the second avatar area appear to be the same size. Further, the body region in the second person image region and the adjusted first avatar region are combined in step S208, and the previously acquired first person image is replaced, so that the first person image region and the second person image region are The image of the character has the same body area and different avatars. It looks more beautiful and harmonious, and has certain interest.
S209,将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像。S209. Synthesize the adjusted first person image region into the second image frame to generate a combined image.
具体实现中,进行图像合成时,可首先确定第一人物图像区域在第二图像帧中的合成位置区域(该合成位置区域为与第一人物图像区域轮廓和大小相同的区域),将该合成位置区域的色素淡化然后将调整后的第一人物图像区域合成到该位置处;或者,可直接将第一人物图像区域覆盖到该位置处。In a specific implementation, when performing image synthesis, first, a composite position area of the first person image area in the second image frame (the combined position area is the same as the contour and size of the first person image area) may be determined, and the synthesis is performed. The pigmentation of the location area is then faded to the adjusted first person image area to the location; alternatively, the first person image area can be directly overlaid to the location.
本发明实施例,可在接收到拍照指令时,通过前置摄像头和后置摄像头采集第一图像帧和第二图像帧,然后根据第二人物图像区域的长宽比例值调整第一人物图像区域的长宽比例值。且当第一人物图像区域中的人物比第二人物图像区域的人物瘦高时压缩第一人物图像区域,使得第一人物图像区域中的人物变胖,然后合成到第二图像帧中生成合照图像;当第一人物图像区域中的人物比第二人物图像区域的人物胖宽时,此时很有可能第一人物图像区域中的人物只拍摄到了人物上半身的小部分,因此获取第一人物图像区域中的第一头像区域和第二人物图像区域中的身体区域,并将该第一头像区域与第二人物图像区域中的身体区域结合之后合成到第二图像帧中生成合照图像,可在拍照通过图像合成技术快速获得包含拍摄者的合照照片,节约用户时间,并且还可调整照片中的人物图像比例,使得合照中的人物图像更加协调、美观。In the embodiment of the present invention, when the photographing instruction is received, the first image frame and the second image frame are collected by the front camera and the rear camera, and then the first person image region is adjusted according to the length and width ratio of the second person image region. The aspect ratio value. And compressing the first person image region when the person in the first person image region is thinner than the person in the second person image region, so that the person in the first person image region becomes fat, and then synthesizing into the second image frame to generate a photo Image; when the person in the image area of the first person is thicker than the person in the image area of the second person, it is very likely that the character in the image area of the first person only captures a small part of the upper body of the character, thus acquiring the first person a first avatar area in the image area and a body area in the second person image area, and combining the first avatar area with the body area in the second person image area, and then synthesizing into the second image frame to generate a photographic image, The photographing is quickly obtained by the image synthesizing technology to capture the photograph of the photograph taken by the photographer, saving the user's time, and also adjusting the proportion of the person image in the photograph, so that the image of the person in the photograph is more harmonious and beautiful.
参见图3,本发明实施例提供的一种终端结构示意图,如图所示终端至少可以包括:图像帧采集单元301、人物图像获取单元302、图像参数调整单元303和合照图像合成单元304。Referring to FIG. 3, a schematic diagram of a terminal structure is provided in the embodiment of the present invention. As shown in the figure, the terminal may include at least an image frame acquiring unit 301, a character image acquiring unit 302, an image parameter adjusting unit 303, and a combined image synthesizing unit 304.
图像帧采集单元301,用于接收拍照指令,通过前置摄像头和后置摄像头采集第一图像帧和第二图像帧。The image frame collecting unit 301 is configured to receive a photographing instruction, and collect the first image frame and the second image frame through the front camera and the rear camera.
本实施例所提及的摄像头可为终端内置的摄像头,如自带前置摄像头和后 置摄像头的手机;本步骤在图像帧采集单元301接收到拍照指令时,启动前置摄像头和后置摄像头同时采集的第一图像帧和第二图像帧。若终端未包含内置的摄像头,但与外部摄像头相连,如终端为PC(Personal Computer,个人计算机),PC内未设置摄像头,但PC与外部两个摄像头相连接(一个为前置摄像头,另一个为后置摄像头);本步骤在接收到拍照指令时,启动与PC相连的摄像头,并同时获取摄像头采集的第一图像帧和第二图像帧。The camera mentioned in this embodiment can be a built-in camera of the terminal, such as a front camera and a rear camera. The mobile phone of the camera is set; in this step, when the image frame acquisition unit 301 receives the photographing instruction, the first image frame and the second image frame simultaneously acquired by the front camera and the rear camera are activated. If the terminal does not include a built-in camera, but is connected to an external camera, such as a PC (Personal Computer), the camera is not set in the PC, but the PC is connected to two external cameras (one is the front camera, the other is the other For the rear camera); this step starts the camera connected to the PC when receiving the camera instruction, and simultaneously acquires the first image frame and the second image frame acquired by the camera.
需要说明的是,在实际实施本发明实施例中第二图像帧为背景图像帧,而第一图像帧为抠图图像帧,因此需要获取第一图像帧中的人物图像区域,并根据第二图像帧中的人物图像区域调整第一图像帧中的人物图像区域,然后将调整后的第一图像帧中的人物图像区域合成到第二图像帧中。因此最后生成的合照图像的背景为第二图像帧中的背景,而人物包括第一图像帧和第二图像帧中拍摄到的人物。It should be noted that, in the embodiment of the present invention, the second image frame is a background image frame, and the first image frame is a bitmap image frame, so the image area of the person in the first image frame needs to be acquired, and according to the second The person image area in the image frame adjusts the person image area in the first image frame, and then the character image area in the adjusted first image frame is synthesized into the second image frame. Thus the background of the last generated composite image is the background in the second image frame, and the character includes the first image frame and the person captured in the second image frame.
进一步的,本实施例中的图像帧采集单元301可具体用于:接收拍照指令,通过前置摄像头和后置摄像头分别采集前摄图像帧和后摄图像帧;将所述前摄图像帧设置为第一图像帧,并将所述后摄图像帧设置为第二图像帧。Further, the image frame collection unit 301 in this embodiment may be specifically configured to: receive a photographing instruction, and respectively acquire a pre-shooting image frame and a post-shooting image frame through a front camera and a rear camera; and set the proactive image frame It is a first image frame, and the back image frame is set as a second image frame.
具体实现中,通常后置摄像头拍摄的风景面积更多,而且可以任意调节与被拍摄者的距离,因此可以拍摄到被拍摄者的全身或者大半个身子;而前置摄像头由于通常距离拍摄者距离较近,只能拍摄到拍摄者的头部和肩部等部分而且占据了图像帧中较多的图像区域,使得拍摄的风景面积较少。因此,将后置摄像头采集到的图像帧设置为第二图像帧,可以提供更多的背景位置给第一图像帧中的人物图像区域,避免在图像合成时两张图像帧中的人物图像区域出现严重的重叠交叉,并且可以保留更多的风景区域,使得最终生成的合照图像更加美观。In the specific implementation, the rear camera usually takes more landscapes and can adjust the distance from the photographer arbitrarily, so that the whole body or the majority of the body of the photographer can be photographed; and the front camera is usually at a distance from the photographer. Closer, only the part of the photographer's head and shoulders can be captured and occupy more image areas in the image frame, so that the landscape area is smaller. Therefore, setting the image frame acquired by the rear camera as the second image frame can provide more background position to the image area of the person in the first image frame, and avoid the image area of the person in the two image frames during image synthesis. Severe overlapping intersections occur and more landscape areas can be preserved, making the resulting combined image more aesthetically pleasing.
进一步的,本实施例中的图像帧采集单元301可具体用于:接收拍照指令,通过前置摄像头和后置摄像头分别采集前摄图像帧和后摄图像帧;接收针对所述前摄图像帧和所述后摄图像帧中的目标图像帧输入的第一图像帧确认指令,将所述目标图像帧设置为第一图像帧,将另一图像帧设置为第二图像帧。Further, the image frame collection unit 301 in this embodiment may be specifically configured to: receive a photographing instruction, and respectively acquire a proactive image frame and a post-image frame by using a front camera and a rear camera; and receive a frame for the proactive image And a first image frame confirmation instruction inputting the target image frame in the back image frame, setting the target image frame as a first image frame and setting another image frame as a second image frame.
具体实现中,终端可提供给用户随意选择需要保留背景的图像帧作为第二图像帧的功能。用户可根据终端的提示在前置摄像头和后置摄像头分别采集的前摄图像帧和后摄图像帧中,按照自己的意愿选择一图像帧作为第二图像帧, 则另一图像帧为第一图像帧。In a specific implementation, the terminal may provide the user with the function of randomly selecting an image frame that needs to retain the background as the second image frame. The user may select an image frame as the second image frame according to the intention of the terminal in the forward image frame and the back image frame respectively collected by the front camera and the rear camera according to the prompt of the terminal. Then another image frame is the first image frame.
人物图像获取单元302,用于获取所述第一图像帧和所述第二图像帧中的人物图像区域,分别作为第一人物图像区域和第二人物图像区域。The character image obtaining unit 302 is configured to acquire the person image regions in the first image frame and the second image frame as the first person image region and the second person image region, respectively.
具体实现中,人物图像获取单元302可通过图像识别技术,获取所述第一图像帧和所述第二图像帧中的人物图像区域,该人物图像区域包括人物的头像区域和拍摄到的身体区域。为了获取较为精准的人物图像区域(只包含人物部分),可进一步结合边缘检测技术确定人物图像的轮廓,将轮廓以内的图像区域设置为人物图像区域。In a specific implementation, the character image acquiring unit 302 may acquire a person image region in the first image frame and the second image frame by using an image recognition technology, where the character image region includes an avatar region of the character and the photographed body region. . In order to obtain a more accurate image area of the person (including only the character part), the edge detection technique may be further combined to determine the outline of the person image, and the image area within the outline is set as the person image area.
图像参数调整单元303,用于根据所述第二人物图像区域的长参数和宽参数,调整所述第一人物图像区域,以使所述第一人物图像区域与第二人物图像区域匹配。The image parameter adjustment unit 303 is configured to adjust the first person image region according to the long parameter and the wide parameter of the second person image region to match the first person image region with the second person image region.
具体实现中,可首先获取第一人物图像区域和第二人物图像区域的长参数和宽参数,其中长参数指人物图像区域中身高方向的最大长度,宽参数是指人物图像区域肩宽方向的最大长度。In a specific implementation, the long parameter and the wide parameter of the first person image area and the second person image area may be first acquired, wherein the long parameter refers to the maximum length of the height direction of the person image area, and the wide parameter refers to the shoulder width direction of the image area of the person. The maximum length.
在实际拍摄时,由于前置摄像头距离拍摄者近使得采集的图像帧中人物图像区域只能拍摄到头部和肩部部分,并且占据图像帧中的大部分区域(宽参数较大);而后置摄像头由于距离被拍摄者较远能拍摄到被拍摄者半身或者全身,并且人物图像区域占据图像帧中的较小区域(长参数较大)。若直接获取其中第一图像帧中的人物图像区域合成到第二图像帧中,最后合成的合照图像中的人物图像区域中的各人物会看起来特别不协调。因此图像参数调整单元303可根据第二人物图像区域的长参数和宽参数调节第一图像区域的长参数和款参数,使得第一人物图像区域和第二人物图像区域看起来更加协调、美观。例如,可分别将第一人物图像区域的长参数和宽参数调整为与第一人物图像区域长参数和宽参数相同,还可将第一人物图像区域的长宽比例值(长参数和宽参数的比例值),调整为与第二人物图像区域的长宽比例值相同。In actual shooting, since the front camera is close to the photographer, the image area of the person in the captured image frame can only capture the head and shoulder portions, and occupy most of the image frame (larger parameter); The camera can capture the half body or the whole body of the subject because the distance is far from the photographer, and the image area of the person occupies a small area in the image frame (the long parameter is large). If the person image area in the first image frame is directly acquired into the second image frame, each character in the person image area in the last synthesized combined image may appear to be particularly uncoordinated. Therefore, the image parameter adjustment unit 303 can adjust the long parameter and the section parameter of the first image region according to the long parameter and the wide parameter of the second person image region, so that the first person image region and the second person image region appear more harmonious and beautiful. For example, the long parameter and the wide parameter of the first person image region may be respectively adjusted to be the same as the first person image region long parameter and the wide parameter, and the aspect ratio value (long parameter and wide parameter) of the first person image region may also be The scale value is adjusted to be the same as the aspect ratio value of the second person image area.
进一步的,参见图4,本发明实施例提供的图像参数调整单元的结构示意图,如图所示的本实施例中的参数调整单元303可以包括:参数获取子单元3301、参数判断子单元3302和参数调整子单元3303。Further, referring to FIG. 4, a schematic structural diagram of an image parameter adjustment unit according to an embodiment of the present invention, the parameter adjustment unit 303 in the embodiment shown in the figure may include: a parameter acquisition subunit 3301, a parameter determination subunit 3302, and Parameter adjustment subunit 3303.
参数获取子单元3301,用于获取所述第一人物图像区域和所述第二人物图像区域的长参数和宽参数; a parameter obtaining subunit 3301, configured to acquire long parameters and wide parameters of the first person image region and the second person image region;
参数判断子单元3302,用于判断所述第一人物图像区域的长宽比例值是否大于或者等于所述第二人物图像区域的长宽比例值,所述长宽比例值为长参数比宽参数的值;The parameter determining sub-unit 3302 is configured to determine whether the aspect ratio value of the first person image area is greater than or equal to a length-to-width ratio value of the second person image area, and the aspect ratio is a long parameter ratio parameter Value
参数调整子单元3303,用于所述参数判断子单元的判断结果为是时,调整所述第一人物图像区域的长参数,使得所述第一人物图像区域和所述第二人物图像区域的长宽比例值相等。a parameter adjustment subunit 3303, configured to adjust a long parameter of the first person image region when the determination result of the parameter determination subunit is YES, such that the first person image region and the second person image region The length to width ratio values are equal.
具体实现中,长宽比例值指的是长参数和宽参数的比例值,当人物图像区域的长宽比例值较大时,代表人物图像区域拍摄到的人物身高方向的长度较大或者肩宽方向的长度较小,整个人物从图像效果上来看是比较瘦的;而当人物图像区域的长宽比例值较小时,代表人物图像区域拍摄到的人物身高方向的长度较小或者肩宽方向的长度较大,整个人物从图像效果上来看是比较胖的。In the specific implementation, the aspect ratio refers to the ratio of the long parameter and the wide parameter. When the aspect ratio of the image area of the person is large, the length of the person's height direction or the shoulder width of the person image area is larger. The length of the direction is small, and the whole character is relatively thin in terms of image effect; and when the aspect ratio of the image area of the person is small, the length of the person's height direction photographed on the representative image area is small or the shoulder width direction is small. The length is large, and the whole character is fatter in terms of image effect.
因此,当参数判断子单元3302的判断结果为是时:第一人物图像区域的长宽比例值大于或者等于第二人物图像区域的长宽比例值,说明第一人物图像区域中的人物整体上比第二人物图像区域的人物要显瘦。参数调整子单元3303保持第一人物图像区域的宽参数不变,调整第一人物图像区域的长参数,使得第一人物图像区域和第二人物图像区域的长宽比例值相等。此时,第一人物图像区域和第二人物图像区域中的人物在整体上看上去胖瘦程度就会比较协调了。Therefore, when the determination result of the parameter determination sub-unit 3302 is YES: the aspect ratio value of the first person image region is greater than or equal to the aspect ratio value of the second person image region, indicating that the person in the first person image region as a whole It is thinner than the character in the image area of the second person. The parameter adjustment sub-unit 3303 keeps the width parameter of the first person image region unchanged, and adjusts the long parameter of the first person image region such that the aspect ratio values of the first person image region and the second person image region are equal. At this time, the characters in the first person image area and the second person image area appear to be relatively fat and thin as a whole.
合照图像合成单元304,用于将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像。The illuminating image synthesizing unit 304 is configured to synthesize the adjusted first person image region into the second image frame to generate a illuminating image.
具体实现中,进行图像合成时,合照图像合成单元304可首先确定第一人物图像区域在第二图像帧中的合成位置区域(该合成位置为与第一人物图像区域轮廓和大小相同的区域),将该合成位置区域的色素淡化然后将调整后的第一人物图像区域合成到该位置处;或者,可直接将第一人物图像区域覆盖到该位置处。In a specific implementation, when performing image synthesis, the combined image synthesizing unit 304 may first determine a composite position region of the first person image region in the second image frame (the composite position is an area having the same contour and size as the first person image region) And dimming the pigment of the composite position area and then synthesizing the adjusted first person image area to the position; or, the first person image area may be directly covered to the position.
进一步的,参见图5,本发明实施例提供的合照图像合成单元的结构示意图,如图所示的本实施例中的合照图像合成单元304可以包括:位置确定子单元3401和合照合成子单元3402。Further, referring to FIG. 5, a schematic structural diagram of a combined image synthesizing unit provided by an embodiment of the present invention, the combined image synthesizing unit 304 in the present embodiment as shown in the figure may include: a position determining subunit 3401 and a combined synthesizing subunit 3402. .
位置确定子单元3401,用于确定所述第一人物图像区域在所述第二图像帧中的合成位置区域;a location determining sub-unit 3401, configured to determine a composite location area of the first person image region in the second image frame;
合照合成子单元3402,用于将所述第一人物图像区域和合成到所述合成位 置区域生成合照图像。a composite synthesis sub-unit 3402 for synthesizing the first person image region and synthesizing to the composite bit Set the area to generate a composite image.
具体实现中,位置确定子单元3401可在第二图像帧中选择与第二人物图像区域左右相邻并且不相交的位置处获取与第一人物图像区域相同大小和轮廓的区域作为合成位置区域。或者给用户提供随意选择合成位置区域的功能,用户在第二图像帧中可随意选择某一区域作为合成位置区域,例如,用户通过终端的触摸屏在第二图像帧中输入闭合的滑动轨迹,位置确定子单元3401以该闭合的滑动轨迹包含的图像区域为中心,获取与第一人物图像区域相同大小和轮廓的区域为合成位置区域。In a specific implementation, the position determining sub-unit 3401 may select, as the composite position area, an area having the same size and contour as the first person image area at a position adjacent to the left and right of the second person image area and not intersecting in the second image frame. Or providing the user with the function of randomly selecting the composite location area, the user can freely select a certain area as the composite location area in the second image frame, for example, the user inputs a closed sliding track in the second image frame through the touch screen of the terminal, the position The determining sub-unit 3401 is centered on the image area included in the closed sliding track, and acquires an area of the same size and contour as the first person image area as a combined position area.
可选的,所述人物图像获取单元302,还用于所述参数判断子单元的判断结果为否时,获取所述第一人物图像区域和所述第二人物图像区域中的人物头像区域,分别作为第一头像区域和第二头像区域;Optionally, the person image acquiring unit 302 is further configured to: when the determining result of the parameter determining subunit is negative, acquiring the character avatar area in the first person image area and the second person image area, As the first avatar area and the second avatar area respectively;
所述图像参数调整单元303,还用于将所述第一头像区域的长参数和宽参数分别调整为与所述第二头像区域的长参数和宽参数相同;The image parameter adjustment unit 303 is further configured to adjust the long parameter and the wide parameter of the first avatar area to be the same as the long parameter and the wide parameter of the second avatar area, respectively;
所述人物图像获取单元302,还用于获取所述第二人物图像区域中的身体区域;The character image obtaining unit 302 is further configured to acquire a body region in the second person image region;
相应的,所述终端还包括:Correspondingly, the terminal further includes:
人物图像处理单元305,用于将调整后的所述第一头像区域与所述第二人物图像区域中的身体区域结合后替换所述第一人物图像区域。The character image processing unit 305 is configured to replace the first person image area by combining the adjusted first avatar area with the body area of the second person image area.
具体实现中,当图像参数调整单元303中的参数判断子单元3302的判断结果为否时,说明第一人物图像区域中的人物整体上比第二人物图像区域的人物要胖,并且此时很可能本身第一图像区域中拍摄到的身高方向的长度较小,也就是可能第一图像区域只拍摄到了头部和肩部而第二人物图像区域很可能拍了大半个身子或者全身。此时将第一人物图像区域直接合成到第二图像帧中,会使得第一人物图像区域和第二人物图像区域很不协调,并且可能第一人物图像区域会完全覆盖第二人物图像区域。In a specific implementation, when the determination result of the parameter determination sub-unit 3302 in the image parameter adjustment unit 303 is NO, it is indicated that the person in the first person image area is generally fatter than the person in the second person image area, and is It may be that the length of the height direction photographed in the first image area itself is small, that is, it is possible that the first image area only captures the head and the shoulder and the second person image area is likely to take more than half of the body or the whole body. At this time, directly synthesizing the first person image region into the second image frame may cause the first person image region and the second person image region to be very uncoordinated, and the first person image region may completely cover the second person image region.
因此,可通过人物图像获取单元302获取第一人物图像区域和所述第二人物图像区域中的人物头像区域,分别作为第一头像区域和第二头像区域,并获取第一头像区域和第二头像区域的长参数和宽参数。然后通过图像参数调整单元303将第一头像区域的长参数和宽参数分别调整为与第二头像区域的长参数和宽参数相同,使得第一头像区域和第二头像区域看起来一样大小。进而通过 人物图像处理单元305将第二人物图像区域中的身体区域和调整后的第一头像区域向相结合,并替换之前获取到的第一人物图像,使得第一人物图像区域和第二人物图像区域里的人物图像身体区域相同而头像不同,看起来更加美观协调,并具有一定的趣味性。Therefore, the person image acquisition unit 302 can acquire the first character image area and the character avatar area in the second person image area, respectively, as the first avatar area and the second avatar area, and acquire the first avatar area and the second Long and wide parameters of the avatar area. Then, the long parameter and the wide parameter of the first avatar area are respectively adjusted to be the same as the long parameter and the wide parameter of the second avatar area by the image parameter adjusting unit 303, so that the first avatar area and the second avatar area appear to be the same size. Pass through The character image processing unit 305 combines the body region in the second person image region and the adjusted first avatar region, and replaces the previously acquired first person image such that the first person image region and the second person image region The characters in the image have the same body area and different avatars, which look more beautiful and harmonious, and have a certain interest.
本发明实施例,可在图像帧采集单元301接收到拍照指令时,通过前置摄像头和后置摄像头采集第一图像帧和第二图像帧;还可通过人物图像获取单元302获取所述第一图像帧和所述第二图像帧中的人物图像区域,分别作为第一人物图像区域和第二人物图像区域;进而通过图像参数调整单元303根据所述第二人物图像区域的长参数和宽参数,调整所述第一人物图像区域,以使所述第一人物图像区域与第二人物图像区域匹配;最后通过合照图像合成单元304将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像。可在拍照通过图像合成技术快速获得包含拍摄者的合照照片,节约用户时间,并且还可调整照片中的人物图像比例,使得合照中的人物图像更加协调、美观。In the embodiment of the present invention, when the image frame acquiring unit 301 receives the photographing instruction, the first image frame and the second image frame are collected by the front camera and the rear camera; and the first image is acquired by the character image acquiring unit 302. The image frame and the person image area in the second image frame are respectively used as the first person image area and the second person image area; and further, the image parameter adjustment unit 303 is configured according to the long parameter and the wide parameter of the second person image area. Adjusting the first person image area to match the first person image area with the second person image area; finally, synthesizing the adjusted first person image area to the first by the combined image synthesizing unit 304 A composite image is generated in two image frames. The photo-synthesis technique can be used to quickly obtain a photo of the photographer, which saves the user's time, and can also adjust the proportion of the person image in the photo, so that the image of the person in the photo is more harmonious and beautiful.
对于前述的各个方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某一些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和单元并不一定是本申请所必须的。For the foregoing various method embodiments, for the sake of brevity, they are all described as a series of action combinations, but those skilled in the art should understand that the present application is not limited by the described order of actions, because according to the present application, Some steps can be performed in other orders or at the same time. In the following, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and units involved are not necessarily required by the present application.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存取存储器(Random Access Memory,简称RAM)等。One of ordinary skill in the art can understand that all or part of the process of implementing the foregoing embodiments can be completed by a computer program to instruct related hardware, and the program can be stored in a computer readable storage medium. When executed, the flow of an embodiment of the methods as described above may be included. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
以上对本发明实施例公开的一种拍照方法及终端进行了详细介绍,以上所揭露的仅为本发明较佳实施例而已,当然不能以此来限定本发明之权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。 The photographing method and the terminal disclosed in the embodiments of the present invention are described in detail above. The above is only the preferred embodiment of the present invention, and the scope of the present invention cannot be limited thereto. Therefore, the present invention claims Equivalent changes made are still within the scope of the invention.

Claims (10)

  1. 一种拍照方法,其特征在于,包括:A photographing method, comprising:
    接收拍照指令,通过前置摄像头和后置摄像头采集第一图像帧和第二图像帧;Receiving a photographing instruction, and acquiring the first image frame and the second image frame through the front camera and the rear camera;
    获取所述第一图像帧和所述第二图像帧中的人物图像区域,分别作为第一人物图像区域和第二人物图像区域;Obtaining a person image area in the first image frame and the second image frame as a first person image area and a second person image area, respectively;
    根据所述第二人物图像区域的长参数和宽参数,调整所述第一人物图像区域,以使所述第一人物图像区域与第二人物图像区域匹配;And adjusting, according to the long parameter and the wide parameter of the second person image region, the first person image region to match the first person image region with the second person image region;
    将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像。The adjusted first person image region is synthesized into the second image frame to generate a combined image.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述第二人物图像区域的长参数和宽参数,调整所述第一人物图像区域包括:The method according to claim 1, wherein the adjusting the first person image area according to the long parameter and the wide parameter of the second person image area comprises:
    获取所述第一人物图像区域和所述第二人物图像区域的长参数和宽参数;Obtaining a long parameter and a wide parameter of the first person image area and the second person image area;
    判断所述第一人物图像区域的长宽比例值是否大于或者等于所述第二人物图像区域的长宽比例值,所述长宽比例值为长参数比宽参数的值;Determining whether the aspect ratio value of the first person image region is greater than or equal to the aspect ratio value of the second person image region, and the aspect ratio value is a value of a long parameter ratio width parameter;
    若是,调整所述第一人物图像区域的长参数,使得所述第一人物图像区域和所述第二人物图像区域的长宽比例值相等。If so, the long parameter of the first person image area is adjusted such that the aspect ratio values of the first person image area and the second person image area are equal.
  3. 根据权利要求2所述的方法,其特征在于,若所述第一人物图像区域的长宽比例值小于所述第二人物图像区域的长宽比例值,所述方法还包括:The method according to claim 2, wherein if the aspect ratio value of the first person image region is smaller than the aspect ratio value of the second person image region, the method further comprises:
    获取所述第一人物图像区域和所述第二人物图像区域中的人物头像区域,分别作为第一头像区域和第二头像区域;Obtaining a character avatar area in the first person image area and the second person image area as a first avatar area and a second avatar area, respectively;
    将所述第一头像区域的长参数和宽参数分别调整为与所述第二头像区域的长参数和宽参数相同;Adjusting the long parameter and the wide parameter of the first avatar area to be the same as the long parameter and the wide parameter of the second avatar area;
    获取所述第二人物图像区域中的身体区域,将调整后的所述第一头像区域与所述第二人物图像区域中的身体区域结合后替换所述第一人物图像区域。And acquiring the body region in the second person image region, and replacing the first person image region by combining the adjusted first avatar region with the body region in the second person image region.
  4. 根据权利要求1所述的方法,其特征在于,所述将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像包括: The method according to claim 1, wherein the synthesizing the adjusted first person image region into the second image frame to generate a photographed image comprises:
    确定所述第一人物图像区域在所述第二图像帧中的合成位置区域;Determining a composite location area of the first person image region in the second image frame;
    将所述第一人物图像区域和合成到所述合成位置区域生成合照图像。The first person image area and the composite image area are combined to generate a combined image.
  5. 根据权利要求1所述的方法,其特征在于,所述接收拍照指令,通过前置摄像头和后置摄像采集第一图像帧和第二图像帧包括:The method according to claim 1, wherein the receiving the photographing instruction, acquiring the first image frame and the second image frame by the front camera and the rear camera comprises:
    接收拍照指令,通过前置摄像头和后置摄像头分别采集前摄图像帧和后摄图像帧;Receiving a photographing instruction, respectively acquiring a forward image frame and a back image frame through the front camera and the rear camera;
    将所述前摄图像帧设置为第一图像帧,并将所述后摄图像帧设置为第二图像帧;或者Setting the proactive image frame as a first image frame and setting the post-image frame as a second image frame; or
    接收针对所述前摄图像帧和所述后摄图像帧中的目标图像帧输入的第一图像帧确认指令,将所述目标图像帧设置为第一图像帧,将另一图像帧设置为第二图像帧。Receiving a first image frame confirmation instruction for the target image frame input in the proactive image frame and the post-image frame, setting the target image frame as a first image frame, and setting another image frame as a first image frame Two image frames.
  6. 一种终端,其特征在于,包括:A terminal, comprising:
    图像帧采集单元,用于接收拍照指令,通过前置摄像头和后置摄像头采集第一图像帧和第二图像帧;The image frame collecting unit is configured to receive a photographing instruction, and collect the first image frame and the second image frame through the front camera and the rear camera;
    人物图像获取单元,用于获取所述第一图像帧和所述第二图像帧中的人物图像区域,分别作为第一人物图像区域和第二人物图像区域;a person image acquiring unit, configured to acquire a person image area in the first image frame and the second image frame as a first person image area and a second person image area, respectively;
    图像参数调整单元,用于根据所述第二人物图像区域的长参数和宽参数,调整所述第一人物图像区域,以使所述第一人物图像区域与第二人物图像区域匹配;An image parameter adjustment unit, configured to adjust the first person image region according to the long parameter and the wide parameter of the second person image region, so that the first person image region matches the second person image region;
    合照图像合成单元,用于将调整后的所述第一人物图像区域合成到所述第二图像帧中生成合照图像。The illuminating image synthesizing unit is configured to synthesize the adjusted first person image region into the second image frame to generate a illuminating image.
  7. 根据权利要求6所述的终端,其特征在于,所述图像参数调整单元包括:The terminal according to claim 6, wherein the image parameter adjustment unit comprises:
    参数获取子单元,用于获取所述第一人物图像区域和所述第二人物图像区域的长参数和宽参数;a parameter obtaining subunit, configured to acquire long parameters and wide parameters of the first person image area and the second person image area;
    参数判断子单元,用于判断所述第一人物图像区域的长宽比例值是否大于或者等于所述第二人物图像区域的长宽比例值,所述长宽比例值为长参数比宽参数的值; a parameter determining subunit, configured to determine whether an aspect ratio value of the first person image region is greater than or equal to a length to width ratio value of the second person image region, and the aspect ratio is a long parameter ratio width parameter Value
    参数调整子单元,用于所述参数判断子单元的判断结果为是时,调整所述第一人物图像区域的长参数,使得所述第一人物图像区域和所述第二人物图像区域的长宽比例值相等。a parameter adjustment subunit, configured to: when the determination result of the parameter determination subunit is YES, adjust a long parameter of the first person image area, so that the first person image area and the second person image area are long The width ratio values are equal.
  8. 根据权利要求7所述的终端,其特征在于,所述人物图像获取单元,还用于所述参数判断子单元的判断结果为否时,获取所述第一人物图像区域和所述第二人物图像区域中的人物头像区域,分别作为第一头像区域和第二头像区域;The terminal according to claim 7, wherein the person image acquisition unit is further configured to acquire the first person image area and the second person when the determination result of the parameter determination subunit is negative a character avatar area in the image area, as a first avatar area and a second avatar area, respectively;
    所述图像参数调整单元,还用于将所述第一头像区域的长参数和宽参数分别调整为与所述第二头像区域的长参数和宽参数相同;The image parameter adjustment unit is further configured to adjust the long parameter and the wide parameter of the first avatar area to be the same as the long parameter and the wide parameter of the second avatar area, respectively;
    所述人物图像获取单元,还用于获取所述第二人物图像区域中的身体区域;The character image obtaining unit is further configured to acquire a body region in the image area of the second person;
    所述终端还包括:The terminal further includes:
    人物图像处理单元,用于将调整后的所述第一头像区域与所述第二人物图像区域中的身体区域结合后替换所述第一人物图像区域。The character image processing unit is configured to replace the first person image area by combining the adjusted first avatar area with the body area of the second person image area.
  9. 根据权利要求6所述的终端,其特征在于,所述合照图像合成单元包括:The terminal according to claim 6, wherein the combined image synthesizing unit comprises:
    位置确定子单元,用于确定所述第一人物图像区域在所述第二图像帧中的合成位置区域;a position determining subunit, configured to determine a composite position area of the first person image area in the second image frame;
    合照合成子单元,用于将所述第一人物图像区域和合成到所述合成位置区域生成合照图像。And a composite photo subunit for generating a photographed image by synthesizing the first person image region and synthesizing into the composite position region.
  10. 根据权利要求6所述的终端,其特征在于,所述图像帧采集单元具体用于:The terminal according to claim 6, wherein the image frame collection unit is specifically configured to:
    接收拍照指令,通过前置摄像头和后置摄像头分别采集前摄图像帧和后摄图像帧;Receiving a photographing instruction, respectively acquiring a forward image frame and a back image frame through the front camera and the rear camera;
    将所述前摄图像帧设置为第一图像帧,并将所述后摄图像帧设置为第二图像帧;或者Setting the proactive image frame as a first image frame and setting the post-image frame as a second image frame; or
    接收针对所述前摄图像帧和所述后摄图像帧中的目标图像帧输入的第一图像帧确认指令,将所述目标图像帧设置为第一图像帧,将另一图像帧设置为第二图像帧。 Receiving a first image frame confirmation instruction for the target image frame input in the proactive image frame and the post-image frame, setting the target image frame as a first image frame, and setting another image frame as a first image frame Two image frames.
PCT/CN2015/091344 2015-07-28 2015-09-30 Photographing method and terminal WO2017016069A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510452529.1 2015-07-28
CN201510452529.1A CN105578028A (en) 2015-07-28 2015-07-28 Photographing method and terminal

Publications (1)

Publication Number Publication Date
WO2017016069A1 true WO2017016069A1 (en) 2017-02-02

Family

ID=55887640

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/091344 WO2017016069A1 (en) 2015-07-28 2015-09-30 Photographing method and terminal

Country Status (2)

Country Link
CN (1) CN105578028A (en)
WO (1) WO2017016069A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112770042A (en) * 2019-11-05 2021-05-07 RealMe重庆移动通信有限公司 Image processing method and device, computer readable medium, wireless communication terminal
EP3780577A4 (en) * 2018-04-04 2021-08-18 Vivo Mobile Communication Co., Ltd. Photography method and mobile terminal

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107124551B (en) * 2017-05-18 2021-03-23 惠州Tcl移动通信有限公司 Automatic synthesis method for mobile terminal photographing, storage device and mobile terminal
CN107277346A (en) * 2017-05-27 2017-10-20 深圳市金立通信设备有限公司 A kind of image processing method and terminal
CN107426502B (en) * 2017-09-19 2020-03-17 北京小米移动软件有限公司 Shooting method and device, electronic equipment and storage medium
CN107592459A (en) * 2017-09-22 2018-01-16 维沃移动通信有限公司 A kind of photographic method and mobile terminal
CN108632543B (en) * 2018-03-26 2020-07-07 Oppo广东移动通信有限公司 Image display method, image display device, storage medium and electronic equipment
CN110475058B (en) * 2018-05-10 2021-06-01 宏碁股份有限公司 Image synthesis method and intelligent device
CN110913121B (en) * 2018-09-18 2021-02-09 珠海格力电器股份有限公司 Shooting method, electronic equipment and computer storage medium
CN110084744B (en) * 2019-03-06 2022-11-08 深圳市云之梦科技有限公司 Image processing method, image processing device, computer equipment and storage medium
CN112153272B (en) * 2019-06-28 2022-02-25 华为技术有限公司 Image shooting method and electronic equipment
CN111369445B (en) * 2020-05-27 2020-09-15 北京伟杰东博信息科技有限公司 Image processing method, system and mobile terminal
CN113473239B (en) * 2020-07-15 2023-10-13 青岛海信电子产业控股股份有限公司 Intelligent terminal, server and image processing method
CN113596323A (en) * 2021-07-13 2021-11-02 咪咕文化科技有限公司 Intelligent group photo method, device, mobile terminal and computer program product
CN113824871A (en) * 2021-08-02 2021-12-21 惠州Tcl云创科技有限公司 Method and device for processing superposed photographing of front camera and rear camera of mobile terminal and mobile terminal

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080151044A1 (en) * 2006-12-22 2008-06-26 Fujifilm Corporation Method and apparatus for generating files for stereographic image display and method and apparatus for controlling stereographic image display
CN102055834A (en) * 2009-10-30 2011-05-11 Tcl集团股份有限公司 Double-camera photographing method of mobile terminal
CN104010138A (en) * 2013-02-23 2014-08-27 三星电子株式会社 Apparatus and method for synthesizing an image in a portable terminal equipped with a dual camera
CN104580910A (en) * 2015-01-09 2015-04-29 宇龙计算机通信科技(深圳)有限公司 Image synthesis method and system based on front camera and rear camera
CN104660899A (en) * 2014-09-29 2015-05-27 上海华勤通讯技术有限公司 Picture processing method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080151044A1 (en) * 2006-12-22 2008-06-26 Fujifilm Corporation Method and apparatus for generating files for stereographic image display and method and apparatus for controlling stereographic image display
CN102055834A (en) * 2009-10-30 2011-05-11 Tcl集团股份有限公司 Double-camera photographing method of mobile terminal
CN104010138A (en) * 2013-02-23 2014-08-27 三星电子株式会社 Apparatus and method for synthesizing an image in a portable terminal equipped with a dual camera
CN104660899A (en) * 2014-09-29 2015-05-27 上海华勤通讯技术有限公司 Picture processing method
CN104580910A (en) * 2015-01-09 2015-04-29 宇龙计算机通信科技(深圳)有限公司 Image synthesis method and system based on front camera and rear camera

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3780577A4 (en) * 2018-04-04 2021-08-18 Vivo Mobile Communication Co., Ltd. Photography method and mobile terminal
US11115591B2 (en) 2018-04-04 2021-09-07 Vivo Mobile Communication Co., Ltd. Photographing method and mobile terminal
CN112770042A (en) * 2019-11-05 2021-05-07 RealMe重庆移动通信有限公司 Image processing method and device, computer readable medium, wireless communication terminal

Also Published As

Publication number Publication date
CN105578028A (en) 2016-05-11

Similar Documents

Publication Publication Date Title
WO2017016069A1 (en) Photographing method and terminal
JP5232669B2 (en) camera
WO2022042776A1 (en) Photographing method and terminal
JP4861952B2 (en) Image processing apparatus and imaging apparatus
EP2975835B1 (en) Imaging device, image processing method, image processing program, and recording medium
US10264230B2 (en) Kinetic object removal from camera preview image
JP6401324B2 (en) Dynamic photo shooting method and apparatus
WO2019214574A1 (en) Image capturing method and apparatus, and electronic terminal
CN109922252B (en) Short video generation method and device and electronic equipment
JP5484994B2 (en) Facial image synthesis device, facial image synthesis method, and program
KR20150011742A (en) User terminal device and the control method thereof
CN109218630A (en) A kind of method for processing multimedia information and device, terminal, storage medium
JP2018006912A (en) Imaging apparatus, image processing apparatus, and control method and program of the same
JP2019504514A (en) Photo composition method, apparatus, program, and recording medium
CN108933891B (en) Photographing method, terminal and system
CN112333386A (en) Shooting method and device and electronic equipment
CN106657798A (en) Photographing method for intelligent terminal
CN112399078B (en) Shooting method and device and electronic equipment
CN108282622B (en) Photo shooting method and device
CN108540722B (en) Method and device for controlling camera to shoot and computer readable storage medium
JP2020014051A (en) Information processing method and information processing apparatus
CN110913120B (en) Image shooting method and device, electronic equipment and storage medium
CN106327588B (en) Intelligent terminal and image processing method and device thereof
CN111800574A (en) Imaging method and device and electronic equipment
JP2013168969A (en) Image display method, and image display device

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

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

Country of ref document: EP

Kind code of ref document: A1