Results 1 to 1 of 1
Thread: Chroma chrome key
- 03-19-2008, 12:41 AM #1
Member
- Join Date
- Mar 2008
- Posts
- 1
- Rep Power
- 0
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;
Java 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(); }}


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks