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
 Dominant Colors

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
woywod Posted - Dec 28 2022 : 11:21:03
Hi
I am using the Proc.Get Dominant Color function, it works very well, but I want to add color numbers to it, for example, find dominant 20 colors used in the picture?
4   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jan 03 2023 : 20:57:04
Please email me for the latest beta. You can do it as follows:

// Get the ten most used colors
var
  i: Integer;
  usedColors : array[1..10] of TColor;
  c: TColor;
  dd: Double;
begin
  Memo1.Clear;

  // Reset used color array
  for i := Low(usedColors) to High(usedColors) do
    usedColors[i] := clNone;

  for i := 1 to 10 do
  begin
    dd := ImageEnView1.Proc.GetDominantColor( c, usedColors );
    usedColors[ i ] := c;
    Memo1.Lines.Add( format( '%s (%d%%)', [ ColorToHex( c ), Round( dd ) ]));
  end;

  // Show palette to users
  IEPromptForColor( c, usedColors, 10 );
end;


Nigel
Xequte Software
www.imageen.com
woywod Posted - Dec 29 2022 : 11:25:47
Hi
I was not very good. can you write me a little example???
woywod Posted - Dec 28 2022 : 15:02:49
thank you.
xequte Posted - Dec 28 2022 : 14:58:41
Hi

I'm afraid that is not supported. Take a look at the code in TImageEnProc.GetDominantColor(); to see how it is calculated (nothing complex happening there).

You might want to copy it to a local method, then use your preferred method to find the 20 highest values in the TIEIntegerMap (named hash).

Nigel
Xequte Software
www.imageen.com