Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

colorToLAB/getPixel alternative  RSS feed

Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making an Android app right now, and part of this app is performing analysis on a photo. The current implementation uses ColorUtils.colorToLAB to retrieve the color at a specific pixel, like this:

The issue is that this code is taking forever to run. Somewhat to be expected because it's iterating over thousands of pixels, but I'd like to reduce the time taken by this code as much as possible. I've benchmarked it and found that this part of the code is taking ~90% of the time for the procedure. I'm wondering if there is any way that is known to improve the performance, or an alternative for how to get the pixel of a color in an that performs better.

Javadoc of the ColorUtils class:
Posts: 5854
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Curious: Why are you using LAB color and not RGB? I think that most images, once de-compressed, are in RGB format.

I tend to avoid power of 2 and multiply it directly. Aren't you missing a square root in there?
I AM MIGHTY! Especially when I hold this tiny ad:
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!