• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Chromakey using 2d arrays

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic