Commit 2aa38181 authored by Kelly Chang's avatar Kelly Chang

some changes

parent 2838647d
......@@ -72,7 +72,7 @@ def plot_hist(tiff_list):
As it stands it needs some work in order to function again. We will
fix this later. 1/25/22
"""
jj = 0
'''jj = 0
fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(15,12))
for cam, ax in zip(cameras, axs.ravel()):
diff = []
......@@ -80,7 +80,6 @@ def plot_hist(tiff_list):
image = Image.open(cam[ii]) #Open the image and read it as an Image object
image = np.array(image)[1:,:] #Convert to an array, leaving out the first row because the first row is just housekeeping data
ar1, ar2 = image.shape
ind1, ind2 = np.random.randint(1,ar1-1), np.random.randint(1,ar2-1) #ind1 randomly selects a row, ind2 randomly selects a column,
#this is now a random pixel selection within the image
......@@ -96,7 +95,24 @@ def plot_hist(tiff_list):
jj += 1
plt.tight_layout()
plt.show()
return
return '''
image = tiff_list[0]
image = Image.open(image) #Open the image and read it as an Image object
image = np.array(image)[1:,:] #Convert to an array, leaving out the first row because the first row is just housekeeping data
row, col = image.shape
predict = np.empty(row,col) # create a empty matrix to update prediction
predict[0,:] = image[0,:] # keep the first row from the image
predict[:,0] = image[:,0] # keep the first columen from the image
diff = np.empty(row,col)
diff[0,:] = np.zeros(row) # keep the first row from the image
diff[:,0] = np.zeros(col)
for r in range(1,row): # loop through the rth row
for c in range(1,col): # loop through the cth column
surrounding = anp.array([predict[r-1,c-1], predict[r-1,c], predict[r-1,c+1], predict[r1,c-1]])
predict[r,c] = np.mean(surrounding) # take the mean of the previous 4 pixels
diff[r,c] = (np.max(surrounding)-np.min(surrounding))
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment