Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a flowchart of a first embodiment of the image processing method of the present invention is shown, the method of the embodiment of the present invention can be applied to a mobile phone, a tablet computer, a camera, and other camera devices capable of supporting photographing, and specifically, in the embodiment of the present invention, the method includes:
s101: and acquiring pre-shot images which are respectively shot by a front camera and a rear camera for shooting.
And opening a front camera and a rear camera of the photographic equipment, and previewing images respectively shot by the front camera and the rear camera for shooting. Specifically, the front camera and the rear camera may be set in the photographing apparatus in advance. And adjusting shooting states, such as adjusting a shooting mode, shooting parameters, a shooting background and the like, according to images respectively shot by the front camera and the rear camera displayed on the photographic equipment, and taking the images respectively shot by the front camera and the rear camera at the moment as pre-shot images after the shooting states are adjusted.
As an alternative embodiment, the rear camera may capture scenery and people, and the front camera may capture the photographer himself. Furthermore, the image acquired by the rear camera can be displayed in a full screen mode, and the image acquired by the front camera is fixed in a small screen display mode and is displayed in an overlapped mode in the upper left corner or the upper right corner of the display screen of the photographic equipment.
If the image shot by the front camera comprises a person image, filtering out a background part of the image according to the person outline, extracting the person image, and taking the extracted person image as a pre-shot image shot by the front camera. If the image shot by the rear camera contains a person and the photographer needs to shoot the image to form a group photo, a certain gap can be reserved for the photographer in advance by the shot person.
S102: and focusing the pre-shot images respectively shot by the front camera and the rear camera to respectively obtain the focal length data of the front camera and the rear camera.
After adjusting the shooting state according to the images respectively captured by the front camera and the rear camera displayed on the photographing device, and obtaining the pre-shot images respectively captured by the front camera and the rear camera, a photographer can touch any position of an image display screen to trigger execution of focusing action, after the photographing device receives a focusing instruction, the front camera and the rear camera can simultaneously perform primary focusing, and respectively obtain the focal length data of the front camera and the rear camera, for example, the obtained focal length data are respectively 2 and 10.
S103: and setting the pre-shot image shot by the front camera to the target position of the pre-shot image shot by the rear camera according to the acquired focal length data to obtain a combined image comprising the pre-shot images shot by the front camera and the rear camera respectively.
After the focal length data of the front camera and the back camera are obtained, if a user operation instruction is received, the pre-shot image shot by the front camera is moved according to the user operation instruction. And in the moving process, carrying out image processing on the pre-shot image shot by the front camera according to the obtained focal length data of the front camera and the back camera, setting the image shot by the front camera after the image processing into the image shot by the back camera, and displaying by the photographic equipment to obtain a combined image comprising the images shot by the front camera and the back camera respectively.
The image processing may include a scaling process or a de-framing process, etc. Specifically, for example, when the acquired focal length data of the front camera and the acquired focal length data of the rear camera are 2 and 10, respectively, the calculation formula of the zoom factor of the image acquired by the front camera is as follows: the zoom factor of the image acquired by the front camera = the focal length data of the rear camera/the focal length data of the front camera, that is, the zoom factor of the image acquired by the front camera =10/2=5 in the embodiment of the present invention, so that the pre-shot image captured by the front camera can be automatically zoomed by 5 times in the process of moving the pre-shot image captured by the front camera, and the frame of the moving image can be further eliminated, so as to obtain the personal image of the photographer himself.
Specifically, the person image subjected to the scaling processing and the frame removal processing may be moved to a target position in a pre-captured image captured by the rear camera, for example, the person image of the photographer himself/herself obtained by the front camera subjected to the image processing is moved to a landscape image obtained by the rear camera, or the person image of the photographer himself/herself obtained by the front camera subjected to the image processing is moved to a gap reserved between the captured persons, and the photographing apparatus displays a combined image of the photographer himself/herself and the landscape or a combined image of the photographer himself/herself and the captured persons. Further, when the current camera is close to the photographer and can only acquire the upper body image of the photographer, the acquired upper body image can be moved left and right along the lower edge of the pre-captured image acquired by the rear camera, the placement position of the upper body image of the photographer is selected, and the upper body image of the photographer is set in the landscape image or in a gap reserved by the photographed person.
After the camera device displays a combined image of the photographer's own person and the landscape or a combined image of the photographer's own person and the photographed person, the person in the combined image can adjust the expression, the motion, or adjust the gap between the persons again, and the like. Further, if the front camera captures only the upper body image of the photographer, the height, the tilt angle, or the like of the photographing apparatus may be adjusted so that the rear camera acquires the upper body image of the person to be photographed similarly, and good coordination is maintained with respect to the height, or the like, of the upper body image of the photographer himself acquired by the front camera. After the adjustment is completed, when a shooting confirmation instruction is detected, the combined image including the photographer and the scenery or the combined image including the photographer and the person to be shot is shot and acquired, and the shot and acquired image is stored.
According to the embodiment of the invention, the corresponding focal length data can be obtained by focusing the images respectively shot by the front camera and the rear camera of the photographic equipment, the image shot by the front camera is set to the target position in the image shot by the rear camera according to the focal length data, the combined image comprising the pre-shot images respectively shot by the front camera and the rear camera is obtained, so that the image comprising the photographer can be conveniently and quickly obtained by the front camera and the rear camera, and the operation is simple.
Referring to fig. 2, a flowchart of a second embodiment of the image processing method according to the present invention is shown, where the method according to the present invention can be applied to a mobile phone, a tablet computer, a camera, and other camera devices capable of supporting photographing, and specifically, in the embodiment of the present invention, the method includes:
s201: and previewing images respectively shot by the front camera and the rear camera for shooting.
And opening a front camera and a rear camera of the photographic equipment, displaying images respectively shot by the front camera and the rear camera by the photographic equipment, and previewing the images respectively shot by the front camera and the rear camera. Specifically, the front camera and the rear camera may be set in the photographing apparatus in advance.
S202: and adjusting shooting states according to the images respectively shot by the front camera and the rear camera, and taking the images respectively shot by the front camera and the rear camera with the adjusted shooting states as pre-shot images.
And adjusting shooting states, such as adjusting a shooting mode, shooting parameters, a shooting background and the like, according to images respectively shot by the front camera and the rear camera displayed on the photographic equipment, and taking the images respectively shot by the front camera and the rear camera at the moment as pre-shot images after the shooting states are adjusted.
As an alternative embodiment, the rear camera may capture scenery and people, and the front camera may capture the photographer himself. Further, the image acquired by the rear camera can be displayed in a full screen mode, and the image acquired by the front camera is fixed in a small screen display mode and displayed in an overlapped mode in the upper left corner or the upper right corner of the display screen of the photographic equipment. The display positions of the images shot by the front camera and the rear camera and the screen display size of the shot images are not limited in the invention.
S203: if the image shot by the front camera comprises a person image, extracting the person image, and taking the extracted person image as a pre-shot image shot by the front camera.
When the image shot by the current camera comprises a character image, the background part of the image can be filtered according to the character outline, the character image is extracted, and the extracted character image is used as a pre-shot image shot by the front camera. If the image shot by the rear camera contains people and the photographer needs to shoot the image to form a combined photograph, a certain gap can be reserved for the photographer in advance by the shot people, so that the people image shot by the front camera can be arranged in the reserved gap in the shot people image shot by the rear camera.
S204: and focusing the pre-shot images respectively shot by the front camera and the rear camera to respectively obtain the focal length data of the front camera and the rear camera.
After adjusting the shooting state according to the images respectively shot by the front camera and the rear camera displayed on the photographing device, and obtaining the pre-shot images respectively shot by the front camera and the rear camera, a photographer can touch any position of an image display screen to trigger execution of focusing operation, after the photographing device receives a focusing instruction, the front camera and the rear camera can simultaneously carry out primary focusing, and respectively obtain the focal length data of the front camera and the rear camera, such as 2 and 10 respectively.
S205: and moving the pre-shot image shot by the front camera according to a user operation instruction, and carrying out image processing on the pre-shot image shot by the front camera according to the acquired focal length data in the moving process.
After the focal length data of the front camera and the back camera are obtained, if a user operation instruction is received, the pre-shot image shot by the front camera is moved according to the user operation instruction. And in the moving process, image processing, such as zooming processing or frame removing processing and the like, is carried out on the pre-shot image shot by the front camera according to the obtained focal length data of the front camera and the back camera. Specifically, the method for calculating the zoom factor of the image obtained by the front camera may be calculated according to the above calculation formula, and the frame of the moving image is eliminated during the moving process to obtain the personal image of the photographer himself.
S206: and moving the pre-shot image shot by the front camera to a target position in the pre-shot image shot by the rear camera to obtain a combined image comprising the pre-shot images shot by the front camera and the rear camera respectively.
And moving the figure image shot by the front camera subjected to zooming processing and frame removing processing to a target position in a pre-shot image shot by a rear camera to obtain a combined image comprising the pre-shot image shot by the front camera subjected to image processing and an image shot by the rear camera.
Specifically, the person image subjected to the scaling processing and the frame removal processing may be moved to a target position in a pre-captured image captured by the rear camera, for example, the person image of the person who is captured by the front camera subjected to the image processing is moved to a landscape image captured by the rear camera, or the person image of the person who is captured by the front camera subjected to the image processing is moved to a gap reserved between the captured persons, and the camera device displays a combined image of the person who is captured and the landscape or a combined image of the person who is captured and the captured persons. Further, when the current camera is close to the photographer and can only acquire the upper body image of the photographer, the acquired upper body image can be moved left and right along the lower edge of the pre-captured image acquired by the rear camera, the placement position of the upper body image of the photographer is selected, and the upper body image of the photographer is set in the landscape image or in a gap reserved by the photographed person.
S207: and if the shooting confirmation instruction is detected, shooting and acquiring the combined image comprising the pre-shot images respectively shot by the front camera and the rear camera.
If the photographic subject includes a person, the person in the image can adjust the expression, the action, the interval between persons and the like. After the adjustment is completed, when a shooting confirmation instruction is detected, shooting and acquiring the combined image comprising the pre-shot images respectively shot by the front camera and the rear camera.
After the camera device displays a combined image of the photographer's own person and the landscape or a combined image of the photographer's own person and the photographed person, the person in the combined image can adjust the expression, the motion, or adjust the gap between the persons again, and the like. Further, if the front camera captures only the upper body image of the photographer, the height, the tilt angle, or the like of the photographing apparatus may be adjusted so that the rear camera acquires the upper body image of the person to be photographed similarly, and maintains good coordination with the upper body image of the photographer himself or herself acquired by the front camera in terms of the height, or the like. After the adjustment is completed, when a confirmation shooting instruction is detected, the combined image including the photographer own person and the scenery or the combined image including the photographer own person and the person to be shot is shot and acquired.
S208: and storing the obtained combined image.
And shooting and acquiring the combined image comprising the person of the photographer and the scenery or the combined image comprising the person of the photographer and the person to be shot, and storing the shot and acquired combined image.
According to the embodiment of the invention, the corresponding focal length data can be obtained by focusing the images respectively shot by the front camera and the rear camera of the photographic equipment, the obtained image of the photographer is subjected to image processing according to the focal length data, the image of the photographer shot by the front camera is set to the target position in the image shot by the rear camera, and the combined image comprising the image of the photographer shot by the front camera and the background image shot by the rear camera is obtained, so that the image comprising the photographer can be conveniently and quickly obtained by the front camera and the rear camera, and the operation is simple.
Referring to fig. 3, a schematic structural diagram of a first embodiment of an image processing apparatus according to the present invention is shown, where the apparatus according to the embodiment of the present invention may be disposed in a mobile phone, a tablet computer, a camera, and other camera devices capable of supporting photographing, and specifically, in the embodiment of the present invention, the apparatus includes: an acquisition module 10, a focusing module 20 and a merging module 30. Wherein,
the acquiring module 10 is configured to acquire pre-shot images respectively captured by a front camera and a rear camera for image capturing.
The front camera and the rear camera of the photographing apparatus are opened, and the acquisition module 10 is triggered to acquire pre-shot images respectively captured by the front camera and the rear camera. Specifically, the front camera and the rear camera may be provided in the photographing apparatus in advance.
Further optionally, fig. 4 is a schematic view of one structural composition of the obtaining module 10 in fig. 3, and in a specific embodiment, the obtaining module 10 may specifically include:
and an image previewing unit 11 for previewing images respectively captured by the front camera and the rear camera.
After the front camera and the rear camera of the photographing apparatus are opened, the image preview unit 11 displays images respectively captured by the front camera and the rear camera, and previews the images respectively captured by the front camera and the rear camera.
As an alternative embodiment, the image captured by the rear camera acquired by the image preview unit 11 may include a landscape and a person, and the image captured by the front camera acquired may be the photographer himself. Further, the image preview unit 11 may set to display the image acquired by the rear camera in a full screen, and set to fix and display the image acquired by the front camera in a small screen display manner in an overlapping manner in the upper left corner or the upper right corner of the display screen of the photographing apparatus.
And the image acquisition unit 12 is configured to adjust shooting states according to the images respectively captured by the front camera and the rear camera previewed by the image previewing unit, and use the images respectively captured by the front camera and the rear camera with the adjusted shooting states as pre-shot images.
The shooting status, such as shooting mode, shooting parameters, shooting background, and the like, is adjusted according to the images respectively captured by the front camera and the rear camera displayed by the image preview unit 11, and after the shooting status is adjusted, the image acquisition unit 12 takes the images respectively captured by the front camera and the rear camera at this time as the pre-shot images.
And a focusing module 20, configured to focus the pre-shot images respectively captured by the front camera and the rear camera acquired by the acquiring module 10, and respectively acquire focal length data of the front camera and the rear camera.
After the image obtaining unit 12 adjusts the shooting status according to the images respectively captured by the front camera and the rear camera displayed by the image previewing unit 11, and obtains the pre-shot images respectively captured by the front camera and the rear camera, a photographer can touch any position of the image display screen to trigger the execution of the focusing action, after the focusing module 20 receives the focusing instruction, the front camera and the rear camera can simultaneously perform primary focusing, and respectively obtain the focal length data of the front camera and the rear camera, such as 2 and 10 respectively.
The merging module 30 is configured to set the pre-shot image captured by the front camera to a target position of the pre-shot image captured by the rear camera according to the focal length data acquired by the focusing module 20, so as to obtain a merged image including the pre-shot images captured by the front camera and the rear camera respectively.
According to the focal length data of the front camera and the rear camera respectively acquired by the focusing module 20, the merging module 30 processes the pre-shot image captured by the front camera, and sets the pre-shot image captured by the front camera after image processing to the target position of the pre-shot image captured by the rear camera.
Further optionally, fig. 5 is a schematic diagram of one structural composition of the merging module 30 in fig. 3, and in an embodiment, the merging module 30 may include:
and the image processing unit 31 is configured to move the pre-shot image shot by the front camera according to a user operation instruction, and perform image processing on the pre-shot image shot by the front camera according to the acquired focal length data of the front camera and the acquired focal length data of the rear camera during the moving process.
The image processing unit 31 may be specifically configured to move a pre-shot image shot by a front camera according to a user operation instruction, and perform zooming processing or frame removal processing on the pre-shot image shot by the front camera according to the acquired focal length data of the front camera and the acquired focal length data of the rear camera during the moving process.
After the focusing module 20 acquires the focal length data of the front camera and the rear camera, if the image processing unit 31 receives a user operation instruction, the pre-shot image captured by the front camera is moved according to the user operation instruction. And in the moving process, carrying out zooming processing or frame removing processing and the like on the pre-shot image shot by the front camera according to the obtained focal length data of the front camera and the back camera. Specifically, the method for calculating the zoom factor of the image obtained by the front camera may be calculated according to the above calculation formula, and further eliminate the frame of the moving image to obtain the personal image of the photographer himself.
The image merging unit 32 is configured to move the pre-shot image captured by the front camera to a target position in the pre-shot image captured by the rear camera, so as to obtain a merged image including the pre-shot images captured by the front camera and the rear camera respectively.
The image merging unit 32 moves the image of the person captured by the front camera, which is subjected to the scaling processing and the frame removal processing by the image processing unit 31, to a target position in the pre-captured image captured by the rear camera, and obtains a merged image including the pre-captured image captured by the front camera and the image captured by the rear camera, which are subjected to the image processing.
Specifically, the image merging unit 32 may move the person image subjected to the scaling processing and the framing processing by the image processing unit 31 to a target position in a pre-captured image captured by the rear camera, for example, move the person image of the person who is captured by the front camera subjected to the image processing by the image processing unit 31 to a landscape image captured by the rear camera, or move the person image of the person who is captured by the front camera subjected to the image processing by the image processing unit 31 to a gap reserved between the persons to be captured, and the image merging unit 32 displays a combined image of the person who is captured and the landscape or a merged image of the person who is captured and the persons to be captured.
According to the embodiment of the invention, the corresponding focal length data can be obtained by focusing the images respectively shot by the front camera and the rear camera of the photographic equipment, the image shot by the front camera is set to the target position in the image shot by the rear camera according to the focal length data, the combined image comprising the pre-shot images respectively shot by the front camera and the rear camera is obtained, so that the image comprising the photographer can be conveniently and quickly obtained by the front camera and the rear camera, and the operation is simple.
Referring to fig. 6, it is a schematic structural diagram of an image processing apparatus according to a second embodiment of the present invention, the image processing apparatus in this embodiment includes an obtaining module 10, a focusing module 20, and a combining module 30 in the first embodiment of the image processing apparatus, and the embodiment further includes:
and the extraction module 40 is configured to, when the image captured by the front camera includes a person image, extract the person image, and use the extracted person image as a pre-shot image captured by the front camera.
When the image captured by the front camera includes a character image, the extraction module 40 may filter out a background portion of the image according to the character outline, extract the character image, and use the extracted character image as a pre-shot image captured by the front camera.
And the shooting module 50 is configured to, after the pre-shot image shot by the front camera is set to a target position of the pre-shot image shot by the rear camera, if a shooting confirmation instruction is detected, shoot and acquire the merged image including the pre-shot images shot by the front camera and the rear camera respectively.
After the acquisition module 10 displays a combined image of the person and the scenery or a combined image of the person and the person to be photographed, the person in the combined image can adjust the expression, the action or the inter-person gap again. When the shooting module 50 detects the shooting confirmation instruction, the combined image including the pre-shot images respectively shot by the front camera and the rear camera is shot and acquired. Further, if the front camera acquired by the acquisition module 10 only captures the upper body image of the photographer, the height, the tilt angle, or the like of the photographing apparatus may be adjusted so that the rear camera likewise acquires the upper body image of the person to be photographed and maintains good compatibility with the upper body image of the photographer himself acquired by the front camera in terms of height or the like. After the adjustment, when the photographing module 50 detects the confirmation photographing instruction, the photographing module photographs and acquires the combined image including the person of the photographer and the scenery or the combined image including the person of the photographer and the person to be photographed.
And a saving module 60, configured to save the obtained merged image.
After the photographing module 50 photographs and acquires the combined image including the person of the photographer and the landscape or the combined image including the person of the photographer and the person to be photographed, the saving module 60 saves the photographed and acquired combined image.
According to the embodiment of the invention, the corresponding focal length data can be obtained by focusing the images respectively shot by the front camera and the rear camera of the photographic equipment, the obtained image of the photographer is subjected to image processing according to the focal length data, the image of the photographer shot by the front camera is set to the target position in the image shot by the rear camera, and the combined image comprising the image of the photographer shot by the front camera and the background image shot by the rear camera is obtained, so that the image comprising the photographer can be conveniently and quickly obtained by the front camera and the rear camera, and the operation is simple.
The steps in the methods of all embodiments of the present invention can be sequentially adjusted, combined and deleted according to actual needs.
The modules or units in the devices of all the embodiments of the present invention can be combined, divided and deleted according to actual needs.
The modules or units in the embodiments of the present invention may be implemented by a general-purpose integrated Circuit, such as a CPU (Central Processing Unit), or an ASIC (Application specific integrated Circuit).
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
While the invention has been described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention.