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
 Proc functions do not work after SelectCustom
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
727 Posts

Posted - Jan 23 2019 :  07:44:42  Show Profile  Reply
Hello,

This is odd.

After performing custom selection using following code:
procedure TfrmMainForm.scBtnSelSkinColorClick(Sender: TObject);
var
  X, Y: Integer;
  Clr: TRGB;
  R,G,B: Integer;
  arrClrVal: array[0..2] of Integer;
begin
  ImageEnViewMain.Deselect;
  ImageEnViewMain.SelectionMaskDepth := 8;
  if (ImageEnViewMain.IEBitmap.Width > 100) and (ImageEnViewMain.IEBitmap.Height > 0) then
  begin
    for Y := 0 to ImageEnViewMain.IEBitmap.Height - 1 do
    begin
      for X := 0 to ImageEnViewMain.IEBitmap.Width - 1 do
      begin
        Clr := ImageEnViewMain.IEBitmap.Pixels[X,Y];
        R := Clr.r;
        G := Clr.g;
        B := Clr.b;

        arrClrVal[0] := R;
        arrClrVal[1] := G;
        arrClrVal[2] := B;        

        if ((R > 95) and (G > 40) and (B > 20) and ((MaxIntValue(arrClrVal) - MinIntValue(arrClrVal)) > 15) and ((r - g) > 15) and (R > G) and (R > B)) then
        begin
          ImageEnViewMain.SelectionMask.SetPixel(X,Y,1);
        end;
      end;
    end;
    ImageEnViewMain.SelectCustom;
    ImageEnViewMain.Proc.DoPreviews(ppeColorAdjust);
  end;
end;


But none of the Proc functions work like for example Proc.DoPreviews(ppeColorAdjust).

Is something wrong with my code or is it a problem in ImageEn?

TIA


Yogi Yang

xequte

38613 Posts

Posted - Jan 23 2019 :  17:33:39  Show Profile  Reply
Hi Yogi

With regard to TIEMask.SetPixel:

If the selection depth is 1 bit, then 0 is unselected and 1 is selected.
If the selection depth is 8 bit, then 0 is unselected, 1 - 254 is partially selected and 255 is fully selected.

You are calling:

ImageEnViewMain.SelectionMask.SetPixel(X,Y,1);

So it "barely" selected. Please try:

ImageEnViewMain.SelectionMask.SetPixel(X,Y,255);


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

xequte

38613 Posts

Posted - Jan 23 2019 :  18:03:59  Show Profile  Reply
// Make a gradient selection (increasing from unselected to fully selected along height of image)
// Then convert selection to gray scale
ImageEnView1.Deselect();
ImageEnView1.SelectionMaskDepth := 8;
for Y := 0 to ImageEnView1.IEBitmap.Height - 1 do
  for X := 0 to ImageEnView1.IEBitmap.Width - 1 do
  begin
    selIntensity := Round( Y / ImageEnView1.IEBitmap.Height * 255 );
    ImageEnView1.SelectionMask.SetPixel( X, Y, selIntensity );
  end;
ImageEnView1.SelectCustom;
ImageEnView1.Proc.ConvertToGray();
ImageEnView1.Deselect();




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

yogiyang

India
727 Posts

Posted - Jan 24 2019 :  01:16:41  Show Profile  Reply
Hello Nigel,

Thanks for the tip and clarifications.

Now it is working!

Also thanks for the code sample.

The effect generated is interesting and can be used in may different ways.

Regards,


Yogi Yang
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: