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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to find most used color?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
yogiyang Posted - Oct 13 2021 : 00:49:43
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
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Oct 17 2021 : 23:36:26
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
yogiyang Posted - Oct 16 2021 : 07:29:51
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
xequte Posted - Oct 13 2021 : 21:50:09
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