# Patent

## Title
Apparatus and method for compositing image in a portable terminal

## Abstract

A method and apparatus for compositing images in a portable terminal are provided. The method includes acquiring a plurality of images; determining a composition region of each of the plurality of images; and compositing the plurality of images by using the composition regions of the plurality of images.

## Background
PRIORITY
This application claims priority under 35 U.S.C. §119(a) to a patent application filed in the Korean Intellectual Property Office on Apr. 19, 2011 and assigned Serial No. 2011-0036031, the entire disclosure of which is incorporated herein by reference.
BACKGROUND OF THE INVENTION
1. Field of the Invention
The present invention relates generally to image composition, and more particularly, to an apparatus and method for compositing images in a portable terminal.
2. Description of the Related Art
The use of portable terminals has recently increased. Accordingly, portable terminals have been equipped with various additional functions. Examples of such additional functions of the portable terminals include a gaming function, a scheduling function, a wake-up call function, an Moving Picture Experts Group (MPEG) layer 3 (MP3) function, a video player function, and a digital camera function.
Specifically, a digital camera function is included in most portable terminals. Aside from a simple photographing function, the digital camera function of the portable terminal provides a photographing function based on a background image. For example, the portable terminal provides a function for photographing a user image and compositing a prestored background image and the user image into one image.
As described above, the conventional portable terminal provides an image composition function to enable the user to acquire various images in addition to a simple image. However, the conventional image composition function composes a user image at a fixed position of the prestored background image, thus failing to satisfy the requirements of users.
SUMMARY OF THE INVENTION
An aspect of the present invention is to substantially solve at least the above problems and/or disadvantages and to provide at least the advantages below. Accordingly, an object of the present invention is to provide an apparatus and method for compositing images in a portable terminal.
Another aspect of the present invention is to provide an apparatus and method for compositing images acquired from a plurality of cameras, in a portable terminal.
Another aspect of the present invention is to provide an apparatus and method for determining a composition region for each of a plurality of images in a portable terminal and compositing the images by an alpha-blending technique.
Another aspect of the present invention is to provide an apparatus and method for sharing a plurality of images between a plurality of portable terminals and compositing the shared images.
Another aspect of the present invention is to provide a method and apparatus for compositing, by a portable terminal supporting a video call function, an image received from a video call counterpart terminal and an image input from a camera of the portable terminal, and displaying the image that was composed during the video call.
According to an aspect of the present invention, a method for compositing images in a portable terminal is provided. The method includes acquiring a plurality of images; determining a composition region of each of the plurality of images; and compositing the plurality of images by using the composition regions of the plurality of images.
According to another aspect of the present invention, an apparatus for compositing images in a portable terminal is provided. The apparatus includes an image-acquiring unit for acquiring a plurality of images; a composition region-determining unit for determining a composition region of each of the plurality of images; and an image-compositing unit for compositing the plurality of images by using the composition regions of the images.



BRIEF DESCRIPTION OF THE DRAWINGS
The above and other aspects, objects, features and advantages of the present invention will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings, in which:
FIG. 1 is a diagram illustrating a method for compositing images in a portable terminal according to an embodiment of the present invention;
FIG. 2 is a block diagram illustrating a portable terminal according to an embodiment of the present invention;
FIG. 3 is a block diagram illustrating an image composition-controlling unit in a portable terminal according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a process of compositing images in a portable terminal according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating a process of compositing images during a video call in a portable terminal according to another embodiment of the present invention;
FIGS. 6A to 6C are diagrams illustrating a screen configuration for an image compositing method in a portable terminal according to an embodiment of the present invention; and
FIGS. 7A to 7C are diagrams illustrating a screen configuration for an image compositing method in a portable terminal according to another embodiment of the present invention.



DETAILED DESCRIPTION OF EMBODIMENTS OF THE PRESENT INVENTION
Embodiments of the present invention will be described herein below with reference to the accompanying drawings. In the following description, detailed descriptions of well-known functions or configurations will be omitted since they would unnecessarily obscure the subject matters of the present invention. Also, the terms used herein are defined according to the functions of the present invention. Thus, the terms may vary depending on users' or operators' intentions or practices. Therefore, the terms used herein must be understood based on the descriptions made herein.
The present invention provides a method and apparatus for compositing images in a portable terminal.
FIG. 1 is a diagram illustrating a method for compositing images in a portable terminal according to an embodiment of the present invention.
Referring to FIG. 1, a user image is acquired through a first camera 100, acquires a background image through a second camera 102, the user image and the background image are composed (merged) to form a composed (merged) image 120. The portable terminal determines a composition region of the user image and a composition region of the background image and composes the composition region of the user image and the composition region of the background image as if the user image was originally included in the background image. According to an embodiment, the first camera 100 may be a camera equipped at a front side of the portable terminal, and the second camera 102 may be a camera equipped at a rear side of the portable terminal. The camera equipped at the front side refers to a camera equipped at the side on which a display panel is provided to enable the user to view the composition results, and the camera at the rear side refers to a camera facing a different directions direction from the camera at the front side.
According to another embodiment, the first camera 100 and the second camera 102 are cameras on different portable terminals. Hereinafter, a description will be given of the composition of images acquired in real-time through the first camera 100 and the second camera 102. However, the images that to be composed may vary without departing from the scope of the present invention. For example, the present invention may also be applicable to the composition of a prestored image and at least one image acquired from the first camera 100 and the second camera 102, and to the composition of wholly prestored images. An image-compositing scheme according to the present invention may be applicable not only to the composition of still images, but also to the composition of video images and the composition of a video image and a still image.
The image-compositing scheme according to the present invention will be described below in detail with reference to FIGS. 2 and 7.
FIG. 2 is a block diagram of a portable terminal, according to an embodiment of the present invention.
Referring to FIG. 2, a portable terminal according to an embodiment of the present invention includes a control unit 200, a first camera 210, a second camera 220, a display unit 230, an input unit 240, a storage unit 250, and a communication module 260. The control unit 200 includes an image composition-controlling unit 202.
The control unit 200 controls an overall operation of the portable terminal. According to an embodiment of the present invention, the control unit 200 includes the image composition-controlling unit 202 to compose at least two images acquired in real-time and display the composed image on the display unit 230. For example, the image composition-controlling unit 202 acquires two or more images in real-time, determines a composition region of each of the acquired images, and composes the images on the basis of the respective composition images of the images to acquire a composed image. Thereafter, the image composition-controlling unit 202 displays the composed image on the display unit 230.
As illustrated in FIG. 3, the image composition-controlling unit 202 according to an embodiment includes an image-acquiring unit 300, a composition region-determining unit 310, and an image-compositing unit 320 to compose two or more images.
When an image composition event occurs in a standby mode state, the image-acquiring unit 300 operates the first camera 210 and the second camera 220 to acquire a user image from the first camera 210 and acquire a background image from the second camera 220. Moreover, when an image composition event occurs in a state of a video call with a counterpart terminal, the image-acquiring unit 300 operates at least one of the first camera 210 and the second camera 220 to acquire at least one image, and acquires an image that is received in real-time from the counterpart terminal performing the video call. The image-acquiring unit 300 may request that the user select a user image and a background image among the images acquired from the first camera 210, the second camera 220 and the counterpart terminal. For the sake of convenience, a description will be given of the case in which the image-acquiring unit 300 acquires a user image from the first camera 210 and uses an image, received in real-time, from the counterpart terminal, as a background image. However, the present invention may also be applicable to other cases. For example, according to the user's settings, both the images received in real-time from the first camera 210 and the counterpart terminal may be used as user images, and the image acquired from the second camera 220 may be used as a background image.
The composition region-determining unit 310 determines a composition region of the user image and the background image acquired by the image-acquiring unit 300. The composition region-determining unit 310 analyzes the user image and the background image, detects a candidate composition region of each image, and displays the candidate composition region of each image on a screen. The composition region-determining unit 310 detects the candidate composition region of each image by the known image recognition techniques such as a face detection technique and a Region-Of-Interest (ROI) analysis technique. The composition region-determining unit 310 determines the detected candidate composition region as the composition region of each image without a user input, or may determine the detected candidate composition region as the composition region of each image according to a user input. If there is a plurality of candidate composition regions in one image, the composition region-determining unit 310 determines a random candidate composition region as the composition region, or may determine the candidate composition region with the highest priority as the composition region by using a a predetermined method. Further, the composition region-determining unit 310 may display all the candidate composition regions on the screen, request the user to select one of the candidate composition regions, and determine the selected candidate composition region as the composition region.
Moreover, the composition region-determining unit 310 requests that the user select the composition region of each image, and detects a user input to determine the composition region. For example, if a user's touch has the shape of a closed curve, a region within the closed curve may be selected as the composition region; and if a user's touch indicates specific coordinates, a peripheral region around the specific coordinates may be selected as the composition region. Selecting of the composition region on the basis of the specific coordinates indicated by the touch of the user includes determining the peripheral region in the image, which is similar to the specific coordinates in color value, as the composition region. When the composition region of the background image and the composition region of the user image are determined, the composition region-determining unit 310 compares the shapes of the two composition regions to determine whether the two composition regions can be composed together. If the two composition regions cannot be composed because they have different shapes, the composition region-determining unit 310 adjusts the two composition regions so that they have the same shape. Moreover, the composition region of the background image of the counterpart terminal may be preset in the counterpart terminal according to a design mode. Thus, the portable terminal may receive information about the preset composition region together with the background image from the counterpart terminal.
The image-compositing unit 320 composes the user image and the background image on the basis of the composition regions determined by the composition region-determining unit 310. The image-compositing unit 320 composes the user image and the background image by covering the composition region of the background image with the composition region of the user image. Herein, the image-compositing unit 320 performs an alpha-blending operation to cover the composition region of the background image with the composition region of the user image.
When combining a background image with a user image, in order for the background image to be seen transparently through the user image, the alpha-blending operation allocates a new 8-bit alpha value to each pixel and blends the Red Green Blue (RGB) values of the background image and the RGB values of the user image. If the size of the composition region of the background image is not equal to the size of the composition region of the user image, the image-compositing unit 320 scales the composition region of the user image up or down to equalize the sizes of the two composition regions, and then performs an alpha-blending operation. Further, if the image composition is performed on video images, the image-compositing unit 320 composes the respective image frames constituting the video images. The image-compositing unit 320 thus tracks the composition region to compose two image frames. For example, if image composition is performed during the video call, the image-compositing unit 320 tracks the position of the composition region in each of the images received in real-time from the counterpart terminal and the camera of the portable terminal, and performs the image composition according to the changed position. Furthermore, after compositing the composition regions of the two images, the image-compositing unit 320 blurs the edges of the composition region so that they look natural. Blurring changes the pixel values around the edge pixels into the average value to soften the image.
The first camera 210 is at a front side of the portable terminal. Under the control of the control unit 200, the first camera 210 converts an analog video signal, input through a sensor (not illustrated), into a digital video signal and provides the same to the control unit 200. The first camera 210 may be used to perform a video call function or a self-photo function.
The second camera 220 is at a rear side of the portable terminal. Under the control of the control unit 200, the second camera 220 converts an analog video signal, input through a sensor (not illustrated), into a digital video signal and provides the same to the control unit 200. The second camera 220 photographs a direction other than the direction photographed by the first camera 220, and provides the photographing results to the control unit 200.
The display unit 230 displays numerals, characters, images, and status information generated during an operation of the portable terminal. According to an embodiment, the display unit 230 displays a user image and a background image on one screen, and displays a determined composition region or a candidate composition region of each user image and background image. Further, the display unit 230 displays a composed image received from the control unit 200.
The input unit 240 includes at least one function key and a touch sensor. The input unit 240 provides the control unit 200 with data corresponding to a key stroked by the user or coordinate data corresponding to a touchpoint. The input unit 240 detects a touch or a user's keystroke for setting the composition region and provides the corresponding data to the control unit 200.
The storage unit 250 stores various data and programs for the overall operation of the portable terminal. The storage unit 250 stores a photographed image. Under the control of the control unit 200, the storage unit 250 stores one composition frame or consecutive composition image frames. The consecutive composition image frames may be stored in the shape of a video image.
The communication module 260 communicates signals with a counterpart terminal through a wired or wireless channel under the control of the control unit 200. According to an embodiment of the present invention, the communication module 260 communicates signals for a video call and communicates images with the counterpart terminal during the video call. The communication module 260 may transmit an image composed in real-time to the counterpart terminal, under the control of the control unit 200.
A description has been given of the case where the portable terminal has two cameras. However, even when the portable terminal only has one camera, an image composition function may be performed using a prestored image or an image received from another portable terminal.
FIG. 4 is a flowchart illustrating a process of compositing images in a portable terminal according to an embodiment of the present invention.
Referring to FIG. 4, when an image composition event occurs in step 401, the portable terminal operates a first camera and a second camera of the portable terminal in step 405. In step 405, the portable terminal displays a user image, input from the first camera, and a background image, input from the second camera, on a screen.
In step 407, the portable terminal determines whether a composition region automatic setting function is activated. The composition region automatic setting function is activated or deactivated by a user.
If the composition region automatic setting function is deactivated, the portable terminal proceeds to step 409. In step 409, the portable terminal requests that the user select composition regions. In step 411, the portable terminal recognizes a user input and displays the selected compose region of the user image and the selected composition region of the background image on the display. The portable terminal thus recognizes the composition region selected by the user, from a keystroke or a key touch of the user.
However, if the composition region automatic setting function is activated, the portable terminal proceeds to step 419, in which the portable terminal recognizes the user image and the background image and detects a candidate composition region of each image. In step 421, the portable terminal displays the detected candidate composition region on the screen. The portable terminal detects the candidate composition region of each image by the known image recognition techniques such as a face detection technique and an ROI analysis technique. If there is a plurality of candidate composition regions in each image, the portable terminal displays only one candidate composition region using a predetermined method, or displays all the candidate composition regions and request that the user select one of the candidate composition regions.
In step 413, the portable terminal determines the composition region of the user image and the composition region of the background image. In step 415, the portable terminal composes the composition region of the user image and the composition region of the background image by an alpha-blending operation. The two images are composed by the alpha-blending operation, thereby maintaining the texture of the composition region of the background image as if the user image was originally included in the background image. Also, if the size of the composition region of the background image is not equal to the size of the composition region of the user image, the portable terminal scales the composition region of the user image up or down to equalize the sizes of the two composition regions, and then perform the alpha-blending operation.
In step 417, the portable terminal displays the composed image on the screen. The portable terminal then ends the process.
FIG. 5 is a flowchart illustrating a process of compositing images during a video call in a portable terminal according to another embodiment of the present invention.
Referring to FIG. 5, a video call is connected in step 501. In step 503, the portable terminal displays a first image acquired from its own camera and a second image received from a counterpart terminal of the video call.
In step 505, the portable terminal determines whether an image composition event occurs.
If an image composition event occurs, the portable terminal proceeds to step 507. In step 507, the portable terminal determines whether a composition region automatic setting function is activated. The composition region automatic setting function may be activated or deactivated by a user.
If the composition region automatic setting function is deactivated, the portable terminal proceeds to step 509, in which the portable terminal requests that the user select composition regions. In step 511, the portable terminal recognizes a user input and displays the selected compose region of the first image and the selected composition region of the second image on the display. The portable terminal then recognizes the composition region selected by the user, from a keystroke or a key touch of the user.
However, if the composition region automatic setting function is activated, the portable terminal proceeds to step 519, in which the portable terminal recognizes the first image and the second image and detects a candidate composition region of each image. In step 521, the portable terminal displays the detected candidate composition region on the screen. The portable terminal detects the candidate composition region of each image by the known image recognition techniques such as a face detection technique and an ROI analysis technique. If there is a plurality of candidate composition regions in each image, the portable terminal displays only one candidate composition region in a predetermined way, or displays all the candidate composition regions and request that the user select one of the candidate composition regions.
In step 513, the portable terminal determines the composition region of the first image and the composition region of the second image. In step 515, the portable terminal composes the composition region of the first image and the composition region of the second image by an alpha-blending operation. The portable terminal requests that the user select the first or second image to be the background image. If the first image is a user image and the second image is a background image, the two images are composed by covering the composition region of the first image with the composition region of the second image. The two images are composed by the alpha-blending operation, thereby maintaining the texture of the composition region of the background image as if the user image were originally included in the background image. Because data of the first image photographed by the portable terminal and data of the second image photographed by the counterpart terminal may change due to a movement of the terminal during the video call, the portable terminal tracks the position of the composition region of each image frame input in real-time and compose the images by using the tracked composition regions. Further, if the size of the composition region of the background image is not equal to the size of the composition region of the user image, the portable terminal scales the composition region of the user image up or down to equalize the sizes of the two composition regions, and then perform an alpha-blending operation.
In step 517, the portable terminal displays the composed image on the screen and transmits the composed image to the counterpart terminal. The portable terminal may not transmit the composed image to the counterpart terminal according to another embodiment of the present invention.
FIGS. 6A to 6C are diagrams illustrating a screen configuration for an image compositing method in a portable terminal according to an embodiment of the present invention. It is assumed that a portable terminal acquires two images and composes the two images to create a composed image. As illustrated in FIG. 6A, a portable terminal acquires a first image including a user image and a second image including images of buildings. As illustrated in FIG. 6B, the portable terminal selects a region including the user image in the first image as a compose region 601 and selects a billboard region of the building in the second image as a second composition region 603. As illustrated in FIG. 6C, the portable terminal synchronizes the billboard region of the second image and the region including the user image. Accordingly, the portable terminal provides a composed image as if the user was an advertising model for billboard. This operation may also be applicable to the case in which the two images are a still image and a video image. However, if at least one of the two images is a video image, it may be necessary to track a changed portion of the composition region of the video image.
FIGS. 7A to 7C are diagrams illustrating a screen configuration for an image compositing method in a portable terminal according to another embodiment of the present invention. It is assumed that a portable terminal acquires an image, another portable terminal acquires two images, and the portable terminal composes the three images to form a composed image. As illustrated in FIG. 7A, according to another embodiment of the present invention, the first terminal acquires a first image including a user image and the second terminal acquires a second image including a user image and a third image including a natural scene image. As illustrated in FIG. 7B, after sending acquired images to one another, the first terminal and the second terminal selects a region including a user image in the first image as a compose region, selects a region including a user image in the second image as a compose region, and selects a region in the third region as a composition region. The compose region of each image may be selected in the portable terminal and then transmitted to the counterpart terminal. Information about the composition region may also be transmitted to the counterpart terminal, together with the image.
As illustrated in FIG. 7C, the first terminal and the second terminal compose the composition region of the third image and the composition regions of the first and second images, thereby providing a composed image as if the user of the first terminal and the user of the second terminal were photographed together with the natural scene as the background. This operation may also be applicable to the case in which the three images are a still image and a video image. However, if at least one of the three images is a video image, it may be necessary to track a changed portion of the composition region of the video image.
Although a description has been given of the case where images are shared between portable terminals during a video call and the shared images are composed together, the image composition scheme may also be applicable to the case in which images are shared between terminals that do not support a video call function. For example, if an image is transmitted from a TeleVision (TV), a Personal Computer (PC) or a video player to a portable terminal through a wireless or wired channel, the portable terminal may compose the image and an image photographed by its camera according to the present invention.
As described above, the present invention composes images in real-time, photographed by the front camera and the rear camera of a portable terminal, thereby acquiring a variety of composed images based on desired backgrounds of the user. Further, the portable terminal receives an image photographed by another portable terminal and composes the received image and an image photographed by the portable terminal itself, thereby forming a composed image as if the user visited an area that was not actually visited by the user, and forming a composed image as if the user of the portable terminal was photographed together with the user of another portable terminal. Moreover, the images are composed by an alpha-blending technique, thereby creating a more realistic composed image.
While the present invention has been shown and described with reference to certain embodiments and drawings of the portable terminal, 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 as defined by the appended claims and their equivalents.

## Claims

1. A portable terminal comprising:
a first camera equipped at a first side of the portable terminal;
a second camera equipped at a second side opposite to the first side of the portable terminal;
a display equipped at the first side of the portable terminal; and
a control unit configured to:
acquire a first image through the first camera,
acquire a second image through the second camera to display the first image and the second image on the display,
detect and display a plurality of candidate composition regions in each of the first image and the second image by recognizing the first image and the second image,
select a first composition region in the first image and a second composition region in the second image, based on the displayed candidate composition regions,
compose a portion of the first image and a portion of the second image based on the first composition region selected in the first image and the second composition region selected in the second image, and
display the composed image on the display.

2. The portable terminal of claim 1, wherein the control unit is further configured to select the first composition region and the second composition region among the displayed candidate composition regions according to a user selection.

3. The portable terminal of claim 2, wherein the control unit is further configured to display the plurality of candidate composition regions in the first image, and to display at least one candidate composition region in the second image, or
wherein the control unit is further configured to display the plurality of candidate composition regions in the second image, and to display at least one candidate composition region in the first image.

4. The portable terminal of claim 1, wherein the control unit is further configured to request a user to select one of the displayed candidate composition regions.

5. The portable terminal of claim 1, further comprising a communication module configured to communicate signals with a counterpart terminal.

6. The portable terminal of claim 5, wherein the first image and the second image are acquired in real-time.

7. The portable terminal of claim 6, wherein the first image and the second image are video images.

8. The portable terminal of claim 1, wherein the control unit is further configured to select the first image or the second image as a background image or a foreground image.

9. The portable terminal of claim 1, wherein the first image and the second image are composed by an alpha-blending operation.

10. The portable terminal of claim 9, wherein the control unit is further configured to track a location of the first composition region and the second composition region on the display.

11. The portable terminal of claim 9, wherein a size of the first composition region and the second composition region is determined by the control unit.

12. A method in a portable terminal, the method comprising:
acquiring a first image through a first camera equipped at a first side of the portable terminal;
acquiring a second camera through a second camera equipped at a second side opposite to the first side of the portable terminal;
displaying the first image and the second image on a display;
detecting and displaying a plurality of candidate composition regions in each of the first image and the second image by recognizing the first image and the second image;
selecting a first composition region in the first image and a second composition region in the second image, based on the displayed candidate composition regions;
composing a portion of the first image and a portion of the second image based on the first composition region selected in the first image and the second composition region selected in the second image; and
displaying the composed image on the display.

13. The method of claim 12, wherein the first composition region and the second composition region are selected among the displayed candidate composition regions according to a user selection.

14. The method of claim 13, wherein displaying the plurality of candidate composition regions in at least one of the first image and the second image comprises:
displaying the plurality of candidate composition regions in the first image, and displaying at least one candidate composition region in the second image, or
displaying the plurality of candidate composition regions in the second image, and displaying at least one candidate composition region in the first image.

15. The method of claim 12, further comprising requesting a user to select one of the displayed candidate composition regions.

16. The method of claim 12, wherein the first image and the second image are acquired in real-time.

17. The method of claim 12, wherein the first image or the second image is selected as a background image or a foreground image.

18. The method of claim 12, wherein the first image and the second image are composed by an alpha-blending operation.

19. The method of claim 18, wherein a location of the first composition region and the second composition region is tracked by a control unit.

20. The method of claim 19, wherein a size of the first composition region and the second composition region is determined by the control unit.