Commit c1140af0 authored by Richard Torenvliet's avatar Richard Torenvliet

worked on test

parent 781de467
...@@ -3,6 +3,7 @@ from LocalBinaryPatternizer import LocalBinaryPatternizer ...@@ -3,6 +3,7 @@ from LocalBinaryPatternizer import LocalBinaryPatternizer
from LetterCropper import LetterCropper from LetterCropper import LetterCropper
from matplotlib.pyplot import imshow, subplot, show, axis from matplotlib.pyplot import imshow, subplot, show, axis
from NormalizedImage import NormalizedImage from NormalizedImage import NormalizedImage
from GaussianFilter import GaussianFilter
# Comment added by Richard Torenvliet # Comment added by Richard Torenvliet
# Steps in this test files are # Steps in this test files are
...@@ -14,11 +15,15 @@ from NormalizedImage import NormalizedImage ...@@ -14,11 +15,15 @@ from NormalizedImage import NormalizedImage
# Image is now an instance of class GrayscaleImage # Image is now an instance of class GrayscaleImage
# GrayscaleImage has functions like resize, crop etc. # GrayscaleImage has functions like resize, crop etc.
image = GrayscaleImage("../images/test.png") image = GrayscaleImage("../images/test9.png")
filter = GaussianFilter(1.4)
image = filter.get_filtered_copy(image)
# Crops image; param threshold is optional: LetterCropper(image, threshold=0.9) # Crops image; param threshold is optional: LetterCropper(image, threshold=0.9)
# image: GrayscaleImage, threshold: float # image: GrayscaleImage, threshold: float
cropper = LetterCropper(image, 0.9)
cropper = LetterCropper(image, 0.7)
cropped_letter = cropper.get_cropped_letter() cropped_letter = cropper.get_cropped_letter()
# Show difference in shape # Show difference in shape
...@@ -29,11 +34,16 @@ print cropped_letter.shape ...@@ -29,11 +34,16 @@ print cropped_letter.shape
norm = NormalizedImage(cropped_letter) norm = NormalizedImage(cropped_letter)
resized = norm.get_normalized_letter() resized = norm.get_normalized_letter()
print resized.show()
show()
# Difference is noticable # Difference is noticable
print resized.shape print resized.shape
lbp = LocalBinaryPatternizer(resized) lbp = LocalBinaryPatternizer(resized)
feature_vector = lbp.create_features_vector() feature_vector = lbp.create_features_vector()
print feature_vector
feature_vector /= 255 # Prepare for displaying -> 0 - 255 -> 0 - 1 feature_vector /= 255 # Prepare for displaying -> 0 - 255 -> 0 - 1
subplot(141) subplot(141)
......
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