<--begin container-->

Homework 5

a. Erosion

Erosion

Source

//check if me is white
if (me == 255) {
	//check if me is touching black
	if (ne == 0 || n_ == 0 || nw == 0 || _e == 0 || _w == 0 || se == 0 || s_ == 0 || sw == 0) {
		me = 0;
	}
}
            
pixelsAltered1[pixIndex]  = me;

Team JAB (Joseph, Antoninus, Bruce) working on the algorithm for erosion. Click on the image for a larger view.

b. Dilation

Dilation

Source

//check if me is white
if (me == 0) {
	//check if me is touching white
	if (ne == 255 || n_ == 255 || nw == 255 || _e == 255 || _w == 255 || se == 255 || s_ == 255 || sw == 255) {
		me = 255;
	}
}
			
pixelsAltered1[pixIndex]  = me;

Team JAB (Joseph, Antoninus, Bruce) working on the algorithm for dilation. Click on the image for a larger view.

b. Connected Components

Connected Components

7 blobs

Connected Components

340 blobs

Connected Components

5 blobs

Connected Components

1 blob

Connected Components

8 blobs

Source

Team JAB (Joseph, Antoninus, Bruce) working on the algorithm for connected components. Click on the images for a larger views.