• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chromakey using 2d arrays

 
Jamal Nasar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First time posting here, hope I'm formatting this right:

I'm having some trouble writing a chromaKey method that basically takes two images, one with a green screen and the other a background, and makes a new image replacing the green-screen with the background.
After compiling, when I try to run it, I get an ArrayIndexOutofBoundsException on the line:



Can someone point me in the right direction?

 
Winston Gutkowski
Bartender
Pie
Posts: 10422
63
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jamal Nasar wrote:After compiling, when I try to run it, I get an ArrayIndexOutofBoundsException on the line:

Well, the only reason for that would be that either pixels or background.pixels has a length of 0; but since you haven't shown us how those are created, it's impossible to guess why.

My suggestion: StopCoding and write down what you're trying to achieve.

Winston
 
Jamal Nasar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion Winston, I added in the rest of the code so the method makes sense in context and I'll try looking for what's causing the length issue in the meanwhile.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic