<< Chapter < Page Chapter >> Page >
This module contains review questions and answers keyed to the module titled Java3016: Green-Screen Processing.

Revised: Sun Apr 03 14:07:48 CDT 2016

This page is included in the following Books:

Table of contents

Preface

This module contains review questions and answers keyed to the module titled Java3016: Green-Screen Processing .

The questions and the answers are connected by hyperlinks to make it easy for you to navigate from the question to the answer and back again.

Questions

Question 1 .

Given Figure 1 , Figure 2 , Figure 3 , and Figure 4 , which of the following output images is produced by the code in Listing 1 ?

A. Figure 5

B. Figure 6

Listing 1 . Question 1.
/*File Java3016ra Copyright 2013 R.G.Baldwin Revised 02/15/13*********************************************************/ import java.awt.Color;public class Java3016ra{ public static void main(String[]args){ new Java3016raRunner().run();}//end main }//end class Java3016ra//======================================================// class Java3016raRunner{public void run(){ Picture snowScene = crop(new Picture("Prob03d.jpg"),6,59,344,256); greenScreenDraw(crop(new Picture("Prob03a.bmp"),123,59,110,256),snowScene,117,0); greenScreenDraw(crop(new Picture("Prob03c.bmp"),123,59,110,256). getPictureWithHeight(256/2),snowScene,55,64);greenScreenDraw( crop(new Picture("Prob03b.bmp"),123,59,110,256).getPictureWithHeight(256/3),snowScene,260,96); snowScene.explore();}//end run method //----------------------------------------------------//private void greenScreenDraw(Picture source, Picture dest,int destX, int destY){Pixel pixel = null; Color color = null;for(int row = 0;row<source.getHeight();row++){ for(int col = 0;col<source.getWidth();col++){ color = source.getPixel(col,row).getColor();if((!(color.equals(Color.GREEN)))&&(!(color.getRed()<40))){ dest.getPixel(destX + col,destY + row).setColor(color); }//end if}//end inner loop }//end outer loop}//end greenScreenDraw //----------------------------------------------------//private Picture crop(Picture pic,int startCol, int startRow,int width, int height){Picture output = new Picture(width,height); int colOut = 0,rowOut=0,col=0,row=0;Pixel pixel = null; Color color = null;for(col = startCol; col<startCol+width; col++,colOut++){for(row = startRow; row<startRow+height; row++,rowOut++){output.getPixel(colOut,rowOut). setColor(pic.getPixel(col,row).getColor());}//end inner loop rowOut = 0;}//end outer loop return output;}//end crop //----------------------------------------------------// }//end class Java3016raRunner

Figure 1 - Prob03a.bmp.

Front view of a female ice skater on a green background.

Figure 2 - Prob03b.bmp.

Left side view of a female ice skater on a green background.

Figure 3 - Prob03c.bmp.

Right side view of a female ice skater on a green background.

Figure 4 - Prob03d.jpg.

View of a frozen lake with some houses on the far side.

Figure 5 - Possible output image.

Image of three ice skaters on the frozen lake wearing a blue costume.

Figure 6 - Possible output image.

Image of three ice skaters on the frozen lake. However, the image of the ice skater is transparent in the areas of the blue costume allowing the background to show through.

Answer 1

Figures

Listings

What is the meaning of the following two images?

This image was inserted here simply to insert some space between the questions and the answers to keep them from being visible on the screen at thesame time.

The image is also an example of the kinds of things that we do in my course titled ITSE 2321, Object-Oriented Programming.

Spacer image of a rabbit and a penguin.

This image was also inserted for the purpose of inserting space between the questions and the answers.

Spacer image of a penguin in the snow in front of some houses.

Answers

Answer 1

The code in Listing 1 produces the output image shown in Figure 6 .

Back to Question 1

Miscellaneous

This section contains a variety of miscellaneous information.

Housekeeping material
  • Module name: Java3016r Review
  • File: Java3016r.htm
  • Published: 02/17/13
Disclaimers:

Financial : Although the Connexions site makes it possible for you to download aPDF file for this module at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, youshould be aware that some of the HTML elements in this module may not translate well into PDF.

I also want you to know that, I receive no financial compensation from the Connexions website even if you purchase the PDF version ofthe module.

In the past, unknown individuals have copied my modules from cnx.org, converted them to Kindle books, and placed them for sale onAmazon.com showing me as the author. I neither receive compensation for those sales nor do I know who does receive compensation. If youpurchase such a book, please be aware that it is a copy of a module that is freely available on cnx.org and that it was made andpublished without my prior knowledge.

Affiliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX.

-end-

Questions & Answers

how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
Do somebody tell me a best nano engineering book for beginners?
s. Reply
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Harper
Do you know which machine is used to that process?
s.
how to fabricate graphene ink ?
SUYASH Reply
for screen printed electrodes ?
SUYASH
What is lattice structure?
s. Reply
of graphene you mean?
Ebrahim
or in general
Ebrahim
in general
s.
Graphene has a hexagonal structure
tahir
On having this app for quite a bit time, Haven't realised there's a chat room in it.
Cied
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
China
Cied
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
Porter
many many of nanotubes
Porter
what is the k.e before it land
Yasmin
what is the function of carbon nanotubes?
Cesar
I'm interested in nanotube
Uday
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
AMJAD
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
AMJAD
what is system testing
AMJAD
what is the application of nanotechnology?
Stotaw
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
Azam
anybody can imagine what will be happen after 100 years from now in nano tech world
Prasenjit
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
Azam
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
Prasenjit
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
Damian
silver nanoparticles could handle the job?
Damian
not now but maybe in future only AgNP maybe any other nanomaterials
Azam
Hello
Uday
I'm interested in Nanotube
Uday
this technology will not going on for the long time , so I'm thinking about femtotechnology 10^-15
Prasenjit
can nanotechnology change the direction of the face of the world
Prasenjit Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Berger describes sociologists as concerned with
Mueller Reply
Got questions? Join the online conversation and get instant answers!
QuizOver.com Reply

Get the best Algebra and trigonometry course in your pocket!





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