-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further developmetn of colour handling
- Loading branch information
1 parent
3152c4f
commit 8a62f9b
Showing
21 changed files
with
277 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Example of removal of fibre bundle core pattern from colour images by | ||
Delaunay triangulation and triangular linear interpolation. | ||
@author: Mike Hughes | ||
Applied Optics Group | ||
University of Kent | ||
""" | ||
|
||
from matplotlib import pyplot as plt | ||
import numpy as np | ||
import time | ||
|
||
from PIL import Image | ||
|
||
import context # Add relative path to get PyBundle | ||
|
||
import os | ||
import pybundle | ||
from pybundle import PyBundle | ||
|
||
# We load in two images, an image with uniform illumination for calibation | ||
# and a image of letters to demonstrate core removal | ||
img = np.array(Image.open(r"..\test\data\bundle_colour_1.tif")) | ||
calibImg = np.array(Image.open(r"..\test\data\bundle_colour_1_background.tif")) | ||
|
||
|
||
# Parameters for reconstruction | ||
coreSize = 3 # Estimated core size used when searching for cores | ||
gridSize = 512 # Number of pixels in reconstructed image | ||
filterSize = None # Pre-Gaussian filter sigma | ||
|
||
|
||
pyb = pybundle.PyBundle(coreMethod = PyBundle.TRILIN, | ||
calibImage = calibImg, | ||
normaliseImage = calibImg, | ||
coreSize = 3, | ||
gridSize = 512) | ||
|
||
# One-time calibration | ||
t1 = time.perf_counter() | ||
pyb.calibrate() | ||
t2 = time.perf_counter() | ||
print('Calibration took:', round(t2-t1,3),'s') | ||
|
||
# Image reconstruction without Numba | ||
imgRecon = pyb.process(img) | ||
t1 = time.perf_counter() | ||
imgRecon = pyb.process(img) | ||
t2 = time.perf_counter() | ||
print('Reconstruction took:', round(t2-t1,4),'s') | ||
|
||
# Display reconstructed image | ||
plt.figure(dpi = 300) | ||
plt.imshow(img, cmap='gray') | ||
plt.title('Raw Image') | ||
plt.show() | ||
|
||
# Display reconstructed image | ||
plt.figure(dpi = 300) | ||
plt.imshow(imgRecon / 1024, cmap='gray') | ||
plt.title('Reconstruction by interpolation') | ||
plt.show() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.