Activity Day           Wedneday, June 08, 2016
Due Date Friday and you must finish one task in class for any credit.

 

Activity 3: [A3] Convolutions by Hand & Finding Edges in Different Directions


   

Motivation:

Learn about convolutions by creating new 3x3 kernels in provided python code inorder to find edges in different directions, and analyzing their results.

We hope this simple activity will provide (conceptually) a bases for the next homework, where you may implement your own versions of the convolution functions already available in openCV(), scipy (scipy.ndimage), or matplotlib, such as convolve2d(), filter2D(), numpy.convolve().

Setup:

A Starter Python File (draft):
http://cobweb.cs.uga.edu/~maria/classes/2016-CompPhoto/ac3/

Starter Images (zip file (here.zip) to retrieve all of them)

Activities (and Questions) Exploring openCV and numpy.

You should be able to finish all activities in class.

--- In class use 'circle' image (INDEX = 0) as your test image.
(1) Create a new kernel EdgeV so that it finds vertical edges. Modify the EdgeV matrix.
(2) Create a new kernel EdgeHV so that it finds diagonal edges. Modify the EdgeHV matrix.
(3) Create an embosses image, see how gimp does it: https://docs.gimp.org/en/plug-in-convmatrix.html
(4) Modify the def simpleConvolve(H,img), so that it works for arbitrarily larger square kernels, test it by demonstrating that it works for 5x5 17.151. Sharpen kernel given in the gimp link.

For Activity (1)-(2) modify the plot area so that it displays all images, including the embossed and sharpened kernel images in a 3, 2 display, see the image to the right above of Taj Mahal.

[ HINT: plt.subplot(2,3,1),plt.imshow(img,cmap = 'gray') ]


What to turn in in class.

You must complete at least completed activity (1) and show it to either a TA or instructor to get any credit.

On t-square you need to turn in a pdf file that includes 2 base images, similar to the 2 images depicted above demonstrating that you completed the activities.

In addition you need find 3 additional images that you have process.

PDF in pdf should have 6 images with some discussion analyzing the result.
image1.png - screenshot of the 2x2 plot area.
image2.png - screenshot of the 3x2 plot area including sharpening, and emboss kernel.

image3.png - image rich in vertical edges.
image4.png - image rich in horizonal edges.
image5.png - image rich in diagonal edges.
image6.png - image that looks cool result, as a result of some kernel, e.g., an emboss kernel.

On t-square, submit as attachment only (no zip files please):
1. activity3-code.py
2. activity3-discussion.pdf (with resulting images template)

Grade Criteria:

coming up - it will be per image.

 

Resources:

openCV-Python documentation and tutorials:
http://docs.opencv.org/3.1.0/d6/d00/tutorial_py_root.html#gsc.tab=0

numpy (scipy) documentation and tutorials (operations on matrices, and on linear algebra!).
http://scipy.github.io/old-wiki/pages/Tentative_NumPy_Tutorial.html