Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def extractParticles(greyIm, LabIm): | |
locations = nd.find_objects(LabIm) | |
i=1 | |
extracted_images=[] | |
for loc in locations: | |
lab_image = np.copy(LabIm[loc]) | |
grey_image = np.copy(greyIm[loc]) | |
lab_image[lab_image<>i]=0 | |
grey_image[lab_image <>i]=0 | |
extracted_images.append(grey_image) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def ResizeImages(ImList): | |
'''Find the largest width and height of images belonging to a list. | |
Return a list of images of same width/height | |
''' | |
maxwidth=0 | |
maxheight=0 | |
if len(np.shape(ImList[0]))==3: | |
components = np.shape(ImList[0])[2] | |
imtype = ImList[0].dtype | |
for i in range(len(ImList)): |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
from PIL import Image, ImageDraw, ImageFont | |
import mahotas as mh | |
def makeLetterImage(character, size): | |
image = Image.new("RGBA", (600,150), (255,255,255)) | |
draw = ImageDraw.Draw(image) | |
font = ImageFont.truetype("verdana.ttf", size) | |
draw.text((5, 0), character, (0,0,0), font=font) | |
img_resized = np.array(image.resize((300,75), Image.ANTIALIAS)) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer