Some examples...

Signed-off-by: Laentir Valetov <laex@bk.ru>
This commit is contained in:
Laentir Valetov 2015-04-23 01:23:04 +03:00
parent 5b7be0e78a
commit e49181b540
16 changed files with 1566 additions and 148 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,198 @@
(*
*****************************************************************
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.
*******************************************************************
*)
// Example 10-2. Kalman filter sample code
//
// Use Kalman Filter to model particle in circular trajectory.
(* *************** License:**************************
Oct. 3, 2008
Right to use this code in any way you want without warrenty, support or any guarentee of it working.
BOOK: It would be nice if you cited it:
Learning OpenCV: Computer Vision with the OpenCV Library
by Gary Bradski and Adrian Kaehler
Published by O'Reilly Media, October 3, 2008
AVAILABLE AT:
http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134
Or: http://oreilly.com/catalog/9780596516130/
ISBN-10: 0596516134 or: ISBN-13: 978-0596516130
OTHER OPENCV SITES:
* The source code is on sourceforge at:
http://sourceforge.net/projects/opencvlibrary/
* The OpenCV wiki page (As of Oct 1, 2008 this is down for changing over servers, but should come back):
http://opencvlibrary.sourceforge.net/
* An active user group is at:
http://tech.groups.yahoo.com/group/OpenCV/
* The minutes of weekly OpenCV development meetings are at:
http://pr.willowgarage.com/wiki/OpenCV
************************************************** *)
program ch10_ex10_2;
{$APPTYPE CONSOLE}
{$POINTERMATH ON}
{$R *.res}
uses
System.SysUtils,
ocv.cvutils,
ocv.core_c,
ocv.highgui_c,
ocv.core.types_c,
ocv.imgproc.types_c,
ocv.imgproc_c,
ocv.tracking_c,
ocv.compat,
uResourcePaths;
function phi2xy(const img: PIplImage; const mat: PCvMat): TcvPoint;
begin
Result := cvPoint(cvRound(img^.width / 2 + img^.width / 3 * cos(pFloat(mat^.data)[0])),
cvRound(img^.height / 2 - img^.width / 3 * sin(pFloat(mat^.data)[0])))
end;
Var
CVX_RED: TCvScalar;
CVX_GREEN: TCvScalar;
CVX_BLUE: TCvScalar;
CVX_CYAN: TCvScalar;
CVX_MAGENTA: TCvScalar;
CVX_YELLOW: TCvScalar;
CVX_WHITE: TCvScalar;
CVX_BLACK: TCvScalar;
CVX_GRAY50: TCvScalar;
rng: TCvRandState;
img: PIplImage;
kalman: PCvKalman;
x_k: PCvMat;
w_k: PCvMat;
z_k: PCvMat;
F: array [0 .. 3] of Single;
y_k: PCvMat;
begin
try
// Init CVX
CVX_RED := CV_RGB($FF, $00, $00);
CVX_GREEN := CV_RGB($00, $FF, $00);
CVX_BLUE := CV_RGB($00, $00, $FF);
CVX_CYAN := CV_RGB($00, $FF, $FF);
CVX_MAGENTA := CV_RGB($FF, $00, $FF);
CVX_YELLOW := CV_RGB($FF, $FF, $00);
CVX_WHITE := CV_RGB($FF, $FF, $FF);
CVX_BLACK := CV_RGB($00, $00, $00);
CVX_GRAY50 := CV_RGB($88, $88, $88);
// Initialize, create Kalman Filter object, window, random number
// generator etc.
//
cvNamedWindow('Kalman', 1);
cvRandInit(@rng, 0, 1, -1, CV_RAND_UNI);
img := cvCreateImage(cvSize(500, 500), 8, 3);
kalman := cvCreateKalman(2, 1, 0);
// state is (phi, delta_phi) - angle and angular velocity
// Initialize with random guess.
//
x_k := cvCreateMat(2, 1, CV_32FC1);
cvRandSetRange(@rng, 0, 0.1, 0);
rng.disttype := CV_RAND_NORMAL;
cvRand(@rng, x_k);
// process noise
//
w_k := cvCreateMat(2, 1, CV_32FC1);
// measurements, only one parameter for angle
//
z_k := cvCreateMat(1, 1, CV_32FC1);
cvZero(z_k);
// Transition matrix 'F' describes relationship between
// model parameters at step k and at step k+1 (this is
// the 'dynamics' in our model.
//
F[0] := 1;
F[1] := 1;
F[2] := 0;
F[3] := 1;
Move(F, kalman^.transition_matrix^.data^, sizeof(F));
// Initialize other Kalman filter parameters.
//
cvSetIdentity(kalman^.measurement_matrix, cvRealScalar(1));
cvSetIdentity(kalman^.process_noise_cov, cvRealScalar(1E-5));
cvSetIdentity(kalman^.measurement_noise_cov, cvRealScalar(1E-1));
cvSetIdentity(kalman^.error_cov_post, cvRealScalar(1));
// choose random initial state
//
cvRand(@rng, kalman^.state_post);
while True do
begin
// predict point position
y_k := cvKalmanPredict(kalman^, 0);
// generate measurement (z_k)
//
cvRandSetRange(@rng, 0, sqrt(pFloat(kalman^.measurement_noise_cov^.data)[0]), 0);
cvRand(@rng, z_k);
cvMatMulAdd(kalman^.measurement_matrix, x_k, z_k, z_k);
// plot points (eg convert to planar co-ordinates and draw)
//
cvZero(img);
cvCircle(img, phi2xy(img, z_k), 4, CVX_YELLOW); // observed state
cvCircle(img, phi2xy(img, y_k), 4, CVX_WHITE, 2); // 'predicted' state
cvCircle(img, phi2xy(img, x_k), 4, CVX_RED); // real state
cvShowImage('Kalman', img);
// adjust Kalman filter state
//
cvKalmanCorrect(kalman^, z_k);
// Apply the transition matrix 'F' (eg, step time forward)
// and also apply the 'process' noise w_k.
//
cvRandSetRange(@rng, 0, sqrt(pFloat(kalman^.process_noise_cov^.data)[0]), 0);
cvRand(@rng, w_k);
cvMatMulAdd(kalman^.transition_matrix, x_k, w_k, x_k);
// exit if user hits 'Esc'
if (cvWaitKey(100) = 27) then
break;
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.

View File

@ -0,0 +1,120 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{24EF7607-4A20-4D2B-8791-73EFD2538D03}</ProjectGuid>
<MainSource>ch10_ex10_2.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<TargetedPlatforms>1025</TargetedPlatforms>
<AppType>Console</AppType>
<FrameworkType>None</FrameworkType>
<ProjectVersion>17.2</ProjectVersion>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<Manifest_File>None</Manifest_File>
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>..\..\bin\$(Platform)</DCC_ExeOutput>
<DCC_S>false</DCC_S>
<DCC_N>false</DCC_N>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1049</VerInfo_Locale>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_K>false</DCC_K>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
<DCC_F>false</DCC_F>
<SanitizedProjectName>ch10_ex10_2</SanitizedProjectName>
<DCC_E>false</DCC_E>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_DebugInformation>0</DCC_DebugInformation>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>None</Manifest_File>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">ch10_ex10_2.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k220.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
<Platform value="iOSDevice64">True</Platform>
<Platform value="OSX32">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>
<!-- EurekaLog First Line
[Exception Log]
EurekaLog Version=7007
Activate=0
DeleteMapAfterCompile=0
Encrypt Password=""
EurekaLog Last Line -->

Binary file not shown.

View File

@ -0,0 +1,239 @@
(*
*****************************************************************
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.
*******************************************************************
*)
//
// ch9_watershed image
// This is an exact copy of the watershed.cpp demo in the OpenCV ../samples/c directory
//
// Think about using a morphologically eroded forground and background segmented image as the template
// for the watershed algorithm to segment objects by color and edges for collecting
//
(* *************** License:**************************
Oct. 3, 2008
Right to use this code in any way you want without warrenty, support or any guarentee of it working.
BOOK: It would be nice if you cited it:
Learning OpenCV: Computer Vision with the OpenCV Library
by Gary Bradski and Adrian Kaehler
Published by O'Reilly Media, October 3, 2008
AVAILABLE AT:
http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134
Or: http://oreilly.com/catalog/9780596516130/
ISBN-10: 0596516134 or: ISBN-13: 978-0596516130
OTHER OPENCV SITES:
* The source code is on sourceforge at:
http://sourceforge.net/projects/opencvlibrary/
* The OpenCV wiki page (As of Oct 1, 2008 this is down for changing over servers, but should come back):
http://opencvlibrary.sourceforge.net/
* An active user group is at:
http://tech.groups.yahoo.com/group/OpenCV/
* The minutes of weekly OpenCV development meetings are at:
http://pr.willowgarage.com/wiki/OpenCV
************************************************** *)
program ch9_watershed;
{$APPTYPE CONSOLE}
{$POINTERMATH ON}
{$R *.res}
uses
System.SysUtils,
ocv.cvutils,
ocv.core_c,
ocv.highgui_c,
ocv.core.types_c,
ocv.imgproc.types_c,
ocv.imgproc_c,
ocv.tracking_c,
ocv.compat,
uResourcePaths;
Var
marker_mask: PIplImage;
markers: PIplImage;
img0, img, img_gray, wshed: PIplImage;
prev_pt: TCvPoint;
procedure on_mouse(event: Integer; x: Integer; y: Integer; flags: Integer; param: Pointer); cdecl;
Var
pt: TCvPoint;
begin
if not Assigned(img) then
Exit;
if (event = CV_EVENT_LBUTTONUP) or ((flags and CV_EVENT_FLAG_LBUTTON) = 0) then
prev_pt := cvPoint(-1, -1)
else if (event = CV_EVENT_LBUTTONDOWN) then
prev_pt := cvPoint(x, y)
else if (event = CV_EVENT_MOUSEMOVE) and ((flags and CV_EVENT_FLAG_LBUTTON) <> 0) then
begin
pt := cvPoint(x, y);
if (prev_pt.x < 0) then
prev_pt := pt;
cvLine(marker_mask, prev_pt, pt, cvScalarAll(255), 5, 8, 0);
cvLine(img, prev_pt, pt, cvScalarAll(255), 5, 8, 0);
prev_pt := pt;
cvShowImage('image', img);
end;
end;
Var
filename: AnsiString;
rng: TCvRNG;
c: Integer;
storage: pCvMemStorage;
contours: pCvSeq;
color_tab: pCvMat;
i, j, comp_count: Integer;
ptr: pByte;
t: double;
idx: Integer;
dst: pByte;
begin
try
prev_pt := cvPoint(-1, -1);
if ParamCount > 0 then
filename := ParamStr(1)
else
filename := cResourceMedia+'fruits.jpg';
rng := CvRNG(-1);
img0 := cvLoadImage(c_str(filename), 1);
if not Assigned(img0) then
Halt;
WriteLn('Hot keys: '#13#10#9 + 'ESC - quit the program'#13#10#9 + 'r - restore the original image'#13#10#9 +
'w or ENTER - run watershed algorithm'#13#10#13#10#9 + '(before running it, roughly mark the areas on the image)'#13#10#9 +
'(before that, roughly outline several markers on the image)');
cvNamedWindow('image', 1);
cvNamedWindow('watershed transform', 1);
img := cvCloneImage(img0);
img_gray := cvCloneImage(img0);
wshed := cvCloneImage(img0);
marker_mask := cvCreateImage(cvGetSize(img), 8, 1);
markers := cvCreateImage(cvGetSize(img), IPL_DEPTH_32S, 1);
cvCvtColor(img, marker_mask, CV_BGR2GRAY);
cvCvtColor(marker_mask, img_gray, CV_GRAY2BGR);
cvZero(marker_mask);
cvZero(wshed);
cvShowImage('image', img);
cvShowImage('watershed transform', wshed);
cvSetMouseCallback('image', on_mouse, 0);
While true do
begin
c := cvWaitKey(0);
if c = 27 then
break;
if char(c) = 'r' then
begin
cvZero(marker_mask);
cvCopy(img0, img);
cvShowImage('image', img);
end;
if (chr(c) = 'w') or (c = 13) then
begin
storage := cvCreateMemStorage(0);
contours := nil;
comp_count := 0;
// cvSaveImage( 'wshed_mask.png', marker_mask );
// marker_mask = cvLoadImage( 'wshed_mask.png', 0 );
cvFindContours(marker_mask, storage, @contours, sizeof(TCvContour), CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE,cvPoint(0,0));
cvZero(markers);
while (contours <> nil) do
begin
cvDrawContours(markers, contours, cvScalarAll(comp_count + 1), cvScalarAll(comp_count + 1), -1, -1, 8, cvPoint(0, 0));
contours := contours^.h_next;
comp_count := comp_count + 1;
end;
color_tab := cvCreateMat(1, comp_count, CV_8UC3);
for i := 0 to comp_count - 1 do
begin
ptr := pByte(Integer(color_tab^.data) + i * 3);
ptr[0] := (cvRandInt(rng) mod 180 + 50);
ptr[1] := (cvRandInt(rng) mod 180 + 50);
ptr[2] := (cvRandInt(rng) mod 180 + 50);
end;
begin
t := cvGetTickCount();
cvWatershed(img0, markers);
t := cvGetTickCount() - t;
WriteLn('exec time = ', (t / (cvGetTickFrequency() * 1000)):6:3,'ms');
end;
// paint the watershed image
for i := 0 to markers^.height - 1 do
for j := 0 to markers^.width - 1 do
begin
idx := Integer(CV_IMAGE_ELEM(markers, SizeOf(integer), i, j)^);
dst := CV_IMAGE_ELEM(wshed, SizeOf(uchar), i, j * 3);
if (idx = -1) then
begin
dst[0] := 255;
dst[1] := 255;
dst[2] := 255;
end
else if (idx <= 0) or (idx > comp_count) then
begin
dst[0] := 0;
dst[1] := 0;
dst[2] := 0; // should not get here
end
else
begin
ptr := pByte(Integer(color_tab^.data) + (idx - 1) * 3);
dst[0] := ptr[0];
dst[1] := ptr[1];
dst[2] := ptr[2];
end;
end;
cvAddWeighted(wshed, 0.5, img_gray, 0.5, 0, wshed);
cvShowImage('watershed transform', wshed);
cvReleaseMemStorage(storage);
cvReleaseMat(color_tab);
end;
end;
except
on E: Exception do
WriteLn(E.ClassName, ': ', E.Message);
end;
end.

View File

@ -0,0 +1,464 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{24EF7607-4A20-4D2B-8791-73EFD2538D03}</ProjectGuid>
<MainSource>ch9_watershed.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<TargetedPlatforms>1025</TargetedPlatforms>
<AppType>Console</AppType>
<FrameworkType>None</FrameworkType>
<ProjectVersion>17.2</ProjectVersion>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<Manifest_File>None</Manifest_File>
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>..\..\bin\$(Platform)</DCC_ExeOutput>
<DCC_S>false</DCC_S>
<DCC_N>false</DCC_N>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1049</VerInfo_Locale>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_K>false</DCC_K>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
<DCC_F>false</DCC_F>
<SanitizedProjectName>ch9_watershed</SanitizedProjectName>
<DCC_E>false</DCC_E>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_DebugInformation>0</DCC_DebugInformation>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>None</Manifest_File>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">ch9_watershed.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k220.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
<Platform value="iOSDevice64">True</Platform>
<Platform value="OSX32">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
<Deployment Version="1">
<DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="OSX32">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="..\..\bin\Win32\ch9_watershed.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>ch9_watershed.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossim32\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Required="true" Name="DependencyPackage">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="DependencyModule">
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch2048">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXInfoPList"/>
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage470">
<Platform Name="Android">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeX86File">
<Platform Name="Android">
<RemoteDir>library\lib\x86</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXEntitlements"/>
<DeployClass Name="AndroidGDBServer">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage960">
<Platform Name="Android">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch320">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon144">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
<Platform Name="Android">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDef">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="OSX32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyFramework">
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage426">
<Platform Name="Android">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSEntitlements"/>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="OSX32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidClassesDexFile">
<Platform Name="Android">
<RemoteDir>classes</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSInfoPList"/>
<DeployClass Name="iPad_Launch1024">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="iPad_Launch768">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="ProjectOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiFile">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage640">
<Platform Name="Android">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="File">
<Platform Name="Android">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>0</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640x1136">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1536">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
</Deployment>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>
<!-- EurekaLog First Line
[Exception Log]
EurekaLog Version=7007
Activate=0
DeleteMapAfterCompile=0
Encrypt Password=""
EurekaLog Last Line -->

Binary file not shown.

View File

@ -1,29 +1,32 @@
// *****************************************************************
// 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.
// *******************************************************************
(*
*****************************************************************
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.
*******************************************************************
*)
program cv_And;
{$APPTYPE CONSOLE}
{$POINTERMATH ON}
{$R *.res}
uses
@ -52,20 +55,20 @@ Var
image: pIplImage = nil;
dst: pIplImage = nil;
// äëÿ õðàíåíèÿ êàíàëîâ RGB
// для хранения каналов RGB
rgb: pIplImage = nil;
r_plane: pIplImage = nil;
g_plane: pIplImage = nil;
b_plane: pIplImage = nil;
// äëÿ õðàíåíèÿ êàíàëîâ RGB ïîcëå ïðåîáðàçîâàíèÿ
// для хранения каналов RGB пое преобразования
r_range: pIplImage = nil;
g_range: pIplImage = nil;
b_range: pIplImage = nil;
// äëÿ õðàíåíèÿ cóììàðíîé êàðòèíêè
// для хранения cуммарной картинки
rgb_and: pIplImage = nil;
//
// ôóíêöèè-îáðàáîò÷èêè ïîëçóíêà
// функции-обработчики ползунка
//
procedure myTrackbarRmin(pos: Integer); cdecl;
begin
@ -110,10 +113,10 @@ Var
begin
try
// ïîëó÷àåì êàðòèíêó
// получаем картинку
image := cvLoadImage(filename);
WriteLn(Format('[i] image: %s', [filename]));
// cîçäà¸ì êàðòèíêè
// cоздаём картинки
// S := cvGetSize(image);
// S := cvGetSize(image);
// ccvGetSize(image, S);
@ -125,14 +128,14 @@ begin
g_range := cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1);
b_range := cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1);
rgb_and := cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1);
// êîïèðóåì
// копируем
cvCopyImage(image, rgb);
// ðàçáèâàåì íà îòåëüíûå êàíàëû
// разбиваем на отельные каналы
cvSplit(rgb, b_plane, g_plane, r_plane, nil);
//
// îïðåäåëÿåì ìèíèìàëüíîå è ìàêcèìàëüíîå çíà÷åíèå
// ó êàíàëîâ HSV
// определяем минимальное и макcимальное значение
// у каналов HSV
framemin := 0;
framemax := 0;
@ -149,7 +152,7 @@ begin
Bmin := Trunc(framemin);
Bmax := Trunc(framemax);
// îêíà äëÿ îòîáðàæåíèÿ êàðòèíêè
// окна для отображения картинки
cvNamedWindow('original', CV_WINDOW_AUTOSIZE);
cvNamedWindow('R', CV_WINDOW_AUTOSIZE);
cvNamedWindow('G', CV_WINDOW_AUTOSIZE);
@ -167,7 +170,7 @@ begin
cvCreateTrackbar('Bmax', 'B range', @Gmax, RGBmax, myTrackbarBmax);
//
// ðàçìåcòèì îêíà ïî ðàáî÷åìó còîëó
// размеcтим окна по рабочему олу
//
if (image^.width < 1920 / 4) and (image^.height < 1080 / 2) then
begin
@ -184,29 +187,29 @@ begin
while (true) do
begin
// ïîêàçûâàåì êàðòèíêó
// показываем картинку
cvShowImage('original', image);
// ïîêàçûâàåì cëîè
// показываем ои
cvShowImage('R', r_plane);
cvShowImage('G', g_plane);
cvShowImage('B', b_plane);
// ïîêàçûâàåì ðåçóëüòàò ïîðîãîâîãî ïðåîáðàçîâàíèÿ
// показываем результат порогового преобразования
cvShowImage('R range', r_range);
cvShowImage('G range', g_range);
cvShowImage('B range', b_range);
// cêëàäûâàåì
// cкладываем
cvAnd(r_range, g_range, rgb_and);
cvAnd(rgb_and, b_range, rgb_and);
// ïîêàçûâàåì ðåçóëüòàò
// показываем результат
cvShowImage('rgb and', rgb_and);
c := cvWaitKey(33);
if (c = 27) then
// åcëè íàæàòà ESC - âûõîäèì
// еcли нажата ESC - выходим
break;
end;
@ -215,7 +218,7 @@ begin
WriteLn(Format('[i][G] %d : %d', [Gmin, Gmax]));
WriteLn(Format('[i][B] %d : %d', [Bmin, Bmax]));
// îcâîáîæäàåì ðåcóðcû
// ообождаем реcур
cvReleaseImage(image);
cvReleaseImage(rgb);
cvReleaseImage(r_plane);
@ -225,7 +228,7 @@ begin
cvReleaseImage(g_range);
cvReleaseImage(b_range);
cvReleaseImage(rgb_and);
// óäàëÿåì îêíà
// удаляем окна
cvDestroyAllWindows();
except
on E: Exception do

View File

@ -1,43 +1,45 @@
// **************************************************************************************************
// 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
// **************************************************************************************************
// License:
// The contents of this file are 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/
//
// 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.
//
// Alternatively, the contents of this file may be used under the terms of the
// GNU Lesser General Public License (the "LGPL License"), in which case the
// provisions of the LGPL License are applicable instead of those above.
// If you wish to allow use of your version of this file only under the terms
// of the LGPL License and not to allow others to use your version of this file
// under the MPL, indicate your decision by deleting the provisions above and
// replace them with the notice and other provisions required by the LGPL
// License. If you do not delete the provisions above, a recipient may use
// your version of this file under either the MPL or the LGPL License.
//
// For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
// **************************************************************************************************
// The Initial Developer of the Original Code:
// OpenCV: open source computer vision library
// Homepage: http://ocv.org
// Online docs: http://docs.ocv.org
// Q&A forum: http://answers.ocv.org
// Dev zone: http://code.ocv.org
// **************************************************************************************************
// Original: https://sites.google.com/site/komputernoezrenie/end
// **************************************************************************************************
(*
**************************************************************************************************
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
**************************************************************************************************
License:
The contents of this file are 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/
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.
Alternatively, the contents of this file may be used under the terms of the
GNU Lesser General Public License (the "LGPL License"), in which case the
provisions of the LGPL License are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms
of the LGPL License and not to allow others to use your version of this file
under the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the LGPL
License. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the LGPL License.
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
**************************************************************************************************
The Initial Developer of the Original Code:
OpenCV: open source computer vision library
Homepage: http://ocv.org
Online docs: http://docs.ocv.org
Q&A forum: http://answers.ocv.org
Dev zone: http://code.ocv.org
**************************************************************************************************
Original: https://sites.google.com/site/komputernoezrenie/end
**************************************************************************************************
*)
{$POINTERMATH ON}
unit uMainForm;
@ -128,6 +130,11 @@ begin
for i := 0 to N_Samples - 1 do
begin
facesfilename := '../../resource/faces/s' + IntToStr(i + 1) + '/1.pgm';
if not FileExists(facesfilename) then
begin
ShowMessage('File ' + facesfilename + ' not found');
Halt;
end;
img_load := cvLoadImage(c_str(facesfilename));
size := cvSize(img_load.width, img_load.height);
img_load_ch1[i] := cvCreateImage(size, IPL_DEPTH_8U, 1);

View File

@ -1,11 +1,11 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{6412034E-6D64-48D5-A7AC-EA776515BC8F}</ProjectGuid>
<ProjectVersion>16.1</ProjectVersion>
<ProjectVersion>17.2</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<MainSource>vclPCArecognition.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Release</Config>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>3</TargetedPlatforms>
<AppType>Application</AppType>
@ -115,7 +115,6 @@
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;LastCompiledTime=29.09.2014 21:08:55</VerInfo_Keys>
<DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<VerInfo_Locale>1033</VerInfo_Locale>
@ -200,7 +199,391 @@
<Excluded_Packages Name="$(BDSBIN)\dclofficexp200.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Deployment/>
<Deployment Version="1">
<DeployClass Required="true" Name="DependencyPackage">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="DependencyModule">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch2048">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXInfoPList">
<Platform Name="OSX32">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage470">
<Platform Name="Android">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeX86File">
<Platform Name="Android">
<RemoteDir>library\lib\x86</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXEntitlements">
<Platform Name="OSX32">
<RemoteDir>../</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidGDBServer">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage960">
<Platform Name="Android">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch320">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon144">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
<Platform Name="Android">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDef">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyFramework">
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage426">
<Platform Name="Android">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSEntitlements">
<Platform Name="iOSDevice64">
<RemoteDir>../</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<RemoteDir>../</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidClassesDexFile">
<Platform Name="Android">
<RemoteDir>classes</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSInfoPList">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1024">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch768">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="ProjectOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiFile">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage640">
<Platform Name="Android">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="File">
<Platform Name="Android">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>0</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640x1136">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1536">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
</Deployment>
<Platforms>
<Platform value="Win32">True</Platform>
<Platform value="Win64">True</Platform>
@ -210,6 +593,7 @@
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>
<!-- EurekaLog First Line

View File

@ -921,6 +921,7 @@ procedure cvCrossProduct(const src1: pCvArr; const src2: pCvArr; dst: pCvArr); c
// * Matrix transform: dst = A*B + C, C is optional */
// #define cvMatMulAdd( src1, src2, src3, dst ) cvGEMM( (src1), (src2), 1., (src3), 1., (dst), 0 )
procedure cvMatMulAdd(const src1, src2, src3: pCvArr; dst: pCvArr);
// #define cvMatMul( src1, src2, dst ) cvMatMulAdd( (src1), (src2), NULL, (dst))
const
@ -2306,17 +2307,17 @@ procedure cvSetData; external core_lib;
procedure cvGetRawData; external core_lib;
{$IF DEFINED(DelphiOCVVersion_29)}
//{$IFDEF VER290}
//function cvGetSize(const arr: pCvArr): TCvSize; external core_lib;
//{$ELSE}
//// ----------------------
// {$IFDEF VER290}
// function cvGetSize(const arr: pCvArr): TCvSize; external core_lib;
// {$ELSE}
/// / ----------------------
procedure _cvGetSize(const arr: pCvArr; Var size: TCvSize); cdecl; external core_lib name 'cvGetSize';
{$IFDEF CPU32}
function cvGetSize(const arr: pCvArr): TCvSize; assembler;
asm
// mov eax,arr // â eax óæå õðàíèòñÿ àäðåñ arr
// push eax
// push eax
push edx // â edx àäðåñ ïåðåìåííîé Result - ñîõðàíÿåì, ò.ê. _cvGetSize âîçâðàùàåò ðåçóëüòàò â eax:edx
push eax
call _cvGetSize
@ -2337,7 +2338,7 @@ asm
mov Result.height,eax
end;
{$ENDIF CPU64}
//{$ENDIF}
// {$ENDIF}
// -------------------
{$ELSEIF DEFINED(DelphiOCVVersion_30)}
function cvGetSize(const arr: pCvArr): TCvSize; external core_lib;
@ -2638,6 +2639,12 @@ procedure cvExp; external core_lib;
procedure cvLog; external core_lib;
procedure cvCrossProduct; external core_lib;
procedure cvMatMulAdd(const src1, src2, src3: pCvArr; dst: pCvArr);
begin
cvGEMM(src1, src2, 1, src3, 1, dst, 0);
end;
procedure cvGEMM; external core_lib;
function cvInvert; external core_lib;

View File

@ -167,8 +167,8 @@ procedure cvPyrUp(const src: pIplImage; dst: pIplImage; filter: Integer = CV_GAU
int calc CV_DEFAULT(1),
int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
*)
function cvCreatePyramid(const img: pCvArr; extra_layers: Integer; rate: double; const layer_sizes: pCvSize = nil;
bufarr: pCvArr = nil; calc: Integer = 1; filter: Integer = CV_GAUSSIAN_5x5): ppCvMat; cdecl;
function cvCreatePyramid(const img: pCvArr; extra_layers: Integer; rate: double; const layer_sizes: pCvSize = nil; bufarr: pCvArr = nil;
calc: Integer = 1; filter: Integer = CV_GAUSSIAN_5x5): ppCvMat; cdecl;
(*
Releases pyramid
@ -186,6 +186,13 @@ procedure cvReleasePyramid(var pyramid: ppCvMat; extra_layers: Integer); cdecl;
procedure cvPyrMeanShiftFiltering(const src: pCvArr; dst: pCvArr; sp: double; sr: double; max_level: Integer { = 1 };
termcrit: TCvTermCriteria { = CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 5, 1)) } ); cdecl;
(*
Segments image using seed "markers"
CVAPI(void) cvWatershed( const CvArr* image, CvArr* markers );
*)
procedure cvWatershed(const image: pCvArr; markers: pCvArr); cdecl;
{
/* Calculates an image derivative using generalized Sobel
(aperture_size = 1,3,5,7) or Scharr (aperture_size = -1) operator.
@ -198,8 +205,7 @@ procedure cvPyrMeanShiftFiltering(const src: pCvArr; dst: pCvArr; sp: double; sr
int yorder,
int aperture_size CV_DEFAULT(3));
}
procedure cvSobel(const src: pIplImage; dst: pIplImage; xorder: Integer; yorder: Integer;
aperture_size: Integer = 3); cdecl;
procedure cvSobel(const src: pIplImage; dst: pIplImage; xorder: Integer; yorder: Integer; aperture_size: Integer = 3); cdecl;
{
/* Calculates the image Laplacian: (d2/dx + d2/dy)I */
@ -260,8 +266,7 @@ procedure cvWarpPerspective(const src: pIplImage; dst: pIplImage; const map_matr
CvMat* map_matrix );
}
function cvGetPerspectiveTransform(const src: pCvPoint2D32f; const dst: pCvPoint2D32f; map_matrix: pCvMat)
: pCvMat; cdecl;
function cvGetPerspectiveTransform(const src: pCvPoint2D32f; const dst: pCvPoint2D32f; map_matrix: pCvMat): pCvMat; cdecl;
{
/* Performs generic geometric transformation using the specified coordinate maps */
CVAPI(void) cvRemap(
@ -308,8 +313,7 @@ procedure cvUndistort2(const src: pCvArr; dst: pCvArr; const camera_matrix: pCvA
CvArr* mapx,
CvArr* mapy );
}
procedure cvInitUndistortMap(const camera_matrix: pCvMat; const distortion_coeffs: pCvMat; mapx: pCvArr;
mapy: pCvArr); cdecl;
procedure cvInitUndistortMap(const camera_matrix: pCvMat; const distortion_coeffs: pCvMat; mapx: pCvArr; mapy: pCvArr); cdecl;
// (* Computes undistortion+rectification map for a head of stereo camera *)
@ -325,15 +329,15 @@ procedure cvInitUndistortMap(const camera_matrix: pCvMat; const distortion_coeff
// const CvMat* dist_coeffs,
// const CvMat* R CV_DEFAULT(0),
// const CvMat* P CV_DEFAULT(0));
procedure cvUndistortPoints(const src: pCvMat; dst: pCvMat; const camera_matrix: pCvMat; const dist_coeffs: pCvMat;
const R: pCvMat = nil; const P: pCvMat = nil); cdecl;
procedure cvUndistortPoints(const src: pCvMat; dst: pCvMat; const camera_matrix: pCvMat; const dist_coeffs: pCvMat; const R: pCvMat = nil;
const P: pCvMat = nil); cdecl;
// * creates structuring element used for morphological operations */
// CVAPI(IplConvKernel*) cvCreateStructuringElementEx(
// int cols, int rows, int anchor_x, int anchor_y,
// int shape, int* values CV_DEFAULT(NULL) );
function cvCreateStructuringElementEx(cols: Integer; rows: Integer; anchor_x: Integer; anchor_y: Integer;
shape: Integer; values: PInteger = nil): pIplConvKernel; cdecl;
function cvCreateStructuringElementEx(cols: Integer; rows: Integer; anchor_x: Integer; anchor_y: Integer; shape: Integer;
values: PInteger = nil): pIplConvKernel; cdecl;
// (* releases structuring element *)
// CVAPI(procedure) cvReleaseStructuringElement( element: array of IplConvKernel);
@ -344,8 +348,8 @@ procedure cvReleaseStructuringElement(Var element: pIplConvKernel); cdecl;
// CVAPI(void) cvMorphologyEx( const CvArr* src, CvArr* dst,
// CvArr* temp, IplConvKernel* element,
// int operation, int iterations CV_DEFAULT(1) );
procedure cvMorphologyEx(const src: pIplImage; dst: pIplImage; temp: pIplImage; element: pIplConvKernel;
operation: Integer; iterations: Integer = 1); cdecl;
procedure cvMorphologyEx(const src: pIplImage; dst: pIplImage; temp: pIplImage; element: pIplConvKernel; operation: Integer;
iterations: Integer = 1); cdecl;
// * Calculates all spatial and central moments up to the 3rd order */
// CVAPI(void) cvMoments( const CvArr* arr, CvMoments* moments, int binary CV_DEFAULT(0));
@ -390,8 +394,7 @@ procedure cvGetHuMoments(moments: pCvMoments; hu_moments: pCvHuMoments); cdecl;
CVAPI(int) cvSampleLine( const CvArr* image, CvPoint pt1, CvPoint pt2, void* buffer,
int connectivity CV_DEFAULT(8));
*)
function cvSampleLine(const image: pCvArr; pt1: TCvPoint; pt2: TCvPoint; buffer: Pointer; connectivity: Integer = 8)
: Integer; cdecl;
function cvSampleLine(const image: pCvArr; pt1: TCvPoint; pt2: TCvPoint; buffer: Pointer; connectivity: Integer = 8): Integer; cdecl;
(*
Retrieves the rectangular image region with specified center from the input array.
dst(x,y) <- src(x + center.x - dst_width/2, y + center.y - dst_height/2).
@ -432,9 +435,8 @@ procedure cvMatchTemplate(const image: pCvArr; const templ: pCvArr; result: pCvA
float* lower_bound CV_DEFAULT(NULL),
void* userdata CV_DEFAULT(NULL));
*)
function cvCalcEMD2(const signature1: pCvArr; const signature2: pCvArr; distance_type: Integer;
distance_func: TCvDistanceFunction = nil; const cost_matrix: pCvArr = nil; flow: pCvArr = nil;
lower_bound: pfloat = nil; userdata: Pointer = nil): float; cdecl;
function cvCalcEMD2(const signature1: pCvArr; const signature2: pCvArr; distance_type: Integer; distance_func: TCvDistanceFunction = nil;
const cost_matrix: pCvArr = nil; flow: pCvArr = nil; lower_bound: pfloat = nil; userdata: Pointer = nil): float; cdecl;
// ****************************************************************************************
// * Contours retrieving *
@ -442,17 +444,17 @@ function cvCalcEMD2(const signature1: pCvArr; const signature2: pCvArr; distance
const
// * contour retrieval mode */
CV_RETR_EXTERNAL = 0;
CV_RETR_LIST = 1;
CV_RETR_CCOMP = 2;
CV_RETR_TREE = 3;
CV_RETR_LIST = 1;
CV_RETR_CCOMP = 2;
CV_RETR_TREE = 3;
// * contour approximation method */
CV_CHAIN_CODE = 0;
CV_CHAIN_APPROX_NONE = 1;
CV_CHAIN_APPROX_SIMPLE = 2;
CV_CHAIN_APPROX_TC89_L1 = 3;
CV_CHAIN_CODE = 0;
CV_CHAIN_APPROX_NONE = 1;
CV_CHAIN_APPROX_SIMPLE = 2;
CV_CHAIN_APPROX_TC89_L1 = 3;
CV_CHAIN_APPROX_TC89_KCOS = 4;
CV_LINK_RUNS = 5;
CV_LINK_RUNS = 5;
type
@ -571,8 +573,8 @@ function cvEndFindContours(Var scanner: pCvContourScanner): pCvSeq; cdecl;
int minimal_perimeter CV_DEFAULT(0),
int recursive CV_DEFAULT(0));
*)
function cvApproxChains(src_seq: pCvSeq; storage: pCvMemStorage; method: Integer = CV_CHAIN_APPROX_SIMPLE;
parameter: double = 0; minimal_perimeter: Integer = 0; recursive: Integer = 0): pCvSeq; cdecl;
function cvApproxChains(src_seq: pCvSeq; storage: pCvMemStorage; method: Integer = CV_CHAIN_APPROX_SIMPLE; parameter: double = 0;
minimal_perimeter: Integer = 0; recursive: Integer = 0): pCvSeq; cdecl;
(*
Initializes Freeman chain reader.
The reader is used to iteratively get coordinates of all the chain points.
@ -617,8 +619,7 @@ function cvApproxPoly(
int is_closed CV_DEFAULT(-1));
*)
function cvArcLength(const curve: Pointer; slice: TCvSlice { = CV_WHOLE_SEQ }; is_closed: Integer { = 1 } )
: double; cdecl;
function cvArcLength(const curve: Pointer; slice: TCvSlice { = CV_WHOLE_SEQ }; is_closed: Integer { = 1 } ): double; cdecl;
(*
CV_INLINE double cvContourPerimeter( const void* contour )
@ -651,8 +652,7 @@ function cvMinEnclosingCircle(points: pCvArr; center: pCvPoint2D32f; radius: pSi
CVAPI(double) cvMatchShapes( const void* object1, const void* object2,
int method, double parameter CV_DEFAULT(0));
}
function cvMatchShapes(const object1: Pointer; const object2: Pointer; method: Integer; parameter: double = 0)
: double; cdecl;
function cvMatchShapes(const object1: Pointer; const object2: Pointer; method: Integer; parameter: double = 0): double; cdecl;
{
/* Calculates exact convex hull of 2d point set */
@ -661,8 +661,8 @@ function cvMatchShapes(const object1: Pointer; const object2: Pointer; method: I
int orientation CV_DEFAULT(CV_CLOCKWISE),
int return_points CV_DEFAULT(0));
}
function cvConvexHull2(const input: pCvSeq; hull_storage: Pointer = nil; orientation: Integer = CV_CLOCKWISE;
return_points: Integer = 0): pCvSeq; cdecl;
function cvConvexHull2(const input: pCvSeq; hull_storage: Pointer = nil; orientation: Integer = CV_CLOCKWISE; return_points: Integer = 0)
: pCvSeq; cdecl;
{
/* Checks whether the contour is convex or not (returns 1 if convex, 0 if not) */
@ -704,8 +704,7 @@ procedure cvBoxPoints(box: TCvBox2D; pt: TBoxPoints); cdecl;
CvContour* contour_header,
CvSeqBlock* block );
*)
function cvPointSeqFromMat(seq_kind: Integer; const mat: pCvArr; contour_header: pCvContour; block: pCvSeqBlock)
: pCvSeq; cdecl;
function cvPointSeqFromMat(seq_kind: Integer; const mat: pCvArr; contour_header: pCvContour; block: pCvSeqBlock): pCvSeq; cdecl;
(*
Checks whether the point is inside polygon, outside, on an edge (at a vertex).
Returns positive, negative or zero value, correspondingly.
@ -727,8 +726,7 @@ function cvPointPolygonTest(const contour: pCvArr; pt: TCvPoint2D32f; measure_di
float** ranges CV_DEFAULT(NULL),
int uniform CV_DEFAULT(1));
}
function cvCreateHist(dims: Integer; sizes: PInteger; _type: Integer; ranges: Pointer = nil; uniform: Integer = 1)
: pCvHistogram; cdecl;
function cvCreateHist(dims: Integer; sizes: PInteger; _type: Integer; ranges: Pointer = nil; uniform: Integer = 1): pCvHistogram; cdecl;
// function cvCreateHist(dims: Integer; sizes: PInteger; _type: Integer; ranges: ppFloat = nil;
// uniform: Integer = 1): pCvHistogram; cdecl; overload;
@ -740,8 +738,8 @@ function cvCreateHist(dims: Integer; sizes: PInteger; _type: Integer; ranges: Po
float* data, float** ranges CV_DEFAULT(NULL),
int uniform CV_DEFAULT(1));
*)
function cvMakeHistHeaderForArray(dims: Integer; sizes: PInteger; hist: pCvHistogram; data: pfloat;
ranges: ppfloat = nil; uniform: Integer = 1): pCvHistogram; cdecl;
function cvMakeHistHeaderForArray(dims: Integer; sizes: PInteger; hist: pCvHistogram; data: pfloat; ranges: ppfloat = nil;
uniform: Integer = 1): pCvHistogram; cdecl;
// * Releases histogram */
// CVAPI(void) cvReleaseHist( CvHistogram** hist );
@ -758,8 +756,8 @@ procedure cvClearHist(hist: pCvHistogram); cdecl;
int* min_idx CV_DEFAULT(NULL),
int* max_idx CV_DEFAULT(NULL));
}
procedure cvGetMinMaxHistValue(const hist: pCvHistogram; min_value: pSingle; max_value: pSingle;
min_idx: PInteger = nil; max_idx: PInteger = nil); cdecl;
procedure cvGetMinMaxHistValue(const hist: pCvHistogram; min_value: pSingle; max_value: pSingle; min_idx: PInteger = nil;
max_idx: PInteger = nil); cdecl;
// (* Clear all histogram bins that are below the threshold *)
// CVAPI(procedure) cvThreshHist(var hist: CvHistogram; threshold: Double);
@ -789,8 +787,7 @@ function cvCompareHist(hist1: pCvHistogram; hist2: pCvHistogram; method: Integer
int accumulate CV_DEFAULT(0),
const CvArr* mask CV_DEFAULT(NULL) );
}
procedure cvCalcArrHist(var arr: pIplImage; hist: pCvHistogram; accumulate: Integer = 0;
const mask: pIplImage = nil); cdecl;
procedure cvCalcArrHist(var arr: pIplImage; hist: pCvHistogram; accumulate: Integer = 0; const mask: pIplImage = nil); cdecl;
// CV_INLINE void cvCalcHist(
// IplImage** image,
@ -912,8 +909,7 @@ procedure cvFloodFill(
double threshold2,
int aperture_size CV_DEFAULT(3) );
}
procedure cvCanny(const image: pIplImage; edges: pIplImage; threshold1: double; threshold2: double;
aperture_size: Integer = 3); cdecl;
procedure cvCanny(const image: pIplImage; edges: pIplImage; threshold1: double; threshold2: double; aperture_size: Integer = 3); cdecl;
// (* Runs canny edge detector *) CVAPI(
// procedure)cvCanny(CvArr * image: array of
@ -947,8 +943,8 @@ procedure cvCanny(const image: pIplImage; edges: pIplImage; threshold1: double;
CvSize zero_zone,
CvTermCriteria criteria );
}
procedure cvFindCornerSubPix(const image: pIplImage; corners: pCvPoint2D32f; count: Integer; win: TCvSize;
zero_zone: TCvSize; criteria: TCvTermCriteria); cdecl;
procedure cvFindCornerSubPix(const image: pIplImage; corners: pCvPoint2D32f; count: Integer; win: TCvSize; zero_zone: TCvSize;
criteria: TCvTermCriteria); cdecl;
// function; var Adjust corner position using some sort of gradient search * )CVAPI(
@ -968,9 +964,9 @@ procedure cvFindCornerSubPix(const image: pIplImage; corners: pCvPoint2D32f; cou
int use_harris CV_DEFAULT(0),
double k CV_DEFAULT(0.04) );
}
procedure cvGoodFeaturesToTrack(const image: pIplImage; eig_image: pIplImage; temp_image: pIplImage;
corners: pCvPoint2D32f; corner_count: PInteger; quality_level: double; min_distance: double;
const mask: pIplImage = nil; block_size: Integer = 3; use_harris: Integer = 0; k: double = 0.04); cdecl;
procedure cvGoodFeaturesToTrack(const image: pIplImage; eig_image: pIplImage; temp_image: pIplImage; corners: pCvPoint2D32f;
corner_count: PInteger; quality_level: double; min_distance: double; const mask: pIplImage = nil; block_size: Integer = 3;
use_harris: Integer = 0; k: double = 0.04); cdecl;
// (* Finds lines on binary image using one of several methods.

View File

@ -244,7 +244,7 @@ Type
CP: Integer; (* number of control vector dimensions *)
(* backward compatibility fields *)
{$IFDEF 1}
//{$IFDEF 1}
PosterState: PSingle; (* =state_pre->data.fl *)
PriorState: PSingle; (* =state_post->data.fl *)
DynamMatr: PSingle; (* =transition_matrix->data.fl *)
@ -254,9 +254,9 @@ Type
KalmGainMatr: PSingle; (* =gain->data.fl *)
PriorErrorCovariance: PSingle; (* =error_cov_pre->data.fl *)
PosterErrorCovariance: PSingle; (* =error_cov_post->data.fl *)
Temp1: PSingle; (* temp1->data.fl *)
Temp2: PSingle; (* temp2->data.fl *)
{$ENDIF}
_Temp1: PSingle; (* temp1->data.fl *)
_Temp2: PSingle; (* temp2->data.fl *)
//{$ENDIF}
state_pre: pCvMat; (* predicted state (x'(k)):
x(k)=A*x(k-1)+B*u(k) *)
state_post: pCvMat; (* corrected state (x(k)):