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
 Custom Requirement: Layer0 = BackGroundImage, Layer1 = Rectangle (masking)

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
andyhill Posted - Dec 31 2022 : 18:14:07
I have the following code that loads a Rectangle on Layer1 over Layer0 Background - all good.

What I want to achieve is still use Layer1 as the mask BUT I want the area of Layer0 outside of the mask to be slightly transparent instead of opaque (remember user can drag rectangle over background image) ?

Please advise how using the code below - thanks in advance.


ImageEnView1.LayersAdd(ielkShape);
ImageEnView1.SetLayersGripStyle(clBlack, clLime, bsSolid, DefaultGripSize, iegsCircle);
TIEShapeLayer(ImageEnView1.CurrentLayer).Shape:= iesRoundRect; 
ImageEnView1.CurrentLayer.PosX:=                x1;
ImageEnView1.CurrentLayer.PosY:=                y1;
ImageEnView1.CurrentLayer.Width:=               x2;
ImageEnView1.CurrentLayer.Height:=              y2;
ImageEnView1.CurrentLayer.FillColor:=           clNone;
ImageEnView1.CurrentLayer.AlphaEdgeFeathering:= 50;
ImageEnView1.CurrentLayer.IsMask:= True;
ImageEnView1.MouseInteractLayers:= [mlEditLayerPoints, mlMoveLayers, mlResizeLayers];
ImageEnView1.Update();
ImageEnView1.VisibleBitmapRect:= ImageEnView1.Layers[1].LayerRect;
ImageEnView1.Update();


Andy
20   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jan 13 2023 : 23:09:36
Actually, you can email me for an update that supports joining two bitmaps and strips any overlapping content.

Nigel
Xequte Software
www.imageen.com
andyhill Posted - Jan 12 2023 : 14:45:24
Good thinking - ready for update ...

Andy
xequte Posted - Jan 12 2023 : 14:03:36
Hi Andy

OpenCV does not support that. But you can rotate the images before processing and then rotate the result back.

Nigel
Xequte Software
www.imageen.com
andyhill Posted - Jan 11 2023 : 20:55:06
Can we have both Vertical Stitching (one on top of each other [top/down1/down2 etc.]) and Horizontal Stitching (panorama [left/right/right etc.]).

Andy
xequte Posted - Jan 11 2023 : 17:00:09
Oh, I see. That issue is still pending. Those kinds of images require the newer version of OpenCV (bearing in mind that stitching is designed to merge multiple photos into a single panorama). We've mostly completed the updating to that, but need to test the remaining issues.

Nigel
Xequte Software
www.imageen.com
andyhill Posted - Jan 11 2023 : 13:49:35
Yes the demo was faulty but my issue was not with the demo, it was with IEVision stitching that causes A/V's and you said Fabrizio was fixing it late last year:-

pano:= IEVisionLib.createStitcher().stitch(images, status);

I am very keen to move forward with the IEVision fix.

Andy
xequte Posted - Jan 10 2023 : 15:37:49
Hi Andy

Actually, there is an issue with the Pattern Matching demo that caused that. The correct code should be:

// Find templates
procedure TMainForm.btnMatchClick(Sender: TObject);
var
  i: integer;
  image, templ, map: TIEVisionImage;
  rect: TIEVisionRect;
  rank: double;
begin
  ImageEnView1.Proc.Undo();

  // for each image in TImageEnMView (template images)
  for i := 0 to ImageEnMView1.ImageCount - 1 do
  begin

    // get image where to search in
    image := ImageEnView1.IEBitmap.GetIEVisionImage();

    // get the template image to search
    templ := ImageEnMView1.GetTIEBitmap(i).GetIEVisionImage();

    // perform template searching
    rect := image.matchTemplate(templ, TIEVisionTemplateMatchMethod(cmbMethod.ItemIndex), @rank);

    // fill the resulting map (must be done before ImageEnView.IEBitmap changes, otherwise "images" is invalid)
    map := image.matchTemplateAsMap(templ, TIEVisionTemplateMatchMethod(cmbMethod.ItemIndex));

    // draw a red box around the found rectangle
    with ImageEnView1.IEBitmap.Canvas do
    begin
      Pen.Color := clRed;
      Pen.Width := 5;
      Brush.Style := bsClear;
      Rectangle(IEVisionRectToTRect(rect));
      Font.Height := 36;
      Font.Color := clRed;
      Brush.Style := bsSolid;
      Brush.Color := clWhite;
      TextOut(rect.x + 4, rect.y + 4, ImageEnMView1.ImageBottomText[i] + ' ' + FloatToStr(trunc(rank)) + '%');
    end;
    ImageEnView1.Update();

    {
    // Or use layers
    if i = 0 then
      ImageEnView1.LayersClear( False );
    ImageEnView1.LayersAdd( ielkText, IEVisionRectToTRect( rect ));
    with TIETextLayer( ImageEnView1.CurrentLayer ) do
    begin
      BorderColor  := clRed;
      BorderWidth  := 5;
      FillColor    := clWhite;
      Opacity      := 0.66;
      Font.Height  := 24;
      Font.Color   := clRed;
      WordWrap     := False;
      Alignment    := iejCenter;
      Text         := ImageEnMView1.ImageBottomText[i] + ' ' + FloatToStr(trunc(rank)) + '%';
      TextOverflow := ieoShrink;
    end;
    }

    // draw the resulting map
    ImageEnView2.IEBitmap.AssignIEVisionImage(map);
    ImageEnView2.Update();

    ImageEnMView1.ReleaseBitmap(i);
  end;
end;



Nigel
Xequte Software
www.imageen.com
andyhill Posted - Jan 09 2023 : 20:04:46
Crash with the Pattern Matching demo

Andy
xequte Posted - Jan 09 2023 : 19:27:27
Hi Andy

Sorry, what issue are you referring to?

Nigel
Xequte Software
www.imageen.com
andyhill Posted - Jan 09 2023 : 12:38:15
Thanks Nigel - This now works :)

Any news on the IEVision fix ?

Andy
xequte Posted - Jan 08 2023 : 20:03:49
Hi Andy

I have updated the code.

Nigel
Xequte Software
www.imageen.com
andyhill Posted - Jan 07 2023 : 00:04:12
ABitmap: TBitmap

dest: TIEBitmap


Andy
xequte Posted - Jan 06 2023 : 20:24:40
That will be:

lyr := ImageEnView1.Layers[idx];

Nigel
Xequte Software
www.imageen.com
andyhill Posted - Jan 06 2023 : 13:22:26
lyr:= TIELayer(fLayers[idx]); ???

Andy
xequte Posted - Jan 05 2023 : 21:13:48
Hi Andy

DrawLayerOuterEx() is shown in the code above. You can specify any value for Gray.

Nigel
Xequte Software
www.imageen.com
andyhill Posted - Jan 05 2023 : 20:29:01
My version 11.4.0 does not have "DrawLayerOuterEx" so will have to wait for an update.

Also, with the custom gray code above can we also change the transparency % as well ?

I await for the IEVision update as well.

Andy
andyhill Posted - Jan 05 2023 : 17:15:04
Thank you Nigel, I appreciate your response.

Andy
xequte Posted - Jan 05 2023 : 16:13:22
Hi Andy

You can use the OnDrawLayer event to customizes the gray, e.g.

// Draw layers outside of the specified index as gray
procedure DrawLayerOuterEx(ABitmap: TIEBitmap; Layer: TIELayer; GrayValue: Integer);
var
  i, j: integer;
  rgb: PRGB;
  bwidth, bheight: integer;
  cab: TRect;
begin
  Layer.CalcClientAreaBox( False );

  bwidth  := ABitmap.Width;
  bheight := ABitmap.Height;
  for i := 0 to bheight - 1 do
  begin
    rgb := ABitmap.Scanline[i];
    for j := 0 to bwidth - 1 do
    begin
      cab := Layer.IE_ClientAreaBoxEx;
      if ((j < cab.Left) or (j > cab.Right) or (i < cab.Top) or (i > cab.Bottom)) and
         ((((i and 1) = 0) and ((j and 1) = 0)) or (((i and 1) = 1) and ((j and 1) = 1))) then
      with rgb^ do
      begin
        r := GrayValue;
        g := GrayValue;
        b := GrayValue;
      end;
      inc(rgb);
    end;
  end;
end;

procedure Tfmain.ImageEnView1DrawLayer(Sender: TObject; Dest: TIEBitmap; LayerIndex: Integer);
begin
  if LayerIndex = ImageEnView1.LayersCurrent then
    DrawLayerOuterEx( dest, ImageEnView1.Layers[LayerIndex], 99 );
end;



Nigel
Xequte Software
www.imageen.com
andyhill Posted - Jan 05 2023 : 14:17:15
Nigel, I was talking about quick reply (no image option) so therefore I have to use the full reply option in order to access images - no big deal.

I look forward to a future update where one can adjust the gray percentage in "DrawOuter" - thanks for your hard work.


Andy
xequte Posted - Jan 04 2023 : 19:28:32
Hi Andy

I'm sorry, that cannot be customized at this time.

Nigel
Xequte Software
www.imageen.com