This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
  • Carey Brown
  • salvin francis
  • Claude Moore

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: 5774
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?
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Create Edit Print & Convert PDF Using Free API with Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!