def resizeAndWrite(source, destination, widthIn):
    if (os.path.exists(source)):
        print("Source Path Left       : {}".format(source))
        print("Destination Path Right : {}".format(destination))
        cr.folderCheck(os.path.dirname(destination))
        resized = imutils.resize(cv2.imread(source), width=widthIn)
        print("Writing Resized Image of '{}' to '{}'".format(
            source, destination))
        cv2.imwrite(destination, resized)
        return True, resized
    else:
        print("File'{}' does not exist".format(sourcePathRight))
        return False, None
Exemple #2
0
cr.printLabel("Visual Camera Parametors:")
print("Height: {}, Width: {}, Frame Rate: {}".format(height, width, frameRate))

cr.printLabel("Gaining Camera Indexes")
myCmd = os.popen('v4l2-ctl --list-devices').read()
leftCamIndex = cr.getLeftWebCamIndex(myCmd)[1]
rightCamIndex = cr.getRightWebCamIndex(myCmd)[1]
print("Left Camera Index: {}".format(leftCamIndex))
print("Right Camera Index: {}".format(rightCamIndex))

cr.printLabel("Initiating Visual Cameras with Maximum Resolution")
capLeft = cr.openWebCamMPGJ(leftCamIndex, width, height, frameRate)
capRight = cr.openWebCamMPGJ(rightCamIndex, width, height, frameRate)

cr.printLabel("Creating Sub Directories")
cr.folderCheck(directory + "left")
cr.folderCheck(directory + "right")
cr.folderCheck(directory + "thermal")

cr.printLabel("Initiating Thermal Buffer")
BUF_SIZE = 2
q = Queue(BUF_SIZE)

cr.printLabel("Visual Camera Check")

if not capLeft.isOpened():
    print('Left Camera Stream Not opened')
    exit(0)
else:
    print("Left Camera Stream Open")
Exemple #3
0
    open("dataFiles/DF_003_stereoParams_Jetson002_Set1_2020_04_10_14_09_01.p",
         "rb"))
thermalParams = pickle.load(
    open("dataFiles/DF_005_thermalParams_Jetson002_Set1_2020_04_11_16_51_50.p",
         "rb"))
leftAndRightParametors = loadmat(
    'dataFiles/DF_002_pythonVisualJetson002_Set1_2020_04_10_14_07_40.mat')
imageFileNamesLeft = leftAndRightParametors['imageFileNames1']
imageFileNamesRight = leftAndRightParametors['imageFileNames2']

cr.printLabel("Gaining Stereo File Names from the Matlab Deployment")
leftFileNames, rightFileNames = cr.mat2PyGetStereoFileNames(
    imageFileNamesLeft, imageFileNamesRight)

cr.printLabel("Creating Sub Directories")
cr.folderCheck(directory + "leftResizedRectified/")
cr.folderCheck(directory + "rightResizedRectified/")
cr.folderCheck(directory + "thermalUndistorted/")

cr.printLabel("Savining Rectified Stereo Images")
cr.saveRectifiedForMatStereo(leftFileNames, rightFileNames, stereoParams)

cr.printLabel("Gaining Thermal File Names")
thermalFileNames = cr.getReplacedFileNames(leftFileNames, "leftResized",
                                           "thermal")

cr.printLabel("Savining Undistorted Thermal Images")
cr.saveUndistortedForMatThermal(thermalFileNames, thermalParams)

cr.printLabel("MINTS done")
Exemple #4
0
myCmd = os.popen('v4l2-ctl --list-devices').read()

leftCamIndex = cr.getLeftWebCamIndex(myCmd)[1]

print(leftCamIndex)

# #Initiate the cameras
print("Initiating Visual Cameras with Maximum Resolution")

capLeft = WebcamVideoStream(leftCamIndex).start()

print("Defining Directory")
directory = "/home/teamlary/mintsData/jetson001/"

print("Creating Directories")
cr.folderCheck(directory + "left")

nn = 10


def main():

    startTime = time.time()
    # your code
    for n in range(nn):
        print("Check: " + str(n))
        capLeft.read()

    while (True):

        dateTime = datetime.datetime.now()
import cv2

cr.printMINTS("fevSen")

directory = "/home/teamlary/mintsData/jetson002Set1/"

sourceLeft = directory + "left/"
sourceRight = directory + "right/"

destinationLeft = directory + "leftResized/"
destinationRight = directory + "rightResized/"

resizeWidth = 648

cr.printLabel("Creating Sub Directories")
cr.folderCheck(destinationLeft)
cr.folderCheck(destinationRight)


def resizeAndWrite(source, destination, widthIn):
    if (os.path.exists(source)):
        print("Source Path Left       : {}".format(source))
        print("Destination Path Right : {}".format(destination))
        cr.folderCheck(os.path.dirname(destination))
        resized = imutils.resize(cv2.imread(source), width=widthIn)
        print("Writing Resized Image of '{}' to '{}'".format(
            source, destination))
        cv2.imwrite(destination, resized)
        return True, resized
    else:
        print("File'{}' does not exist".format(sourcePathRight))
Exemple #6
0
cr.printMINTS("fevSen")

directory                  = "/home/teamlary/mintsData/jetson002Set1/"
sourceFolder               = "/home/teamlary/mintsData/jetson002Set1All/"
lookUpFolder               = directory +"left/"

destinationFolder           = directory

sourceFolderRight          = sourceFolder + "right/"
sourceFolderThermal        = sourceFolder + "thermal/"

destinationFolderRight     = destinationFolder + "right/"
destinationFolderThermal   = destinationFolder + "thermal/"

cr.printLabel("Creating Sub Directories")
cr.folderCheck(destinationFolderRight)
cr.folderCheck(destinationFolderThermal)


print("Listing all files")

if os.path.isdir(lookUpFolder):
    print("Available Files in '{}':".format(lookUpFolder))
    for fileName in sorted(os.listdir(lookUpFolder)):

        if fileName.endswith(".jpg"):
            full= lookUpFolder + fileName
            fileNameCheck   = fileName[0:26]

            # Moving Right Images
            sourcePathRight      = sourceFolderRight      + fileNameCheck + "_right.jpg"