Method for providing image, and electronic device for supporting same
An electronic device according to various embodiments of the present disclosure includes a camera, a processor, and memory storing instructions. The instructions, when executed by the processor, cause the electronic device obtain an image via the camera, identify at least one area in the image by performing segmentation on the image, the at least one area respectively corresponding to at least one object included in the image, obtain a brightness of the at least one area, identify at least one weight respectively corresponding to the at least one object, and control an exposure of the camera based on the brightness of the at least one area and the at least one weight.
1 . An electronic device comprising:
a camera;
at least one processor; and
memory storing instructions that, when executed by the at least one processor individually or collectively, cause the electronic device to:
obtain an image via the camera,
identify at least one area in the image by performing segmentation on the image, the at least one area respectively corresponding to at least one object included in the image,
obtain a brightness of the at least one area,
identify at least one weight respectively corresponding to the at least one object, and
control an exposure of the camera based on the brightness of the at least one area and the at least one weight,
wherein the instructions, when executed by the processor, further cause the electronic device to:
identify whether the at least one object includes a designated object,
based on the at least one object including the designated object, control the exposure of the camera based on a first convergence speed, and
based on the at least one object not including the designated object, control the exposure of the camera based on a second convergence speed higher than the first convergence speed.
2 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device:
detect the at least one object included in the image by performing the segmentation on the image, and
obtain information associated with a location of the at least one object.
3 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, further cause the electronic device to:
set a plurality of weights for a plurality of objects, respectively, so that at least portions of the plurality of objects have different weights, and
store the plurality of objects and the plurality of weights in the memory.
4 . The electronic device of claim 3 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to set a weight for a person object, the weight for the person object being higher than a weight for another object among the plurality of objects.
5 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to:
obtain a brightness of the image based on the brightness of the at least one area and the at least one weight,
determine an exposure value of the camera based on the brightness of the image and a target brightness, and
control the exposure of the camera based on the exposure value of the camera.
6 . The electronic device of claim 1 , wherein the instructions, when executed by the processor, further cause the electronic device to:
based on the at least one object including the designated object, determine to control the exposure of the camera based on the at least one object in the image, and
based on the at least one object not including the designated object, determine to control the exposure of the camera based on a central area the image.
7 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, further cause the electronic device to detect a change amount of a location of the at least one area, and
wherein the instructions, when executed by the at least one processor, cause the electronic device to set a shutter speed of the camera based on the change amount of the location of the at least one area.
8 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to:
after controlling the exposure of the camera, obtain a subsequent image that is subsequent to the image via the camera,
obtain a brightness of an area corresponding to a designated object included in the subsequent image, and
correct a brightness of the subsequent image based on the brightness of the area and a target brightness of the designated object.
9 . A method of providing an image in an electronic device, the method comprising:
obtaining an image via a camera of the electronic device;
identifying at least one area in the image by performing segmentation on the image, the at least one area respectively corresponding to at least one object included in the image;
obtaining a brightness of the at least one area;
identifying at least one weight respectively corresponding to the at least one object; and
controlling an exposure of the camera based on the brightness of the at least one area and the at least one weight,
wherein the method further comprises:
identify whether the at least one object includes a designated object;
based on the at least one object including the designated object, controlling the exposure of the camera based on a first convergence speed; and
based on the at least one object not including the designated object, controlling the exposure of the camera based on a second convergence speed higher than the first convergence speed.
10 . The method of claim 9 , wherein the identifying of the at least one area comprises:
detecting the at least one object included in the image by performing the segmentation on the image; and
obtaining information associated with a location of the at least one object.
11 . The method of claim 9 , further comprising:
setting a plurality of weights for a plurality of objects, respectively, so that at least portions of the plurality of objects have different weights; and
storing the plurality of objects and the plurality of weights in memory of the electronic device.
12 . The method of claim 11 , wherein the setting of the plurality of weights comprises setting a weight for a person object, the weight for the person object being higher than a weight for another object among the plurality of objects.
13 . The method of claim 9 , wherein the controlling of the exposure of the camera comprises:
obtaining a brightness of the image based on the brightness of the at least one area and the at least one weight;
determining an exposure value of the camera based on the brightness of the image and a target brightness; and
controlling the exposure of the camera based on the exposure value of the camera.
14 . The method of claim 9 , further comprising:
based on the at least one object including the designated object, determining to control the exposure of the camera based on the at least one object in the image; and
based on the at least one Object not including the designated object, determining to control the exposure of the camera based on a central area in the image.
15 . The method of claim 9 , further comprising detecting a change amount of a location of the at least one area; and
wherein the controlling of the exposure of the camera comprises:
setting a shutter speed of the camera based on the change amount of the location of the at least one area.
16 . A non-transitory computer-readable storage medium having recorded thereon computer executable instructions, wherein the computer executable instructions that, when executed by at least one processor of an electronic device individually or Collectively, cause the electronic device to:
obtain an image via a camera of the electronic device,
identifying at least one area in the image by performing segmentation on the image, the at least one area respectively corresponding to at least one object included in the image,
obtain a brightness of the at least one area,
identify at least one weight respectively corresponding to the at least one object, and
control an exposure of the camera based on the brightness of the at least one area and the at least one weight,
wherein the computer executable instructions, when executed by the at least one processor individually or collectively, further cause the electronic device to;
identify whether the at least one object includes a designated object,
based on the at least one object including the designated object, control the exposure of the camera based on a first convergence speed, and
based on the at least one object not including the designated object, control the exposure of the camera based on a second convergence speed higher than the first convergence speed.