original_docstring: Extracts all relevant exif data from images in a folder and stores them in a csv at the output_folder
docstring: Extracts all relevant exif data from images in a folder and stores them in a csv at the output_folder
docstring_tokens: Extracts all relevant exif data from images in a folder and stores them in a csv at the output_folder
code: def extract_exif_folder(pics_folder, output_folder):
      """Extracts all relevant exif data from images in a folder and stores them in a csv at the output_folder"""
      list_pics = os.listdir(pics_folder)
  
      count_no_gps = 0
      list_gps_valid = []
      list_gps_lat = []
      list_gps_lon = []
      list_idx = []
      list_datetime = []
      list_filename = []
  
      for i in range(len(list_pics)):
          name_pic = list_pics[i]
          path_pic = pics_folder + '/' + name_pic
  
          gps_lat, gps_lon, img_datetime = extract_exif_data(path_pic)
  
          b_gps_valid = True
          if gps_lat > 90:
              b_gps_valid = False
              count_no_gps += 1
  
          print(i, path_pic, b_gps_valid, gps_lat, gps_lon)
          list_idx.append(i)
          list_gps_valid.append(b_gps_valid)
          list_gps_lat.append(gps_lat)
          list_gps_lon.append(gps_lon)
          list_datetime.append(img_datetime)
          list_filename.append(name_pic)
  
      print("Images with no gps data:", count_no_gps)
      # Spanish CSV format. For author debugging
      # with open(output_folder+"exif_es.csv", "w") as f_out:
      #     separator = ';'
      #     for i in range(len(list_idx)):
      #         f_out.write(
      #             separator.join([
      #                 list_datetime[i].strftime("%Y-%m-%d %H:%M:%S"),
      #                 "%d" % list_gps_valid[i],
      #                 "%.8f" % list_gps_lat[i],
      #                 "%.8f" % list_gps_lon[i],
      #                 "%d" % list_gps_valid[i],
      #                 list_filename[i]
      #             ]).replace('.', ',') + '\n')
  
      with open(output_folder + "exif.csv", "w") as f_out:
          separator = ','
          for i in range(len(list_idx)):
              f_out.write(
                  separator.join([
                      list_datetime[i].strftime("%Y-%m-%d %H:%M:%S"),
                      "%d" % list_gps_valid[i],
                      "%.8f" % list_gps_lat[i],
                      "%.8f" % list_gps_lon[i],
                      "%d" % list_gps_valid[i],
                      list_filename[i]
                  ]) + '\n')
code_tokens: def extract_exif_folder ( pics_folder , output_folder ) : list_pics = os . listdir ( pics_folder ) count_no_gps = 0 list_gps_valid = [ ] list_gps_lat = [ ] list_gps_lon = [ ] list_idx = [ ] list_datetime = [ ] list_filename = [ ] for i in range ( len ( list_pics ) ) : name_pic = list_pics [ i ] path_pic = pics_folder + '/' + name_pic gps_lat , gps_lon , img_datetime = extract_exif_data ( path_pic ) b_gps_valid = True if gps_lat > 90 : b_gps_valid = False count_no_gps += 1 print ( i , path_pic , b_gps_valid , gps_lat , gps_lon ) list_idx . append ( i ) list_gps_valid . append ( b_gps_valid ) list_gps_lat . append ( gps_lat ) list_gps_lon . append ( gps_lon ) list_datetime . append ( img_datetime ) list_filename . append ( name_pic ) print ( "Images with no gps data:" , count_no_gps ) with open ( output_folder + "exif.csv" , "w" ) as f_out : separator = ',' for i in range ( len ( list_idx ) ) : f_out . write ( separator . join ( [ list_datetime [ i ] . strftime ( "%Y-%m-%d %H:%M:%S" ) , "%d" % list_gps_valid [ i ] , "%.8f" % list_gps_lat [ i ] , "%.8f" % list_gps_lon [ i ] , "%d" % list_gps_valid [ i ] , list_filename [ i ] ] ) + '\n' )
short_docstring: Extracts all relevant exif data from images in a folder and stores them in a csv at the output_folder
short_docstring_tokens: Extracts all relevant exif data from images in a folder and stores them in a csv at the output_folder
comment: """Extracts all relevant exif data from images in a folder and stores them in a csv at the output_folder"""$SEP$# Spanish CSV format. For author debugging
  $SEP$# with open(output_folder+"exif_es.csv", "w") as f_out:
  $SEP$#     separator = ';'
  $SEP$#     for i in range(len(list_idx)):
  $SEP$#         f_out.write(
  $SEP$#             separator.join([
  $SEP$#                 list_datetime[i].strftime("%Y-%m-%d %H:%M:%S"),
  $SEP$#                 "%d" % list_gps_valid[i],
  $SEP$#                 "%.8f" % list_gps_lat[i],
  $SEP$#                 "%.8f" % list_gps_lon[i],
  $SEP$#                 "%d" % list_gps_valid[i],
  $SEP$#                 list_filename[i]
  $SEP$#             ]).replace('.', ',') + '\n')
  