Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-19-2008, 01:41 AM
Member
 
Join Date: Mar 2008
Posts: 1
lambeau86 is on a distinguished road
Chroma chrome key
Hi, I'm new to java and I'm trying to get my program to run where it takes one photo of me at a green screen and then substitutes it for another background.

I have all the code that grabs the pictures but I cant quite get it to work correctly. My code so far is as follows;

Code:
public class DIP { public static void chromakey(Picture p1, Picture p2){ for( int i = 0, j = p1.getHeight()-1; i < p1.getWidth(); i++){ for( int k = 0, l= p2.getHeight(); k < p2.getWidth()-1; k++){ int g1 = p1.getGreen(i, j); while (g1 > 180 && g1 < 190) i=k; j=l; }}} public static void main(String[] args) { // Choose a file from the filesystem ImageFileChooser ifc = new ImageFileChooser(); String filename = ifc.getFile(); // Create a Picture object Picture original = new Picture(filename, "Original Image"); Picture chrom = new Picture(filename, "Chromakey"); // Show the Picture original.displayImage(); // Convert Picture to chromakey System.out.println("Converting to chromakey."); String filename2 = ifc.getFile(); Picture background = new Picture(filename2, ""); chromakey(chrom,background); chrom.displayImage(); }}
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 10:59 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org