Designed auto exposure algorithm to get a proper c

2019-08-22 00:28发布

I want to get pictures from:

fnumber=6.3;
iso_list=[100,200,300,400,500,600,700,800];
shutterspeed_list=[1,1/2,1/3,1/4,1/5,1/6];

Choose the best pair iso and shutterspeed to get picture with appropriate brightness (the brightness=150.0) based on the exposure value.

I think i can solve like this:

  1. Set the desired_brightness=150.0,get the current_brightness based on the picture
  2. Get the current iso and shutterspeed,calculate the current_ev
  3. brightness_ratio=log2(desired_brightness)/log2(current_brightness)
  4. desired_ev=current_ev*brightness_ratio
  5. Get the shutterspeed and iso based on the target_ev

Here is the code:

    def get_target_ev(self,cur_bright,tar_bright,shutterspeed,iso):
       f=6.3       
       bright_ratio=math.log(tar_bright,2)/math.log(cur_bright,2)
       cur_ev=math.log(f*f*shutterspeed,2)+math.log(iso/100.0,2)
       target_ev=cur_ev*bright_ratio
       return target_ev

Does it make sense?

0条回答
登录 后发表回答