In accordance with another aspect of the disclosure, an electronic device is provided. The electronic device includes a camera module, wherein the camera module includes a lens assembly including one or more lenses and an image sensor including at least one pixel, a display, and a processor electrically connected with the display and the camera module. The at least one pixel may include a first sub-pixel, a second sub-pixel, a third sub-pixel, and a fourth sub-pixel covered by one color filter and may include a first micro lens covering the first sub-pixel, a second micro lens covering the second sub-pixel, and a third micro lens covering the third sub-pixel and the fourth sub-pixel. The processor may obtain a light of an external object passing through the one or more lenses by using the at least one pixel, may generate depth data associated with the external object, based on data obtained from the third sub-pixel and the fourth sub-pixel through the third micro lens, by using the image sensor, may generate pixel data on the at least one pixel based on data obtained from the first sub-pixel, the second sub-pixel, the third sub-pixel, and the fourth sub-pixel, by using the image sensor, may display an image generated based on the pixel data through the display, and may adjust a focus on the external object by moving the one or more lenses based on the depth data.
Other aspects, advantages, and salient features of the disclosure will become apparent to those skilled in the art from the following detailed description, which, taken in conjunction with the annexed drawings, discloses various embodiments of the disclosure.