mirror of
https://github.com/Laex/Delphi-OpenCV.git
synced 2024-11-16 00:05:52 +01:00
Components...
Signed-off-by: Laentir Valetov <laex@bk.ru>
This commit is contained in:
parent
7b8f5b2ee5
commit
b3051e5d08
@ -28,7 +28,7 @@ package OpenCV;
|
||||
{$ALIGN 8}
|
||||
{$ASSERTIONS ON}
|
||||
{$BOOLEVAL OFF}
|
||||
{$DEBUGINFO ON}
|
||||
{$DEBUGINFO OFF}
|
||||
{$EXTENDEDSYNTAX ON}
|
||||
{$IMPORTEDDATA ON}
|
||||
{$IOCHECKS ON}
|
||||
@ -61,7 +61,6 @@ contains
|
||||
uOCVView in 'uOCVView.pas',
|
||||
uOCVImageOperation in 'uOCVImageOperation.pas',
|
||||
uOCVRegister in 'uOCVRegister.pas',
|
||||
uOCVSplitter in 'uOCVSplitter.pas',
|
||||
uOCVIOProperties in 'uOCVIOProperties.pas';
|
||||
|
||||
end.
|
||||
|
@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{67FAAD9E-2FAD-44C3-8F98-56827C3D1CE8}</ProjectGuid>
|
||||
<MainSource>OpenCV.dpk</MainSource>
|
||||
<ProjectVersion>15.3</ProjectVersion>
|
||||
<ProjectVersion>15.4</ProjectVersion>
|
||||
<FrameworkType>VCL</FrameworkType>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
@ -50,6 +50,7 @@
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<SanitizedProjectName>OpenCV</SanitizedProjectName>
|
||||
<GenPackage>true</GenPackage>
|
||||
<DCC_CBuilderOutput>All</DCC_CBuilderOutput>
|
||||
<GenDll>true</GenDll>
|
||||
@ -103,7 +104,6 @@
|
||||
<DCCReference Include="uOCVView.pas"/>
|
||||
<DCCReference Include="uOCVImageOperation.pas"/>
|
||||
<DCCReference Include="uOCVRegister.pas"/>
|
||||
<DCCReference Include="uOCVSplitter.pas"/>
|
||||
<DCCReference Include="uOCVIOProperties.pas"/>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_2</Key>
|
||||
|
@ -103,8 +103,7 @@ type
|
||||
destructor Destroy; override;
|
||||
published
|
||||
property Enabled : Boolean Read FEnabled write SetEnabled default False;
|
||||
property CameraCaptureSource: TocvCameraCaptureSource read FCameraCaptureSource write SetCameraCaptureSource
|
||||
default CAP_ANY;
|
||||
property CameraCaptureSource: TocvCameraCaptureSource read FCameraCaptureSource write SetCameraCaptureSource default CAP_ANY;
|
||||
property Resolution: TocvResolution read FResolution write setResolution;
|
||||
end;
|
||||
|
||||
|
@ -39,32 +39,28 @@ Type
|
||||
procedure SetValue(const Value: string); override;
|
||||
end;
|
||||
|
||||
TVideoSourceProperty = class(TInterfaceProperty)
|
||||
private
|
||||
FGetValuesStrProc: TGetStrProc;
|
||||
protected
|
||||
procedure ReceiveComponentNames(const S: string);
|
||||
public
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
procedure GetValues(Proc: TGetStrProc); override;
|
||||
procedure SetValue(const Value: string); override;
|
||||
function GetValue: string; override;
|
||||
end;
|
||||
// TVideoSourceProperty = class(TInterfaceProperty)
|
||||
// private
|
||||
// FGetValuesStrProc: TGetStrProc;
|
||||
// protected
|
||||
// procedure ReceiveComponentNames(const S: string);
|
||||
// public
|
||||
// function GetAttributes: TPropertyAttributes; override;
|
||||
// procedure GetValues(Proc: TGetStrProc); override;
|
||||
// procedure SetValue(const Value: string); override;
|
||||
// function GetValue: string; override;
|
||||
// end;
|
||||
|
||||
implementation
|
||||
|
||||
Uses
|
||||
|
||||
VCL.Dialogs,
|
||||
|
||||
System.SysUtils,
|
||||
System.TypInfo,
|
||||
System.RTLConsts,
|
||||
uOCVImageOperation,
|
||||
uOCVSplitter,
|
||||
uOCVTypes;
|
||||
|
||||
{ TImageOperationProperty }
|
||||
{TImageOperationProperty}
|
||||
|
||||
function TImageOperationProperty.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
@ -79,12 +75,12 @@ end;
|
||||
|
||||
procedure TImageOperationProperty.GetValues(Proc: TGetStrProc);
|
||||
var
|
||||
i: Integer;
|
||||
I: Integer;
|
||||
rIO: TRegisteredImageOperations;
|
||||
begin
|
||||
rIO := GetRegisteredImageOperations;
|
||||
for i := 0 to rIO.Count - 1 do
|
||||
Proc(rIO[i]);
|
||||
for I := 0 to rIO.Count - 1 do
|
||||
Proc(rIO[I]);
|
||||
end;
|
||||
|
||||
procedure TImageOperationProperty.SetValue(const Value: string);
|
||||
@ -93,102 +89,25 @@ Var
|
||||
i: Integer;
|
||||
AIntf: IocvEditorPropertiesContainer;
|
||||
begin
|
||||
APropertiesClass := GetRegisteredImageOperations.FindByClassName(Value);
|
||||
APropertiesClass := GetRegisteredImageOperations.FindByName(Value);
|
||||
if APropertiesClass = nil then
|
||||
APropertiesClass := TocvImageOperationClass(GetRegisteredImageOperations.Objects[0]);
|
||||
|
||||
for i := 0 to PropCount - 1 do
|
||||
if Supports(GetComponent(i), IocvEditorPropertiesContainer, AIntf) then
|
||||
AIntf.SetPropertiesClass(APropertiesClass);
|
||||
|
||||
Modified;
|
||||
end;
|
||||
|
||||
{ TVideoSourceProperty }
|
||||
|
||||
function TVideoSourceProperty.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
Result := inherited GetAttributes;
|
||||
Result := Result - [paReadOnly] + [paValueList, paSortList, paRevertable];
|
||||
end;
|
||||
|
||||
function TVideoSourceProperty.GetValue: string;
|
||||
Var
|
||||
AInterface: IInterface;
|
||||
ICR: IocvDataSource;
|
||||
begin
|
||||
AInterface := GetIntfValue;
|
||||
if (AInterface <> nil) and Supports(AInterface, IocvDataSource, ICR) then
|
||||
Result := ICR.GetName
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
procedure TVideoSourceProperty.GetValues(Proc: TGetStrProc);
|
||||
begin
|
||||
FGetValuesStrProc := Proc;
|
||||
try
|
||||
Designer.GetComponentNames(GetTypeData(TypeInfo(TComponent)), ReceiveComponentNames);
|
||||
finally
|
||||
FGetValuesStrProc := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVideoSourceProperty.ReceiveComponentNames(const S: string);
|
||||
var
|
||||
Temp: TComponent;
|
||||
Intf: IInterface;
|
||||
i: Integer;
|
||||
begin
|
||||
Temp := Designer.GetComponent(S);
|
||||
if Assigned(FGetValuesStrProc) and Assigned(Temp) then
|
||||
begin
|
||||
if Supports(TObject(Temp), GetTypeData(GetPropType)^.Guid, Intf) then
|
||||
FGetValuesStrProc(S);
|
||||
if not HasInstance(Temp) then
|
||||
if Temp is TocvSplitter then
|
||||
for i := 0 to (Temp as TocvSplitter).Channels.Count - 1 do
|
||||
FGetValuesStrProc(S + '[' + i.ToString + ']');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVideoSourceProperty.SetValue(const Value: string);
|
||||
var
|
||||
Intf: IInterface;
|
||||
Component: TComponent;
|
||||
CompName: string;
|
||||
n1, n2, ChanIndex: Integer;
|
||||
SpComp: TocvSplitter;
|
||||
begin
|
||||
if Value = '' then
|
||||
Intf := nil
|
||||
else
|
||||
begin
|
||||
if Pos('[', Value) <> 0 then
|
||||
begin
|
||||
CompName := Copy(Value, 1, Pos('[', Value) - 1);
|
||||
n1 := Pos('[', Value);
|
||||
n2 := Pos(']', Value);
|
||||
ChanIndex := Copy(Value, n1 + 1, n2 - n1 - 1).ToInteger;
|
||||
SpComp := Designer.GetComponent(CompName) as TocvSplitter;
|
||||
if Assigned(SpComp) and (ChanIndex < SpComp.Channels.Count) then
|
||||
Intf := SpComp.Channels[ChanIndex]
|
||||
else
|
||||
raise EDesignPropertyError.CreateRes(@SInvalidPropertyValue);
|
||||
end
|
||||
else
|
||||
begin
|
||||
Component := Designer.GetComponent(Value);
|
||||
if (Component = nil) or (not Supports(TObject(Component), GetTypeData(GetPropType)^.Guid, Intf)) then
|
||||
raise EDesignPropertyError.CreateRes(@SInvalidPropertyValue);
|
||||
end;
|
||||
end;
|
||||
SetIntfValue(Intf);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
RegisterPropertyEditor(TypeInfo(TocvCustomImageOperation), TocvImageOperation, 'Properties', TImageOperationProperty);
|
||||
RegisterPropertyEditor(TypeInfo(string), TocvImageOperation, 'PropertiesClassName', nil);
|
||||
//RegisterPropertyEditor(TypeInfo(TocvCustomImageOperation), nil, 'Operation', TImageOperationProperty);
|
||||
//UnlistPublishedProperty(nil, 'OperationClassName');
|
||||
|
||||
RegisterPropertyEditor(TypeInfo(IocvDataSource), nil, 'VideoSource', TVideoSourceProperty);
|
||||
RegisterPropertyEditor(TypeInfo(TocvCustomImageOperation), TocvImageOperation, 'Operation', TImageOperationProperty);
|
||||
RegisterPropertyEditor(TypeInfo(TocvCustomImageOperation), TocvImageOperationCollectionItem, 'Operation', TImageOperationProperty);
|
||||
UnlistPublishedProperty(TocvImageOperation, 'OperationClassName');
|
||||
UnlistPublishedProperty(TocvImageOperationCollectionItem, 'OperationClassName');
|
||||
|
||||
end.
|
||||
|
@ -39,7 +39,7 @@ type
|
||||
CS: TCriticalSection;
|
||||
FOwner: TComponent;
|
||||
protected
|
||||
procedure LockTransform;
|
||||
function LockTransform: Boolean;
|
||||
procedure UnlockTransform;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); virtual;
|
||||
@ -79,6 +79,70 @@ type
|
||||
property ApertureSize: Integer Read FApertureSize write SetApertureSize default 100;
|
||||
end;
|
||||
|
||||
TocvErodeDilateMode = (SHAPE_RECT, SHAPE_CROSS, SHAPE_ELLIPSE, SHAPE_CUSTOM);
|
||||
|
||||
TovcCustomErodeDilate = class(TocvCustomImageOperation)
|
||||
protected
|
||||
procedure AssignTo(Dest: TPersistent); override;
|
||||
private
|
||||
FRadius: Integer;
|
||||
FIterations: Integer;
|
||||
FMorphOp: TocvErodeDilateMode;
|
||||
procedure SetRadius(const Value: Integer);
|
||||
procedure SetIterations(const Value: Integer);
|
||||
procedure SetMorphOp(const Value: TocvErodeDilateMode);
|
||||
protected
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
published
|
||||
property Radius: Integer Read FRadius write SetRadius default 5;
|
||||
property Iterations: Integer Read FIterations write SetIterations default 5;
|
||||
property MorphOp: TocvErodeDilateMode read FMorphOp write SetMorphOp default SHAPE_RECT;
|
||||
end;
|
||||
|
||||
TovcErode = class(TovcCustomErodeDilate)
|
||||
public
|
||||
function Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean; override;
|
||||
end;
|
||||
|
||||
TovcDilate = class(TovcCustomErodeDilate)
|
||||
public
|
||||
function Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean; override;
|
||||
end;
|
||||
|
||||
TocvLaplace = class(TocvCustomImageOperation)
|
||||
protected
|
||||
procedure AssignTo(Dest: TPersistent); override;
|
||||
private
|
||||
FAperture: Integer;
|
||||
procedure SetAperture(const Value: Integer);
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
function Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean; override;
|
||||
published
|
||||
property Aperture: Integer read FAperture write SetAperture default 3;
|
||||
end;
|
||||
|
||||
TovcSobel = class(TocvCustomImageOperation)
|
||||
protected
|
||||
procedure AssignTo(Dest: TPersistent); override;
|
||||
private
|
||||
FXOrder: Integer;
|
||||
FYOrder: Integer;
|
||||
FAperture: Integer;
|
||||
procedure SetAperture(const Value: Integer);
|
||||
procedure SetXOrder(const Value: Integer);
|
||||
procedure SetYOrder(const Value: Integer);
|
||||
protected
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
function Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean; override;
|
||||
published
|
||||
property XOrder: Integer read FXOrder write SetXOrder default 1;
|
||||
property YOrder: Integer read FYOrder write SetYOrder default 1;
|
||||
property Aperture: Integer read FAperture write SetAperture default 3;
|
||||
end;
|
||||
|
||||
TocvSmoothOperations = (BLUR_NO_SCALE, BLUR, GAUSSIAN, MEDIAN, BILATERAL);
|
||||
|
||||
TovcImageOperation_Smooth = class(TocvCustomImageOperation)
|
||||
@ -113,12 +177,49 @@ type
|
||||
procedure SetPropertiesClass(Value: TocvImageOperationClass);
|
||||
end;
|
||||
|
||||
TocvImageOperationCollectionItem = class(TCollectionItem, IocvEditorPropertiesContainer)
|
||||
private
|
||||
CS: TCriticalSection;
|
||||
FOperation: TocvCustomImageOperation;
|
||||
FOperationClass: TocvImageOperationClass;
|
||||
function LockTransform: Boolean;
|
||||
procedure UnlockTransform;
|
||||
procedure CreateProperties;
|
||||
procedure DestroyProperties;
|
||||
procedure RecreateProperties;
|
||||
function GetPropertiesClassName: string;
|
||||
procedure SetProperties(const Value: TocvCustomImageOperation);
|
||||
procedure SetPropertiesClass(Value: TocvImageOperationClass);
|
||||
procedure SetPropertiesClassName(const Value: string);
|
||||
protected
|
||||
function GetProperties: TocvCustomImageOperation;
|
||||
function GetPropertiesClass: TocvImageOperationClass;
|
||||
// function GetOwner: TComponent;
|
||||
function GetDisplayName: string; override;
|
||||
{IInterface}
|
||||
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
|
||||
function _AddRef: Integer; stdcall;
|
||||
function _Release: Integer; stdcall;
|
||||
public
|
||||
constructor Create(Collection: TCollection); override;
|
||||
destructor Destroy; override;
|
||||
function Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean;
|
||||
procedure Assign(Source: TPersistent); override;
|
||||
property OperationClass: TocvImageOperationClass read GetPropertiesClass write SetPropertiesClass;
|
||||
published
|
||||
property OperationClassName: string read GetPropertiesClassName write SetPropertiesClassName;
|
||||
property Operation: TocvCustomImageOperation read GetProperties write SetProperties;
|
||||
end;
|
||||
|
||||
TocvImageOperationCollection = class(TOwnedCollection);
|
||||
|
||||
TocvImageOperation = class(TocvDataSourceAndReceiver, IocvEditorPropertiesContainer)
|
||||
private
|
||||
CS: TCriticalSection;
|
||||
FProperties: TocvCustomImageOperation;
|
||||
FPropertiesClass: TocvImageOperationClass;
|
||||
procedure LockTransform;
|
||||
FOperation: TocvCustomImageOperation;
|
||||
FOperationClass: TocvImageOperationClass;
|
||||
FOperations: TocvImageOperationCollection;
|
||||
function LockTransform: Boolean;
|
||||
procedure UnlockTransform;
|
||||
procedure CreateProperties;
|
||||
procedure DestroyProperties;
|
||||
@ -134,15 +235,17 @@ type
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
property PropertiesClass: TocvImageOperationClass read GetPropertiesClass write SetPropertiesClass;
|
||||
property OperationClass: TocvImageOperationClass read GetPropertiesClass write SetPropertiesClass;
|
||||
published
|
||||
property PropertiesClassName: string read GetPropertiesClassName write SetPropertiesClassName;
|
||||
property Properties: TocvCustomImageOperation read GetProperties write SetProperties;
|
||||
property OperationClassName: string read GetPropertiesClassName write SetPropertiesClassName;
|
||||
property Operation: TocvCustomImageOperation read GetProperties write SetProperties;
|
||||
property Operations: TocvImageOperationCollection Read FOperations write FOperations;
|
||||
end;
|
||||
|
||||
TRegisteredImageOperations = class(TStringList)
|
||||
public
|
||||
function FindByClassName(const ClassName: String): TocvImageOperationClass;
|
||||
function FindByName(const Name: String): TocvImageOperationClass;
|
||||
function GetNameByClass(const IOClass: TClass): String;
|
||||
procedure RegisterIOClass(const IOClass: TClass; const ClassName: String);
|
||||
end;
|
||||
@ -166,32 +269,32 @@ begin
|
||||
Result := _RegisteredImageOperations;
|
||||
end;
|
||||
|
||||
{ TocvImageOperation }
|
||||
{TocvImageOperation}
|
||||
|
||||
procedure TocvImageOperation.SetProperties(const Value: TocvCustomImageOperation);
|
||||
begin
|
||||
if (FProperties <> nil) and (Value <> nil) then
|
||||
FProperties.Assign(Value);
|
||||
if (FOperation <> nil) and (Value <> nil) then
|
||||
FOperation.Assign(Value);
|
||||
end;
|
||||
|
||||
procedure TocvImageOperation.SetPropertiesClass(Value: TocvImageOperationClass);
|
||||
begin
|
||||
if FPropertiesClass <> Value then
|
||||
if FOperationClass <> Value then
|
||||
begin
|
||||
FPropertiesClass := Value;
|
||||
FOperationClass := Value;
|
||||
RecreateProperties;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TocvImageOperation.CreateProperties;
|
||||
begin
|
||||
if FPropertiesClass <> nil then
|
||||
FProperties := FPropertiesClass.Create(Self);
|
||||
if FOperationClass <> nil then
|
||||
FOperation := FOperationClass.Create(Self);
|
||||
end;
|
||||
|
||||
procedure TocvImageOperation.DestroyProperties;
|
||||
begin
|
||||
FreeAndNil(FProperties);
|
||||
FreeAndNil(FOperation);
|
||||
end;
|
||||
|
||||
procedure TocvImageOperation.RecreateProperties;
|
||||
@ -202,59 +305,74 @@ end;
|
||||
|
||||
procedure TocvImageOperation.SetPropertiesClassName(const Value: string);
|
||||
begin
|
||||
PropertiesClass := TocvImageOperationClass(GetRegisteredImageOperations.FindByClassName(Value));
|
||||
OperationClass := TocvImageOperationClass(GetRegisteredImageOperations.FindByClassName(Value));
|
||||
end;
|
||||
|
||||
constructor TocvImageOperation.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
CS := TCriticalSection.Create;
|
||||
FOperations := TocvImageOperationCollection.Create(Self, TocvImageOperationCollectionItem);
|
||||
end;
|
||||
|
||||
destructor TocvImageOperation.Destroy;
|
||||
begin
|
||||
LockTransform;
|
||||
if Assigned(FProperties) then
|
||||
FreeAndNil(FProperties);
|
||||
if LockTransform then
|
||||
if Assigned(FOperation) then
|
||||
FreeAndNil(FOperation);
|
||||
FOperations.Free;
|
||||
CS.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TocvImageOperation.GetProperties: TocvCustomImageOperation;
|
||||
begin
|
||||
if not Assigned(FProperties) then
|
||||
FProperties := TocvImageOperation_None.Create(Self);
|
||||
Result := FProperties;
|
||||
if not Assigned(FOperation) then
|
||||
FOperation := TocvImageOperation_None.Create(Self);
|
||||
Result := FOperation;
|
||||
end;
|
||||
|
||||
function TocvImageOperation.GetPropertiesClass: TocvImageOperationClass;
|
||||
begin
|
||||
Result := TocvImageOperationClass(Properties.ClassType);
|
||||
Result := TocvImageOperationClass(Operation.ClassType);
|
||||
end;
|
||||
|
||||
function TocvImageOperation.GetPropertiesClassName: string;
|
||||
begin
|
||||
Result := Properties.ClassName;
|
||||
Result := Operation.ClassName;
|
||||
end;
|
||||
|
||||
procedure TocvImageOperation.LockTransform;
|
||||
function TocvImageOperation.LockTransform: Boolean;
|
||||
begin
|
||||
CS.Enter;
|
||||
Result := CS.TryEnter;
|
||||
end;
|
||||
|
||||
procedure TocvImageOperation.TakeImage(const IplImage: pIplImage);
|
||||
var
|
||||
Destanation: pIplImage;
|
||||
SourceDestanation: pIplImage;
|
||||
i: Integer;
|
||||
begin
|
||||
if Assigned(FProperties) and FProperties.Transform(IplImage, Destanation) then
|
||||
begin
|
||||
LockTransform;
|
||||
if LockTransform then
|
||||
try
|
||||
if FOperations.Count > 0 then
|
||||
begin
|
||||
SourceDestanation := IplImage;
|
||||
for i := 0 to FOperations.Count - 1 do
|
||||
begin
|
||||
if not(FOperations.Items[i] as TocvImageOperationCollectionItem).Transform(SourceDestanation, Destanation) then
|
||||
Exit;
|
||||
if SourceDestanation <> IplImage then
|
||||
cvReleaseImage(SourceDestanation);
|
||||
SourceDestanation := Destanation;
|
||||
end;
|
||||
NotifyReceiver(SourceDestanation);
|
||||
end
|
||||
else if Assigned(FOperation) and FOperation.Transform(IplImage, Destanation) then
|
||||
NotifyReceiver(Destanation);
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TocvImageOperation.UnlockTransform;
|
||||
@ -262,7 +380,7 @@ begin
|
||||
CS.Leave;
|
||||
end;
|
||||
|
||||
{ TovcImageOperationCanny }
|
||||
{TovcImageOperationCanny}
|
||||
|
||||
procedure TovcImageOperation_Canny.AssignTo(Dest: TPersistent);
|
||||
begin
|
||||
@ -276,7 +394,7 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
constructor TovcImageOperation_Canny.Create { (AOwner: TPersistent) };
|
||||
constructor TovcImageOperation_Canny.Create {(AOwner: TPersistent)};
|
||||
begin
|
||||
inherited;
|
||||
FThreshold1 := 10;
|
||||
@ -286,7 +404,7 @@ end;
|
||||
|
||||
procedure TovcImageOperation_Canny.SetApertureSize(const Value: Integer);
|
||||
begin
|
||||
LockTransform;
|
||||
if LockTransform then
|
||||
try
|
||||
FApertureSize := Value;
|
||||
finally
|
||||
@ -296,7 +414,7 @@ end;
|
||||
|
||||
procedure TovcImageOperation_Canny.SetThreshold1(const Value: double);
|
||||
begin
|
||||
LockTransform;
|
||||
if LockTransform then
|
||||
try
|
||||
FThreshold1 := Value;
|
||||
finally
|
||||
@ -306,7 +424,7 @@ end;
|
||||
|
||||
procedure TovcImageOperation_Canny.SetThreshold2(const Value: double);
|
||||
begin
|
||||
LockTransform;
|
||||
if LockTransform then
|
||||
try
|
||||
FThreshold2 := Value;
|
||||
finally
|
||||
@ -318,7 +436,8 @@ function TovcImageOperation_Canny.Transform(const Source: pIplImage; var Destana
|
||||
Var
|
||||
gray: pIplImage;
|
||||
begin
|
||||
LockTransform;
|
||||
Result := False;
|
||||
if LockTransform then
|
||||
try
|
||||
// cîçäà¸ì îäíîêàíàëüíûå êàðòèíêè
|
||||
gray := cvCreateImage(cvGetSize(Source), IPL_DEPTH_8U, 1);
|
||||
@ -334,25 +453,37 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TocvImageOperationGrayScale }
|
||||
{TocvImageOperationGrayScale}
|
||||
|
||||
function TocvImageOperation_GrayScale.Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if LockTransform then
|
||||
try
|
||||
Destanation := cvCreateImage(cvGetSize(Source), IPL_DEPTH_8U, 1);
|
||||
// ïðåîáðàçóåì â ãðàäàöèè cåðîãî
|
||||
cvCvtColor(Source, Destanation, CV_RGB2GRAY);
|
||||
Result := true;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TocvImageOperationNone }
|
||||
{TocvImageOperationNone}
|
||||
|
||||
function TocvImageOperation_None.Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
if LockTransform then
|
||||
try
|
||||
Destanation := cvCloneImage(Source);
|
||||
Result := true;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TCustomOpenCVImgOperation }
|
||||
{TCustomOpenCVImgOperation}
|
||||
|
||||
constructor TocvCustomImageOperation.Create(AOwner: TComponent);
|
||||
begin
|
||||
@ -367,9 +498,9 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TocvCustomImageOperation.LockTransform;
|
||||
function TocvCustomImageOperation.LockTransform: Boolean;
|
||||
begin
|
||||
CS.Enter;
|
||||
Result := CS.TryEnter;
|
||||
end;
|
||||
|
||||
procedure TocvCustomImageOperation.UnlockTransform;
|
||||
@ -377,9 +508,10 @@ begin
|
||||
CS.Leave;
|
||||
end;
|
||||
|
||||
{ TovcImageOperationSmooth }
|
||||
{TovcImageOperationSmooth}
|
||||
Const
|
||||
ocvSmoothOperations: array [TocvSmoothOperations] of Integer = (CV_BLUR_NO_SCALE, CV_BLUR, CV_GAUSSIAN, CV_MEDIAN, CV_BILATERAL);
|
||||
ocvSmoothOperations: array [TocvSmoothOperations] of Integer = (CV_BLUR_NO_SCALE, CV_BLUR, CV_GAUSSIAN, CV_MEDIAN,
|
||||
CV_BILATERAL);
|
||||
|
||||
procedure TovcImageOperation_Smooth.AssignTo(Dest: TPersistent);
|
||||
begin
|
||||
@ -395,7 +527,7 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
constructor TovcImageOperation_Smooth.Create { (AOwner: TPersistent) };
|
||||
constructor TovcImageOperation_Smooth.Create {(AOwner: TPersistent)};
|
||||
begin
|
||||
inherited;
|
||||
FSmoothOperation := GAUSSIAN;
|
||||
@ -407,7 +539,7 @@ end;
|
||||
|
||||
procedure TovcImageOperation_Smooth.SetSigma1(const Value: double);
|
||||
begin
|
||||
LockTransform;
|
||||
if LockTransform then
|
||||
try
|
||||
FSigma1 := Value;
|
||||
finally
|
||||
@ -418,7 +550,7 @@ end;
|
||||
//
|
||||
procedure TovcImageOperation_Smooth.Setsigma2(const Value: double);
|
||||
begin
|
||||
LockTransform;
|
||||
if LockTransform then
|
||||
try
|
||||
FSigma2 := Value;
|
||||
finally
|
||||
@ -429,7 +561,7 @@ end;
|
||||
//
|
||||
procedure TovcImageOperation_Smooth.SetSize1(const Value: Integer);
|
||||
begin
|
||||
LockTransform;
|
||||
if LockTransform then
|
||||
try
|
||||
FSize1 := Value;
|
||||
finally
|
||||
@ -440,7 +572,7 @@ end;
|
||||
//
|
||||
procedure TovcImageOperation_Smooth.SetSize2(const Value: Integer);
|
||||
begin
|
||||
LockTransform;
|
||||
if LockTransform then
|
||||
try
|
||||
FSize2 := Value;
|
||||
finally
|
||||
@ -450,7 +582,7 @@ end;
|
||||
|
||||
procedure TovcImageOperation_Smooth.SetSmoothOperation(const Value: TocvSmoothOperations);
|
||||
begin
|
||||
LockTransform;
|
||||
if LockTransform then
|
||||
try
|
||||
FSmoothOperation := Value;
|
||||
finally
|
||||
@ -460,7 +592,8 @@ end;
|
||||
|
||||
function TovcImageOperation_Smooth.Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean;
|
||||
begin
|
||||
LockTransform;
|
||||
Result := False;
|
||||
if LockTransform then
|
||||
try
|
||||
Destanation := cvCloneImage(Source);
|
||||
cvSmooth(Source, Destanation, ocvSmoothOperations[SmoothOperation], size1, size2, sigma1, sigma2);
|
||||
@ -470,13 +603,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TRegisteredImageOperations }
|
||||
{TRegisteredImageOperations}
|
||||
|
||||
function TRegisteredImageOperations.FindByClassName(const ClassName: String): TocvImageOperationClass;
|
||||
Var
|
||||
i: Integer;
|
||||
begin
|
||||
i := IndexOf(ClassName);
|
||||
for i := 0 to Count - 1 do
|
||||
if TocvImageOperationClass(Objects[i]).ClassName = ClassName then
|
||||
Exit(TocvImageOperationClass(Objects[i]));
|
||||
end;
|
||||
|
||||
function TRegisteredImageOperations.FindByName(const Name: String): TocvImageOperationClass;
|
||||
Var
|
||||
i: Integer;
|
||||
begin
|
||||
i := IndexOf(Name);
|
||||
if i <> -1 then
|
||||
Result := TocvImageOperationClass(Objects[i])
|
||||
else
|
||||
@ -502,12 +644,350 @@ begin
|
||||
RegisterClass(TPersistentClass(IOClass));
|
||||
end;
|
||||
|
||||
{TovcCustomErodeDilate}
|
||||
|
||||
procedure TovcCustomErodeDilate.AssignTo(Dest: TPersistent);
|
||||
begin
|
||||
if Dest is TovcCustomErodeDilate then
|
||||
begin
|
||||
FRadius := (Dest as TovcCustomErodeDilate).Radius;
|
||||
FIterations := (Dest as TovcCustomErodeDilate).Iterations;
|
||||
FMorphOp := (Dest as TovcCustomErodeDilate).MorphOp;
|
||||
end
|
||||
else
|
||||
inherited;
|
||||
end;
|
||||
|
||||
constructor TovcCustomErodeDilate.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FRadius := 5;
|
||||
FIterations := 5;
|
||||
end;
|
||||
|
||||
procedure TovcCustomErodeDilate.SetIterations(const Value: Integer);
|
||||
begin
|
||||
if LockTransform then
|
||||
try
|
||||
FIterations := Value;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TovcCustomErodeDilate.SetMorphOp(const Value: TocvErodeDilateMode);
|
||||
begin
|
||||
if LockTransform then
|
||||
try
|
||||
FMorphOp := Value;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TovcCustomErodeDilate.SetRadius(const Value: Integer);
|
||||
begin
|
||||
if LockTransform then
|
||||
try
|
||||
FRadius := Value;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
const
|
||||
EDMorpgOp: array [TocvErodeDilateMode] of Integer = (CV_SHAPE_RECT, CV_SHAPE_CROSS, CV_SHAPE_ELLIPSE, CV_SHAPE_CUSTOM);
|
||||
|
||||
{TovcErode}
|
||||
|
||||
function TovcErode.Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean;
|
||||
Var
|
||||
Kern: pIplConvKernel;
|
||||
begin
|
||||
Result := False;
|
||||
if LockTransform then
|
||||
try
|
||||
Destanation := cvCloneImage(Source);
|
||||
Kern := cvCreateStructuringElementEx(Radius * 2 + 1, Radius * 2 + 1, Radius, Radius, EDMorpgOp[FMorphOp]);
|
||||
cvErode(Source, Destanation, Kern, Iterations);
|
||||
cvReleaseStructuringElement(Kern);
|
||||
Result := true;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
{TovcDilate}
|
||||
|
||||
function TovcDilate.Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean;
|
||||
Var
|
||||
Kern: pIplConvKernel;
|
||||
begin
|
||||
Result := False;
|
||||
if LockTransform then
|
||||
try
|
||||
Destanation := cvCloneImage(Source);
|
||||
Kern := cvCreateStructuringElementEx(Radius * 2 + 1, Radius * 2 + 1, Radius, Radius, EDMorpgOp[FMorphOp]);
|
||||
cvDilate(Source, Destanation, Kern, Iterations);
|
||||
cvReleaseStructuringElement(Kern);
|
||||
Result := true;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
{TocvLaplace}
|
||||
|
||||
procedure TocvLaplace.AssignTo(Dest: TPersistent);
|
||||
begin
|
||||
if Dest is TocvLaplace then
|
||||
begin
|
||||
FAperture := (Dest as TocvLaplace).Aperture;
|
||||
end
|
||||
else
|
||||
inherited;
|
||||
end;
|
||||
|
||||
constructor TocvLaplace.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAperture := 3;
|
||||
end;
|
||||
|
||||
procedure TocvLaplace.SetAperture(const Value: Integer);
|
||||
begin
|
||||
if LockTransform then
|
||||
try
|
||||
FAperture := Value;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TocvLaplace.Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean;
|
||||
Var
|
||||
D: pIplImage;
|
||||
begin
|
||||
Result := False;
|
||||
if LockTransform then
|
||||
try
|
||||
D := cvCreateImage(cvGetSize(Source), IPL_DEPTH_16S, Source^.nChannels);
|
||||
Destanation := cvCreateImage(cvGetSize(Source), Source^.depth, Source^.nChannels);
|
||||
cvLaplace(Source, D, Aperture);
|
||||
cvConvertScale(D, Destanation);
|
||||
cvReleaseImage(D);
|
||||
Result := true;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
{TovcSobel}
|
||||
|
||||
procedure TovcSobel.AssignTo(Dest: TPersistent);
|
||||
begin
|
||||
if Dest is TovcSobel then
|
||||
begin
|
||||
FXOrder := (Dest as TovcSobel).XOrder;
|
||||
FYOrder := (Dest as TovcSobel).YOrder;
|
||||
FAperture := (Dest as TovcSobel).Aperture;
|
||||
end
|
||||
else
|
||||
inherited;
|
||||
end;
|
||||
|
||||
constructor TovcSobel.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FXOrder := 1;
|
||||
FYOrder := 1;
|
||||
FAperture := 3;
|
||||
end;
|
||||
|
||||
procedure TovcSobel.SetAperture(const Value: Integer);
|
||||
begin
|
||||
if LockTransform then
|
||||
try
|
||||
FAperture := Value;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TovcSobel.SetXOrder(const Value: Integer);
|
||||
begin
|
||||
if LockTransform then
|
||||
try
|
||||
if (YOrder <> 0) and (Value <> 0) then
|
||||
FXOrder := Value;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TovcSobel.SetYOrder(const Value: Integer);
|
||||
begin
|
||||
if LockTransform then
|
||||
try
|
||||
if (XOrder <> 0) and (Value <> 0) then
|
||||
FYOrder := Value;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TovcSobel.Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean;
|
||||
Var
|
||||
D: pIplImage;
|
||||
begin
|
||||
Result := False;
|
||||
if LockTransform then
|
||||
try
|
||||
D := cvCreateImage(cvGetSize(Source), IPL_DEPTH_16S, Source^.nChannels);
|
||||
Destanation := cvCreateImage(cvGetSize(Source), Source^.depth, Source^.nChannels);
|
||||
cvSobel(Source, D, XOrder, YOrder, Aperture);
|
||||
cvConvertScale(D, Destanation);
|
||||
cvReleaseImage(D);
|
||||
Result := true;
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
{TocvImageOperationCollectionItem}
|
||||
|
||||
procedure TocvImageOperationCollectionItem.Assign(Source: TPersistent);
|
||||
begin
|
||||
if Source is TocvImageOperationCollectionItem then
|
||||
Operation.Assign(TocvImageOperationCollectionItem(Source).Operation)
|
||||
else
|
||||
inherited;
|
||||
end;
|
||||
|
||||
constructor TocvImageOperationCollectionItem.Create(Collection: TCollection);
|
||||
begin
|
||||
inherited;
|
||||
CS := TCriticalSection.Create;
|
||||
end;
|
||||
|
||||
procedure TocvImageOperationCollectionItem.CreateProperties;
|
||||
begin
|
||||
if FOperationClass <> nil then
|
||||
FOperation := FOperationClass.Create(nil);
|
||||
end;
|
||||
|
||||
destructor TocvImageOperationCollectionItem.Destroy;
|
||||
begin
|
||||
CS.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TocvImageOperationCollectionItem.DestroyProperties;
|
||||
begin
|
||||
FreeAndNil(FOperation);
|
||||
end;
|
||||
|
||||
function TocvImageOperationCollectionItem.GetDisplayName: string;
|
||||
begin
|
||||
Result := GetRegisteredImageOperations.GetNameByClass(FOperation.ClassType);
|
||||
end;
|
||||
|
||||
// function TocvImageOperationCollectionItem.GetOwner: TComponent;
|
||||
// begin
|
||||
// Result := (Collection as TOwnedCollection).Owner as TComponent;
|
||||
// end;
|
||||
|
||||
function TocvImageOperationCollectionItem.GetProperties: TocvCustomImageOperation;
|
||||
begin
|
||||
if not Assigned(FOperation) then
|
||||
FOperation := TocvImageOperation_None.Create(nil);
|
||||
Result := FOperation;
|
||||
end;
|
||||
|
||||
function TocvImageOperationCollectionItem.GetPropertiesClass: TocvImageOperationClass;
|
||||
begin
|
||||
Result := TocvImageOperationClass(Operation.ClassType);
|
||||
end;
|
||||
|
||||
function TocvImageOperationCollectionItem.GetPropertiesClassName: string;
|
||||
begin
|
||||
Result := Operation.ClassName;
|
||||
end;
|
||||
|
||||
function TocvImageOperationCollectionItem.LockTransform: Boolean;
|
||||
begin
|
||||
Result := CS.TryEnter;
|
||||
end;
|
||||
|
||||
function TocvImageOperationCollectionItem.QueryInterface(const IID: TGUID; out Obj): HResult;
|
||||
begin
|
||||
if GetInterface(IID, Obj) then
|
||||
Result := 0
|
||||
else
|
||||
Result := E_NOINTERFACE;
|
||||
end;
|
||||
|
||||
procedure TocvImageOperationCollectionItem.RecreateProperties;
|
||||
begin
|
||||
DestroyProperties;
|
||||
CreateProperties;
|
||||
end;
|
||||
|
||||
procedure TocvImageOperationCollectionItem.SetProperties(const Value: TocvCustomImageOperation);
|
||||
begin
|
||||
if (FOperation <> nil) and (Value <> nil) then
|
||||
FOperation.Assign(Value);
|
||||
end;
|
||||
|
||||
procedure TocvImageOperationCollectionItem.SetPropertiesClass(Value: TocvImageOperationClass);
|
||||
begin
|
||||
if FOperationClass <> Value then
|
||||
begin
|
||||
FOperationClass := Value;
|
||||
RecreateProperties;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TocvImageOperationCollectionItem.SetPropertiesClassName(const Value: string);
|
||||
begin
|
||||
OperationClass := TocvImageOperationClass(GetRegisteredImageOperations.FindByClassName(Value));
|
||||
end;
|
||||
|
||||
function TocvImageOperationCollectionItem.Transform(const Source: pIplImage; var Destanation: pIplImage): Boolean;
|
||||
begin
|
||||
if LockTransform then
|
||||
try
|
||||
Result := Assigned(FOperation) and FOperation.Transform(Source, Destanation)
|
||||
finally
|
||||
UnlockTransform;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TocvImageOperationCollectionItem.UnlockTransform;
|
||||
begin
|
||||
CS.Leave;
|
||||
end;
|
||||
|
||||
function TocvImageOperationCollectionItem._AddRef: Integer;
|
||||
begin
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function TocvImageOperationCollectionItem._Release: Integer;
|
||||
begin
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
GetRegisteredImageOperations.RegisterIOClass(TocvImageOperation_None, 'None');
|
||||
GetRegisteredImageOperations.RegisterIOClass(TocvImageOperation_GrayScale, 'GrayScale');
|
||||
GetRegisteredImageOperations.RegisterIOClass(TovcImageOperation_Canny, 'Canny');
|
||||
GetRegisteredImageOperations.RegisterIOClass(TovcImageOperation_Smooth, 'Smooth');
|
||||
GetRegisteredImageOperations.RegisterIOClass(TovcErode, 'Erode');
|
||||
GetRegisteredImageOperations.RegisterIOClass(TovcDilate, 'Dilate');
|
||||
GetRegisteredImageOperations.RegisterIOClass(TocvLaplace, 'Laplace');
|
||||
GetRegisteredImageOperations.RegisterIOClass(TovcSobel, 'Sobel');
|
||||
|
||||
finalization
|
||||
|
||||
|
@ -33,8 +33,7 @@ Uses
|
||||
System.Classes,
|
||||
uOCVCamera,
|
||||
uOCVView,
|
||||
uOCVImageOperation,
|
||||
uOCVSplitter;
|
||||
uOCVImageOperation;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
@ -42,9 +41,7 @@ begin
|
||||
RegisterComponents('OpenCV', [TocvCamera]);
|
||||
RegisterComponents('OpenCV', [TocvCamera]);
|
||||
RegisterComponents('OpenCV', [TocvView]);
|
||||
RegisterComponents('OpenCV', [TocvSplitter]);
|
||||
RegisterClasses([TocvImageOperation_None, TocvImageOperation_GrayScale, TovcImageOperation_Canny, TovcImageOperation_Smooth,
|
||||
TocvChannel]);
|
||||
RegisterClasses([TocvImageOperation_None, TocvImageOperation_GrayScale, TovcImageOperation_Canny, TovcImageOperation_Smooth]);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -1,188 +0,0 @@
|
||||
// *****************************************************************
|
||||
// Delphi-OpenCV Demo
|
||||
// Copyright (C) 2013 Project Delphi-OpenCV
|
||||
// ****************************************************************
|
||||
// Contributor:
|
||||
// Laentir Valetov
|
||||
// email:laex@bk.ru
|
||||
// ****************************************************************
|
||||
// You may retrieve the latest version of this file at the GitHub,
|
||||
// located at git://github.com/Laex/Delphi-OpenCV.git
|
||||
// ****************************************************************
|
||||
// The contents of this file are used with permission, subject to
|
||||
// the Mozilla Public License Version 1.1 (the "License"); you may
|
||||
// not use this file except in compliance with the License. You may
|
||||
// obtain a copy of the License at
|
||||
// http://www.mozilla.org/MPL/MPL-1_1Final.html
|
||||
//
|
||||
// Software distributed under the License is distributed on an
|
||||
// "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
// implied. See the License for the specific language governing
|
||||
// rights and limitations under the License.
|
||||
// *******************************************************************
|
||||
unit uOCVSplitter;
|
||||
|
||||
interface
|
||||
|
||||
Uses
|
||||
System.Classes,
|
||||
core.types_c,
|
||||
uOCVTypes;
|
||||
|
||||
Type
|
||||
TocvChannel = class(TCollectionItem, IocvDataSource)
|
||||
private
|
||||
FOpenCVVideoReceiver: IocvDataReceiver;
|
||||
FVCLComObject: Pointer;
|
||||
FDataReceiver: TocvDataReceiver;
|
||||
FName: String;
|
||||
protected
|
||||
procedure SetReceiver(const OpenCVVideoReceiver: IocvDataReceiver);
|
||||
procedure NotifyReceiver(const IplImage: pIplImage);
|
||||
{ IInterface }
|
||||
function QueryInterface(const IID: TGUID; out Obj): HResult; virtual; stdcall;
|
||||
function _AddRef: Integer; stdcall;
|
||||
function _Release: Integer; stdcall;
|
||||
function GetName: string;
|
||||
published
|
||||
constructor Create(Collection: TCollection); override;
|
||||
property Name: String read GetName write FName;
|
||||
end;
|
||||
|
||||
TocvChannelCollection = class(TCollection)
|
||||
private
|
||||
FOwner: TComponent;
|
||||
function GetOCVItem(Index: Integer): IocvDataSource;
|
||||
public
|
||||
constructor Create(const AOwner: TComponent; const ItemClass: TCollectionItemClass);
|
||||
property OCVChannel[Index: Integer]: IocvDataSource read GetOCVItem; default;
|
||||
end;
|
||||
|
||||
TocvSplitter = class(TocvDataReceiver)
|
||||
private
|
||||
FChannels: TocvChannelCollection;
|
||||
FocvVideoSource: IocvDataSource;
|
||||
procedure SetOpenCVVideoSource(const Value: IocvDataSource);
|
||||
procedure SetChannels(const Value: TocvChannelCollection);
|
||||
protected
|
||||
procedure TakeImage(const IplImage: pIplImage); override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
published
|
||||
property VideoSource: IocvDataSource Read FocvVideoSource write SetOpenCVVideoSource;
|
||||
property Channels: TocvChannelCollection read FChannels write SetChannels;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
Uses System.SysUtils;
|
||||
|
||||
{ TocvSplitter }
|
||||
|
||||
constructor TocvSplitter.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FChannels := TocvChannelCollection.Create(Self, TocvChannel);
|
||||
end;
|
||||
|
||||
destructor TocvSplitter.Destroy;
|
||||
begin
|
||||
FChannels.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TocvSplitter.SetChannels(const Value: TocvChannelCollection);
|
||||
begin
|
||||
FChannels.Assign(Value);
|
||||
end;
|
||||
|
||||
procedure TocvSplitter.SetOpenCVVideoSource(const Value: IocvDataSource);
|
||||
begin
|
||||
if FocvVideoSource <> Value then
|
||||
begin
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(nil);
|
||||
FocvVideoSource := Value;
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TocvSplitter.TakeImage(const IplImage: pIplImage);
|
||||
var
|
||||
OCVChannel: TCollectionItem;
|
||||
begin
|
||||
for OCVChannel in FChannels do
|
||||
(OCVChannel as TocvChannel).NotifyReceiver(IplImage);
|
||||
end;
|
||||
|
||||
{ TocvChannel }
|
||||
|
||||
constructor TocvChannel.Create(Collection: TCollection);
|
||||
begin
|
||||
inherited;
|
||||
Name;
|
||||
end;
|
||||
|
||||
function TocvChannel.GetName: string;
|
||||
begin
|
||||
if Length(Trim(FName)) = 0 then
|
||||
FName := (Collection as TocvChannelCollection).FOwner.Name + '[' + ID.ToString + ']';
|
||||
Result := FName;
|
||||
end;
|
||||
|
||||
procedure TocvChannel.NotifyReceiver(const IplImage: pIplImage);
|
||||
begin
|
||||
if Assigned(FOpenCVVideoReceiver) then
|
||||
FOpenCVVideoReceiver.TakeImage(IplImage);
|
||||
end;
|
||||
|
||||
function TocvChannel.QueryInterface(const IID: TGUID; out Obj): HResult;
|
||||
begin
|
||||
if FVCLComObject = nil then
|
||||
begin
|
||||
if GetInterface(IID, Obj) then
|
||||
Result := S_OK
|
||||
else
|
||||
Result := E_NOINTERFACE
|
||||
end
|
||||
else
|
||||
Result := IVCLComObject(FVCLComObject).QueryInterface(IID, Obj);
|
||||
end;
|
||||
|
||||
procedure TocvChannel.SetReceiver(const OpenCVVideoReceiver: IocvDataReceiver);
|
||||
begin
|
||||
FOpenCVVideoReceiver := OpenCVVideoReceiver;
|
||||
end;
|
||||
|
||||
function TocvChannel._AddRef: Integer;
|
||||
begin
|
||||
if FVCLComObject = nil then
|
||||
Result := -1 // -1 indicates no reference counting is taking place
|
||||
else
|
||||
Result := IVCLComObject(FVCLComObject)._AddRef;
|
||||
end;
|
||||
|
||||
function TocvChannel._Release: Integer;
|
||||
begin
|
||||
if FVCLComObject = nil then
|
||||
Result := -1 // -1 indicates no reference counting is taking place
|
||||
else
|
||||
Result := IVCLComObject(FVCLComObject)._Release;
|
||||
end;
|
||||
|
||||
{ TocvChannelCollection }
|
||||
|
||||
constructor TocvChannelCollection.Create(const AOwner: TComponent; const ItemClass: TCollectionItemClass);
|
||||
begin
|
||||
inherited Create(ItemClass);
|
||||
FOwner := AOwner;
|
||||
end;
|
||||
|
||||
function TocvChannelCollection.GetOCVItem(Index: Integer): IocvDataSource;
|
||||
begin
|
||||
Result := TocvChannel(inherited GetItem(Index));
|
||||
end;
|
||||
|
||||
end.
|
@ -28,7 +28,7 @@ interface
|
||||
Uses
|
||||
System.SysUtils,
|
||||
System.Classes,
|
||||
System.SyncObjs,
|
||||
// System.SyncObjs,
|
||||
System.Generics.Collections,
|
||||
core.types_c;
|
||||
|
||||
@ -41,23 +41,25 @@ Type
|
||||
|
||||
IocvDataSource = interface
|
||||
['{80640C0A-6828-42F8-83E7-DA5FD9036DFF}']
|
||||
procedure SetReceiver(const OpenCVVideoReceiver: IocvDataReceiver);
|
||||
procedure AddReceiver(const OpenCVVideoReceiver: IocvDataReceiver);
|
||||
procedure RemoveReceiver(const OpenCVVideoReceiver: IocvDataReceiver);
|
||||
function GetName: string;
|
||||
end;
|
||||
|
||||
TocvReceiverList = TList<IocvDataReceiver>;
|
||||
TocvReceiverList = TThreadList<IocvDataReceiver>;
|
||||
|
||||
TocvDataSource = class(TComponent, IocvDataSource)
|
||||
private
|
||||
ReceiverCS: TCriticalSection;
|
||||
// FReceiverCS: TCriticalSection;
|
||||
protected
|
||||
FOpenCVVideoReceiver: IocvDataReceiver;
|
||||
procedure NotifyReceiver(const IplImage: pIplImage); virtual;
|
||||
FOpenCVVideoReceivers: TocvReceiverList;
|
||||
function GetName: string; virtual;
|
||||
procedure NotifyReceiver(const IplImage: pIplImage); virtual;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure SetReceiver(const OpenCVVideoReceiver: IocvDataReceiver); virtual;
|
||||
procedure AddReceiver(const OpenCVVideoReceiver: IocvDataReceiver); virtual;
|
||||
procedure RemoveReceiver(const OpenCVVideoReceiver: IocvDataReceiver); virtual;
|
||||
end;
|
||||
|
||||
TocvDataReceiver = class(TComponent, IocvDataReceiver)
|
||||
@ -88,27 +90,22 @@ Type
|
||||
|
||||
implementation
|
||||
|
||||
{ TOpenCVDataSource }
|
||||
{TOpenCVDataSource}
|
||||
|
||||
procedure TocvDataSource.SetReceiver(const OpenCVVideoReceiver: IocvDataReceiver);
|
||||
procedure TocvDataSource.AddReceiver(const OpenCVVideoReceiver: IocvDataReceiver);
|
||||
begin
|
||||
ReceiverCS.Enter;
|
||||
try
|
||||
FOpenCVVideoReceiver := OpenCVVideoReceiver;
|
||||
finally
|
||||
ReceiverCS.Leave;
|
||||
end;
|
||||
FOpenCVVideoReceivers.Add(OpenCVVideoReceiver);
|
||||
end;
|
||||
|
||||
constructor TocvDataSource.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
ReceiverCS := TCriticalSection.Create;
|
||||
FOpenCVVideoReceivers := TocvReceiverList.Create;
|
||||
end;
|
||||
|
||||
destructor TocvDataSource.Destroy;
|
||||
begin
|
||||
ReceiverCS.Free;
|
||||
FOpenCVVideoReceivers.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -118,17 +115,30 @@ begin
|
||||
end;
|
||||
|
||||
procedure TocvDataSource.NotifyReceiver(const IplImage: pIplImage);
|
||||
Var
|
||||
R: IocvDataReceiver;
|
||||
LockList: TList<IocvDataReceiver>;
|
||||
begin
|
||||
if Assigned(FOpenCVVideoReceiver) then
|
||||
FOpenCVVideoReceiver.TakeImage(IplImage);
|
||||
LockList := FOpenCVVideoReceivers.LockList;
|
||||
try
|
||||
for R in LockList do
|
||||
R.TakeImage(IplImage);
|
||||
finally
|
||||
FOpenCVVideoReceivers.UnlockList;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TOpenCVDataSourceAndReceiver }
|
||||
procedure TocvDataSource.RemoveReceiver(const OpenCVVideoReceiver: IocvDataReceiver);
|
||||
begin
|
||||
FOpenCVVideoReceivers.Remove(OpenCVVideoReceiver);
|
||||
end;
|
||||
|
||||
{TOpenCVDataSourceAndReceiver}
|
||||
|
||||
destructor TocvDataSourceAndReceiver.Destroy;
|
||||
begin
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(nil);
|
||||
FocvVideoSource.RemoveReceiver(Self);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -137,10 +147,10 @@ begin
|
||||
if (FocvVideoSource <> Value) then
|
||||
begin
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(nil);
|
||||
FocvVideoSource.RemoveReceiver(Self);
|
||||
FocvVideoSource := Value;
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(Self);
|
||||
FocvVideoSource.AddReceiver(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -154,12 +164,12 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
{ TocvDataReceiver }
|
||||
{TocvDataReceiver}
|
||||
|
||||
destructor TocvDataReceiver.Destroy;
|
||||
begin
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(nil);
|
||||
FocvVideoSource.RemoveReceiver(Self);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -168,15 +178,16 @@ begin
|
||||
if (FocvVideoSource <> Value) then
|
||||
begin
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(nil);
|
||||
FocvVideoSource.RemoveReceiver(Self);
|
||||
FocvVideoSource := Value;
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(Self);
|
||||
FocvVideoSource.AddReceiver(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TocvDataReceiver.SetVideoSource(const Value: TObject);
|
||||
begin
|
||||
if (Value <> Self) then
|
||||
VideoSource := Value as TocvDataSource;
|
||||
end;
|
||||
|
||||
|
@ -35,9 +35,14 @@ uses
|
||||
core.types_c;
|
||||
|
||||
type
|
||||
|
||||
TOnOcvPaint = procedure(Sender: TObject; const IplImage: pIplImage) of object;
|
||||
|
||||
TocvView = class(TWinControl, IocvDataReceiver)
|
||||
private
|
||||
FocvVideoSource: IocvDataSource;
|
||||
FOnAfterPaint: TOnOcvPaint;
|
||||
FOnBeforePaint: TOnOcvPaint;
|
||||
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
|
||||
procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
|
||||
procedure SetOpenCVVideoSource(const Value: IocvDataSource);
|
||||
@ -49,6 +54,8 @@ type
|
||||
published
|
||||
property VideoSource: IocvDataSource Read FocvVideoSource write SetOpenCVVideoSource;
|
||||
property Align;
|
||||
property OnAfterPaint: TOnOcvPaint read FOnAfterPaint write FOnAfterPaint;
|
||||
property OnBeforePaint: TOnOcvPaint read FOnBeforePaint write FOnBeforePaint;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -56,12 +63,12 @@ implementation
|
||||
Uses
|
||||
cvUtils;
|
||||
|
||||
{ TOpenCVView }
|
||||
{TOpenCVView}
|
||||
|
||||
destructor TocvView.Destroy;
|
||||
begin
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(nil);
|
||||
FocvVideoSource.RemoveReceiver(Self);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -70,10 +77,10 @@ begin
|
||||
if FocvVideoSource <> Value then
|
||||
begin
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(nil);
|
||||
FocvVideoSource.RemoveReceiver(Self);
|
||||
FocvVideoSource := Value;
|
||||
if Assigned(FocvVideoSource) then
|
||||
FocvVideoSource.SetReceiver(Self);
|
||||
FocvVideoSource.AddReceiver(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -85,10 +92,13 @@ end;
|
||||
procedure TocvView.TakeImage(const IplImage: pIplImage);
|
||||
begin
|
||||
if not(csDestroying in ComponentState) then
|
||||
ipDraw(
|
||||
GetDC(Handle),
|
||||
IplImage,
|
||||
ClientRect);
|
||||
begin
|
||||
if Assigned(OnBeforePaint) then
|
||||
OnBeforePaint(Self, IplImage);
|
||||
ipDraw(GetDC(Handle), IplImage, ClientRect);
|
||||
if Assigned(OnAfterPaint) then
|
||||
OnAfterPaint(Self, IplImage);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TocvView.WMEraseBkgnd(var Message: TWMEraseBkgnd);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{32F0B620-F9A6-4081-8E87-C89FF09CAD04}</ProjectGuid>
|
||||
<ProjectVersion>15.3</ProjectVersion>
|
||||
<ProjectVersion>15.4</ProjectVersion>
|
||||
<FrameworkType>VCL</FrameworkType>
|
||||
<MainSource>cCameraCapture.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
@ -46,6 +46,7 @@
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<SanitizedProjectName>cCameraCapture</SanitizedProjectName>
|
||||
<VerInfo_Locale>1049</VerInfo_Locale>
|
||||
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||
@ -79,7 +80,6 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||
<DCC_UnitSearchPath>..\..\..\component\Win32\Debug\;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;LastCompiledTime=13.06.2013 17:56:41</VerInfo_Keys>
|
||||
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
|
@ -30,13 +30,17 @@ object MainForm: TMainForm
|
||||
Width = 145
|
||||
Height = 21
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
TabOrder = 0
|
||||
OnChange = cbb1Change
|
||||
Items.Strings = (
|
||||
'None'
|
||||
'Convert to grayscale'
|
||||
'Canny'
|
||||
'Smooth')
|
||||
'Smooth'
|
||||
'Erode'
|
||||
'Dilate'
|
||||
'Laplace'
|
||||
'Sobel')
|
||||
end
|
||||
object chk1: TCheckBox
|
||||
Left = 308
|
||||
@ -54,6 +58,7 @@ object MainForm: TMainForm
|
||||
Top = 4
|
||||
Width = 294
|
||||
Height = 269
|
||||
VideoSource = ocvcmr1
|
||||
end
|
||||
object ocvw2: TocvView
|
||||
Left = 8
|
||||
@ -63,26 +68,24 @@ object MainForm: TMainForm
|
||||
VideoSource = ocvmgprtn1
|
||||
end
|
||||
object ocvcmr1: TocvCamera
|
||||
Enabled = True
|
||||
Resolution = r1280x720
|
||||
Resolution = r640x360
|
||||
Left = 368
|
||||
Top = 132
|
||||
Top = 192
|
||||
end
|
||||
object ocvmgprtn1: TocvImageOperation
|
||||
PropertiesClassName = 'TocvImageOperation_None'
|
||||
VideoSource = ocvcmr1
|
||||
OperationClassName = 'TocvLaplace'
|
||||
Operations = <
|
||||
item
|
||||
OperationClassName = 'TovcErode'
|
||||
end
|
||||
item
|
||||
OperationClassName = 'TovcImageOperation_Canny'
|
||||
Operation.Threshold1 = 10.000000000000000000
|
||||
Operation.Threshold2 = 100.000000000000000000
|
||||
Operation.ApertureSize = 3
|
||||
end>
|
||||
Left = 368
|
||||
Top = 228
|
||||
end
|
||||
object ocvspltr1: TocvSplitter
|
||||
VideoSource = ocvcmr1
|
||||
Channels = <
|
||||
item
|
||||
Name = 'ocvspltr1[0]'
|
||||
end
|
||||
item
|
||||
Name = 'ocvspltr1[1]'
|
||||
end>
|
||||
Left = 368
|
||||
Top = 180
|
||||
end
|
||||
end
|
||||
|
@ -28,7 +28,7 @@ interface
|
||||
uses
|
||||
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
||||
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uOCVTypes, uOCVImageOperation,
|
||||
uOCVCamera, uOCVView, Vcl.StdCtrls, uOCVSplitter;
|
||||
core.types_c, uOCVCamera, uOCVView, Vcl.StdCtrls;
|
||||
|
||||
type
|
||||
TMainForm = class(TForm)
|
||||
@ -39,7 +39,6 @@ type
|
||||
ocvw1: TocvView;
|
||||
ocvmgprtn1: TocvImageOperation;
|
||||
ocvw2: TocvView;
|
||||
ocvspltr1: TocvSplitter;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure cbb1Change(Sender: TObject);
|
||||
procedure chk1Click(Sender: TObject);
|
||||
@ -55,13 +54,14 @@ implementation
|
||||
{$R *.dfm}
|
||||
|
||||
Const
|
||||
IOClass: array [0 .. 3] of TocvImageOperationClass = (
|
||||
{ } TocvImageOperation_None, TocvImageOperation_GrayScale,
|
||||
{ } TovcImageOperation_Canny, TovcImageOperation_Smooth);
|
||||
IOClass: array [0 .. 7] of TocvImageOperationClass = (
|
||||
{} TocvImageOperation_None, TocvImageOperation_GrayScale,
|
||||
{} TovcImageOperation_Canny, TovcImageOperation_Smooth,
|
||||
{} TovcErode, TovcDilate, TocvLaplace, TovcSobel);
|
||||
|
||||
procedure TMainForm.cbb1Change(Sender: TObject);
|
||||
begin
|
||||
ocvmgprtn1.PropertiesClass := IOClass[cbb1.ItemIndex];
|
||||
ocvmgprtn1.OperationClass := IOClass[cbb1.ItemIndex];
|
||||
end;
|
||||
|
||||
procedure TMainForm.chk1Click(Sender: TObject);
|
||||
@ -71,12 +71,9 @@ end;
|
||||
|
||||
procedure TMainForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
ocvw1.VideoSource := ocvspltr1.Channels[0];
|
||||
ocvmgprtn1.VideoSource := ocvspltr1.Channels[1];
|
||||
ocvw2.VideoSource := ocvmgprtn1;
|
||||
cbb1.ItemIndex := 0;
|
||||
chk1.Checked := ocvcmr1.Enabled;
|
||||
ocvmgprtn1.PropertiesClass := IOClass[cbb1.ItemIndex];
|
||||
ocvmgprtn1.OperationClass := IOClass[cbb1.ItemIndex];
|
||||
ocvcmr1.Enabled := True;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -3,15 +3,15 @@
|
||||
<ProjectGuid>{8D6AD714-8F0C-4676-BF52-9CBAF8714460}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Projects Include="cvAdaptiveSkinDetector\cv_AdaptiveSkinDetector.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
<Projects Include="cvGoodFeaturesToTrack\cv_GoodFeaturesToTrack.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
<Projects Include="cvGoodFeaturesToTrack\cv_GoodFeaturesToTrack_Video.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
<Projects Include="cvAdaptiveSkinDetector\cv_AdaptiveSkinDetector.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
<Projects Include="cvAddWeighted\cv_AddWeighted.dproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
@ -200,6 +200,15 @@
|
||||
<Default.Personality/>
|
||||
</BorlandProject>
|
||||
</ProjectExtensions>
|
||||
<Target Name="cv_AdaptiveSkinDetector">
|
||||
<MSBuild Projects="cvAdaptiveSkinDetector\cv_AdaptiveSkinDetector.dproj"/>
|
||||
</Target>
|
||||
<Target Name="cv_AdaptiveSkinDetector:Clean">
|
||||
<MSBuild Projects="cvAdaptiveSkinDetector\cv_AdaptiveSkinDetector.dproj" Targets="Clean"/>
|
||||
</Target>
|
||||
<Target Name="cv_AdaptiveSkinDetector:Make">
|
||||
<MSBuild Projects="cvAdaptiveSkinDetector\cv_AdaptiveSkinDetector.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="cv_GoodFeaturesToTrack">
|
||||
<MSBuild Projects="cvGoodFeaturesToTrack\cv_GoodFeaturesToTrack.dproj"/>
|
||||
</Target>
|
||||
@ -218,15 +227,6 @@
|
||||
<Target Name="cv_GoodFeaturesToTrack_Video:Make">
|
||||
<MSBuild Projects="cvGoodFeaturesToTrack\cv_GoodFeaturesToTrack_Video.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="cv_AdaptiveSkinDetector">
|
||||
<MSBuild Projects="cvAdaptiveSkinDetector\cv_AdaptiveSkinDetector.dproj"/>
|
||||
</Target>
|
||||
<Target Name="cv_AdaptiveSkinDetector:Clean">
|
||||
<MSBuild Projects="cvAdaptiveSkinDetector\cv_AdaptiveSkinDetector.dproj" Targets="Clean"/>
|
||||
</Target>
|
||||
<Target Name="cv_AdaptiveSkinDetector:Make">
|
||||
<MSBuild Projects="cvAdaptiveSkinDetector\cv_AdaptiveSkinDetector.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="cv_AddWeighted">
|
||||
<MSBuild Projects="cvAddWeighted\cv_AddWeighted.dproj"/>
|
||||
</Target>
|
||||
@ -768,13 +768,13 @@
|
||||
<MSBuild Projects="cvSum\cv_Sum.dproj" Targets="Make"/>
|
||||
</Target>
|
||||
<Target Name="Build">
|
||||
<CallTarget Targets="cv_GoodFeaturesToTrack;cv_GoodFeaturesToTrack_Video;cv_AdaptiveSkinDetector;cv_AddWeighted;cv_And;cv_CalcHist;cv_CalcOpticalFlowPyrLK;cv_Canny;cv_CodeBook;cv_CopyMakeBorder;cv_CreateCameraCapture;cv_CreateFGDStatModel;cv_CreateGaussianBGModel;cv_CreateStructuringElementEx;cv_CreateTrackbar;cv_CreateVideoWriter;cv_CvtColor;cv_CvtPixToPlane;cv_ExtractSURF;cv_ExtractSURF2;cv_FindContours;cv_FindContours2;cv_FloodFill;cv_GetSubRect;cv_HoughCircles;cv_HoughLines2;cv_InRangeS;cv_Integral;cv_Laplace;cv_LinearPolar;cv_LoadHaarClassifierCascade;cv_LoadImage;cv_LoadImage2;cv_LoadVideo;cv_MatchShapes;cv_MatchTemplate;cv_MorphologyEx;cv_Motion;cv_PyrSegmentation;cv_RandInt;cv_Resize;cv_Save;cv_SetImageROI;cv_SetImageROI2;cv_SetMouseCallback;cv_Smooth;cv_SnakeImage;cv_Sobel;cv_Sub;cv_WarpAffine;cv_WarpPerspective;cvErode_cvDilate;cvSetImageROI_cvAddWeighted;cvSplit_cvMerge;cvThreshold_cvAdaptiveThreshold;latentsvmdetect;Posit;cv_CalcHist2;cv_DFT;cv_FindContours3;cv_MatchShapes2;cv_SegmentImage;cv_Sum"/>
|
||||
<CallTarget Targets="cv_AdaptiveSkinDetector;cv_GoodFeaturesToTrack;cv_GoodFeaturesToTrack_Video;cv_AddWeighted;cv_And;cv_CalcHist;cv_CalcOpticalFlowPyrLK;cv_Canny;cv_CodeBook;cv_CopyMakeBorder;cv_CreateCameraCapture;cv_CreateFGDStatModel;cv_CreateGaussianBGModel;cv_CreateStructuringElementEx;cv_CreateTrackbar;cv_CreateVideoWriter;cv_CvtColor;cv_CvtPixToPlane;cv_ExtractSURF;cv_ExtractSURF2;cv_FindContours;cv_FindContours2;cv_FloodFill;cv_GetSubRect;cv_HoughCircles;cv_HoughLines2;cv_InRangeS;cv_Integral;cv_Laplace;cv_LinearPolar;cv_LoadHaarClassifierCascade;cv_LoadImage;cv_LoadImage2;cv_LoadVideo;cv_MatchShapes;cv_MatchTemplate;cv_MorphologyEx;cv_Motion;cv_PyrSegmentation;cv_RandInt;cv_Resize;cv_Save;cv_SetImageROI;cv_SetImageROI2;cv_SetMouseCallback;cv_Smooth;cv_SnakeImage;cv_Sobel;cv_Sub;cv_WarpAffine;cv_WarpPerspective;cvErode_cvDilate;cvSetImageROI_cvAddWeighted;cvSplit_cvMerge;cvThreshold_cvAdaptiveThreshold;latentsvmdetect;Posit;cv_CalcHist2;cv_DFT;cv_FindContours3;cv_MatchShapes2;cv_SegmentImage;cv_Sum"/>
|
||||
</Target>
|
||||
<Target Name="Clean">
|
||||
<CallTarget Targets="cv_GoodFeaturesToTrack:Clean;cv_GoodFeaturesToTrack_Video:Clean;cv_AdaptiveSkinDetector:Clean;cv_AddWeighted:Clean;cv_And:Clean;cv_CalcHist:Clean;cv_CalcOpticalFlowPyrLK:Clean;cv_Canny:Clean;cv_CodeBook:Clean;cv_CopyMakeBorder:Clean;cv_CreateCameraCapture:Clean;cv_CreateFGDStatModel:Clean;cv_CreateGaussianBGModel:Clean;cv_CreateStructuringElementEx:Clean;cv_CreateTrackbar:Clean;cv_CreateVideoWriter:Clean;cv_CvtColor:Clean;cv_CvtPixToPlane:Clean;cv_ExtractSURF:Clean;cv_ExtractSURF2:Clean;cv_FindContours:Clean;cv_FindContours2:Clean;cv_FloodFill:Clean;cv_GetSubRect:Clean;cv_HoughCircles:Clean;cv_HoughLines2:Clean;cv_InRangeS:Clean;cv_Integral:Clean;cv_Laplace:Clean;cv_LinearPolar:Clean;cv_LoadHaarClassifierCascade:Clean;cv_LoadImage:Clean;cv_LoadImage2:Clean;cv_LoadVideo:Clean;cv_MatchShapes:Clean;cv_MatchTemplate:Clean;cv_MorphologyEx:Clean;cv_Motion:Clean;cv_PyrSegmentation:Clean;cv_RandInt:Clean;cv_Resize:Clean;cv_Save:Clean;cv_SetImageROI:Clean;cv_SetImageROI2:Clean;cv_SetMouseCallback:Clean;cv_Smooth:Clean;cv_SnakeImage:Clean;cv_Sobel:Clean;cv_Sub:Clean;cv_WarpAffine:Clean;cv_WarpPerspective:Clean;cvErode_cvDilate:Clean;cvSetImageROI_cvAddWeighted:Clean;cvSplit_cvMerge:Clean;cvThreshold_cvAdaptiveThreshold:Clean;latentsvmdetect:Clean;Posit:Clean;cv_CalcHist2:Clean;cv_DFT:Clean;cv_FindContours3:Clean;cv_MatchShapes2:Clean;cv_SegmentImage:Clean;cv_Sum:Clean"/>
|
||||
<CallTarget Targets="cv_AdaptiveSkinDetector:Clean;cv_GoodFeaturesToTrack:Clean;cv_GoodFeaturesToTrack_Video:Clean;cv_AddWeighted:Clean;cv_And:Clean;cv_CalcHist:Clean;cv_CalcOpticalFlowPyrLK:Clean;cv_Canny:Clean;cv_CodeBook:Clean;cv_CopyMakeBorder:Clean;cv_CreateCameraCapture:Clean;cv_CreateFGDStatModel:Clean;cv_CreateGaussianBGModel:Clean;cv_CreateStructuringElementEx:Clean;cv_CreateTrackbar:Clean;cv_CreateVideoWriter:Clean;cv_CvtColor:Clean;cv_CvtPixToPlane:Clean;cv_ExtractSURF:Clean;cv_ExtractSURF2:Clean;cv_FindContours:Clean;cv_FindContours2:Clean;cv_FloodFill:Clean;cv_GetSubRect:Clean;cv_HoughCircles:Clean;cv_HoughLines2:Clean;cv_InRangeS:Clean;cv_Integral:Clean;cv_Laplace:Clean;cv_LinearPolar:Clean;cv_LoadHaarClassifierCascade:Clean;cv_LoadImage:Clean;cv_LoadImage2:Clean;cv_LoadVideo:Clean;cv_MatchShapes:Clean;cv_MatchTemplate:Clean;cv_MorphologyEx:Clean;cv_Motion:Clean;cv_PyrSegmentation:Clean;cv_RandInt:Clean;cv_Resize:Clean;cv_Save:Clean;cv_SetImageROI:Clean;cv_SetImageROI2:Clean;cv_SetMouseCallback:Clean;cv_Smooth:Clean;cv_SnakeImage:Clean;cv_Sobel:Clean;cv_Sub:Clean;cv_WarpAffine:Clean;cv_WarpPerspective:Clean;cvErode_cvDilate:Clean;cvSetImageROI_cvAddWeighted:Clean;cvSplit_cvMerge:Clean;cvThreshold_cvAdaptiveThreshold:Clean;latentsvmdetect:Clean;Posit:Clean;cv_CalcHist2:Clean;cv_DFT:Clean;cv_FindContours3:Clean;cv_MatchShapes2:Clean;cv_SegmentImage:Clean;cv_Sum:Clean"/>
|
||||
</Target>
|
||||
<Target Name="Make">
|
||||
<CallTarget Targets="cv_GoodFeaturesToTrack:Make;cv_GoodFeaturesToTrack_Video:Make;cv_AdaptiveSkinDetector:Make;cv_AddWeighted:Make;cv_And:Make;cv_CalcHist:Make;cv_CalcOpticalFlowPyrLK:Make;cv_Canny:Make;cv_CodeBook:Make;cv_CopyMakeBorder:Make;cv_CreateCameraCapture:Make;cv_CreateFGDStatModel:Make;cv_CreateGaussianBGModel:Make;cv_CreateStructuringElementEx:Make;cv_CreateTrackbar:Make;cv_CreateVideoWriter:Make;cv_CvtColor:Make;cv_CvtPixToPlane:Make;cv_ExtractSURF:Make;cv_ExtractSURF2:Make;cv_FindContours:Make;cv_FindContours2:Make;cv_FloodFill:Make;cv_GetSubRect:Make;cv_HoughCircles:Make;cv_HoughLines2:Make;cv_InRangeS:Make;cv_Integral:Make;cv_Laplace:Make;cv_LinearPolar:Make;cv_LoadHaarClassifierCascade:Make;cv_LoadImage:Make;cv_LoadImage2:Make;cv_LoadVideo:Make;cv_MatchShapes:Make;cv_MatchTemplate:Make;cv_MorphologyEx:Make;cv_Motion:Make;cv_PyrSegmentation:Make;cv_RandInt:Make;cv_Resize:Make;cv_Save:Make;cv_SetImageROI:Make;cv_SetImageROI2:Make;cv_SetMouseCallback:Make;cv_Smooth:Make;cv_SnakeImage:Make;cv_Sobel:Make;cv_Sub:Make;cv_WarpAffine:Make;cv_WarpPerspective:Make;cvErode_cvDilate:Make;cvSetImageROI_cvAddWeighted:Make;cvSplit_cvMerge:Make;cvThreshold_cvAdaptiveThreshold:Make;latentsvmdetect:Make;Posit:Make;cv_CalcHist2:Make;cv_DFT:Make;cv_FindContours3:Make;cv_MatchShapes2:Make;cv_SegmentImage:Make;cv_Sum:Make"/>
|
||||
<CallTarget Targets="cv_AdaptiveSkinDetector:Make;cv_GoodFeaturesToTrack:Make;cv_GoodFeaturesToTrack_Video:Make;cv_AddWeighted:Make;cv_And:Make;cv_CalcHist:Make;cv_CalcOpticalFlowPyrLK:Make;cv_Canny:Make;cv_CodeBook:Make;cv_CopyMakeBorder:Make;cv_CreateCameraCapture:Make;cv_CreateFGDStatModel:Make;cv_CreateGaussianBGModel:Make;cv_CreateStructuringElementEx:Make;cv_CreateTrackbar:Make;cv_CreateVideoWriter:Make;cv_CvtColor:Make;cv_CvtPixToPlane:Make;cv_ExtractSURF:Make;cv_ExtractSURF2:Make;cv_FindContours:Make;cv_FindContours2:Make;cv_FloodFill:Make;cv_GetSubRect:Make;cv_HoughCircles:Make;cv_HoughLines2:Make;cv_InRangeS:Make;cv_Integral:Make;cv_Laplace:Make;cv_LinearPolar:Make;cv_LoadHaarClassifierCascade:Make;cv_LoadImage:Make;cv_LoadImage2:Make;cv_LoadVideo:Make;cv_MatchShapes:Make;cv_MatchTemplate:Make;cv_MorphologyEx:Make;cv_Motion:Make;cv_PyrSegmentation:Make;cv_RandInt:Make;cv_Resize:Make;cv_Save:Make;cv_SetImageROI:Make;cv_SetImageROI2:Make;cv_SetMouseCallback:Make;cv_Smooth:Make;cv_SnakeImage:Make;cv_Sobel:Make;cv_Sub:Make;cv_WarpAffine:Make;cv_WarpPerspective:Make;cvErode_cvDilate:Make;cvSetImageROI_cvAddWeighted:Make;cvSplit_cvMerge:Make;cvThreshold_cvAdaptiveThreshold:Make;latentsvmdetect:Make;Posit:Make;cv_CalcHist2:Make;cv_DFT:Make;cv_FindContours3:Make;cv_MatchShapes2:Make;cv_SegmentImage:Make;cv_Sum:Make"/>
|
||||
</Target>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
|
||||
</Project>
|
||||
|
@ -3,7 +3,7 @@
|
||||
// Copyright (C) 2013 Project Delphi-OpenCV
|
||||
// ****************************************************************
|
||||
// Contributor:
|
||||
// laentir Valetov
|
||||
// Laentir Valetov
|
||||
// email:laex@bk.ru
|
||||
// ****************************************************************
|
||||
// You may retrieve the latest version of this file at the GitHub,
|
||||
|
@ -55,7 +55,7 @@ begin
|
||||
|
||||
// окно для отображения картинки
|
||||
cvNamedWindow('original', CV_WINDOW_AUTOSIZE);
|
||||
cvNamedWindow('cvLaplace', CV_WINDOW_AUTOSIZE);
|
||||
cvNamedWindow('cvLaplace8b', CV_WINDOW_AUTOSIZE);
|
||||
|
||||
// применяем оператор Лаплccа
|
||||
cvLaplace(image, dst, aperture);
|
||||
@ -65,7 +65,7 @@ begin
|
||||
|
||||
// показываем картинку
|
||||
cvShowImage('original', image);
|
||||
cvShowImage('cvLaplace', dst2);
|
||||
cvShowImage('cvLaplace8b', dst2);
|
||||
|
||||
cvWaitKey(0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user