ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to find most used color?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
698 Posts

Posted - Oct 13 2021 :  00:49:43  Show Profile  Reply
Hello,

I am trying to calculate the most used color. Meaning I want to find that color which has largest number of pixels in a JPEG image.

Currently I am using IEBitmap.ScanLine and building an unique array of colors and then counting each color in the array.

But this process is taking a lot of time especially when the image is big (30 MB and higher).

Is there any better way to achieve this in a faster and accurate manner?

TIA

Yogi Yang

xequte

6420 Posts

Posted - Oct 13 2021 :  21:50:09  Show Profile  Reply
Hi Yogi

You can also use:

https://www.imageen.com/help/TImageEnProc.GetDominantColor.html

But if you already have a good algorithm using scanlines, it may be not be any faster.



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

yogiyang

India
698 Posts

Posted - Oct 16 2021 :  07:29:51  Show Profile  Reply
Hello Nigel,

Thanks for the reply.

I also tried to improve speed by switching to MyRGB := ieTemp.IEBitmap.Pixels[X, Y];

But this also does not make any difference.

I used function Proc.GetDominantColor but the color returned by it and that calculated by my code are different. And the color returned by Proc.GetDominantColor does not match visually when we look at the image and the color returned by this function. But on the contrary the color calculated by my code matches visually with the image.

TIA

Yogi Yang
Go to Top of Page

xequte

6420 Posts

Posted - Oct 17 2021 :  23:36:26  Show Profile  Reply
Hi Yogi

I have done some testing of GetDominantColor today. I could not find any issues. Can you forward your test images.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: