### kelly change

parent 88b0738b
.DS_Store 0 → 100644
This diff is collapsed.

642 KB

 ... ... @@ -101,26 +101,15 @@ def plot_hist(tiff_list): 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(col) # keep the first row from the image diff[:,0] = np.zeros(row) 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 predict[-1,:] = image[-1,:] # keep the first row from the image predict[:,-1] = image[:,-1] # keep the first columen from the image diff = np.empty([row,col]) diff[0,:] = np.zeros(col) # keep the first row from the image diff[:,0] = np.zeros(row) diff[-1,:] = np.zeros(col) # keep the first row from the image diff[:,-1] = np.zeros(row) predict = np.empty([row-1,col-1]) # create a empty matrix to update prediction temp = image.copy diff = np.empty([row-1,col-1]) for r in range(1,row-1): # loop through the rth row for c in range(1,col-1): # loop through the cth column surrounding = np.array([predict[r-1,c-1], predict[r-1,c], predict[r-1,c+1], predict[r,c-1]]) surrounding = np.array([temp[r-1,c-1], temp[r-1,c], temp[r-1,c+1], temp[r,c-1]]) predict[r,c] = np.mean(surrounding) # take the mean of the previous 4 pixels temp[r,c] = np.mean(surrounding) diff[r,c] = (np.max(surrounding)-np.min(surrounding)) predict = np.ravel(predict) ... ...
This diff is collapsed.
images/.DS_Store 0 → 100644