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 colorize a color range / faster
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jcf

France
14 Posts

Posted - Aug 16 2013 :  04:44:14  Show Profile  Reply
hello, i'm trying to add a "false colors" effect to my pics, using selectcolors and colorize:

ImageEnView1.SelectColors(CreateRGB(127,127,127),CreateRGB(178,178,178));
ImageEnView1.Proc.Colorize(50, 75, 1);
imageenview1.DeSelect;

My example colorize the range 50%-70% in yellow, after converting the pic in Gray.

BUT: as i'm colorizing 4 or 5 different ranges, the selection and deselection is pretty slow for each region: around 15 secondes to colorize two ranges of color in a 4K picture !

Is there any solution to keep do the same job without the selection, faster ? a colorize function with a range i can choose, like castcolorrange ?
(Previously i was using ImageEnView1.Proc.CastColorRange(BeginColor,EndColor,CastColor); but it doesn't keep the shades, it makes only one flat color for all shades selected).

Here is attached an example i want to make.

fab

1310 Posts

Posted - Sep 06 2013 :  01:45:28  Show Profile  Reply
Hi,
TImageEnProc.SelectColors will be optimized for 24 bit RGB images, from next minor version. In my tests SelectColors will require about 600ms on a 4K image (on a i5/i7 Intel CPU).

In the mean time you could select pixel by pixel. For example:

var
  i, j: integer;
  p_rgb: PRGB;

...

  for i := 0 to ImageEnView1.IEBitmap.Height - 1 do
  begin
    p_rgb := ImageEnView1.IEBitmap.ScanLine[i];
    for j := 0 to ImageEnView1.IEBitmap.Width - 1 do
    begin
      with p_rgb^ do
        if (r >= 127) and (g >= 127) and (b >= 127) and (r <= 178) and (g <= 178) and (b <= 178) then
          ImageEnView1.SelectionMask.SetPixel(j, i, 1);
      inc(p_rgb);
    end;
  end;
  ImageEnView1.SelectCustom();

  ImageEnView1.Proc.Colorize(50, 75, 1);
  ImageEnView1.DeSelect;


This requires about the same time of optimized version.
Go to Top of Page

jcf

France
14 Posts

Posted - Sep 18 2013 :  14:30:53  Show Profile  Reply
Hi,
thank you for your response.
I'm using the 4.3.1.
so i'm gonna wait for the next version...
Thanks.
JC
Go to Top of Page

davenovo

USA
26 Posts

Posted - Sep 19 2013 :  10:03:36  Show Profile  Reply
You can use MapGrayToColor. It requires you precomute the color table, but then you don't have to make any selections.
Go to Top of Page

jcf

France
14 Posts

Posted - Sep 25 2013 :  13:35:39  Show Profile  Reply
> Fab: is the version 5.0 including optimized version ?

>davenovo: Thanks, i'm gonna try, if it doesn't take too much time to compute the color table everytime i want a new range into a new color...
Go to Top of Page

fab

1310 Posts

Posted - Sep 30 2013 :  13:44:39  Show Profile  Reply
Yes, 5.0 includes optimized version.
Go to Top of Page

jcf

France
14 Posts

Posted - Oct 28 2013 :  00:34:47  Show Profile  Reply
Thanks, i'm gonna try.
JC
Go to Top of Page

jcf

France
14 Posts

Posted - Feb 23 2014 :  12:07:27  Show Profile  Reply
still slow with version 5.0.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: