This week's book giveaway is in the Go forum.
We're giving away four copies of Head First Go and have Jay McGavren on-line!
See this thread for details.
Win a copy of Head First Go this week in the Go 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

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: 5654
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?
It's fun to be me, and still legal in 9 states! Wanna see my tiny ad?
Become a Java guru with IntelliJ IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!