Exemple #1
0
import numpy as np
import cv2
import micasense.utils as msutils
import micasense.metadata as metadata
import exiftool
import matplotlib.pyplot as plt
import os,glob
import math


exiftoolPath = None
if os.name == 'nt':
    exiftoolPath = 'C:/exiftool/exiftool.exe'

imageRaw = '/mnt/114e4710-77b7-4a37-a8f6-0177deea301b/Desktop/Link to Mine/MicaSense/imageprocessing-master/data/0000SET/000/IMG_0001_3.tif'
meta = metadata.Metadata(imageRaw)
radianceImage, _,_,_,_ = msutils.raw_image_to_radiance(meta, imageRaw)
plotutils.plotwithcolorbar(V,'Vignette Factor')
plotutils.plotwithcolorbar(R,'Row Gradient Factor')
plotutils.plotwithcolorbar(V*R,'Combined Corrections')
plotutils.plotwithcolorbar(L,'Vignette and row gradient corrected raw values')
plotutils.plotwithcolorbar(radianceImage,'All factors applied and scaled to radiance')
Exemple #2
0
 sbr_E = 0
 sbr_N = 0
 # Num of each band's radiance
 nbr_B = 0
 nbr_G = 0
 nbr_R = 0
 nbr_E = 0
 nbr_N = 0
 for im in imageFiles:
     # Read raw image DN values
     imageName = filePath + os.sep + "low_altitude" + os.sep + im
     imageRaw = plt.imread(imageName)
     print("Processing %s" % imageName)
     meta = metadata.Metadata(imageName, exiftoolPath=exiftoolPath)
     bandName = meta.get_item('XMP:BandName')
     radianceImage, L, V, R = msutils.raw_image_to_radiance(meta, imageRaw)
     panel_coords = panelDetect(imageName, black_th, cont_th)
     print('Panel Coords', panel_coords[0][0][0])
     # Extract coordinates
     if panel_coords[0][0][0]:
         nw_x = int(panel_coords[0][0][0])
         nw_y = int(panel_coords[0][0][1])
         sw_x = int(panel_coords[1][0][0])
         sw_y = int(panel_coords[1][0][1])
         se_x = int(panel_coords[2][0][0])
         se_y = int(panel_coords[2][0][1])
         ne_x = int(panel_coords[3][0][0])
         ne_y = int(panel_coords[3][0][1])
         x_min = numpy.min([nw_x, sw_x, ne_x, se_x])
         x_max = numpy.max([nw_x, sw_x, ne_x, se_x])
         y_min = numpy.min([nw_y, sw_y, ne_y, se_y])
Exemple #3
0
    a = 0
    #loop through images in folder "d"
    while a < numimgs:

        imageName = origimgpaths[a]
        imageRaw = plt.imread(imageName)
        name = imageName[-14:]
        exiftoolPath = None
        if os.name == 'nt':
            exiftoolPath = exiftoolloc
        # get image metadata
        meta = metadata.Metadata(imageName, exiftoolPath=exiftoolPath)

        #calculating radiance image from raw image using micasense module
        radianceImage, L, V, R = msutils.raw_image_to_radiance(meta, imageRaw)

        #Saving the images in the same file format as they were originally
        #checking if folder is already there and if not, the folder is generated
        #The file structure is essentially \\PATHOFSAVEDIRECTORY\\000SET\\000
        #You have to determine what number the set folder is (i.e. 000SET or 001SET or 002SET) as well as which final folder number (000, 001, 002 etc.)
        #split filename at image directory
        subdir = imageName.split(origimgdirs[d])
        # merging save directory for folder "d" with the SET and 000 folders for the specific image file
        savedir = savedirs[d] + subdir[1][:-15]
        subdir1 = subdir[1].split('SET')
        setdir = savedirs[d] + subdir1[0] + 'SET'
        #if the path doesn't exist, make it
        if not os.path.exists(setdir):
            os.mkdir(setdir)
        if not os.path.exists(savedir):