Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having some trouble with C++ coding activities involving images. Any help is appreciated. The code doesn't have to be perfect but anything to

I am having some trouble with C++ coding activities involving images. Any help is appreciated. The code doesn't have to be perfect but anything to get me started or to point me in the right direction would be great.

A) Given an image of coins on a table, count the number of pennies! Note that you are provided three images to test with, but your code should work for any similar image. (Assume that the images were taken with the same camera, at the same distance from the table)

Notes

Approximately 17 lines of code Use Microsoft Paint or Digital Color Meter to find the color of the penny

Program Inputs Enter image name:

The user will always enter a valid filename Program Outputs

Number of pennies: XXX Replace XXX with the number of pennies in the image

Test Case 1:

 Enter image name: Penny_Alpha.png Number of pennies: 1 

Test Case 2:

 Enter image name: Penny_Bravo.png Number of pennies: 2 

Test Case 3:

 Enter image name: Penny_Charlie.png Number of pennies: 3 

B)

An image kernel is a mathematical operation that creates interesting effects on im- ages (extra reading: http://docs.gimp.org/en/plug-in-convmatrix.html). It really is nothing more than a 3 by 3 table/matrix of numbers! To use the kernel, we place it over every row and column in the image and multiply the pixel color values by the number in the kernel, yielding 9 multiplications. These multiplications are summed together to get 1 value, which is placed in a new image at the center row and column of the kernel matrix.

Different kernels simply have different numbers in the matrix!

Follow these steps to implement your own image kernel to outline any image:

Download the NinjaTurtles and PowerRangers images to your Debug folder of Codelite Let the user pick which image to open and find its dimensions Create a blank image the same size Skipping the outside edges, go through every row, column, color in the image

Multiply all neighbors around the current row, column, and color with the corresponding spot in the image kernel. Sum all these values together!

Place this new value into the blank image at the current row, column, and color Save the new image as Outline.png

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions