예제 #1
0
from image_processing import ImageProcessing

import cv2

beforeL = cv2.imread(
    "/home/tino/smt_image_data/SmtImageData/342411_20161007-175850_L.tif")
afterL = cv2.imread(
    "/home/tino/smt_image_data/SmtImageData/342411_20161007-183433_L.tif")

beforeR = cv2.imread(
    "/home/tino/smt_image_data/SmtImageData/388903_20161028-044310_R.tif")
afterR = cv2.imread(
    "/home/tino/smt_image_data/SmtImageData/388903_20161028-044623_R.tif")

processing = ImageProcessing()
result = processing.determineDisplacement(beforeL, beforeR, afterL, afterR)
print(result)
예제 #2
0
print("Processing files")

outputFile = open("./displacements.csv", "w")

with outputFile:
    ids = len(filesForId)
    for id in filesForId:
        files = filesForId[id]
        if len(files) != 4:
            print("WHAT?")
        files.sort()
        print(files)
        beforeLeft = cv2.imread(FOLDER + files[0])
        beforeRight = cv2.imread(FOLDER + files[1])
        afterLeft = cv2.imread(FOLDER + files[2])
        afterRight = cv2.imread(FOLDER + files[3])
        try:
            displLeft, displRight, _, _, qualityScore = imageProcessor.determineDisplacement(
                beforeLeft, beforeRight, afterLeft, afterRight)
            print("Quality Score: " + str(qualityScore))
        except:
            continue

        outputFile.write(
            str(id) + "," + str(displLeft[0]) + "," + str(displLeft[1][0]) +
            "," + str(displLeft[1][1]) + "," + str(displRight[0]) + "," +
            str(displRight[1][0]) + "," + str(displRight[1][1]) + "," +
            str(qualityScore) + "\n")
        outputFile.flush()
        print(displLeft)
        print(displRight)