Is there a Delphi Example available of how to use the OMRDetectMarks function.
Somehow i am not able to translate the C# sample to a working delphi version.
A Delphi Equivalent of the C# sample application will do fine for me.
OMRDetectMarks
Re: OMRDetectMarks
Hello,
So far I have been able to write the following snippet based on this tutorial: http://blog.virtec.org/2008/07/the-myst ... safearray/
The code is a conversion of the vb sample of the reference guide. It is unfortunately don't work but I guess I am close to the goal:
Hope this brings some lights...
Kind regards,
Loïc
So far I have been able to write the following snippet based on this tutorial: http://blog.virtec.org/2008/07/the-myst ... safearray/
The code is a conversion of the vb sample of the reference guide. It is unfortunately don't work but I guess I am close to the goal:
Code: Select all
procedure TForm1.Button8Click(Sender: TObject);
type
TArrayOfInteger = array of Integer;
var
GdPictureImaging1: _GdPictureImaging;
ImageID: integer;
Areas, Confidence : TArrayOfInteger;
result: PSafeArray;
r: Integer;
i: Integer;
begin
GdPictureImaging1 := CreateComObject(CLASS_GdPictureImaging) as _GdPictureImaging;
ImageID := GdPictureImaging1.CreateGdPictureImageFromFile('c:\\test.tif');
if ImageID <> 0 then
begin
SetLength(Areas, 8);
SetLength(Confidence, 2);
Areas[0] := 997;
Areas[1] := 242;
Areas[2] := 38;
Areas[3] := 33;
Areas[4] := 762;
Areas[5] := 271;
Areas[6] := 53;
Areas[7] := 42;
result := GdPictureImaging1.OMRDetectMarks(ImageID, PSafeArray(Areas), 2, 0.5, PSafeArray(Confidence), True);
for i := 0 to 1 do
begin
SafeArrayGetElement(result, i, r);
//do something with r
r:=r;
end;
GdPictureImaging1.ReleaseGdPictureImage(ImageID);
end;
end;
Kind regards,
Loïc
Re: OMRDetectMarks
This is almost exactly as far as i came.
Meanwhile i have been trying other things, and this is what i came up with (but still doesn't work)
when i run this, i get the error:
The specified matrix is not of the expected type.
Does this help you (or anyone else) to come to a working Delphi sample?
Meanwhile i have been trying other things, and this is what i came up with (but still doesn't work)
Code: Select all
procedure TForm1.Button8Click(Sender: TObject);
type
TArrayOfInteger = array of Integer;
var
GdPictureImaging1: _GdPictureImaging;
ImageID: integer;
Areas: TArrayOfInteger;
psAreas, result: PSafeArray;
Bounds: array[0..0] of pSafeArrayBound;
r: Integer;
i: Integer;
begin
GdPictureImaging1 := CreateComObject(CLASS_GdPictureImaging) as _GdPictureImaging;
ImageID := GdPictureImaging1.CreateGdPictureImageFromFile('c:\\test.tif');
if ImageID <> 0 then
begin
SetLength(Areas, 8);
Areas[0] := 997;
Areas[1] := 242;
Areas[2] := 38;
Areas[3] := 33;
Areas[4] := 762;
Areas[5] := 271;
Areas[6] := 53;
Areas[7] := 42;
Bounds[0].lLbound:=0;
Bounds[0].cElements:=8;
psAreas := SafeArrayCreate(VarInteger, 1, @Bounds);
psAreas.pvData:=Areas;
//Just to check if psAreas is filled the correct way
for i := 0 to 7 do
begin
SafeArrayGetElement(result, i, r);
r:=r; // breakpoint here
end;
result := GdPictureImaging1.OMRDetectMarks(ImageID, psAreas, 2);
for i := 0 to 1 do
begin
SafeArrayGetElement(result, i, r);
//do something with r
r:=r;
end;
GdPictureImaging1.ReleaseGdPictureImage(ImageID);
end;
end;
The specified matrix is not of the expected type.
Does this help you (or anyone else) to come to a working Delphi sample?
Who is online
Users browsing this forum: No registered users and 2 guests