mirror of
https://github.com/balajsra/EECS-442-WN19-DIC-Project.git
synced 2025-09-04 09:53:19 +00:00
Spacing and Tab Fixes in __main__.py
Renamed functions to use underscores and lowercase rather than camel case. Made minor spacing changes.
This commit is contained in:
@@ -4,10 +4,10 @@ from matplotlib import pyplot as plt
|
|||||||
import os
|
import os
|
||||||
import file_data
|
import file_data
|
||||||
|
|
||||||
def main():
|
|
||||||
|
|
||||||
|
def main():
|
||||||
# Read in all images
|
# Read in all images
|
||||||
images = readImages()
|
images = read_images()
|
||||||
|
|
||||||
# Read in data from Section001_Data.txt
|
# Read in data from Section001_Data.txt
|
||||||
specimen, load_disp_data = file_data.read_file("../Section001_Data.txt")
|
specimen, load_disp_data = file_data.read_file("../Section001_Data.txt")
|
||||||
@@ -17,7 +17,7 @@ def main():
|
|||||||
strains = []
|
strains = []
|
||||||
|
|
||||||
# Get distances using sift
|
# Get distances using sift
|
||||||
distances = getSiftDistance(images[0], images[1])
|
distances = get_sift_distance(images[8], images[9])
|
||||||
|
|
||||||
# These distances are coming out as zero for some reason.
|
# These distances are coming out as zero for some reason.
|
||||||
# Still trying to figure out if it's a bug in the code I
|
# Still trying to figure out if it's a bug in the code I
|
||||||
@@ -39,22 +39,26 @@ def main():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def readImages():
|
def read_images():
|
||||||
image_dir = '../images/'
|
image_dir = '../Images/'
|
||||||
filenames = os.listdir(image_dir)
|
filenames = os.listdir(image_dir)
|
||||||
|
|
||||||
images = []
|
images = []
|
||||||
for file in filenames:
|
for file in filenames:
|
||||||
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 getStrain(length, displacement):
|
|
||||||
|
def get_strain(length, displacement):
|
||||||
return displacement / length
|
return displacement / length
|
||||||
|
|
||||||
def getYoungsModulus(strain, stress):
|
|
||||||
return strain / stress
|
|
||||||
|
|
||||||
def getSiftDistance(img1, img2):
|
def get_youngs_modulus(strain, stress):
|
||||||
|
return stress / strain
|
||||||
|
|
||||||
|
|
||||||
|
def get_sift_distance(img1, img2):
|
||||||
""" Gets distance between matching pts in
|
""" Gets distance between matching pts in
|
||||||
img1 and img2.
|
img1 and img2.
|
||||||
"""
|
"""
|
||||||
@@ -96,7 +100,5 @@ def getSiftDistance(img1, img2):
|
|||||||
return distances
|
return distances
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
Reference in New Issue
Block a user