Patent Description:
With continuous development of photographing technologies and widespread popularity of terminal devices, a photographing function of the terminal device is widely used, and increasingly more users may perform photographing by using a terminal device such as a mobile phone and a tablet computer. This greatly improves photographing convenience.

In a conventional technology, the terminal device may implement the photographing function by using a camera that is disposed in the terminal device and that has a short focus distance. For example, the terminal device may implement the photographing function by enabling the fixed-focus camera to work in a Remosaic mode or a binning mode (namely, a mode used to combine adjacent pixels with a same color into one pixel). Depth of field in the Remosaic mode is shallow, and although foreground definition of a photographed image is high, there is a problem that background definition is low. Depth of field in the binning mode is deep, and although background definition of a photographed image is high, there is a problem that foreground definition is low. <CIT> discloses an image processing method and electronic equipment, which are applied to the field of communication and are used for solving the problem that the quality of an image obtained by the electronic equipment through an image sensor is poorer. The method comprises the following steps: in a first working mode, acquiring first original data through an image sensor to obtain a first image; in a second working mode, collecting second original data through the image sensor to obtain a second image, wherein, the resolution of the first image is different from that of the second image; and fusing the first image and the second image to obtain a target image with a higher signal-to-noise ratio. The method is specifically applied to the image processing process based on the image sensor. <CIT> discloses a digital image acquisition system having no photographic film that comprises an apparatus for capturing digital images and a flash unit for providing illumination during image capture. The system has a portrait mode for generating an image of a foreground object against a blurred background, the portrait mode being operable to capture first, second and third images (A, B and C) of nominally the same scene. One of the first and second images (A, B) is taken with flash and the other is taken without flash, and the third image (C) is blurred compared to the first and second images. The portrait mode is further operable to determine foreground and background regions of the scene using the first and second images (A, B), and to substitute the blurred background of the third image (C) for the background of an in-focus image of the scene. In one example the in-focus image is one of the first and second images. <CIT> discloses an image processing method and a terminal apparatus. The method comprises: acquiring at least one first image and at least one second image alternatingly and consecutively outputted by a camera sensor, wherein the resolution of the first image is the same as the resolution corresponding to a current photographing mode, and the resolution of the first image is N times of the resolution of the second image, where N is an integer greater than <NUM>; the camera sensor adopting a first exposure parameter to output each first image, and adopting a second exposure parameter to output each second image, where the first exposure parameter is greater than the second exposure parameter; and performing image fusion based on the at least one first image and the at least one second image to obtain a fused image with an increased dynamic range.

Embodiments of this application provide a photographing method, a terminal device, a computer program product and a storage medium, to resolve a conventional-technology problem that an image photographed by a fixed-focus camera with a short focus distance has low background definition or low foreground definition.

According to a first aspect, an embodiment of this application provides a photographing method of claim <NUM>.

In the foregoing photographing method, during photographing, the fixed-focus camera of a terminal device is controlled to alternate between different working modes. For example, the fixed-focus camera may be controlled to alternate between a Remosaic mode and a binning mode, or the fixed-focus camera may be controlled to alternate between a binning mode used to combine four pixels with a same color into one pixel and a binning mode used to combine nine pixels with a same color into one pixel, to obtain the first image and the second image. In addition, the fixed-focus camera sends the first image and the second image to a processor of the terminal device. The first image and the second image include a same photographing scene, and the resolution of the first image is N times the resolution of the second image. Therefore, foreground definition of the first image is higher than foreground definition of the second image, and background definition of the second image is higher than background definition of the first image. The processor performs image fusion processing on the first image and the second image, to fuse the high-definition foreground of the first image into the second image whose background definition is high, so as to obtain the photographed image whose foreground definition and background definition are both high. This improves an image photographing effect, and improves user experience.

In a possible implementation, the obtaining a first image and a second image that are output by a fixed-focus camera includes:.

In the photographing method provided in this possible implementation, the terminal device controls, only in a photographing scene in which the predetermined target such as a person or an animal exists, the fixed-focus camera to alternate between different working modes, to obtain the first image and the second image that correspond to different modes, so as to perform image fusion processing. This can reduce photographing time in a photographing scene in which no predetermined target exists, and improve a photographing speed.

In a possible implementation, when the obtained first image and the obtained second image each are one frame, the performing image fusion processing on foreground of the first image and background of the second image to obtain a photographed image includes:
obtaining the predetermined target by segmenting the first image, and fusing, into a location of the predetermined target in the second image, the predetermined target obtained through segmentation, to obtain the photographed image.

In the photographing method provided in this possible implementation, the terminal device may obtain the predetermined target by segmenting the first image by using an image segmentation technology, and may fuse, into the location corresponding to the predetermined target in the second image, the predetermined target obtained through segmentation, to obtain the photographed image. Specifically, the terminal device may separately obtain a first predetermined target by segmenting the first image by using the image segmentation technology and obtain a second predetermined target by segmenting the second image by using the image segmentation technology. The first predetermined target and the second predetermined target are a same target in different images. In addition, the terminal device may obtain a location of the second predetermined target in the second image. Then, the terminal device may fuse, into the location in the second image, the first predetermined target obtained through segmentation, to obtain the photographed image.

In another possible implementation, when the obtained first image and the obtained second image each are at least two frames, the performing image fusion processing on foreground of the first image and background of the second image to obtain a photographed image includes:.

In the photographing method provided in this possible implementation, when the first image and the second image each include a plurality of frames, the terminal device may first perform image fusion processing on the plurality of frames of first images by using a high dynamic range (High Dynamic Range, HDR) algorithm to obtain the third image corresponding to the plurality of frames of first images, and perform image fusion processing on the plurality of frames of second images by using the HDR algorithm to obtain the fourth image corresponding to the plurality of frames of second images. Both the third image and the fourth image are HDR images. Then, the terminal device may perform segmentation and fusion processing on the third image and the fourth image to obtain the photographed image. Herein, image fusion processing is separately performed on the plurality of frames of first images and the plurality of frames of second images by using the HDR algorithm, so that the obtained third image and the obtained fourth image have more dynamic ranges and image details. Therefore, the photographed image obtained through fusion based on the third image and the fourth image has higher definition. This improves an image photographing effect, and improves user experience.

For example, when the first image and the second image each include a plurality of frames, the terminal device may first obtain one frame of first image with highest foreground definition in the plurality of frames of first images, and may obtain one frame of second image with highest background definition in the plurality of frames of second images. Then, the terminal device may perform segmentation and fusion processing on the frame of first image with the highest foreground definition and the frame of second image with the highest background definition to obtain the photographed image finally output by the terminal device. Herein, the terminal device performs segmentation and fusion by selecting the first image with the highest foreground definition and the second image with the highest background definition. This can ensure that both foreground definition and background definition of the photographed image obtained through fusion are high, and improve user experience.

In another possible implementation, when the obtained first image is one frame, and the obtained second image is at least two frames, the performing image fusion processing on foreground of the first image and background of the second image to obtain a photographed image includes:.

For example, the third image and the fourth image are high dynamic range HDR images.

It should be noted that, before the performing image fusion processing on foreground of the first image and background of the second image, the method includes:
enlarging a size of the second image to a size of the first image based on the resolution of the first image and the resolution of the second image.

It should be noted that, because the resolution of the first image is N times the resolution of the second image, the size of the first image is also N times the size of the first image. For example, when the first image is a full-size image, and the second image is an image corresponding to the binning mode used to combine four pixels with a same color into one pixel, the resolution of the first image is four times the resolution of the second image, and therefore the size of the second image is one quarter of the size of the first image. In other words, in this embodiment of this application, the size of the second image is different from the size of the first image. To perform image fusion processing on the first image and the second image, after obtaining the first image and the second image, the terminal device may first enlarge the size of the second image to the size of the first image based on the resolution of the first image and the resolution of the second image, then may obtain the predetermined target by segmenting the first image by using the image segmentation technology, and may fuse, into the enlarged second image, the predetermined target obtained through segmentation. The enlarging operation on the second image and the segmentation operation on the predetermined target may be performed simultaneously. For example, the terminal device may simultaneously perform the enlarging operation on the second image and the segmentation operation on the predetermined target in a multi-thread parallel manner, to improve an image processing speed, improve a photographing speed, and improve user experience.

An embodiment of this application provides a photographing method of claim <NUM>.

In the foregoing photographing method, a terminal device may obtain the first image and the second image by performing conversion processing on one frame of Remosaic original color-block image output by the fixed-focus camera. Then, the terminal device may perform segmentation and fusion on the first image and the second image to obtain the photographed image finally output by the terminal device. Both foreground definition and background definition of the obtained photographed image are high. In addition, because there is no foreground change problem between the first image and the second image, there may be no gap in a fusion part obtained after the first image and the second image are fused. In this way, interpolation processing can be prevented from being performed on the fusion part, or the terminal device can be prevented from performing secondary fusion processing on the first image and the second image. This greatly improves a photographing speed and a photographing effect of the terminal device, and improves user experience. In addition, in the photographing method, because the fixed-focus camera needs to obtain only one frame of Remosaic original color-block image, the fixed-focus camera does not need to be switched back and forth between different working modes. Therefore, time and power consumed by performing mode switching by the fixed-focus camera can be greatly reduced, and a speed of obtaining the first image and the second image by the terminal device can be improved. This further improves photographing efficiency of the terminal device, and improves user experience.

In a possible implementation, the obtaining a Remosaic original color-block image output by a fixed-focus camera includes:.

According to a second aspect, an embodiment of this application provides a terminal device of claim <NUM>, including a memory, a processor, and a computer program that is stored in the memory and that can be run on the processor. When the processor executes the computer program, the terminal device is enabled to implement the photographing method in any one of the implementations of the first aspect.

According to a third aspect, an embodiment of this application provides a computer-readable storage medium of claim <NUM>. The computer-readable storage medium stores a computer program. When the computer program is executed by a computer, the computer is enabled to implement the photographing method in any one of the implementations of the first aspect or the second aspect.

According to a forth aspect, an embodiment of this application provides a computer program product of claim <NUM>. When the computer program product runs on a terminal device, the terminal device is enabled to perform the photographing method in any one of the implementations of the first aspect or the second aspect.

It should be understood that, during use in the specification of this application, the term "include" indicates existence of a described feature, entirety, step, operation, element, and/or component, but does not rule out existence or addition of one or more other features, entireties, steps, operations, elements, components, and/or sets thereof.

It should be further understood that the term "and/or" used in the specification of this application indicates any and all possible combinations of one or more associated listed items, and includes these combinations.

As used in the specification of this application, the term "if" may be interpreted as "when", "once", "in response to determining", or "in response to detecting" based on the context. Similarly, based on the context, the phrase "if it is determined that" or "if (a described condition or event) is detected" may be interpreted as "once it is determined that", "in response to determining", "once (a described condition or event) is detected", or "in response to detecting (a described condition or event)".

In addition, in the descriptions of the specification of this application, the terms "first", "second", "third", and the like are merely used to distinguish between descriptions, and cannot be understood as an indication or implication of relative importance.

Based on "an embodiment", "some embodiments", or the like" described in the specification of this application means that one or more embodiments of this application include a specific feature, structure, or characteristic described based on the embodiment. Therefore, statements such as "in an embodiment", "in some embodiments", "in some other embodiments", and "in other embodiments" that appear at different places in this specification do not necessarily mean referring to a same embodiment. Instead, the statements mean "one or more but not all of embodiments", unless otherwise specifically emphasized in another manner. The terms "include", "comprise", "have", and their variants all mean "include but are not limited to", unless otherwise specifically emphasized in another manner.

A photographing method provided in embodiments of this application may be applied to a terminal device such as a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (augmented reality, AR) device/a virtual reality (virtual reality, VR) device, a notebook computer, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook, or a personal digital assistant (personal digital assistant, PDA). A specific type of the terminal device is not limited in the embodiments of this application.

In a conventional technology, the terminal device may implement a photographing function by using a camera disposed in the terminal device. The camera may be a front-facing camera of the terminal device, or may be a rear-facing camera of the terminal device. <FIG> is a schematic diagram in which a camera is a front-facing camera of a terminal device. The following is also described by using an example in which the camera is the front-facing camera of the terminal device.

The front-facing camera of the terminal device is generally applicable to a short-distance photographing scene such as a selfie scene. Therefore, a fixed-focus camera with a short focus distance is generally used as the front-facing camera of the terminal device. For example, a fixed-focus camera with a focus distance of <NUM> to <NUM> (which is generally a selfie distance of a user) may be used. The fixed-focus camera is a camera with only one fixed focal length. The focus distance is a distance from a focus point to the camera. The focus point is a location of a photographed object when the photographed object is most clearly photographed.

Based on the principles of optics and a capability of the human eye to identify clarity, the fixed-focus camera generally has a clear range that is generally referred to as depth of field. An object located inside the depth of field may be clearly presented in an image obtained by the camera, and an object located outside the depth of field is blurry presented in the image obtained by the camera. As shown in <FIG>, the depth of field may generally include back depth of field located behind the focus point and front depth of field located in front of the focus point. Herein, the front and the back of the focus point are determined by using a direction in which the focus point faces the camera.

When light is good, and sufficient exposure may be implemented by using a single pixel, the terminal device may obtain a high-pixel image by enabling the fixed-focus camera to work in a Remosaic (Remosaic) mode shown in <FIG>, so as to ensure resolution of the image. When light is dim, the terminal device may enable the fixed-focus camera to work in a binning mode, to expand a photosensitive area of a pixel and increase an amount of admitted light of the pixel by combining a plurality of pixels with a same color into one pixel, so as to obtain a high-brightness and low-noise image. Herein, the plurality of pixels combined in the binning mode may be n2 pixels, where n is an integer greater than or equal to <NUM>.

For example, as shown in <FIG>, when n is <NUM>, the binning mode is a mode used to combine four pixels with a same color into one pixel. When n is <NUM>, the binning mode is a mode used to combine nine pixels with a same color into one pixel. When n is <NUM>, the binning mode is a mode used to combine sixteen pixels with a same color into one pixel.

In the conventional technology, the front depth of field of the fixed-focus camera is ΔL1=F*δ*L<NUM>/(f<NUM>+F*δ*L), the back depth of field thereof is ΔL2=F*δ*L<NUM>/(f<NUM>-F*δ*L), and the depth of field thereof is ΔL=ΔL1+ΔL2=(2f<NUM>*F*δ*L<NUM>)/(f<NUM>-F<NUM>*δ<NUM>*L<NUM>). F is an aperture of the fixed-focus camera, δ is a diameter of a permissible circle of confusion, f is a focal length, and L is a photographing distance (focus distance + focal length).

It may be learned from the foregoing depth-of-field formula that, when the focal length, the focus distance, and the aperture remain unchanged, the depth of field of the fixed-focus camera depends on the diameter of the permissible circle of confusion, and the diameter of the permissible circle of confusion depends on a size of a single pixel in a current working mode of the fixed-focus camera. Specifically, the diameter of the permissible circle of confusion is approximately sizes of four single pixels in each working mode. Herein, because the size of the single pixel in the binning mode is four times the size of the single pixel in the Remosaic mode, the depth of field in the binning mode (including the front depth of field and the back depth of field) is greater than the depth of field in the Remosaic mode.

For example, when the focal length f of the fixed-focus camera is <NUM>, the photographing distance L thereof is <NUM>, the aperture F thereof is <NUM>, and a size of an original pixel (the size of the original pixel is the size of the single pixel in the Remosaic mode, namely, one quarter of the size of the single pixel in the binning mode) is <NUM>, it may be learned through calculation based on the foregoing depth-of-field formula that the front depth of field in the Remosaic mode is <NUM> and the back depth of field in the Remosaic mode is <NUM>, and the front depth of field in the binning mode is <NUM>, and the back depth of field in the binning mode is <NUM>.

In conclusion, it may be learned that the depth of field in the Remosaic mode is shallow, and although an image obtained when the fixed-focus camera works in the Remosaic mode has high foreground definition, there is a problem that background (also referred to as a background) definition is low; and the depth of field in the binning mode is deep, and although an image obtained when the fixed-focus camera works in the binning mode has high background definition, there is a problem that foreground definition is low.

To resolve the foregoing problem, the embodiments of this application provide a photographing method and apparatus, a terminal device, and a computer-readable storage medium. During photographing, a first image corresponding to a Remosaic mode and a second image corresponding to a binning mode may be obtained, and foreground of the first image and background of the second image are fused to obtain a photographed image whose foreground definition and background definition are both high.

The photographing method provided in this embodiment may be applied to a terminal device, and the terminal device includes a fixed-focus camera, a processor, and a display. In a same photographing scene, the fixed-focus camera alternates between a Remosaic mode and a binning mode to obtain a first image corresponding to the Remosaic mode and a second image corresponding to the binning mode, and sends the first image and the second image to the processor. The first image and the second image include a current same photographing scene. The processor fuses the first image and the second image to obtain a final photographed image, and may display the final photographed image on the display.

It should be noted that, in this embodiment, that the fixed-focus camera alternates between the Remosaic mode and the binning mode to obtain the first image corresponding to the Remosaic mode and the second image corresponding to the binning mode. In this embodiment, the fixed-focus camera alternatively alternates between different binning modes. For example, the fixed-focus camera may alternate between a binning mode (namely, a four-in-one mode) used to combine four pixels with a same color into one pixel and a binning mode (namely, a nine-in-one mode) used to combine nine pixels with a same color into one pixel, to obtain a first image corresponding to the four-in-one mode and a second image corresponding to the nine-in-one mode, and fuses foreground of the first image corresponding to the four-in-one mode and background of the second image corresponding to the nine-in-one mode to obtain a photographed image whose foreground definition and background definition are both high.

The following is described by using an example in which the first image is an image corresponding to the Remosaic mode and the second image is an image corresponding to the binning mode used to combine four pixels with a same color into one pixel.

For example, a sequence that the fixed-focus camera alternates between the Remosaic mode and the binning mode may be the following alternating sequence: First, the fixed-focus camera works in the Remosaic mode to obtain one frame of first image; next, the fixed-focus camera is switched to the binning mode to obtain one frame of second image; subsequently, the fixed-focus camera is switched to the Remosaic mode to obtain one frame of first image; then, the fixed-focus camera is switched to the binning mode to obtain one frame of second image, and so on. For example, a sequence that the fixed-focus camera alternates between the Remosaic mode and the binning mode may be the following alternating sequence: First, the fixed-focus camera works in the binning mode to obtain one frame of second image; next, the fixed-focus camera is switched to the Remosaic mode to obtain one frame of first image; subsequently, the fixed-focus camera is switched to the binning mode to obtain one frame of second image; then, the fixed-focus camera is switched to the Remosaic mode to obtain one frame of first image, and so on. The alternating sequence is not limited in this embodiment.

Optionally, during photographing, the terminal device may determine, based on a specific photographing scene, whether to perform photographing by using the photographing method provided in this embodiment.

Specifically, after a photographing function of the terminal device is enabled, the terminal device may first obtain a preview image, and then may detect, by using a target detection algorithm, whether a predetermined target exists in the preview image. When a predetermined target exists in the preview image, the terminal device may control the fixed-focus camera to alternately work between the Remosaic mode and the binning mode, to obtain the first image and the second image that correspond to a current photographing scene, and send the first image and the second image to another component (such as the processor) of the terminal device. The processor of the terminal device may fuse the first image and the second image to obtain the photographed image corresponding to the current photographing scene. When no predetermined target exists in the preview image, the terminal device may control the fixed-focus camera to work only in the Remosaic mode or only in the binning mode to obtain the photographed image corresponding to a current photographing scene.

For example, when no predetermined target exists in the preview image, and brightness of light in a current photographing scene is greater than or equal to a preset brightness threshold, the terminal device may control the fixed-focus camera to work in the Remosaic mode to obtain a high-pixel image corresponding to the current photographing scene. When no predetermined target exists in the preview image, and brightness of light in a current photographing scene is less than a preset brightness threshold, the terminal device may control the fixed-focus camera to work in the binning mode to obtain a high-brightness image corresponding to the current photographing scene. The preset brightness threshold may be set by a user, or may be determined by the terminal device by default.

For example, the predetermined target may be a person. In this case, the terminal device may detect, by using a face detection algorithm, whether a predetermined target exists in the preview image. For example, the predetermined target may be a specific object (such as an animal). In this case, the terminal device may detect, by using a target detection technology and an object identification technology, whether a predetermined target exists in the preview image.

It should be understood that, the preview image may be an image output by the fixed-focus camera in real time, or may be an image currently displayed on the display.

In a possible implementation, the terminal device may also set, in advance for selection by the user, a photographing mode (for example, a clear photographing mode) corresponding to the photographing method provided in this embodiment. In a photographing process, if the user selects the clear photographing mode, the terminal device may perform a photographing operation by using the photographing method provided in this embodiment.

Specifically, after the photographing function of the terminal device is enabled, the user may enable the clear photographing mode by entering a photographing instruction corresponding to the clear photographing mode. The photographing instruction may be an instruction generated by triggering a preset key, an instruction generated by triggering a preset gesture, or an instruction generated by triggering a preset voice keyword. This is not limited in this embodiment.

For example, as shown in <FIG>, after the photographing function of the terminal device is enabled, the user may select the photographing mode in a display interface of the terminal device, and the terminal device may enable the clear photographing mode based on selection of the user. Alternatively, as shown in <FIG>, after the photographing function of the terminal device is enabled, a virtual button for clear photographing may be presented in a display interface of the terminal device. If the user triggers the virtual button, the clear photographing mode is enabled.

For example, after the photographing function of the terminal device is enabled, the user may enable the clear photographing mode by entering the photographing instruction in a display interface of the terminal device, for example, an "O" gesture or a voice input "clear photographing".

It should be noted that, because the second image is an image obtained after pixel combination, brightness of the second image is higher than brightness of the first image. To avoid an over-exposure problem of the second image output by the fixed-focus camera, the terminal device may control the fixed-focus camera to output the first image and the second image by using different exposure parameters. For example, the terminal device may control the fixed-focus camera to output the first image by using a first exposure parameter, and may control the fixed-focus camera to output the second image by using a second exposure parameter. The first exposure parameter is greater than the second exposure parameter. Specific values of the first exposure parameter and the second exposure parameter may be determined based on a current actual photosensitive value of the fixed-focus camera.

Optionally, when fusing the first image and the second image, the terminal device may obtain the predetermined target by segmenting the first image by using an image segmentation technology, and may fuse, into a location corresponding to the predetermined target in the second image, the predetermined target obtained through segmentation, to obtain the photographed image.

Specifically, the terminal device may separately obtain a first predetermined target by segmenting the first image by using the image segmentation technology and obtain a second predetermined target by segmenting the second image by using the image segmentation technology. The first predetermined target and the second predetermined target are a same target in different images. In addition, the terminal device may obtain a location of the second predetermined target in the second image. Then, the terminal device may fuse, into the location in the second image, the first predetermined target obtained through segmentation, to obtain the photographed image.

It should be understood that there may be one or more predetermined targets in the photographing scene. When there is one predetermined target, the terminal device may directly separately obtain the predetermined target by segmenting the first image and the second image by using the image segmentation technology, and may fuse, into a location of the predetermined target in the second image, the predetermined target obtained by segmenting the first image. When there are a plurality of predetermined targets, the terminal device may use the plurality of predetermined targets as a whole, and then may separately obtain the whole by segmenting the first image and the second image by using the image segmentation technology, and may fuse, into a location of the whole in the second image, the whole obtained by segmenting the first image. Herein, when there are a plurality of predetermined targets, the terminal device may separately obtain the plurality of predetermined targets by segmenting the first image, separately obtain the plurality of predetermined targets by segmenting the second image, and obtain locations of the plurality of predetermined targets in the second image, and finally, may separately fuse, into the locations of the predetermined targets in the second image, the plurality of predetermined targets obtained by segmenting the first image.

For example, when three predetermined targets A, B, and C exist in the current photographing scene, the terminal device may separately obtain the predetermined target A, the predetermined target B, and the predetermined target C by segmenting the first image by using the image segmentation technology, and may separately obtain the predetermined target A, the predetermined target B, and the predetermined target C by segmenting the second image by using the image segmentation technology, and may obtain a location A of the predetermined target A in the second image, a location B of the predetermined target B in the second image, and a location C of the predetermined target C in the second image. Then, the terminal device may fuse, into the location A of the predetermined target A in the second image, the predetermined target A obtained by segmenting the first image, may fuse, into the location B of the predetermined target B in the second image, the predetermined target B obtained by segmenting the first image, and may fuse, into the location C of the predetermined target C in the second image, the predetermined target C obtained by segmenting the first image, to obtain the photographed image.

It may be understood that the terminal device may obtain a location of the predetermined target in the first image, determine a fusion location of the predetermined target in the second image based on a correspondence between the first image and the second image, and then may fuse, into the second image based on the fusion location, the predetermined target obtained by segmenting the first image.

It should be noted that, because the second image is a binning image relative to the first image, that is, resolution of the first image is N times resolution of the second image, a size of the second image is different from a size of the first image. For example, the size of the second image may be one quarter, one ninth, or the like of the size of the first image. Therefore, to fuse the first image and the second image, after obtaining the first image and the second image, the terminal device may first perform enlarging processing on the second image based on the size of the first image to enlarge the second image to the size of the first image, and then may obtain the predetermined target by segmenting the first image by using the image segmentation technology, and may fuse, into the enlarged second image, the predetermined target obtained through segmentation.

Herein, the enlarging operation on the second image and the segmentation operation on the predetermined target may be performed simultaneously. For example, the terminal device may simultaneously perform the enlarging operation on the second image and the segmentation operation on the predetermined target in a multi-thread parallel manner, to improve an image processing speed, improve a photographing speed, and improve user experience.

It should be understood that the foregoing step of obtaining a first image corresponding to the Remosaic mode and a second image corresponding to the binning mode may be obtaining one frame of first image corresponding to the Remosaic mode and one frame of second image corresponding to the binning mode, or may be obtaining a plurality of frames of first images corresponding to the Remosaic mode and a plurality of frames of second images corresponding to the binning mode, or may be obtaining one frame of first image corresponding to the Remosaic mode and a plurality of frames of second images corresponding to the binning mode, or may be obtaining a plurality of frames of first images corresponding to the Remosaic mode and one frame of second image corresponding to the binning mode.

When the terminal device obtains one frame of first image corresponding to the Remosaic mode and one frame of second image corresponding to the binning mode, the terminal device may directly perform segmentation and fusion on the first image and the second image, that is, may directly obtain the predetermined target by segmenting the first image, and directly fuse, into the second image, the predetermined target obtained through segmentation, to obtain the photographed image.

When the terminal device obtains a plurality of frames of first images corresponding to the Remosaic mode and a plurality of frames of second images corresponding to the binning mode, the terminal device may first separately perform image fusion processing on the plurality of frames of first images and the plurality of frames of second images by using a high dynamic range (High Dynamic Range, HDR) algorithm, to obtain a third image corresponding to the plurality of frames of first images and a fourth image corresponding to the plurality of frames of second images. Both the third image and the fourth image are HDR images. Then, the terminal device may perform segmentation and fusion on the third image and the fourth image, that is, obtain the predetermined target by segmenting the third image, and fuse, into the fourth image, the predetermined target obtained through segmentation, to obtain the photographed image. Herein, image fusion processing is separately performed on the plurality of frames of first images and the plurality of frames of second images by using the HDR algorithm, so that the obtained third image and the obtained fourth image have more dynamic ranges and image details. Therefore, the photographed image obtained through fusion based on the third image and the fourth image has higher definition. This improves an image photographing effect, and improves user experience. It should be understood that, when the terminal device obtains a plurality of frames of first images corresponding to the Remosaic mode and a plurality of frames of second images corresponding to the binning mode, the terminal device may first obtain one frame of first image with highest foreground definition in the plurality of frames of first images, and may obtain one frame of second image with highest background definition in the plurality of frames of second images. Then, the terminal device may perform segmentation and fusion on the frame of first image with the highest foreground definition and the frame of second image with the highest background definition to obtain the photographed image finally output by the terminal device. Herein, the terminal device performs segmentation and fusion by selecting the first image with the highest foreground definition and the second image with the highest background definition. This can ensure that both foreground definition and background definition of the photographed image obtained through fusion are high, and improve user experience.

Similarly, when the terminal device obtains one frame of first image corresponding to the Remosaic mode and a plurality of frames of second images corresponding to the binning mode, the terminal device may perform image fusion processing on the plurality of frames of second images to obtain a fourth image, obtain the predetermined target by segmenting the first image, and fuse, into a location of the predetermined target in the fourth image, the predetermined target obtained through segmentation, to obtain the photographed image. Alternatively, the terminal device may obtain one frame of second image with highest background definition in the plurality of frames of second images, obtain the predetermined target by segmenting the first image, and fuse, into a location of the predetermined target in the frame of second image with the highest background definition, the predetermined target obtained through segmentation, to obtain the photographed image.

When the terminal device obtains a plurality of frames of first images corresponding to the Remosaic mode and one frame of second image corresponding to the binning mode, the terminal device may perform image fusion processing on the plurality of frames of first images to obtain a third image, obtain the predetermined target by segmenting the third image, and fuse, into a location of the predetermined target in the second image, the predetermined target obtained through segmentation, to obtain the photographed image. Alternatively, the terminal device may obtain one frame of first image with highest foreground definition in the plurality of frames of first images, obtain the predetermined target by segmenting the frame of the first image with the highest foreground definition, and fuse, into a location of the predetermined target in the second image, the predetermined target obtained through segmentation, to obtain the photographed image.

Herein, the terminal device may separately perform image fusion on the plurality of frames of first images and the plurality of frames of second images by using the HDR algorithm in a conventional technology. This is not limited in this embodiment.

It should be noted that, after completing fusion on the first image and the second image to obtain a fusion image, the terminal device may detect a fusion part in the fusion image. If there is no gap in the fusion part, the terminal device may directly determine the fusion image as the photographed image finally output by the terminal device. If there is a gap in the fusion part, and the gap is less than a specified gap threshold, the terminal device may fill the gap through interpolation, and may determine the fusion image existing after filling as the photographed image finally output by the terminal device. If there is a gap in the fusion part, and the gap is greater than or equal to a specified gap threshold, the terminal device may perform fusion processing on the first image and the second image again, or may obtain again the first image and the second image that correspond to the current photographing scene, and perform fusion processing on the first image and the second image that are obtained again. The specified gap threshold may be specifically determined based on an actual case. Herein, the terminal device may fill the gap through interpolation in the conventional technology. This is not limited in this embodiment.

<FIG> shows the first image that is obtained by the terminal device and that corresponds to the Remosaic mode. <FIG> shows the second image that is obtained by the terminal device and that corresponds to the binning mode. <FIG> shows the final photographed image obtained by performing segmentation and fusion on <FIG> in this embodiment. It may be learned through comparison between <FIG> and both <FIG> that both the foreground definition and the background definition of the photographed image obtained in this embodiment are high, so that the user can view an image with clear foreground and clear background. This improves a photographing effect of the terminal device, and improves user experience.

In the photographing method provided in this embodiment, the terminal device may obtain the first image and the second image that are output by the fixed-focus camera, and may perform segmentation and fusion on the first image and the second image, that is, may fuse the high-definition foreground of the first image into the second image whose background definition is high, to obtain the photographed image whose foreground definition and background definition are both high. This improves a photographing effect of the terminal device, and improves user experience.

In the photographing method provided in the foregoing Embodiment <NUM>, the first image and the second image are separately obtained by using the fixed-focus camera, and image fusion processing is performed on the first image and the second image, to obtain the photographed image finally output by the terminal device. In other words, the first image and the second image in the foregoing Embodiment <NUM> are two frames of images separately obtained by the fixed-focus camera. In other words, there is a time difference between the first image and the second image that are obtained by the fixed-focus camera. Therefore, foreground (for example, a location or a posture of the predetermined target) of the first image and the second image may change to an extent. Consequently, a gap may occur in the photographed images obtained by the terminal device through fusion. When the gap that occurs is small, although the gap may be filled through interpolation, the manner of filling the gap through interpolation reduces an image effect to an extent. When the gap that occurs is large, the terminal device needs to perform fusion processing on the first image and the second image again, or the terminal device needs to obtain the first image and the second image again, and perform fusion processing again on the first image and the second image that are obtained again. As a result, a photographing speed of the terminal device is reduced and/or a photographing effect of the terminal device is reduced, and user experience is greatly reduced.

To alleviate the foregoing problem, in the photographing method provided in this embodiment, first, one frame of Remosaic original color-block image may be obtained by using a fixed-focus camera; next, a first image corresponding to a Remosaic mode and a second image corresponding to a binning mode may be obtained by performing conversion processing on the Remosaic original color-block image; and finally, a photographed image finally output by the terminal device may be obtained by performing segmentation and fusion on the first image and the second image.

In other words, the first image and the second image that are obtained in this embodiment are from a same frame of Remosaic original color-block image. Therefore, there is no foreground change problem between the first image and the second image that are obtained in this embodiment, that is, foreground and background of the first image obtained in this embodiment are respectively consistent with foreground and background of the second image. Therefore, a problem that a gap occurs in the fusion part after the first image and the second image are fused because the foreground is changed in the foregoing Embodiment <NUM> can be resolved. In this way, interpolation processing can be prevented from being performed on the fusion part, or the terminal device can be prevented from performing secondary fusion processing on the first image and the second image, or the terminal device can be prevented from performing secondary obtaining and secondary fusion processing on the first image and the second image. This greatly improves a photographing speed and a photographing effect of the terminal device, and improves user experience.

It should be understood that a difference between this embodiment and the foregoing Embodiment <NUM> lies in that the first image and the second image in this embodiment are obtained by converting one frame of Remosaic original color-block image obtained by the fixed-focus camera. In other words, only a manner of obtaining the first image and the second image in this embodiment is different from a manner of obtaining the first image and the second image in the foregoing Embodiment <NUM>, and other content is the same as that in the foregoing Embodiment <NUM>. The following mainly describes a difference part between this embodiment and the foregoing Embodiment <NUM>. For a same part, refer to the descriptions in the foregoing Embodiment <NUM> directly.

For example, the fixed-focus camera in this embodiment may be a four-in-one camera. During photographing, a photosensitive component in the fixed-focus camera may be controlled to perform exposure successively, so that the fixed-focus camera can obtain an original Remosaic color-block image shown in <FIG>.

In a possible implementation, after obtaining the original Remosaic color-block image, the fixed-focus camera may send the original Remosaic color-block image to another component (such as the processor) of the terminal device. The processor of the terminal device may output four pixels with a same color in the original Remosaic color-block image as a combined pixel. For example, an original Remosaic color-block image shown in <FIG> may be output as a combined pixel shown in <FIG>, to obtain the second image corresponding to the binning mode. In addition, the processor may convert, for output by using a Remosaic software algorithm, the original Remosaic color-block image into pixels arranged in a Bayer array. For example, an original Remosaic color-block image shown in <FIG> may be converted, for output, into a Remosaic structure that is arranged in a Bayer array and that is shown in <FIG>, to obtain the first image corresponding to the Remosaic mode. For example, the Remosaic software algorithm may be used to determine, by using an associated pixel, a pixel value corresponding to each pixel obtained after conversion.

For example, when determining pixel values corresponding to pixels R3'<NUM>' and R5'<NUM>' that are obtained after conversion in <FIG>, the terminal device may first determine an associated pixel R33 in <FIG> that corresponds to the pixel R3'<NUM>' obtained after conversion, and determine an associated pixel R55 in <FIG> that corresponds to the pixel R5'<NUM>' obtained after conversion. Then, the pixel value corresponding to R3'<NUM>' may be determined based on the associated pixel R33, and the pixel value corresponding to R5'<NUM>' may be determined based on the associated pixel R55.

Specifically, when determining the pixel value corresponding to R5'<NUM>', because R5'<NUM>' has a same color as the associated pixel R55, the terminal device may directly determine a pixel value corresponding to the R55 as the pixel value corresponding to R5'<NUM>'. When determining the pixel value corresponding to R3'<NUM>', because R3'<NUM>' has a different color from the associated pixel R33, the terminal device cannot directly determine a pixel value corresponding to the R33 as the pixel value corresponding to R3'<NUM>'. In this case, the terminal device may obtain one or more pixels in <FIG> that are adjacent to the associated pixel R33 and that have a same color as R3'<NUM>', and may determine, based on pixel values corresponding to the one or more pixels, the pixel value corresponding to R3'<NUM>'. It should be noted that the adjacency herein should be understood in a general sense, for example, the one or more pixels may be understood as one or more pixels in <FIG> that are closest to the associated pixel R33 and that are in all pixels having a same color as R3'<NUM>'.

It should be noted that a quantity of pixels that are obtained by the terminal device and that are adjacent to the associated pixel R33 may be specifically determined based on an actual case, for example, may be four or another quantity. For example, when there are four pixels that are obtained by the terminal device and that are adjacent to the associated pixel, in <FIG>, the four pixels that are adjacent to the associated pixel R33 and that have a same color as R3'<NUM>' may be R22, R25, R52, and R55.

For example, when there are a plurality of pixels that are obtained by the terminal device and that are adjacent to the associated pixel R33, the terminal device may determine a largest pixel value corresponding to the plurality of pixels as the pixel value corresponding to R3'<NUM>'. For example, if a pixel value corresponding to R55 in R22, R25, R52, and R55 is the largest, the pixel value corresponding to R55 may be determined as the pixel value corresponding to the R3'<NUM>'.

For example, when there are a plurality of pixels that are obtained by the terminal device and that are adjacent to the associated pixel R33, the terminal device may determine a smallest pixel value corresponding to the plurality of pixels as the pixel value corresponding to R3'<NUM>'. For example, if a pixel value corresponding to R25 in R22, R25, R52, and R55 is the smallest, the pixel value corresponding to R25 may be determined as the pixel value corresponding to the R3'<NUM>'.

For example, when there are a plurality of pixels that are obtained by the terminal device and that are adjacent to the associated pixel R33, the terminal device may determine an average pixel value corresponding to the plurality of pixels as the pixel value corresponding to R3'<NUM>'. For example, an average pixel value (R22+R25+R52+R55)/<NUM> corresponding to R22, R25, R52, and R55 may be determined as the pixel value corresponding to R3'<NUM>'.

For example, when there are a plurality of pixels that are obtained by the terminal device and that are adjacent to the associated pixel R33, first, the terminal device may determine, based on a near-far relationship between a pixel and an associated pixel, a weight corresponding to each pixel; next, the terminal device may perform, based on the weight, weighted summation on pixel values corresponding to the plurality of pixels; and the terminal device may determine, as the pixel value corresponding to R3'<NUM>', a pixel value obtained through weighted summation. For example, when the terminal device determines, based on the near-far relationship between a pixel and an associated pixel, that a weight corresponding to R22 is Q1, a weight corresponding to R25 is Q2, a weight corresponding to R52 is Q3, and a weight corresponding to R55 is Q4, the terminal device may determine, as the pixel value corresponding to R3'<NUM>', a pixel value (R22*Q1+R25*Q2+R52*Q3+R55*Q4) obtained through weighted summation.

It should be understood that the foregoing determining, as the pixel value corresponding to R3'<NUM>', the largest pixel value, the smallest pixel value, the average pixel value, and the pixel value obtained through weighted summation is merely an example for description, and should not be understood as a limitation on this embodiment. Certainly, in this embodiment, the pixel value corresponding to R3'<NUM>' may be determined in another determining manner in the existing Remosaic software algorithm.

In another possible implementation, the processor of the terminal device may perform pixel structure conversion on the original Remosaic color-block image by using a hardware module (namely, a hardware module that may implement a Remosaic algorithm), to convert the original Remosaic color-block image into a pixel structure arranged in a Bayer array and output the pixel structure, so as to obtain the first image corresponding to the Remosaic mode. An execution speed of the hardware module is faster than an execution speed of software in the terminal device. Therefore, the terminal device converts, by using the hardware module, the original Remosaic color-block image into the pixel structure arranged in the Bayer array and output the pixel structure, so that a speed of obtaining the first image can be greatly improved, and photographing efficiency of the terminal device can be further improved.

In a possible implementation, the fixed-focus camera is integrated with a hardware module that may implement a Remosaic algorithm. Therefore, after obtaining the original Remosaic color-block image, the fixed-focus camera may output, as a combined pixel through pixel combination, a plurality of pixels with a same color in the original Remosaic color-block image, to obtain the second image corresponding to the binning mode. In addition, pixel structure conversion may be performed on the original Remosaic color-block image by using the hardware module of the fixed-focus camera, to convert the original Remosaic color-block image into a pixel structure arranged in a Bayer array and output the pixel structure, so as to obtain the first image corresponding to the Remosaic mode. Then, the fixed-focus camera may output the first image corresponding to the Remosaic mode and the second image corresponding to the binning mode to the processor of the terminal device. The processor may perform segmentation and fusion on the first image and the second image to obtain the final photographed image.

It should be understood that a process of performing segmentation and fusion on the first image and the second image herein is similar to the process of performing segmentation and fusion on the first image and the second image in Embodiment <NUM>, and a basic principle thereof is the same. For specific content, refer to the descriptions in Embodiment <NUM>.

In the photographing method provided in this embodiment, conversion processing may be performed on only one frame of Remosaic original color-block image to obtain the first image corresponding to the Remosaic mode and the second image corresponding to the binning mode. Then, segmentation and fusion may be performed on the first image and the second image to obtain the photographed image finally output by the terminal device. Both foreground definition and background definition of the obtained photographed image are high. In addition, because there is no foreground change problem between the first image and the second image, there may be no gap in the fusion part obtained after the first image and the second image are fused. In this way, interpolation processing can be prevented from being performed on the fusion part, or the terminal device can be prevented from performing secondary fusion processing on the first image and the second image. This greatly improves a photographing speed and a photographing effect of the terminal device, and improves user experience. In addition, in this embodiment, because the fixed-focus camera needs to obtain only one frame of Remosaic original color-block image, the fixed-focus camera does not need to be switched back and forth between the Remosaic mode and the binning mode. Therefore, time and power consumed by performing mode switching by the fixed-focus camera can be greatly reduced, and a speed of obtaining the first image and the second image by the terminal device can be improved. This further improves photographing efficiency of the terminal device, and improves user experience.

Based on the foregoing descriptions in Embodiment <NUM> and Embodiment <NUM>, the following briefly describes photographing processes in Embodiment <NUM> and Embodiment <NUM>.

<FIG> is a schematic flowchart of a photographing method according to Embodiment <NUM>. In this embodiment, a terminal device obtains a first image and a second image that are output by a fixed-focus camera. As shown in <FIG>, the photographing method may include the following steps:.

The terminal device obtains a first image and a second image that are output by a fixed-focus camera, where a focus distance of the fixed-focus camera is less than a preset distance, resolution of the first image is N times resolution of the second image, N is an integer greater than <NUM>, and the first image and the second image include a same photographing scene.

The terminal device performs image fusion processing on foreground of the first image and background of the second image to obtain a photographed image.

The fixed-focus camera is a fixed-focus camera with a short focus distance, namely, a fixed-focus camera whose focus distance is less than the preset distance. Herein, the preset distance may be determined based on an actual case. For example, the preset distance may be determined as <NUM> centimeters or <NUM> centimeters based on an actual case.

It should be understood that the terminal device may first obtain a preview image, and detect whether a predetermined target exists in the preview image. When a predetermined target exists in the preview image, the terminal device obtains at least one frame of first image and at least one frame of second image that are output by the fixed-focus camera.

It should be noted that, when the terminal device obtains a plurality of frames of first images and a plurality of frames of second images, the terminal device may first perform fusion processing on the plurality of frames of first images by using an HDR algorithm, to obtain a third image, and may perform fusion processing on the plurality of frames of second images by using the HDR algorithm, to obtain a fourth image. Then, the terminal device performs segmentation and fusion on the third image and the fourth image to obtain the photographed image output by the terminal device.

In the photographing method provided in this embodiment, the terminal device may obtain the first image and the second image that are output by the fixed-focus camera, and may perform image fusion on the first image and the second image, that is, may fuse the high-definition foreground of the first image into the second image whose background definition is high, to obtain the photographed image whose foreground definition and background definition are both high. This improves a photographing effect of the terminal device, and improves user experience.

<FIG> is a schematic flowchart of a photographing method according to Embodiment <NUM>. In this embodiment, a terminal device obtains one frame of Remosaic original color-block image output by a fixed-focus camera. As shown in <FIG>, the photographing method may include the following steps:.

Obtain one frame of Remosaic original color-block image output by a fixed-focus camera, where a focus distance of the fixed-focus camera is less than a preset distance.

Obtain a first image and a second image based on the Remosaic original color-block image, where resolution of the first image is N times resolution of the second image, N is an integer greater than <NUM>, and the first image and the second image include a same photographing scene.

Perform image fusion processing on foreground of the first image and background of the second image to obtain a photographed image.

It should be understood that the terminal device may first obtain a preview image, and detect whether a predetermined target exists in the preview image. When a predetermined target exists in the preview image, the terminal device obtains one frame of Remosaic original color-block image output by the fixed-focus camera.

In the photographing method provided in this embodiment, first, one frame of Remosaic original color-block image may be obtained by using the fixed-focus camera; next, the first image corresponding to a Remosaic mode and the second image corresponding to a binning mode may be obtained by performing conversion processing on the Remosaic original color-block image; and finally, segmentation and fusion may be performed on the first image and the second image to obtain the photographed image finally output by the terminal device. Because the first image and the second image are obtained by using a same frame of Remosaic original color-block image, there may be no gap in a fusion part obtained after the first image and the second image are fused. In this way, interpolation processing can be prevented from being performed on the fusion part, or the terminal device can be prevented from performing secondary fusion processing on the first image and the second image. This greatly improves a photographing speed and a photographing effect of the terminal device, and improves user experience.

It should be understood that sequence numbers of the foregoing processes do not mean execution sequences in various embodiments. The execution sequences of the processes should be determined according to functions and internal logic of the processes, and should not be construed as any limitation on the implementation processes of embodiments of this application.

<FIG> is a schematic diagram of a structure of a terminal device according to an embodiment of this application. As shown in <FIG>, a terminal device <NUM> in this embodiment includes at least one processor <NUM> (only one processor is shown in <FIG>), a memory <NUM>, and a computer program <NUM> that is stored in the memory <NUM> and that can be run on the at least one processor <NUM>. When the processor <NUM> executes the computer program <NUM>, the terminal device is enabled to implement steps in any one of the embodiments of the foregoing photographing methods.

Optionally, the terminal device <NUM> may further include a camera <NUM>, a display <NUM>, and the like. The camera <NUM> may obtain an optical image generated by photographing an object, and may convert the optical image into an electrical signal. Then, the electrical signal is converted into a digital signal through analog-to-digital conversion. Subsequently, the digital signal may be processed by using a digital signal processor DSP, and the processed digital signal may be sent to the processor <NUM> for processing, to finally convert the processed digital signal into an image that can be viewed on the display <NUM>.

The processor <NUM> may be a central processing unit (Central Processing Unit, CPU). The processor <NUM> may be a general purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or another programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The general-purpose processor may be a microprocessor, or the processor <NUM> may be any conventional processor or the like.

In some embodiments, the memory <NUM> may be an internal storage unit of the terminal device <NUM>, for example, a hard disk or memory of the terminal device <NUM>. In some other embodiments, the memory <NUM> may be an external storage device of the terminal device <NUM>, for example, a removable hard disk, a smart media card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, or a flash card (Flash Card) that is configured on the terminal device <NUM>. Further, the memory <NUM> may include an internal storage unit of the terminal device <NUM>, and also include an external storage device. The memory <NUM> is configured to store an operating system, an application program, a bootloader (BootLoader) program, data, another program, and the like, for example, program code used to store a computer program. The processor <NUM> implements various function applications (such as a photographing function) and data processing of the terminal device <NUM> by running the program code stored in the memory <NUM>. The memory <NUM> may be further configured to temporarily store data that has been or is to be output.

It should be noted that <FIG> is merely an example of the terminal device <NUM>, and does not constitute a limitation on the terminal device <NUM>. The terminal device <NUM> may include more or fewer components than those shown in the figure, or combine some components, or have different components. For example, the terminal device <NUM> may include an input/output device, a network access device, and the like.

For example, the terminal device in this embodiment of this application may be a mobile phone, a tablet computer, a wearable device, or the like. An example in which the terminal device is a mobile phone is used. <FIG> is a block diagram of a partial structure of a mobile phone according to an embodiment of this application. As shown <FIG>, the mobile phone may include components such as a radio frequency (Radio Frequency, RF) circuit <NUM>, a memory <NUM>, an input unit <NUM>, a display unit <NUM>, a sensor <NUM>, an audio circuit <NUM>, a wireless fidelity (wireless fidelity, WiFi) module <NUM>, a processor <NUM>, and a power supply <NUM>. A person skilled in the art may understand that the structure of the mobile phone shown in <FIG> does not constitute a limitation on the mobile phone, and the mobile phone may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

The components of the mobile phone are described in detail below with reference to <FIG>.

The RF circuit <NUM> may be configured to receive and send a signal in an information receiving/sending process or a call process. In particular, after receiving downlink information of a base station, the RF circuit <NUM> sends the downlink information to the processor <NUM> for processing, and in addition, sends related uplink data to the base station. Usually, an RF circuit <NUM> includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, and the like. In addition, the RF circuit <NUM> may further communicate with a network and another device through wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to a global system for mobile communications (Global System of Mobile communication, GSM), a general packet radio service (General Packet Radio Service, GPRS), code division multiple access (Code Division Multiple Access, CDMA), wideband code division multiple access (Wideband Code Division Multiple Access, WCDMA), long term evolution (Long Term Evolution, LTE), an email, a short message service (Short Messaging Service, SMS), and the like.

The memory <NUM> may be configured to store a software program and a module. The processor <NUM> performs various function applications and data processing of the mobile phone by running the software program and the module that are stored in the memory <NUM>. The memory <NUM> may mainly include a program storage area and a data storage area. The program storage area may store an operating system, an application program required by at least one function (such as a sound play function and an image display function), and the like. The data storage area may store data (such as audio data or an address book) created based on use of the mobile phone, and the like. In addition, the memory <NUM> may include a high-speed random access memory, or may include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, or another volatile solid-state storage device.

The input unit <NUM> may be configured to receive input digit or character information, and generate a key signal input related to a user setting and function control of the mobile phone. Specifically, the input unit <NUM> may include a touch panel <NUM> and another input device <NUM>. The touch panel <NUM>, also referred to as a touchscreen, may collect a touch operation performed by a user on or near the touch panel <NUM> (for example, an operation performed by the user on the touch panel <NUM> or near the touch panel <NUM> by using any suitable object or accessory such as a finger or a stylus), and drive a corresponding connection apparatus based on a preset program. Optionally, the touch panel <NUM> may include two parts: a touch detection apparatus and a touch controller. The touch detection apparatus detects a touch location of the user, detects a signal generated by the touch operation, and transfers the signal to the touch controller. The touch controller receives the touch information from the touch detection apparatus, converts the touch information into touch point coordinates, and then sends the touch point coordinates to the processor <NUM>. In addition, the touch controller can receive and execute a command sent by the processor <NUM>. In addition, the touch panel <NUM> may be implemented by using a plurality of types, such as a resistive type, a capacitive type, an infrared ray type, and a surface acoustic wave type. In addition to the touch panel <NUM>, the input unit <NUM> may include the another input device <NUM>. Specifically, the another input device <NUM> may include but be not limited to one or more of a physical keyboard, a functional key (such as a volume control key or an on/off key), a trackball, a mouse, or a joystick.

The display unit <NUM> may be configured to display information entered by the user or information provided for the user and various menus of the mobile phone. The display unit <NUM> may include a display panel <NUM>. Optionally, the display panel <NUM> may be configured in a form such as a liquid crystal display (Liquid Crystal Display, LCD) or an organic light-emitting diode (Organic Light-Emitting Diode, OLED). Further, the touch panel <NUM> may cover the display panel <NUM>. After detecting a touch operation on or near the touch panel <NUM>, the touch panel <NUM> transfers the touch operation to the processor <NUM>, to determine a type of a touch event. Subsequently, the processor <NUM> provides a corresponding visual output on the display panel <NUM> based on the type of the touch event. In <FIG>, the touch panel <NUM> and the display panel <NUM> are used as two independent components to implement input and output functions of the mobile phone. However, in some embodiments, the touch panel <NUM> and the display panel <NUM> may be integrated to implement the input and output functions of the mobile phone.

The mobile phone may further include at least one type of sensor <NUM>, for example, a light sensor, a motion sensor, and another sensor. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor may adjust luminance of the display panel <NUM> based on brightness of ambient light. The proximity sensor may turn off the display panel <NUM> and/or backlight when the mobile phone moves to the car of the user. As a type of movement sensor, an accelerometer sensor may detect a value of acceleration in each direction (usually on three axes), may detect a value and a direction of gravity in a stationary state, and may be used in an application for identifying a mobile phone posture (such as screen switching between a landscape mode and a portrait mode, a related game, or magnetometer posture calibration), a function related to vibration identification (such as a pedometer or a knock), or the like. Other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, or an infrared sensor may be further configured in the mobile phone.

The audio circuit <NUM>, a loudspeaker <NUM>, and a microphone <NUM> can provide an audio interface between the user and the mobile phone. The audio circuit <NUM> may convert received audio data into an electrical signal and transmit the electrical signal to the loudspeaker <NUM>. The loudspeaker <NUM> converts the electrical signal into a sound signal for output. In addition, the microphone <NUM> converts a collected sound signal into an electrical signal. The audio circuit <NUM> converts the electrical signal into audio data after receiving the electrical signal, and then outputs the audio data to the processor <NUM>. The processor <NUM> processes the audio data, and then sends the processed audio data to, for example, another mobile phone, by using the RF circuit <NUM>, or outputs the processed audio data to the memory <NUM> for further processing.

Wi-Fi belongs to a short-distance wireless transmission technology. The mobile phone may help, by using the Wi-Fi module <NUM>, the user receive and send an email, browse a web page, access streaming media, and the like. The Wi-Fi module <NUM> provides wireless broadband Internet access for the user. Although <FIG> shows the Wi-Fi module <NUM>, it may be understood that the Wi-Fi module <NUM> is not a necessary component of the mobile phone, and may be totally omitted as required without changing the essence of the present invention.

The processor <NUM> is a control center of the mobile phone, and connects various parts of the entire mobile phone by using various interfaces and lines. By running or executing the software program and/or the module stored in the memory <NUM> and invoking the data stored in the memory <NUM>, the processor <NUM> performs various functions and/or data processing of the mobile phone, to perform overall monitoring on the mobile phone. Optionally, the processor <NUM> may include one or more processing units. Preferably, the processor <NUM> may integrate an application processor and a modem processor. The application processor mainly processes an operating system, a user interface, an application, and the like. The modem processor mainly processes wireless communication. It may be understood that the foregoing modem processor may be not integrated into the processor <NUM>.

The mobile phone further includes a power supply <NUM> (such as a battery) for supplying power to each component. Preferably, the power supply may be logically connected to the processor <NUM> by using a power management system, to implement functions such as charging, discharging, and power consumption management by using the power management system.

Although not shown, the mobile phone may further include a camera. Optionally, a location of the camera on the mobile phone may be a front location, or may be a rear location. This is not limited in this embodiment of this application.

Optionally, the mobile phone may include a single camera, a dual camera, three cameras, or the like. This is not limited in this embodiment of this application.

For example, the mobile phone may include three cameras, one is a primary camera, one is a wide-angle camera, and one is a long-focus camera.

Optionally, when the mobile phone includes a plurality of cameras, the plurality of cameras may be all front-facing cameras, or may be all rear-facing cameras, or some cameras are front-facing cameras and some other cameras are rear-facing cameras. This is not limited in this embodiment of this application.

In addition, although not shown in the figure, the mobile phone may further include a Bluetooth module and the like.

An embodiment of this application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a computer, the computer is enabled to implement the steps in the foregoing method embodiments.

An embodiment of this application provides a computer program product. When the computer program product runs on a terminal device, the terminal device is enabled to implement steps in the foregoing method embodiments.

When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, the integrated unit may be stored in a computer-readable storage medium. Based on such an understanding, in this application, all or some processes in the methods of the foregoing embodiments may be completed by a computer program instructing related hardware. The computer program may be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps in the foregoing method embodiments may be implemented. The computer program includes computer program code, and the computer program code may be in a form of source code, a form of object code, a form of an executable file, some intermediate forms, or the like. The computer-readable storage medium may include at least any entity or apparatus that can include computer program code into an apparatus/a terminal device, a recording medium, a computer memory, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, for example, a USB flash drive, a removable hard disk, a magnetic disk, or an optical disc. In some jurisdictions, based on legislation and patent practice, the computer-readable storage medium cannot be an electrical carrier signal or a telecommunication signal.

In embodiments provided in this application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the described apparatus/terminal device embodiment is merely an example. For example, the module or unit division is merely logical function division and may be other division in actual implementation. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections may be implemented through some interfaces.

Claim 1:
A photographing method, comprising:
obtaining a first image and a second image that are output by a fixed-focus camera, wherein a focus distance of the fixed-focus camera is less than a preset distance, resolution of the first image is N times resolution of the second image, N is an integer greater than <NUM>, and the first image and the second image comprise a same photographing scene, wherein the second image is obtained in a binning mode; and
performing image fusion processing on foreground of the first image and background of the second image to obtain a photographed image wherein the foreground of the first image includes a predetermined target located inside a depth of field of the fixed-focus camera.