Monday, October 10, 2016

Exer7: Optical Character Recognition Part 1


In this exercise we were tasked to detect what number is present on the input image.

To do so we used a set of training images as basis. For each number, we made five samples thus resulting in 50 control images.

We used Euclidean Distance Formula:


This formula is used on the training data images and on the input image. The lower the result, the closest it is to the input image.




Training Data
Sample Input Images Used
Correct output!
Incorrect output :(

Although we were able to detect the connected components, some of the numbers resulted to the wrong output. Perhaps the features that we used aren't enough.

Exer6: Erosion-Dilation

For this exercise we were tasked to detect the shaded and count the shaded circles in the evaluation forms.

There were the following problems/concerns in the exercise:
  • 'x' marks exist in some forms where the answers were changed. 'x' marks should not be detected as a circle
  • some circles are lightly shaded
In order to get the desired output, we used a lot of preprocessing techniques (blurring, erosion, dilation, binarization, etc.) to enhance the image before detecting the circles.

Successfully detected image!

Unable to distinguish 'x' marks from circles

As seen on the second image, we were not able to distinguish the 'x' marks.

Monday, September 19, 2016

Exer5: BLOBS

There were two parts:

PART1: Coins

The activity is to box the coins depending on the value. After boxing the coins, the total value will be computed.

  • 5 centavos - RED
  • 10 centavos - BLUE
  • 25 centavos - PINK
  • 1 peso - YELLOW
  • 5 pesos - GREEN

original image (coins1.jpg)


image after binarization


OUTPUT YAY


PART2: Objects

Objects seen in the given image are to be boxed, identified and labeled.


original image(objects.jpg)


image after binarization


OUTPUT YAY. lols Nokia3310 ftw








Exer4: Canny Edge Detection and Adaptive Thresholding

We had two tasks for this exer:

First was to highlight the text of the following images and turn the background to white. First we had to get the threshold of all the images and binarize them afterwards. (Simple)


japbend.jpg



japflat.jpg


magazin1.jpg



magazin2.jpg


Second activity was to get the edges of a certain image after binarizing it. Canny Edge detection was used.

original image (source.jpg)

after adaptive thresholding and canny edge detection











Monday, August 29, 2016

Exercise 3: Image Filtering

Original Image



Mean Filtering

Kernel 1:
1  1  1
1  1  1
1  1  1


Kernel 2:
-1  -1  -1
-1   8  -1
-1  -1  -1


Kernel 3:
1  2  1
2  4  2
1  2  1


Kernel 4:
1  0  0
0  1  0
0  0  1


Kernel 5:
0  -1   0
-1   5  -1
0  -1   0



Comparison:
  • Out of all kernels, kernel 1 produced the smoothest and clearest image. It's color is also closest to the original image.
  • Kernel 2 produced the image with most noise. Also it's color changed the most as compared to the other kernels. 
  • Kernel 3 produced a somewhat smooth image but the color of the original image changed.
  • 4th and 5th kernel resulted in smooth but very dark images. Kernel 5 gave the darkest image out of all.

Median Filtering

Kernel 1:
1  1  1
1  1  1
1  1  1


Kernel 2:
-1  -1  -1
-1   8  -1
-1  -1  -1


Kernel 3:
1  2  1
2  4  2
1  2  1


Kernel 4:
1  0  0
0  1  0
0  0  1


Kernel 5:
0  -1   0
-1   5  -1
0  -1   0


Comparison:
  • All images, except kernel 4 and 5, gave good results which is a smooth image.
  • Kernel 1 is the most similar to the original image.
  • Kernel 2's colors are the most different as compared to the other kernels (image negative)
  • Kernel 1 and 2 gave the smoothest results.
  • There are still a few grains and noise in kernel 3.
  • The original image is no longer visible in kernel 4 and 5. It only resulted in a black image.








Saturday, August 27, 2016

Exer2: Histogram

Daytime Image Histogram:


Colors of the daytime image are deviated more to the 0 values since there are plenty of dark colors in the image. The contrast is pretty good since there peaks in the histogram.

Nighttime Image Histogram:


Peak of the histograms is almost all (if not) near the 0 value. Image is mostly composed of dark colors.
Low Contrast Image Histogram:

Colors are not very evenly distributed since there are almost no colors near the 0 value. Colors focus more on the 255 values since the image is light to begin with. Contrast is low because peaks in the image are not high.

High Contrast Image Histogram:


Peak is the highest here as compared the other images. Colors are "kind of" evenly distributed.


  • Colors are mostly evenly distributed in the daytime image as compared to the other images.
  • Peaks are lowest in the low contrast image. Because of the image's low contrast. Highest in the high contrast image.









Monday, August 22, 2016

Exercise 2: Image Transformation Compare and Contrast

  • Daytime Image
    • The original image has good contrast and lightning.
    • After using the first function the colors of the image were inverted. The used to be white parts of the original image are converted to darker colors and are now easier to identify. Using the first function may be useful to highlight the lighter (or white) details of the original image.
    • Using the second function made the original image darker. Details of the image are now harder to observe and identify. I honestly don't see the point of this function.
    • The third function made the original image lighter and the contrast of the image is now lower. It now has a "foggier" feel to it.
 

  • Nighttime Image
    • The original image is a bit grainy and well, dark. Details of the image are hard to identify. Street lights/lamps are the most obvious parts of the image.
    • Since the first function converts the original image to its image negative, the new image now is almost all "white" or light colors since the original image was dark to begin with. Only street lights are identifiable in the new image.
    • Using second function made the image almost entirely black. Only the lights are seen in the image (and even these are dim).
    • The third function made the image a bit lighter. Still, details of the image are not seen because even if the image is lighter the contrast is very low. Using this function kind of blurred the image.

      

  • High Contrast Image
    • The original image has high contrast thus the small details of the image are easily identifiable.
    • Even after using the first function and the image is converted to its negative, details are still highly emphasized since the contrast of the original image is high.
    •  Although the second function made the image darker, the new image is a bit lighter as compared to the outputs from the daytime image and the nighttime image. This maybe the result of having high contrast.
    • The third function made the image brighter and it lowered the original image's contrast.


  • Low Contrast Image
    • The original image has low contrast. Details from afar are not as easily identifiable as compared to the high contrast image.
    • The first function actually helps in highlighting details from afar. After being converted to its image negative, small details can now be easily observed.
    • Again, the second image only makes the image darker. Details are harder to observe in this image.
    •  The third function lowers the contrast even more. This blurs the overall already blurry image.





Final Thoughts?
  • After using the first function, there's is obviously a notable change since the images are converted to their negatives. Most notable change is on the nighttime image since the entire image is dark thus the image negative resulted into a mostly white image.
  • The second function only darkens the images. Again, the nighttime image was the most notable since the entire image turned almost all black after applying the function. I still don't know why we use this function.
  • Applying the third function lowers the contrast of the images. This may be good to use for images with contrasts that are too high. For example, after applying this function on the high contrast image the resulting image is now a bit easier on the eyes.