<< Chapter < Page Chapter >> Page >

You can download a copy of the raw image file here .

Summary

In this module, you learned how to invert images and how to display images in PictureExplorer objects.

What's next?

You will learn how to implement a space-wise linear color-modification algorithm in the next module.

While not a requirement of the course, you can select the following links to view optional online video lectures on the material in thismodule.

Miscellaneous

This section contains a variety of miscellaneous information.

Housekeeping material
  • Module name: Java OOP: Image Processing Algorithms, Image Inversion, and PictureExplorer Objects
  • File: Java3004.htm
  • Published: 07/29/12
Disclaimers:

Financial : Although the Connexions site makes it possible for you to download a PDF file for thismodule at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, you should beaware 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 of the module.

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

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

Complete program listing

A complete listing of the program discussed in this module is shown in Listing 6 below.

Listing 6 . Complete program listing.
/*File Prob02 Copyright 2008 R.G.Baldwin *********************************************************/public class Prob02{//the driver class public static void main(String[]args){ Prob02Runner obj = new Prob02Runner();obj.run(); System.out.println(obj.getPicture());}//end main }//end class Prob02//======================================================// class Prob02Runner{private Picture pic = new Picture("Prob02.jpg"); public Prob02Runner(){//constructorSystem.out.println("Dick Baldwin"); }//end constructor//----------------------------------------------------// //Accessor methodpublic Picture getPicture(){return pic;} //----------------------------------------------------////This method is where the action is. public void run(){//Display the raw picture. pic.addMessage("Dick Baldwin",10,20);pic.explore(); //Set the blue color components to 0 and invert the// red and green color components for every pixel in // the picture.Pixel[] pixelArray = pic.getPixels();for(Pixel pixel:pixelArray ){ pixel.setRed(255 - pixel.getRed());pixel.setGreen(255 - pixel.getGreen()); pixel.setBlue(0);}//end for loop //Display the modified picturepic.explore(); }//end run method}//end class Prob02Runner

-end-

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