Open main menu

CDOT Wiki β

Changes

BLAStoise

1,640 bytes added, 02:30, 12 February 2017
Assignment 1
=== Assignment 1 ===
'''Sudoku Solverby Matt B.'''
Sudoku solver is a program that solves a sudoku puzzle. The user can input an existing file and have the program solve this, or can manually enter values to be solved. The sudoku puzzle is 9x9 in size. The data needs to be in a specific format for the program to work. There are 9 rows of values, with each cell/element in the row needing to be separated by a space. A value of 0 tells the program to solve this value.
'''Oil PaintingBy Sallie J.'''
This program converts a regular image into a stylized oil painting, it uses OpenCV. The painting algorithm depends on the brush size and colour intensity. The program takes three command line arguments: int for brush size, int for intensity and file name of an image. Upon finishing, the program produces the original image along with the oil paint version and the total time required in seconds.
$
 
The time required for the program depends largely on the file size being converted. Around 5 seconds for a 50KB image and 100 seconds for a 1MB image. It depends on the brush size and intensity levels as well.
 
'''Analysis'''
 
The profiling revealed that 99% of the processing time is spent in the paint function where the for-loop logic is located. Within that 99% the program spends roughly 2/3rds of its time reading accessing data through the "at" function of the OpenCV Mat class (n-dimensional dense array class). The other 1/3 is spent on direct access through OpenCV’s Vec class (short numerical vectors). The for-loop is structured divides the picture up based on brush size. Then it finds the colour for each pixel in that section. Finally, it then averages the intensity to produce the final colour of that group of pixels. This is what makes this program ideal for parallelizing, because each iteration of this for-loop is calculating the final colours for each pixel. (SIMD type of process, the single instruction is to find the final colour and the multiple data is the pixels.)
//Simplified for-loop structure
for (int y = BrushSize; y < (height - BrushSize); y++) //for each row based on brush size
{
for (int x = BrushSize; x < (width - BrushSize); x++) //for each column in brush size
{
for (int j = -BrushSize; j <= BrushSize; j++) //for each pixel row in one brush size grouping
{
for (int i = -BrushSize; i <= BrushSize; i++)//for each pixel column in one brush size grouping
{ //algorithm and logic for colour calculations }
}
}
}
=== Assignment 2 ===
=== Assignment 3 ===
23
edits