class BinaryImage: def __init__(self): pass def compute_histogram(self, image): """Computes the histogram of the input image takes as input: image: a grey scale image returns a histogram as a list""" hist = [0]*256 return hist def find_otsu_threshold(self, hist): """analyses a histogram it to find the otsu's threshold assuming that the input hstogram is bimodal histogram takes as input hist: a bimodal histogram returns: an optimal threshold value (otsu's threshold)""" threshold = 0 return threshold def binarize(self, image): """Comptues the binary image of the the input image based on histogram analysis and thresholding take as input image: an grey scale image returns: a binary image""" bin_img = image.copy() return bin_img
class BinaryImage:
def __init__(self):
pass
def compute_histogram(self, image):
"""Computes the histogram of the input image
takes as input:
image: a grey scale image
returns a histogram as a list"""
hist = [0]*256
return hist
def find_otsu_threshold(self, hist):
"""analyses a histogram it to find the otsu's threshold assuming that the input hstogram is bimodal histogram
takes as input
hist: a bimodal histogram
returns: an optimal threshold value (otsu's threshold)"""
threshold = 0
return threshold
def binarize(self, image):
"""Comptues the binary image of the the input image based on histogram analysis and thresholding
take as input
image: an grey scale image
returns: a binary image"""
bin_img = image.copy()
return bin_img
Step by step
Solved in 3 steps with 1 images