Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

o complete the lab, complete illinify , spotlight , and watermark functions in lab_intro.cpp . You will find a complete grayscale function (above) is already

o complete the lab, complete

illinify

,

spotlight

, and

watermark

functions in

lab_intro.cpp

. You will find

a complete

grayscale

function (above) is already provided for you.

All C++ programs begin with the

main

function, which is usually defined in

main.cpp

. You can find that a

main

function has been provided for you that:

1. Loads in the image

alma.png

2. Calls each image modification function

3. Saves the modified image as

out-MODIFIED.png

, where

MODIFIED

is the modification (eg:

out-

grayscale.png

)

A description of each function is provided in

lab_intro.cpp

and examples are given below:

Compiling the Code

To compile your code, run the following from your

lab_intro

directory:

To

illinify

an image is to transform the hue of

every pixel to Illini Orange or Illini Blue.

The hue of every pixel is set to the a hue value of

either orange or blue, based on if the pixel's hue

value is closer to orange than blue.

Remember, hue

values are a circle!

To

spotlight

an image is to create a spotlight

centered at a given point: (centerX, centerY).

A spotlight adjusts the luminance of a pixel based

on the Euclidean distance the pixel is away from

the center by decreasing the luminance by 0.5%

per 1 pixel Euclidean distance away from the

center, up to an 80% decrease in luminance.

For example, a pixel 3 pixels above and 4 pixels to

the right of the center is a total of

pixels away and its

luminance is decreased by 2.5% (0.975x its original

value). At a distance over 160 pixels away, the

luminance will always be decreased by 80% (0.2x

its original value).

To

watermark

an image is to lighten a region of an

image

based on the contents of a

spotlight

, given

both images.

For every pixel that exists within the bounds of

both

image

and

spotlight

, the luminance of

image

must be increased by +0.2 (absolute, but not to

exceed 1.0) if and only if the luminance of

spotlight

at the same pixel is 100%.

You should not assume anything about the size of

the images. However, you need only consider the

range of pixels that exist in both images.

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

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions