The present disclosure relates to an electronic device and a method of controlling an electronic device.
A digital single lens reflex (DSLR) camera etc., has been used for generating an image with bokeh. In the image with bokeh, a portion that requires attention is made clearer and a foreground and a background of the portion is blurred. Namely, a portion that needs to get attention is made clearer and a foreground and a background of the portion is blurred.
In recent years, a technique of image processing in which an image with bokeh is generated artificially from an image taken with a camera having a deep depth of field, is widely spread. The camera having a deep depth of field is installed in an electronic device such as a smartphone and captures an image that is in focus from a short-distance portion to a long-distance portion.
A method of using depth information which is included in a stereo image taken through binocular stereo viewing is a technique employed to artificially produce an image with bokeh. By using the technique, an electronic device such as a smartphone can generate an image with bokeh.
However, the depth information may be false in some types of a surface of an object in a subject. For example, if a binocular stereo image has a low texture pattern that does not have a clear change along an epipolar line, or a repeated pattern such as checkered pattern, depth information cannot be accurately calculated. As a result, an image with inappropriate bokeh is generated.
Algorithms used in an image processing system available for electronic devices such as smartphones cannot be directly improved because the system is usually a black box for manufacturers of the electronic devices. Therefore, it is difficult to correct the depth information based on a stereo image.
In accordance with the present disclosure, an electronic device may include:
a first camera configured to acquire a first image of a subject;
a second camera configured to acquire a second image of the subject;
a range sensor configured to emit a pulsed light toward the subject and detect a reflected light of the pulsed light reflected from the subject, and acquire time of flight (ToF) depth information; and
an image signal processor configured to acquire an image with bokeh, based on the first image, the second image, and the ToF depth information, the image with bokeh being the first image with one or more bokeh portions,
the image signal processor is configured to acquire a depth information of a stereo image by matching the first image and the second image; correct the depth information of the stereo image based on the first image and the ToF depth information, and acquire the corrected depth information.
In accordance with the present disclosure, a method of controlling an electronic device, the electronic device including a first camera, a second camera, a range sensor, and an image signal processor, and the method including: acquiring, by the first camera, a first image of a subject; acquiring, by the second camera, a second image of the subject; acquiring, by the range sensor, ToF depth information of the subject; acquiring, by the image signal processor, a depth information of a stereo image by matching the first image and the second image; correcting, based on the first image and the ToF depth information, the depth information of the stereo image, and acquiring the corrected depth information; and acquiring, by the image signal processor, based on the corrected depth information, an image with bokeh; the image with bokeh being the first image with one or more bokeh portions.
These and/or other aspects and advantages of embodiments of the present disclosure will become apparent and more readily appreciated from the following descriptions made with reference to the drawings, in which:
Embodiments of the present disclosure will be described in detail and examples of the embodiments will be illustrated in the accompanying drawings. The same or similar elements and the elements having same or similar functions are denoted by like reference numerals throughout the descriptions. The embodiments described herein with reference to the drawings are explanatory, which aim to illustrate the present disclosure, but shall not be construed to limit the present disclosure.
<Electronic device 100>
As shown in
The stereo camera module 10 includes a master camera module (also referred to as first camera) 11 and a slave camera module (also referred to as second camera) 12 for the use for binocular stereo viewing as shown in
The master camera module 11 includes a first lens 11a that is capable of focusing on a subject, a first image sensor 11b that detects an image inputted via the first lens 11a, and a first image sensor driver 11c that drives the first image sensor 11b, as shown in
The slave camera module 12 includes a second lens 12a that is capable of focusing on a subject, a second image sensor 12b that detects an image inputted via the second lens 12a, and a second image sensor driver 12c that drives the second image sensor 12b, as shown in
The master camera module 11 acquires a master camera image (also referred to as first image) of the subjects 101a and 101b. Similarly, the slave camera module 12 acquires a slave camera image (also referred to as second image) of the subjects 101a and 101b.
The range sensor module 20 acquires time of flight (ToF) depth information (ToF depth value) by emitting pulsed light toward the subjects 101a and 101b, and detecting reflection light from the subjects 101a and 101b. The ToF depth information indicates an actual distance between the electronic device 100 and a subject.
The resolution of the ToF depth information detected by the range sensor module 20 is lower than the resolution of stereo depth information of a stereo image that is acquired based on the master camera image and the slave camera image. A warp processing (ToF depth expansion processing) Y2 is performed to expand the ToF information to a field of view (FOV) of the master camera image.
The image signal processor 30 controls the master camera module 11, the slave camera module 12, and the range sensor module 20 to acquire a camera image. The camera image is the master camera image with bokeh. The camera image is acquired based on the master camera image obtained by means of the master camera module 11, the slave camera image obtained by means of the slave camera module 12, and the ToF depth information obtained by means of the range sensor module 20.
Furthermore, as shown in
The GNSS module 40 measures the current position of the electronic device 100. The wireless communication module 41 performs wireless communications with the Internet. The CODEC 42 bi-directionally performs encoding and decoding, using a predetermined encoding/decoding method, as shown in
The display module 45 displays predefined information. For example, the display module 45 displays a master camera image so that a user can check it.
The input module 46 inputs information via a user's operation. For example, the input module 46 inputs a position information which indicates a portion of the master camera image displayed on the display module 45. The position information is an in-focus position 210 shown in
An IMU 47 detects the angular velocity and the acceleration of the electronic device 100.
The main processor 48 controls the global navigation satellite system (GNSS) module 40, the wireless communication module 41, the CODEC 42, the speaker 43, the microphone 44, the display module 45, the input module 46, and the IMU 47.
The memory 49 stores a program and data required for the image signal processor 30, acquired image data, and a program and data required for the main processor 48.
The electronic device 100 having the above-described configuration is a mobile apparatus such as a smartphone in this embodiment, but may be other types of electronic devices including a plurality of camera modules.
<Flow of Data in the Electronic Device 100>
As shown in
The image signal processor 30 acquires stereo depth information 204 by matching processing (stereo processing) X1 of the master camera image 201 and the slave camera image 202 as shown in
The image signal processor 30 also extracts person region information (in a broader sense, subject region information) 205 that defines the region of the subject in the master camera image 201 by performing AI processing (image processing) X2 on the region of the subject.
The image signal processor 30 further acquires depth information 206 of the master camera image 201 by performing combining processing X3 on the stereo depth information 204 and the extracted person region information (subject region information) 205.
The image signal processor 30 also performs an uncertain region detection processing Y1 to detect an uncertain region in the master camera image 201. The uncertain region is a region on which the matching processing X1 cannot be performed based on the master camera image 201 and the slave camera image 202. The uncertain region is a region where parallax cannot be calculated by means of the stereo depth information of a stereo image. Specifically, the uncertain region is a low texture region or a repeated pattern region.
The image signal processor 30 acquires uncertain region information 207 relating to the detected uncertain region in the master camera image 201.
The image signal processor 30 also performs a warp processing Y2 to match a FOV (field of view) of the ToF depth information with that of the master camera image. The warp processing Y2 is performed based on the ToF depth information and camera parameter 211. The camera parameter 211 includes camera parameters of the master camera module 11 and the range sensor module 20.
The image signal processor 30 also performs a depth correction Y3 to correct the depth information 206 of the uncertain region. The depth correction Y3 is performed based on the ToF depth information 203, the depth information 206, the uncertain region information 207 and the in-focus position 210. Corrected depth information 208 is acquired by the depth correction Y3. The depth correction Y3 will be described in detail later with reference to
With respect to a non-detection region, for which no ToF depth information is detected (for example, a foreground and a background of the subject), the image signal processor 30 may acquire the corrected depth information 208 in the depth correction Y3 by replacing depth information of the non-detection region with depth information for correction that meets a user's instruction.
As described above, the image signal processor 30 acquires the corrected depth information 208 by correcting the depth information 206 based on the master camera image 201 and the ToF depth information 203. The depth information 206 is acquired based on the stereo image which is acquired by the matching processing X1.
The image signal processor 30 then performs a bokeh processing X4 on the master camera image 201 based on the corrected depth information 208 such that a camera image with bokeh (also referred to as image with bokeh) 209 is obtained.
The bokeh processing X4 may be performed in consideration of the in-focus position 210. For example, the camera image with bokeh 209 is generated by emphasizing more bokeh as the difference between the corrected depth information 208 and an average value of the depth information around the in-focus position 210 increases.
<Method of Controlling the Electronic Device 100>
An example of a method of controlling the electronic device 100 described above will now be described. In particular, an example of a flow of the electronic device 100 for acquiring a camera image with appropriate bokeh will be described below.
The image signal processor 30 acquires a correct region defined by the in-focus position 210. For example, the correct region is a circular or rectangular region centered on the in-focus position.
The correct region is an in-focus region which has neither a checkered pattern (i.e., low texture region) nor a plurality of horizontally long plates (i.e., repeated pattern region).
According to the example flow shown in
A user specifies a correct region (block S62). For example, the user specifies a correct region by tapping a touch panel of the display module 45. In this example, as shown in
The image signal processor 30 acquires the master camera image (
The image signal processor 30 performs the uncertain region detection processing for detecting an uncertain region in which the stereo processing cannot be performed on the master camera image and the slave camera image (block S33). The block S33 will be described in detail later with reference to
The image signal processor 30 acquires a corrected depth information by correcting the depth information corresponding to the uncertain region (block S34). Examples of depth information corresponding to the uncertain region are those having no depth value, or having no value but interpolated using depth values of surrounding portions. The block S34 will be described in detail later with reference to
The image signal processor 30 performs the bokeh processing X4 on the master camera image to acquire the camera image with bokeh 209 (block S35). As shown in
<Detail of the Uncertain Region Detection Processing>
An example of a flow of the uncertain region detection processing (i.e., the block S33) will be described with reference to
The image signal processor 30 performs an autocorrelation calculation with a reference region of the master camera image being moved by a predefined movement amount relative to a region of interest, thereby calculating a degree of similarity (characteristic value) between the region of interest and the reference region (block S81).
Specifically, as shown in
In computing the similarity in the autocorrelation calculation in the uncertain region detection processing, a sum of squared difference (SSD) method, a sum of absolute difference (SAD) method, a normalized cross correlation (NCC) method, a zero means normalized cross correlation (ZNCC) method, or a summed normalized cross correlation (SNCC) method may be used.
The image signal processor 30 detects a region in which a change in the calculated degree of similarity with respect to a predefined movement amount is smaller than a predefined value (block S82), and labels the detected region as a low texture region.
For example, if, in a region, a frequency (characteristic value) that is based on an average value of the peak intervals or a mode value of peaks of the similarity with respect to a predefined movement amount is less (smaller) than a predefined label reference value, the image signal processor 30 labels the region as a low texture region (see
The image signal processor 30 may further classify low texture regions based on the magnitude of the change in (change in the depth of low point of) similarity.
The image signal processor 30 detects a region in which there are a plurality of peaks in the calculated degree of similarity with respect to a predefined movement amount (block S83), and labels the detected region as a repeated pattern region.
For example, if, in a region, a frequency (characteristic value) that is based on an average value of the peak intervals or a mode value of peaks of the similarity with respect to a predefined movement amount is equal to or more (greater) than a predefined label reference value, the image signal processor 30 labels the region as a repeated pattern region (see
The image signal processor 30 combines the labeled repeated pattern region and the labeled low texture region (block S84).
In the combining flow (block S84), first, the image signal processor 30 performs an autocorrelation calculation on the master camera image by moving the reference region Rf relative to the region of interest Ri by a predefined movement amount in a direction orthogonal to the epipolar line, thereby calculating the degree of similarity (characteristic value) between the region of interest Ri and the reference region Rf (block S121).
Please note that the autocorrelation calculation in the direction orthogonal to the epipolar line may be omitted if the processing time of the image signal processor 30 needs to be reduced.
The image signal processor 30 calculates the characteristic value (frequency) based on the degree of similarity calculated in the above-described autocorrelation calculation (block S122), links pixels having similar characteristic values in uncertain regions, classifies linked pixel groups of the uncertain regions (see
As described above, the characteristic value or the frequency is calculated based on the average value of the intervals between the peaks or the mode value of the peaks of the degree of similarity. The low texture regions are labeled based on the depth of the low point of the degree of similarity. The clear texture regions are excluded from the autocorrelation calculation in advance (
<Details of the Depth Information Correction Processing>
An example of a flow of depth information correction processing (i.e., the block S34) will be described with reference to
The image signal processor 30 defines criteria (block S141). The criteria are used to exclude incorrect data in the peripheral regions Rp1 and Rp2.
As shown in
In S141, the criteria are defined based on the correct region Rc that is an in-focus area which has neither a low texture region nor a repeated pattern region. For example, in order to define the criteria, the image signal processor 30 calculates an average value Ave1 (first average value) of the ToF depth information of the correct region Rc and an average value Ave2 (second average value) of the depth information of the correct region Rc.
As shown in
The quadrant Q2 is an incorrect region where ToF depth information is less than the first average value AVE1 and depth information is greater than the second average value AVE2. The quadrant Q4 is an incorrect region where ToF depth information is greater than the first average value AVE1 and depth information is less than the second average value AVE2.
A set of depth information and ToF depth information in the Q2 and the Q4 is considered incorrect and excluded as an illegal value. On the other hand, the Q1 and the Q3 are correct regions and thus a set of depth information and ToF depth information in the Q1 and Q3 is not excluded.
The image signal processor 30 excludes a set of incorrect depth information and ToF depth information in the peripheral region based on the criteria (block S142). For example, one or more sets of depth information and ToF depth information in the Q2 and the Q4 are excluded from data used in the next block S143.
The image signal processor 30 calculates a relationship between ToF depth information of the peripheral region and depth information of the peripheral region (block S143). The calculation in the block S143 may be performed by statistical method, e.g., regression analysis or histogram analysis etc. Accuracy of the calculated relationship is high since the incorrect values in the peripheral region are excluded in advance.
As a result of the block S143, the following model can be obtained:
Y=aX+b (1)
where Y is a depth value, X is a ToF depth value, and a and b are parameters estimated by the regression analysis.
The image signal processor 30 estimates depth information in the uncertain region based on the relationship (i.e., the model defined by the formula (1)) (block S144). The estimation processing is performed for pixels where ToF depth information could be detected. That is to say, in the example shown in
The image signal processor 30 replaces the depth information of the uncertain region with the estimated depth information of the uncertain region, thereby acquiring the corrected depth information (block S145). As shown in
In contrast with this, in a case shown in
The image signal processor 30 smooths the depth information of the uncertain region based on the depth information of the peripheral region (block S145). Thereby, the remaining incorrect depth information in the region R4 can be modified and depth values in the region R2 become uniform.
Please note that the blocks S142 to S146 are performed for each uncertain region. In case of
According to the flow described above, a camera image with appropriate bokeh can be generated. For example, as shown in
In at least one embodiment, the blocks S141 and S142 may be omitted if an exclusion processing is not performed.
In at least one embodiment, the block S146 may be omitted if a smoothing processing is not performed. For example, if a peripheral region is set to be separated from the uncertain region by a gap which is larger than the amount of leakage of the uncertain region, the block S146 may be omitted.
In at least one embodiment, the uncertain region may be dilated by performing morphological processing between the S141 and the S142.
According to the present disclosure, the uncertain region detection processing is performed to detect an uncertain region where depth information may be false, and the depth information correction processing is performed to correct depth information of the detected uncertain region based on the relationship between the ToF depth information of a peripheral region adjacent to the uncertain region and the depth information of the peripheral region. Thereby, an image with appropriate bokeh can be generated even if a relationship between the stereo depth information and the ToF depth information is not clear, or even if depth information is false due to low texture or repeated pattern of an object.
Further, according to the present disclosure, incorrect data in the peripheral region are excluded before calculating the relationship by means of the criteria based on the correct region defined by the in-focus position. Thereby, an accuracy of the relationship can be improved and a high accuracy of correcting depth information can be achieved.
In the description of embodiments of the present disclosure, it is to be understood that terms such as “central”, “longitudinal”, “transverse”, “length”, “width”, “thickness”, “upper”, “lower”, “front”, “rear”, “back”, “left”, “right”, “vertical”, “horizontal”, “top”, “bottom”, “inner”, “outer”, “clockwise” and “counterclockwise” should be construed to refer to the orientation or the position as described or as shown in the drawings in discussion. These relative terms are only used to simplify the description of the present disclosure, and do not indicate or imply that the device or element referred to must have a particular orientation, or must be constructed or operated in a particular orientation. Thus, these terms cannot be constructed to limit the present disclosure.
In addition, terms such as “first” and “second” are used herein for purposes of description and are not intended to indicate or imply relative importance or significance or to imply the number of indicated technical features. Thus, a feature defined as “first” and “second” may comprise one or more of this feature. In the description of the present disclosure, “a plurality of” means “two or more than two”, unless otherwise specified.
In the description of embodiments of the present disclosure, unless specified or limited otherwise, the terms “mounted”, “connected”, “coupled” and the like are used broadly, and may be, for example, fixed connections, detachable connections, or integral connections; may also be mechanical or electrical connections; may also be direct connections or indirect connections via intervening structures; may also be inner communications of two elements which can be understood by those skilled in the art according to specific situations.
In the embodiments of the present disclosure, unless specified or limited otherwise, a structure in which a first feature is “on” or “below” a second feature may include an embodiment in which the first feature is in direct contact with the second feature, and may also include an embodiment in which the first feature and the second feature are not in direct contact with each other, but are in contact via an additional feature formed therebetween. Furthermore, a first feature “on”, “above” or “on top of” a second feature may include an embodiment in which the first feature is orthogonally or obliquely “on”, “above” or “on top of” the second feature, or just means that the first feature is at a height higher than that of the second feature; while a first feature “below”, “under” or “on bottom of” a second feature may include an embodiment in which the first feature is orthogonally or obliquely “below”, “under” or “on bottom of” the second feature, or just means that the first feature is at a height lower than that of the second feature.
Various embodiments and examples are provided in the above description to implement different structures of the present disclosure. In order to simplify the present disclosure, certain elements and settings are described in the above. However, these elements and settings are only by way of example and are not intended to limit the present disclosure. In addition, reference numbers and/or reference letters may be repeated in different examples in the present disclosure. This repetition is for the purpose of simplification and clarity and does not refer to relations between different embodiments and/or settings. Furthermore, examples of different processes and materials are provided in the present disclosure. However, it would be appreciated by those skilled in the art that other processes and/or materials may also be applied.
Reference throughout this specification to “an embodiment”, “some embodiments”, “an exemplary embodiment”, “an example”, “a specific example” or “some examples” means that a particular feature, structure, material, or characteristics described in connection with the embodiment or example is included in at least one embodiment or example of the present disclosure. Thus, the appearances of the above phrases throughout this specification are not necessarily referring to the same embodiment or example of the present disclosure. Furthermore, the particular features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples.
Any process or method described in a flow chart or described herein in other ways may be understood to include one or more modules, segments or portions of codes of executable instructions for achieving specific logical functions or steps in the process, and the scope of a preferred embodiment of the present disclosure includes other implementations, in which it should be understood by those skilled in the art that functions may be implemented in a sequence other than the sequences shown or discussed, including in a substantially identical sequence or in an opposite sequence.
The logic and/or step described in other manners herein or shown in the flow chart, for example, a particular sequence table of executable instructions for realizing the logical function, may be specifically achieved in any computer readable medium to be used by the instructions execution system, device or equipment (such as a system based on computers, a system comprising processors or other systems capable of obtaining instructions from the instructions execution system, device and equipment executing the instructions), or to be used in combination with the instructions execution system, device and equipment. As to the specification, “the computer readable medium” may be any device adaptive for including, storing, communicating, propagating or transferring programs to be used by or in combination with the instruction execution system, device or equipment. More specific examples of the computer readable medium comprise but are not limited to: an electronic connection (an electronic device) with one or more wires, a portable computer enclosure (a magnetic device), a random access memory (RAM), a read only memory (ROM), an erasable programmable read-only memory (EPROM or a flash memory), an optical fiber device and a portable compact disk read-only memory (CDROM). In addition, the computer readable medium may even be a paper or other appropriate medium capable of printing programs thereon, this is because, for example, the paper or other appropriate medium may be optically scanned and then edited, decrypted or processed with other appropriate methods when necessary to obtain the programs in an electric manner, and then the programs may be stored in the computer memories.
It should be understood that each part of the present disclosure may be realized by the hardware, software, firmware or their combination. In the above embodiments, a plurality of steps or methods may be realized by the software or firmware stored in the memory and executed by the appropriate instructions execution system. For example, if it is realized by the hardware, likewise in another embodiment, the steps or methods may be realized by one or a combination of the following techniques known in the art: a discrete logic circuit having a logic gate circuit for realizing a logic function of a data signal, an application-specific integrated circuit having an appropriate combination logic gate circuit, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
Those skilled in the art shall understand that all or parts of the steps in the above exemplifying method of the present disclosure may be achieved by commanding the related hardware with programs. The programs may be stored in a computer readable storage medium, and the programs comprise one or a combination of the steps in the method embodiments of the present disclosure when run on a computer.
In addition, each function cell of the embodiments of the present disclosure may be integrated in a processing module, or these cells may be separate physical existence, or two or more cells are integrated in a processing module. The integrated module may be realized in a form of hardware or in a form of software function modules. When the integrated module is realized in a form of software function module and is sold or used as a standalone product, the integrated module may be stored in a computer readable storage medium.
The storage medium mentioned above may be read-only memories, magnetic disks, CD, etc.
Although embodiments of the present disclosure have been shown and described, it would be appreciated by those skilled in the art that the embodiments are explanatory and cannot be construed to limit the present disclosure, and changes, modifications, alternatives and variations can be made in the embodiments without departing from the scope of the present disclosure.
This application is a continuation of International Application No. PCT/CN2019/124146, filed Dec. 9, 2019, the entire disclosure of which is incorporated herein by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2019/124146 | Dec 2019 | US |
Child | 17725136 | US |