Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, November 30, 2005 12:33:33 PM(UTC)

VasjaS  
VasjaS

Groups: Registered
Posts: 3


Hi!
 
I'm using LEADTOOLS VCL 14.5 and Delphi 7.0. What i'd like to do is to be able to put more independent ROIs on an image. They should behave like an annotation object (resize, move, selection...) and at the same time define a region where an effect (emboss, edge detect, ...) is to be applied.
 
I guess this task should be accomplished by some kind of layer system (like multiple LeadImages one above another) or something but i don't seem to find anything useful (i am new to LEADTOOLS).
 
Am I missing something?
 
Thanks for any advice, hope there's an easy way to do this! 
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, December 7, 2005 10:56:46 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


If you use LEADTOOLS Document Imaging, which has Annotations support,
you can define an annotation object (such as a freehand object or a
rectangle object), then obtain a region based on the annotation
object's location. This is done using the L_AnnGetRgnHandle API function (which can be used with VCL).

Then, you can use the VCL SetRgnHandle method to set the region into
the control. Finally, use any image processing function from those that apply to the region only.


If you need multiple regions together, you can repeat the process of
calling L_AnnGetRgnHandle, and use the L_RGN_OR flag with the SetRgnHandle method to create a composite region.

Amin Dodin

LEADTOOLS Technical Support
Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#3 Posted : Friday, December 9, 2005 5:31:58 AM(UTC)

VasjaS  
VasjaS

Groups: Registered
Posts: 3


Thanks Amin,

I tried the L_AnnGetRgnHandle but could not get it to work (access violations and stuff). I am not sure if the type definitions are right and if the function call is right  as well.

Here's what I tried to do:

type pRGNXFORM = ^RGNXFORM;
type pL_HRGN = ^L_HRGN;
function L_AnnGetRgnHandle(hObject: HANNOBJECT; pXForm: pRGNXFORM; phRgn: pL_HRGN): L_INT; stdcall; external 'ltann14e.dll';

procedure TForm1.Lead1AnnDrawn(hObject: L_HANDLE);
var
  rgn: pL_HRGN;
begin
  Lead1.AnnTool := 0;

  L_AnnGetRgnHandle(hObject, ni, rgn);

  Lead1.SetRgnHandle(rgn^, 0, 0, L_RGN_SET);
  Lead1.Emboss(EMBOSS_SE, 500);
end;

 

Please shed some light on the matter!

Thanks!

 
#4 Posted : Wednesday, December 14, 2005 10:25:58 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 353


This is a sample test procedure that creates a region based on an annotation object.

You can use L_AnnGetRgnHandle and other API functions by adding leadunt
to the Uses section. You will also need leadtyp and leaddef for data types and constant values.

procedure TForm1.TestAnnAPI();
var
  hEllipseObject : L_HANDLE;
  Rgn : L_HRGN;
Begin
  // Create an ellipse object and define its location
  hEllipseObject := LEADAnn1.AnnCreate(ANNOBJECT_ELLIPSE, True, True);
  LEADAnn1.AnnDefine(hEllipseObject, 80, 60, ANNDEFINE_BEGINSET);
  LEADAnn1.AnnDefine(hEllipseObject, 180, 260, ANNDEFINE_END);
  // Get a region based on the object
  L_AnnGetRgnHandle(hEllipseObject, nil, @Rgn);
  // No longer need the Ann object
  LEADAnn1.AnnDestroy(hEllipseObject, 0);
  // Set the region into the control
  LEADAnn1.SetRgnHandle(Rgn, 0, 0, L_RGN_SET);
  // No longer need the handle. MUST free it
  LEADAnn1.DeleteRgnHandle(Rgn);
  // Test region is working
  LEADAnn1.Emboss(EMBOSS_SE, 500);
End;

Amin Dodin
LEADTOOLS Technical Support

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.158 seconds.