3
\$\begingroup\$

I am fairly new to game development.

I am developing an application(Aquarium) for windows which requires me to animate(move) fishes around the screen and user will be able to add new fishes drawn on paper and scanned into the application, I did some research and decided to use LibGDX so when user scans the image coming to the system has White background which needs to be removed I needed to know how to remove that make it transparent in LibGDX.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ why not write a custom shader which renders colors above some threshold as transparent? \$\endgroup\$ Commented Aug 29, 2016 at 14:44

1 Answer 1

1
\$\begingroup\$

It seems like you are asking more about image processing and not LibGDX specifically. Once you change the white background to transparent pixels, then LibGDX will draw it without the transparent pixels.

The algorithm that you are looking for is called Background subtraction or Foreground detection. I have had some success before (albeit in Android) with OpenCV and I believe that you should be able to get the library working on Desktop within Libgdx. It is open source and free to use commercially.

OpenCV has a Java interface and it has a function called grabcut() that does Background subtraction. It is a bit more accurate if you have your user give hints for which pixels are foreground.

Here is another SO post that may help you get OpenCV working

\$\endgroup\$
2
  • \$\begingroup\$ i have worked with image processing in matlab and opencv i want to achieve the same in Libgdx \$\endgroup\$
    – Lokanath
    Commented May 24, 2016 at 10:24
  • \$\begingroup\$ Perhaps you could clarify your question then. What part about using these algorithms in libgdx do you need help with? It should be as simple as linking to the libraries and then using them since Libgdx uses java. \$\endgroup\$ Commented May 24, 2016 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .