<< Chapter < Page Chapter >> Page >
Learn how to implement a space-wise linear color-modification algorithm.

Revised: Sat Apr 02 16:43:04 CDT 2016

This page is included in the following Books:

Table of contents

Preface

This module is one of a series of modules designed to teach you about Object-Oriented Programming (OOP) using Java.

The program described in this module requires the use of the Guzdial-Ericson multimedia class library. You will find download, installation, and usageinstructions for the library at Java OOP: The Guzdial-Ericson Multimedia Class Library .

Viewing tip

I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the Figures and Listings while you are reading about them.

Figures

Listings

Preview

The program that I will explain in this module is designed to be used as a test of the student's understanding of programming using Java andEricson's media library.

The student is provided an image file named Prob03.jpg along with a written specification of a space-wise linear image modification algorithm.

Implement the algorithm

The primary purpose of the test is to determine if the student can implement the algorithm and also satisfy some requirements for text output on the commandline screen. Among other things, this requires that the student be able to:

  • Create a Picture object from an image file.
  • Write an accessor method to return a reference to the Picture object.
  • Modify the pixels in the picture according to the specified algorithm.
  • Display the raw picture and the modified picture in PictureExplorer objects by calling the explore method on the Picture object before and after it is modified.

The algorithm

Scale the blue and green color components by a scale factor that is less than or equal to 1.0. The green scale factor:

  • Is equal to 1.0 on the left side of the image
  • Is equal to 0.0 on the right side of the image
  • Decreases linearly with distance going from left to right across the image.

The blue scale factor

  • Is 0.0 on the left side of the image
  • Is 1.0 on the right side of the image
  • Increases linearly with distance going from left to right across the image.

Do not scale the red color component.

The program output

The program produces the images shown in Figure 1 and Figure 2 and produces the output text shown in Figure 3 on the command line screen.

Figure 1 - The raw image.

Questions & Answers

how to study physic and understand
Ewa Reply
what is conservative force with examples
Moses
what is work
Fredrick Reply
the transfer of energy by a force that causes an object to be displaced; the product of the component of the force in the direction of the displacement and the magnitude of the displacement
AI-Robot
why is it from light to gravity
Esther Reply
difference between model and theory
Esther
Is the ship moving at a constant velocity?
Kamogelo Reply
The full note of modern physics
aluet Reply
introduction to applications of nuclear physics
aluet Reply
the explanation is not in full details
Moses Reply
I need more explanation or all about kinematics
Moses
yes
zephaniah
I need more explanation or all about nuclear physics
aluet
Show that the equal masses particles emarge from collision at right angle by making explicit used of fact that momentum is a vector quantity
Muhammad Reply
yh
Isaac
A wave is described by the function D(x,t)=(1.6cm) sin[(1.2cm^-1(x+6.8cm/st] what are:a.Amplitude b. wavelength c. wave number d. frequency e. period f. velocity of speed.
Majok Reply
what is frontier of physics
Somto Reply
A body is projected upward at an angle 45° 18minutes with the horizontal with an initial speed of 40km per second. In hoe many seconds will the body reach the ground then how far from the point of projection will it strike. At what angle will the horizontal will strike
Gufraan Reply
Suppose hydrogen and oxygen are diffusing through air. A small amount of each is released simultaneously. How much time passes before the hydrogen is 1.00 s ahead of the oxygen? Such differences in arrival times are used as an analytical tool in gas chromatography.
Ezekiel Reply
please explain
Samuel
what's the definition of physics
Mobolaji Reply
what is physics
Nangun Reply
the science concerned with describing the interactions of energy, matter, space, and time; it is especially interested in what fundamental mechanisms underlie every phenomenon
AI-Robot
what is isotopes
Nangun Reply
nuclei having the same Z and different N s
AI-Robot
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with java. OpenStax CNX. Jun 29, 2016 Download for free at https://legacy.cnx.org/content/col11441/1.201
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?

Ask