mirror of
https://github.com/balajsra/EECS-442-WN19-DIC-Project.git
synced 2025-09-07 19:03:14 +00:00
Merged Changes
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
import numpy as np
|
||||
import cv2
|
||||
|
||||
|
||||
def sift_distance():
|
||||
sift = cv2.xfeatures2d.SIFT_create()
|
||||
original_kp, original_des = sift.detectAndCompute(left,None)
|
||||
new_kp, new_des = sift.detectAndCompute(right,None)
|
||||
|
||||
bf = cv2.BFMatcher()
|
||||
matches = bf.knnMatch(original_des, new_des, k=2)
|
||||
|
||||
# Apply ratio test
|
||||
good = []
|
||||
for m, n in matches:
|
||||
if m.distance < 0.3 * n.distance:
|
||||
good.append([m])
|
||||
|
||||
# Featured matched keypoints from images 1 and 2
|
||||
pts1 = np.float32([original_kp[m.queryIdx].pt for m in good])
|
||||
pts2 = np.float32([new_kp[m.trainIdx].pt for m in good])
|
||||
|
||||
#convert to complex number
|
||||
z1 = np.array([[complex(c[0],c[1]) for c in pts1]])
|
||||
z2 = np.array([[complex(c[0],c[1]) for c in pts2]])
|
||||
|
||||
# Distance between featured matched keypoints
|
||||
FM_dist = abs(z2 - z1)
|
@@ -2,6 +2,7 @@ import numpy as np
|
||||
import cv2
|
||||
from matplotlib import pyplot as plt
|
||||
import os
|
||||
import file_data
|
||||
|
||||
def main():
|
||||
|
||||
@@ -9,11 +10,12 @@ def main():
|
||||
images = readImages()
|
||||
|
||||
#Read in data from Section001_Data.txt
|
||||
loads, displacements, surface_area, length = readSpecimenData()
|
||||
specimen, load_disp_data = file_data.read_file("../Section001_Data.txt")
|
||||
|
||||
#Keep track of Stress and Strains
|
||||
stresses = []
|
||||
strains = []
|
||||
|
||||
#Get distances using sift
|
||||
distances = getSiftDistance(images[0], images[1])
|
||||
|
||||
@@ -31,15 +33,14 @@ def main():
|
||||
"""
|
||||
for idx in range(0, len(images)-1):
|
||||
distances = getSiftDistance(images[idx], images[idx+1])
|
||||
strains.append(getStrain(loads[idx], surface_area))
|
||||
#stresses.append(getStress(length, ______))
|
||||
strains.append(getStrain(specimen.ol, load_disp_data[idx].disp))
|
||||
stresses.append(load_disp_data[idx].stress)
|
||||
youngs_mod = getYoungsModulus(strains[idx] / stress[idx])
|
||||
"""
|
||||
|
||||
|
||||
def readImages():
|
||||
my_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
image_dir = os.path.join(my_dir, "Images")
|
||||
image_dir = '../images/'
|
||||
filenames = os.listdir(image_dir)
|
||||
|
||||
images = []
|
||||
@@ -47,15 +48,8 @@ def readImages():
|
||||
images.append(cv2.imread(os.path.join(image_dir,file)))
|
||||
return images
|
||||
|
||||
def readSpecimenData():
|
||||
# TODO
|
||||
return None, None, None, None
|
||||
|
||||
def getStrain(load, surface_area):
|
||||
return load / surface_area
|
||||
|
||||
def getStress(length, change_in_length):
|
||||
return change_in_length / length
|
||||
def getStrain(length, displacement):
|
||||
return displacement / length
|
||||
|
||||
def getYoungsModulus(strain, stress):
|
||||
return strain / stress
|
20
src/main.py
20
src/main.py
@@ -1,20 +0,0 @@
|
||||
#############################################################
|
||||
# EECS 442: Computer Vision - W19 #
|
||||
#############################################################
|
||||
# Authors: Sravan Balaji & Kevin Monpara #
|
||||
# Filename: main.py #
|
||||
# Description: #
|
||||
# #
|
||||
#############################################################
|
||||
|
||||
import file_data
|
||||
|
||||
|
||||
def main():
|
||||
specimen, load_disp_data = file_data.read_file("../Section001_Data.txt")
|
||||
|
||||
print("Done")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user