mirror of
https://github.com/balajsra/EECS-442-WN19-DIC-Project.git
synced 2025-09-09 03:43: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
|
import cv2
|
||||||
from matplotlib import pyplot as plt
|
from matplotlib import pyplot as plt
|
||||||
import os
|
import os
|
||||||
|
import file_data
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
@@ -9,11 +10,12 @@ def main():
|
|||||||
images = readImages()
|
images = readImages()
|
||||||
|
|
||||||
#Read in data from Section001_Data.txt
|
#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
|
#Keep track of Stress and Strains
|
||||||
stresses = []
|
stresses = []
|
||||||
strains = []
|
strains = []
|
||||||
|
|
||||||
#Get distances using sift
|
#Get distances using sift
|
||||||
distances = getSiftDistance(images[0], images[1])
|
distances = getSiftDistance(images[0], images[1])
|
||||||
|
|
||||||
@@ -31,15 +33,14 @@ def main():
|
|||||||
"""
|
"""
|
||||||
for idx in range(0, len(images)-1):
|
for idx in range(0, len(images)-1):
|
||||||
distances = getSiftDistance(images[idx], images[idx+1])
|
distances = getSiftDistance(images[idx], images[idx+1])
|
||||||
strains.append(getStrain(loads[idx], surface_area))
|
strains.append(getStrain(specimen.ol, load_disp_data[idx].disp))
|
||||||
#stresses.append(getStress(length, ______))
|
stresses.append(load_disp_data[idx].stress)
|
||||||
youngs_mod = getYoungsModulus(strains[idx] / stress[idx])
|
youngs_mod = getYoungsModulus(strains[idx] / stress[idx])
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def readImages():
|
def readImages():
|
||||||
my_dir = os.path.dirname(os.path.realpath(__file__))
|
image_dir = '../images/'
|
||||||
image_dir = os.path.join(my_dir, "Images")
|
|
||||||
filenames = os.listdir(image_dir)
|
filenames = os.listdir(image_dir)
|
||||||
|
|
||||||
images = []
|
images = []
|
||||||
@@ -47,15 +48,8 @@ def readImages():
|
|||||||
images.append(cv2.imread(os.path.join(image_dir,file)))
|
images.append(cv2.imread(os.path.join(image_dir,file)))
|
||||||
return images
|
return images
|
||||||
|
|
||||||
def readSpecimenData():
|
def getStrain(length, displacement):
|
||||||
# TODO
|
return displacement / length
|
||||||
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 getYoungsModulus(strain, stress):
|
def getYoungsModulus(strain, stress):
|
||||||
return 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