Refactoring

Signed-off-by: Laentir Valetov <laex@bk.ru>
This commit is contained in:
Laentir Valetov 2015-03-31 00:02:32 +03:00
parent d86e51c2f0
commit 8a4a8eebfd
18 changed files with 416 additions and 423 deletions

View File

@ -1,25 +1,25 @@
//*****************************************************************
// 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_MatchTemplate;
@ -38,6 +38,7 @@ var
imgSrc, imgTmp, imgMat: PIplImage;
min: double;
p1, p2: TCvPoint;
begin
imgSrc := cvLoadImage(cResourceMedia + 'My_Desk.jpg');
imgTmp := cvLoadImage(cResourceMedia + 'Stapler2.jpg');
@ -57,14 +58,16 @@ begin
cvMinMaxLoc(imgMat, @min, @min, nil, @p1, nil);
p2.X := p1.X + imgTmp.Width - 1;
p2.Y := p1.Y + imgTmp.Height - 1;
cvRectangle(imgSrc, p1, p2, CV_RGB(255,0,0));
cvRectangle(imgSrc, p1, p2, CV_RGB(255, 0, 0));
cvShowImage('Result', imgSrc);
cvWaitKey(0);
finally
cvReleaseImage(imgSrc);
cvReleaseImage(imgTmp);
cvReleaseImage(imgMat);
cvDestroyAllWindows;
end;
end.

View File

@ -7,7 +7,7 @@
<TargetedPlatforms>3</TargetedPlatforms>
<AppType>Console</AppType>
<FrameworkType>None</FrameworkType>
<ProjectVersion>16.0</ProjectVersion>
<ProjectVersion>16.1</ProjectVersion>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
@ -151,3 +151,11 @@
<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=1
Encrypt Password=""
EurekaLog Last Line -->

View File

@ -46,10 +46,10 @@ begin
'Using the SURF desriptor:'#13#10#13#10'Usage:'#13#10#9'matcher_simple <image1> <image2>');
end;
{ .$DEFINE USE_SURF }
{ .$DEFINE USE_SIFT }
{ .$DEFINE USE_ORB }
{$DEFINE USE_BRISK}
{.$DEFINE USE_SURF }
{.$DEFINE USE_SIFT }
{$DEFINE USE_ORB}
{.$DEFINE USE_BRISK}
Var
{$IFDEF USE_SURF}

View File

@ -166,29 +166,26 @@ type
property Interpolation: TocvInterpolationMethod read FInterpolation write FInterpolation default INTER_LINEAR;
end;
TocvColorConversion = (BGR2BGRA, RGB2RGBA, BGRA2BGR, RGBA2RGB, BGR2RGBA, RGB2BGRA, RGBA2BGR, BGRA2RGB, BGR2RGB,
RGB2BGR, BGRA2RGBA, RGBA2BGRA, BGR2GRAY, RGB2GRAY, GRAY2BGR, GRAY2RGB, GRAY2BGRA, GRAY2RGBA, BGRA2GRAY, RGBA2GRAY,
BGR2BGR565, RGB2BGR565, BGR5652BGR, BGR5652RGB, BGRA2BGR565, RGBA2BGR565, BGR5652BGRA, BGR5652RGBA, GRAY2BGR565,
BGR5652GRAY, BGR2BGR555, RGB2BGR555, BGR5552BGR, BGR5552RGB, BGRA2BGR555, RGBA2BGR555, BGR5552BGRA, BGR5552RGBA,
GRAY2BGR555, BGR5552GRAY, BGR2XYZ, RGB2XYZ, XYZ2BGR, XYZ2RGB, BGR2YCrCb, RGB2YCrCb, YCrCb2BGR, YCrCb2RGB, BGR2HSV,
RGB2HSV, BGR2Lab, RGB2Lab, BayerBG2BGR, BayerGB2BGR, BayerRG2BGR, BayerGR2BGR, BayerBG2RGB, BayerGB2RGB,
BayerRG2RGB, BayerGR2RGB, BGR2Luv, RGB2Luv, BGR2HLS, RGB2HLS, HSV2BGR, HSV2RGB, Lab2BGR, Lab2RGB, Luv2BGR, Luv2RGB,
HLS2BGR, HLS2RGB, BayerBG2BGR_VNG, BayerGB2BGR_VNG, BayerRG2BGR_VNG, BayerGR2BGR_VNG, BayerBG2RGB_VNG,
BayerGB2RGB_VNG, BayerRG2RGB_VNG, BayerGR2RGB_VNG, BGR2HSV_FULL, RGB2HSV_FULL, BGR2HLS_FULL, RGB2HLS_FULL,
HSV2BGR_FULL, HSV2RGB_FULL, HLS2BGR_FULL, HLS2RGB_FULL, LBGR2Lab, LRGB2Lab, LBGR2Luv, LRGB2Luv, Lab2LBGR, Lab2LRGB,
Luv2LBGR, Luv2LRGB, BGR2YUV, RGB2YUV, YUV2BGR, YUV2RGB, BayerBG2GRAY, BayerGB2GRAY, BayerRG2GRAY, BayerGR2GRAY,
TocvColorConversion = (BGR2BGRA, RGB2RGBA, BGRA2BGR, RGBA2RGB, BGR2RGBA, RGB2BGRA, RGBA2BGR, BGRA2RGB, BGR2RGB, RGB2BGR, BGRA2RGBA,
RGBA2BGRA, BGR2GRAY, RGB2GRAY, GRAY2BGR, GRAY2RGB, GRAY2BGRA, GRAY2RGBA, BGRA2GRAY, RGBA2GRAY, BGR2BGR565, RGB2BGR565, BGR5652BGR,
BGR5652RGB, BGRA2BGR565, RGBA2BGR565, BGR5652BGRA, BGR5652RGBA, GRAY2BGR565, BGR5652GRAY, BGR2BGR555, RGB2BGR555, BGR5552BGR,
BGR5552RGB, BGRA2BGR555, RGBA2BGR555, BGR5552BGRA, BGR5552RGBA, GRAY2BGR555, BGR5552GRAY, BGR2XYZ, RGB2XYZ, XYZ2BGR, XYZ2RGB, BGR2YCrCb,
RGB2YCrCb, YCrCb2BGR, YCrCb2RGB, BGR2HSV, RGB2HSV, BGR2Lab, RGB2Lab, BayerBG2BGR, BayerGB2BGR, BayerRG2BGR, BayerGR2BGR, BayerBG2RGB,
BayerGB2RGB, BayerRG2RGB, BayerGR2RGB, BGR2Luv, RGB2Luv, BGR2HLS, RGB2HLS, HSV2BGR, HSV2RGB, Lab2BGR, Lab2RGB, Luv2BGR, Luv2RGB,
HLS2BGR, HLS2RGB, BayerBG2BGR_VNG, BayerGB2BGR_VNG, BayerRG2BGR_VNG, BayerGR2BGR_VNG, BayerBG2RGB_VNG, BayerGB2RGB_VNG, BayerRG2RGB_VNG,
BayerGR2RGB_VNG, BGR2HSV_FULL, RGB2HSV_FULL, BGR2HLS_FULL, RGB2HLS_FULL, HSV2BGR_FULL, HSV2RGB_FULL, HLS2BGR_FULL, HLS2RGB_FULL,
LBGR2Lab, LRGB2Lab, LBGR2Luv, LRGB2Luv, Lab2LBGR, Lab2LRGB, Luv2LBGR, Luv2LRGB, BGR2YUV, RGB2YUV, YUV2BGR, YUV2RGB, BayerBG2GRAY,
BayerGB2GRAY, BayerRG2GRAY, BayerGR2GRAY,
// YUV 4:2:0 formats family;
YUV2RGB_NV12, YUV2BGR_NV12, YUV2RGB_NV21, YUV2BGR_NV21, YUV420sp2RGB, YUV420sp2BGR, YUV2RGBA_NV12, YUV2BGRA_NV12,
YUV2RGBA_NV21, YUV2BGRA_NV21, YUV420sp2RGBA, YUV420sp2BGRA, YUV2RGB_YV12, YUV2BGR_YV12, YUV2RGB_IYUV, YUV2BGR_IYUV,
YUV2RGB_I420, YUV2BGR_I420, YUV420p2RGB, YUV420p2BGR, YUV2RGBA_YV12, YUV2BGRA_YV12, YUV2RGBA_IYUV, YUV2BGRA_IYUV,
YUV2RGBA_I420, YUV2BGRA_I420, YUV420p2RGBA, YUV420p2BGRA, YUV2GRAY_420, YUV2GRAY_NV21, YUV2GRAY_NV12, YUV2GRAY_YV12,
YUV2GRAY_IYUV, YUV2GRAY_I420, YUV420sp2GRAY, YUV420p2GRAY,
YUV2RGB_NV12, YUV2BGR_NV12, YUV2RGB_NV21, YUV2BGR_NV21, YUV420sp2RGB, YUV420sp2BGR, YUV2RGBA_NV12, YUV2BGRA_NV12, YUV2RGBA_NV21,
YUV2BGRA_NV21, YUV420sp2RGBA, YUV420sp2BGRA, YUV2RGB_YV12, YUV2BGR_YV12, YUV2RGB_IYUV, YUV2BGR_IYUV, YUV2RGB_I420, YUV2BGR_I420,
YUV420p2RGB, YUV420p2BGR, YUV2RGBA_YV12, YUV2BGRA_YV12, YUV2RGBA_IYUV, YUV2BGRA_IYUV, YUV2RGBA_I420, YUV2BGRA_I420, YUV420p2RGBA,
YUV420p2BGRA, YUV2GRAY_420, YUV2GRAY_NV21, YUV2GRAY_NV12, YUV2GRAY_YV12, YUV2GRAY_IYUV, YUV2GRAY_I420, YUV420sp2GRAY, YUV420p2GRAY,
// YUV 4:2:2 formats family;
YUV2RGB_UYVY, YUV2BGR_UYVY, YUV2RGB_Y422, YUV2BGR_Y422, YUV2RGB_UYNV, YUV2BGR_UYNV, YUV2RGBA_UYVY, YUV2BGRA_UYVY,
YUV2RGBA_Y422, YUV2BGRA_Y422, YUV2RGBA_UYNV, YUV2BGRA_UYNV, YUV2RGB_YUY2, YUV2BGR_YUY2, YUV2RGB_YVYU, YUV2BGR_YVYU,
YUV2RGB_YUYV, YUV2BGR_YUYV, YUV2RGB_YUNV, YUV2BGR_YUNV, YUV2RGBA_YUY2, YUV2BGRA_YUY2, YUV2RGBA_YVYU, YUV2BGRA_YVYU,
YUV2RGBA_YUYV, YUV2BGRA_YUYV, YUV2RGBA_YUNV, YUV2BGRA_YUNV, YUV2GRAY_UYVY, YUV2GRAY_YUY2, YUV2GRAY_Y422,
YUV2GRAY_UYNV, YUV2GRAY_YVYU, YUV2GRAY_YUYV, YUV2GRAY_YUNV,
YUV2RGB_UYVY, YUV2BGR_UYVY, YUV2RGB_Y422, YUV2BGR_Y422, YUV2RGB_UYNV, YUV2BGR_UYNV, YUV2RGBA_UYVY, YUV2BGRA_UYVY, YUV2RGBA_Y422,
YUV2BGRA_Y422, YUV2RGBA_UYNV, YUV2BGRA_UYNV, YUV2RGB_YUY2, YUV2BGR_YUY2, YUV2RGB_YVYU, YUV2BGR_YVYU, YUV2RGB_YUYV, YUV2BGR_YUYV,
YUV2RGB_YUNV, YUV2BGR_YUNV, YUV2RGBA_YUY2, YUV2BGRA_YUY2, YUV2RGBA_YVYU, YUV2BGRA_YVYU, YUV2RGBA_YUYV, YUV2BGRA_YUYV, YUV2RGBA_YUNV,
YUV2BGRA_YUNV, YUV2GRAY_UYVY, YUV2GRAY_YUY2, YUV2GRAY_Y422, YUV2GRAY_UYNV, YUV2GRAY_YVYU, YUV2GRAY_YUYV, YUV2GRAY_YUNV,
// alpha premultiplication;
RGBA2mRGBA, mRGBA2RGBA, COLORCVT_MAX);
@ -196,38 +193,35 @@ type
TocvCvtColorOperation = class(TocvCustomImageOperation)
private const
cIPLDepth: array [TocvIPLDepth] of Integer = (IPL_DEPTH_1U, IPL_DEPTH_8U, IPL_DEPTH_16U, IPL_DEPTH_32F,
IPL_DEPTH_64F, (IPL_DEPTH_SIGN or 8), IPL_DEPTH_16S, IPL_DEPTH_32S);
cIPLDepth: array [TocvIPLDepth] of Integer = (IPL_DEPTH_1U, IPL_DEPTH_8U, IPL_DEPTH_16U, IPL_DEPTH_32F, IPL_DEPTH_64F,
(IPL_DEPTH_SIGN or 8), IPL_DEPTH_16S, IPL_DEPTH_32S);
cColorConversion: array [TocvColorConversion] of Integer = (CV_BGR2BGRA, CV_RGB2RGBA, CV_BGRA2BGR, CV_RGBA2RGB,
CV_BGR2RGBA, CV_RGB2BGRA, CV_RGBA2BGR, CV_BGRA2RGB, CV_BGR2RGB, CV_RGB2BGR, CV_BGRA2RGBA, CV_RGBA2BGRA,
CV_BGR2GRAY, CV_RGB2GRAY, CV_GRAY2BGR, CV_GRAY2RGB, CV_GRAY2BGRA, CV_GRAY2RGBA, CV_BGRA2GRAY, CV_RGBA2GRAY,
CV_BGR2BGR565, CV_RGB2BGR565, CV_BGR5652BGR, CV_BGR5652RGB, CV_BGRA2BGR565, CV_RGBA2BGR565, CV_BGR5652BGRA,
CV_BGR5652RGBA, CV_GRAY2BGR565, CV_BGR5652GRAY, CV_BGR2BGR555, CV_RGB2BGR555, CV_BGR5552BGR, CV_BGR5552RGB,
CV_BGRA2BGR555, CV_RGBA2BGR555, CV_BGR5552BGRA, CV_BGR5552RGBA, CV_GRAY2BGR555, CV_BGR5552GRAY, CV_BGR2XYZ,
CV_RGB2XYZ, CV_XYZ2BGR, CV_XYZ2RGB, CV_BGR2YCrCb, CV_RGB2YCrCb, CV_YCrCb2BGR, CV_YCrCb2RGB, CV_BGR2HSV,
CV_RGB2HSV, CV_BGR2Lab, CV_RGB2Lab, CV_BayerBG2BGR, CV_BayerGB2BGR, CV_BayerRG2BGR, CV_BayerGR2BGR,
CV_BayerBG2RGB, CV_BayerGB2RGB, CV_BayerRG2RGB, CV_BayerGR2RGB, CV_BGR2Luv, CV_RGB2Luv, CV_BGR2HLS, CV_RGB2HLS,
CV_HSV2BGR, CV_HSV2RGB, CV_Lab2BGR, CV_Lab2RGB, CV_Luv2BGR, CV_Luv2RGB, CV_HLS2BGR, CV_HLS2RGB,
CV_BayerBG2BGR_VNG, CV_BayerGB2BGR_VNG, CV_BayerRG2BGR_VNG, CV_BayerGR2BGR_VNG, CV_BayerBG2RGB_VNG,
CV_BayerGB2RGB_VNG, CV_BayerRG2RGB_VNG, CV_BayerGR2RGB_VNG, CV_BGR2HSV_FULL, CV_RGB2HSV_FULL, CV_BGR2HLS_FULL,
CV_RGB2HLS_FULL, CV_HSV2BGR_FULL, CV_HSV2RGB_FULL, CV_HLS2BGR_FULL, CV_HLS2RGB_FULL, CV_LBGR2Lab, CV_LRGB2Lab,
CV_LBGR2Luv, CV_LRGB2Luv, CV_Lab2LBGR, CV_Lab2LRGB, CV_Luv2LBGR, CV_Luv2LRGB, CV_BGR2YUV, CV_RGB2YUV, CV_YUV2BGR,
CV_YUV2RGB, CV_BayerBG2GRAY, CV_BayerGB2GRAY, CV_BayerRG2GRAY, CV_BayerGR2GRAY,
cColorConversion: array [TocvColorConversion] of Integer = (CV_BGR2BGRA, CV_RGB2RGBA, CV_BGRA2BGR, CV_RGBA2RGB, CV_BGR2RGBA,
CV_RGB2BGRA, CV_RGBA2BGR, CV_BGRA2RGB, CV_BGR2RGB, CV_RGB2BGR, CV_BGRA2RGBA, CV_RGBA2BGRA, CV_BGR2GRAY, CV_RGB2GRAY, CV_GRAY2BGR,
CV_GRAY2RGB, CV_GRAY2BGRA, CV_GRAY2RGBA, CV_BGRA2GRAY, CV_RGBA2GRAY, CV_BGR2BGR565, CV_RGB2BGR565, CV_BGR5652BGR, CV_BGR5652RGB,
CV_BGRA2BGR565, CV_RGBA2BGR565, CV_BGR5652BGRA, CV_BGR5652RGBA, CV_GRAY2BGR565, CV_BGR5652GRAY, CV_BGR2BGR555, CV_RGB2BGR555,
CV_BGR5552BGR, CV_BGR5552RGB, CV_BGRA2BGR555, CV_RGBA2BGR555, CV_BGR5552BGRA, CV_BGR5552RGBA, CV_GRAY2BGR555, CV_BGR5552GRAY,
CV_BGR2XYZ, CV_RGB2XYZ, CV_XYZ2BGR, CV_XYZ2RGB, CV_BGR2YCrCb, CV_RGB2YCrCb, CV_YCrCb2BGR, CV_YCrCb2RGB, CV_BGR2HSV, CV_RGB2HSV,
CV_BGR2Lab, CV_RGB2Lab, CV_BayerBG2BGR, CV_BayerGB2BGR, CV_BayerRG2BGR, CV_BayerGR2BGR, CV_BayerBG2RGB, CV_BayerGB2RGB,
CV_BayerRG2RGB, CV_BayerGR2RGB, CV_BGR2Luv, CV_RGB2Luv, CV_BGR2HLS, CV_RGB2HLS, CV_HSV2BGR, CV_HSV2RGB, CV_Lab2BGR, CV_Lab2RGB,
CV_Luv2BGR, CV_Luv2RGB, CV_HLS2BGR, CV_HLS2RGB, CV_BayerBG2BGR_VNG, CV_BayerGB2BGR_VNG, CV_BayerRG2BGR_VNG, CV_BayerGR2BGR_VNG,
CV_BayerBG2RGB_VNG, CV_BayerGB2RGB_VNG, CV_BayerRG2RGB_VNG, CV_BayerGR2RGB_VNG, CV_BGR2HSV_FULL, CV_RGB2HSV_FULL, CV_BGR2HLS_FULL,
CV_RGB2HLS_FULL, CV_HSV2BGR_FULL, CV_HSV2RGB_FULL, CV_HLS2BGR_FULL, CV_HLS2RGB_FULL, CV_LBGR2Lab, CV_LRGB2Lab, CV_LBGR2Luv,
CV_LRGB2Luv, CV_Lab2LBGR, CV_Lab2LRGB, CV_Luv2LBGR, CV_Luv2LRGB, CV_BGR2YUV, CV_RGB2YUV, CV_YUV2BGR, CV_YUV2RGB, CV_BayerBG2GRAY,
CV_BayerGB2GRAY, CV_BayerRG2GRAY, CV_BayerGR2GRAY,
// YUV 4:2:0 formats family;
CV_YUV2RGB_NV12, CV_YUV2BGR_NV12, CV_YUV2RGB_NV21, CV_YUV2BGR_NV21, CV_YUV420sp2RGB, CV_YUV420sp2BGR,
CV_YUV2RGBA_NV12, CV_YUV2BGRA_NV12, CV_YUV2RGBA_NV21, CV_YUV2BGRA_NV21, CV_YUV420sp2RGBA, CV_YUV420sp2BGRA,
CV_YUV2RGB_YV12, CV_YUV2BGR_YV12, CV_YUV2RGB_IYUV, CV_YUV2BGR_IYUV, CV_YUV2RGB_I420, CV_YUV2BGR_I420,
CV_YUV420p2RGB, CV_YUV420p2BGR, CV_YUV2RGBA_YV12, CV_YUV2BGRA_YV12, CV_YUV2RGBA_IYUV, CV_YUV2BGRA_IYUV,
CV_YUV2RGBA_I420, CV_YUV2BGRA_I420, CV_YUV420p2RGBA, CV_YUV420p2BGRA, CV_YUV2GRAY_420, CV_YUV2GRAY_NV21,
CV_YUV2GRAY_NV12, CV_YUV2GRAY_YV12, CV_YUV2GRAY_IYUV, CV_YUV2GRAY_I420, CV_YUV420sp2GRAY, CV_YUV420p2GRAY,
CV_YUV2RGB_NV12, CV_YUV2BGR_NV12, CV_YUV2RGB_NV21, CV_YUV2BGR_NV21, CV_YUV420sp2RGB, CV_YUV420sp2BGR, CV_YUV2RGBA_NV12,
CV_YUV2BGRA_NV12, CV_YUV2RGBA_NV21, CV_YUV2BGRA_NV21, CV_YUV420sp2RGBA, CV_YUV420sp2BGRA, CV_YUV2RGB_YV12, CV_YUV2BGR_YV12,
CV_YUV2RGB_IYUV, CV_YUV2BGR_IYUV, CV_YUV2RGB_I420, CV_YUV2BGR_I420, CV_YUV420p2RGB, CV_YUV420p2BGR, CV_YUV2RGBA_YV12,
CV_YUV2BGRA_YV12, CV_YUV2RGBA_IYUV, CV_YUV2BGRA_IYUV, CV_YUV2RGBA_I420, CV_YUV2BGRA_I420, CV_YUV420p2RGBA, CV_YUV420p2BGRA,
CV_YUV2GRAY_420, CV_YUV2GRAY_NV21, CV_YUV2GRAY_NV12, CV_YUV2GRAY_YV12, CV_YUV2GRAY_IYUV, CV_YUV2GRAY_I420, CV_YUV420sp2GRAY,
CV_YUV420p2GRAY,
// YUV 4:2:2 formats family;
CV_YUV2RGB_UYVY, CV_YUV2BGR_UYVY, CV_YUV2RGB_Y422, CV_YUV2BGR_Y422, CV_YUV2RGB_UYNV, CV_YUV2BGR_UYNV,
CV_YUV2RGBA_UYVY, CV_YUV2BGRA_UYVY, CV_YUV2RGBA_Y422, CV_YUV2BGRA_Y422, CV_YUV2RGBA_UYNV, CV_YUV2BGRA_UYNV,
CV_YUV2RGB_YUY2, CV_YUV2BGR_YUY2, CV_YUV2RGB_YVYU, CV_YUV2BGR_YVYU, CV_YUV2RGB_YUYV, CV_YUV2BGR_YUYV,
CV_YUV2RGB_YUNV, CV_YUV2BGR_YUNV, CV_YUV2RGBA_YUY2, CV_YUV2BGRA_YUY2, CV_YUV2RGBA_YVYU, CV_YUV2BGRA_YVYU,
CV_YUV2RGBA_YUYV, CV_YUV2BGRA_YUYV, CV_YUV2RGBA_YUNV, CV_YUV2BGRA_YUNV, CV_YUV2GRAY_UYVY, CV_YUV2GRAY_YUY2,
CV_YUV2GRAY_Y422, CV_YUV2GRAY_UYNV, CV_YUV2GRAY_YVYU, CV_YUV2GRAY_YUYV, CV_YUV2GRAY_YUNV,
CV_YUV2RGB_UYVY, CV_YUV2BGR_UYVY, CV_YUV2RGB_Y422, CV_YUV2BGR_Y422, CV_YUV2RGB_UYNV, CV_YUV2BGR_UYNV, CV_YUV2RGBA_UYVY,
CV_YUV2BGRA_UYVY, CV_YUV2RGBA_Y422, CV_YUV2BGRA_Y422, CV_YUV2RGBA_UYNV, CV_YUV2BGRA_UYNV, CV_YUV2RGB_YUY2, CV_YUV2BGR_YUY2,
CV_YUV2RGB_YVYU, CV_YUV2BGR_YVYU, CV_YUV2RGB_YUYV, CV_YUV2BGR_YUYV, CV_YUV2RGB_YUNV, CV_YUV2BGR_YUNV, CV_YUV2RGBA_YUY2,
CV_YUV2BGRA_YUY2, CV_YUV2RGBA_YVYU, CV_YUV2BGRA_YVYU, CV_YUV2RGBA_YUYV, CV_YUV2BGRA_YUYV, CV_YUV2RGBA_YUNV, CV_YUV2BGRA_YUNV,
CV_YUV2GRAY_UYVY, CV_YUV2GRAY_YUY2, CV_YUV2GRAY_Y422, CV_YUV2GRAY_UYNV, CV_YUV2GRAY_YVYU, CV_YUV2GRAY_YUYV, CV_YUV2GRAY_YUNV,
// alpha premultiplication;
CV_RGBA2mRGBA, CV_mRGBA2RGBA, CV_COLORCVT_MAX);
private
@ -333,8 +327,7 @@ type
property VideoSource: IocvDataSource Read FocvVideoSource write SetVideoSource_Source2;
property OnGetSourceImage: TOnGetImage read FOnGetImage write FOnGetImage;
property OnGetMaskImage: TOnGetImage read FOnGetMaskImage write FOnGetMaskImage;
property TransformInterpolation: TocvInterpolationMethod read FTransformInterpolation write FTransformInterpolation
default INTER_CUBIC;
property TransformInterpolation: TocvInterpolationMethod read FTransformInterpolation write FTransformInterpolation default INTER_CUBIC;
public
constructor Create(AOwner: TPersistent); override;
protected
@ -425,8 +418,7 @@ type
property SmoothType: TocvSmoothOperations read FSmoothOperation write SetSmoothOperation default GAUSSIAN;
end;
TocvThresholdType = (THRESH_BINARY, THRESH_BINARY_INV, THRESH_TRUNC, THRESH_TOZERO, THRESH_TOZERO_INV, THRESH_MASK,
THRESH_OTSU);
TocvThresholdType = (THRESH_BINARY, THRESH_BINARY_INV, THRESH_TRUNC, THRESH_TOZERO, THRESH_TOZERO_INV, THRESH_MASK, THRESH_OTSU);
TocvCustomThresholdOperation = class(TocvCustomImageOperation)
private
@ -458,8 +450,8 @@ type
constructor Create(AOwner: TPersistent); override;
function DoTransform(const Source: IocvImage; out Destanation: IocvImage): Boolean; override;
published
property AdaptiveThresholdType: TocvAdaptiveThresholdType read GetAdaptiveThresholdType
write SetAdaptiveThresholdType default ADAPTIVE_THRESH_MEAN_C; // index 1
property AdaptiveThresholdType: TocvAdaptiveThresholdType read GetAdaptiveThresholdType write SetAdaptiveThresholdType
default ADAPTIVE_THRESH_MEAN_C; // index 1
property BlockSize: Integer index 2 Read GetIntParam write SetIntParam; // 3
property Param: Double index 1 Read GetFloatParam write SetFloatParam; // 5;
end;
@ -584,8 +576,7 @@ type
property RotateAroundCenter: Boolean index 0 Read GetBoolParam write SetBoolParam;
property CustomCenter: TocvPoint2D32f Read FCenter write FCenter;
property Method: TocvInterpolationMethod read FMethod write FMethod default INTER_LINEAR;
property WarpingFlag: TocvInterpolationWarpingFlagSet read FWarpingFlag write FWarpingFlag
default [WARP_FILL_OUTLIERS];
property WarpingFlag: TocvInterpolationWarpingFlagSet read FWarpingFlag write FWarpingFlag default [WARP_FILL_OUTLIERS];
property Scale: Double index 0 Read GetFloatParam write SetFloatParam;
property FillColor: TColor read FFillColor write FFillColor default clBlack;
end;
@ -633,8 +624,7 @@ type
property SourceQuad: TocvQuad read FSourceQuad write FSourceQuad;
property DestQuad: TocvQuad read FDestQuad write FDestQuad;
property Method: TocvInterpolationMethod read FMethod write FMethod default INTER_LINEAR;
property WarpingFlag: TocvInterpolationWarpingFlagSet read FWarpingFlag write FWarpingFlag
default [WARP_FILL_OUTLIERS];
property WarpingFlag: TocvInterpolationWarpingFlagSet read FWarpingFlag write FWarpingFlag default [WARP_FILL_OUTLIERS];
property FullSourceImage: Boolean index 0 Read GetBoolParam write SetBoolParam;
property FillColor: TColor Read FFillColor write FFillColor;
end;
@ -707,8 +697,8 @@ type
TocvMotionDetectCalcRectType = (mdBoundingRect, mdMinAreaRect);
TocvContourApproximationMethods = (CHAIN_CODE, CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE, CHAIN_APPROX_TC89_L1,
CHAIN_APPROX_TC89_KCOS, LINK_RUNS);
TocvContourApproximationMethods = (CHAIN_CODE, CHAIN_APPROX_NONE, CHAIN_APPROX_SIMPLE, CHAIN_APPROX_TC89_L1, CHAIN_APPROX_TC89_KCOS,
LINK_RUNS);
TocvDrawMotionRect = TocvDrawColor;
@ -1018,8 +1008,7 @@ type
property Operation: TocvCustomImageOperation read GetProperties write SetProperties;
property Operations: TocvImageOperationCollection Read FOperations write FOperations;
property OperationsEnabled: Boolean read FUseCollection write SetUseCollection default True;
property OnBeforeEachOperation: TOnOcvNotifyCollectionItem read FOnBeforeEachOperation
write SetOnBeforeEachOperation;
property OnBeforeEachOperation: TOnOcvNotifyCollectionItem read FOnBeforeEachOperation write SetOnBeforeEachOperation;
property OnAfterEachOperation: TOnOcvNotifyCollectionItem read FOnAfterEachOperation write SetOnAfterEachOperation;
property Enabled: Boolean read FEnabled Write FEnabled default True;
end;
@ -1413,8 +1402,7 @@ end;
{ TocvImageOperationSmooth }
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 TocvSmoothOperation.AssignTo(Dest: TPersistent);
begin
@ -1523,8 +1511,7 @@ begin
end;
const
EDMorpgOp: array [TocvErodeDilateMode] of Integer = (CV_SHAPE_RECT, CV_SHAPE_CROSS, CV_SHAPE_ELLIPSE,
CV_SHAPE_CUSTOM);
EDMorpgOp: array [TocvErodeDilateMode] of Integer = (CV_SHAPE_RECT, CV_SHAPE_CROSS, CV_SHAPE_ELLIPSE, CV_SHAPE_CUSTOM);
{ TocvErode }
@ -1565,8 +1552,7 @@ Var
TempImg: pIplImage;
begin
TempImg := cvCreateImage(cvGetSize(Source.IpImage), IPL_DEPTH_16S, Source.IpImage^.nChannels);
Destanation := TocvImage.Create(cvCreateImage(cvGetSize(Source.IpImage), Source.IpImage^.Depth,
Source.IpImage^.nChannels));
Destanation := TocvImage.Create(cvCreateImage(cvGetSize(Source.IpImage), Source.IpImage^.Depth, Source.IpImage^.nChannels));
cvLaplace(Source.IpImage, TempImg, Aperture);
cvConvertScale(TempImg, Destanation.IpImage);
cvReleaseImage(TempImg);
@ -1588,8 +1574,7 @@ Var
TmpImg: pIplImage;
begin
TmpImg := cvCreateImage(cvGetSize(Source.IpImage), IPL_DEPTH_16S, Source.IpImage^.nChannels);
Destanation := TocvImage.Create(cvCreateImage(cvGetSize(Source.IpImage), Source.IpImage^.Depth,
Source.IpImage^.nChannels));
Destanation := TocvImage.Create(cvCreateImage(cvGetSize(Source.IpImage), Source.IpImage^.Depth, Source.IpImage^.nChannels));
cvSobel(Source.IpImage, TmpImg, XOrder, YOrder, Aperture);
cvConvertScale(TmpImg, Destanation.IpImage);
cvReleaseImage(TmpImg);
@ -1742,8 +1727,8 @@ end;
{ TocvThresholdOperation }
Const
cThreshold: array [TocvThresholdType] of Integer = (CV_THRESH_BINARY, CV_THRESH_BINARY_INV, CV_THRESH_TRUNC,
CV_THRESH_TOZERO, CV_THRESH_TOZERO_INV, CV_THRESH_MASK, CV_THRESH_OTSU);
cThreshold: array [TocvThresholdType] of Integer = (CV_THRESH_BINARY, CV_THRESH_BINARY_INV, CV_THRESH_TRUNC, CV_THRESH_TOZERO,
CV_THRESH_TOZERO_INV, CV_THRESH_MASK, CV_THRESH_OTSU);
constructor TocvThresholdOperation.Create { (AOwner: TComponent) };
begin
@ -1778,8 +1763,7 @@ end;
{ TocvAdaptiveThresholdOperation }
const
cAdaptiveThresholdType: array [TocvAdaptiveThresholdType] of Integer = (CV_ADAPTIVE_THRESH_MEAN_C,
CV_ADAPTIVE_THRESH_GAUSSIAN_C);
cAdaptiveThresholdType: array [TocvAdaptiveThresholdType] of Integer = (CV_ADAPTIVE_THRESH_MEAN_C, CV_ADAPTIVE_THRESH_GAUSSIAN_C);
constructor TocvAdaptiveThresholdOperation.Create { (AOwner: TComponent) };
begin
@ -1802,8 +1786,8 @@ end;
function TocvAdaptiveThresholdOperation.DoTransform(const Source: IocvImage; out Destanation: IocvImage): Boolean;
begin
Destanation := TocvImage.Create(cvCreateImage(cvGetSize(Source.IpImage), IPL_DEPTH_8U, 1));
cvAdaptiveThreshold(Source.GrayImage.IpImage, Destanation.IpImage, MaxValue,
cAdaptiveThresholdType[AdaptiveThresholdType], cThreshold[ThresholdType], BlockSize, Param);
cvAdaptiveThreshold(Source.GrayImage.IpImage, Destanation.IpImage, MaxValue, cAdaptiveThresholdType[AdaptiveThresholdType],
cThreshold[ThresholdType], BlockSize, Param);
Result := True;
end;
@ -1856,8 +1840,7 @@ begin
contoursCont := cvFindContours(th_image.IpImage, storage, @Contours, SizeOf(TCvContour), Integer(RetrievalMode),
Integer(ApproximationMethod), cvPoint(Offset.X, Offset.Y));
if ApproxPoly.Enabled then
FContours := cvApproxPoly(Contours, SizeOf(TCvContour), storage, CV_POLY_APPROX_DP, ApproxPoly.Eps,
Integer(ApproxPoly.Recursive));
FContours := cvApproxPoly(Contours, SizeOf(TCvContour), storage, CV_POLY_APPROX_DP, ApproxPoly.Eps, Integer(ApproxPoly.Recursive));
DoNotifyContours(Destanation, contoursCont, Contours);
if (contoursCont > 0) and ContourDraw.Enabled then
begin
@ -1870,16 +1853,14 @@ begin
begin
area := cvContourArea(s_contours, CV_WHOLE_SEQ);
if abs(area) > MinArea then
cvDrawContours(Destanation.IpImage, s_contours, CV_RGB(er, eg, eb), CV_RGB(hr, hg, hb),
ContourDraw.MaxLevel, ContourDraw.Thickness, cLineType[ContourDraw.LineType],
cvPoint(ContourDraw.Offset.X, ContourDraw.Offset.Y));
cvDrawContours(Destanation.IpImage, s_contours, CV_RGB(er, eg, eb), CV_RGB(hr, hg, hb), ContourDraw.MaxLevel,
ContourDraw.Thickness, cLineType[ContourDraw.LineType], cvPoint(ContourDraw.Offset.X, ContourDraw.Offset.Y));
s_contours := s_contours.h_next;
end;
end
else
cvDrawContours(Destanation.IpImage, FContours, CV_RGB(er, eg, eb), CV_RGB(hr, hg, hb), ContourDraw.MaxLevel,
ContourDraw.Thickness, cLineType[ContourDraw.LineType],
cvPoint(ContourDraw.Offset.X, ContourDraw.Offset.Y));
ContourDraw.Thickness, cLineType[ContourDraw.LineType], cvPoint(ContourDraw.Offset.X, ContourDraw.Offset.Y));
end;
Result := True;
end;
@ -1888,8 +1869,7 @@ begin
end;
end;
procedure TocvContoursOperation.DoNotifyContours(const Image: IocvImage; const ContourCount: Integer;
const Contours: pCvSeq);
procedure TocvContoursOperation.DoNotifyContours(const Image: IocvImage; const ContourCount: Integer; const Contours: pCvSeq);
begin
if Assigned(OnContour) then
OnContour(Self, Image, ContourCount, Contours);
@ -2089,11 +2069,11 @@ end;
function TocvHaarCascade.DoTransform(const Source: IocvImage; out Destanation: IocvImage): Boolean;
Var
storage: pCvMemStorage;
gray: IocvImage;
detected_objects: pCvSeq;
// storage: pCvMemStorage;
// gray: IocvImage;
// detected_objects: pCvSeq;
i: Integer;
cvr: pCvRect;
// cvr: pCvRect;
begin
Destanation := Source;
Result := ocvHaarCascadeTransform(
@ -2197,11 +2177,11 @@ procedure TocvHaarCascade.SetHaarCascade(const Value: TocvHaarCascadeType);
Result := Trim(Result);
end;
Var
FullFileName: String;
RS: TResourceStream;
DC: TZDecompressionStream;
FS: TFileStream;
// Var
// FullFileName: String;
// RS: TResourceStream;
// DC: TZDecompressionStream;
// FS: TFileStream;
begin
FLockFrontalFaceChange.Enter;
try
@ -2289,8 +2269,8 @@ begin
Destanation := Source;
if Assigned(IPLTemplate) then
begin
imgMat := cvCreateImage(cvSize(Source.IpImage^.Width - IPLTemplate^.Width + 1,
Source.IpImage^.height - IPLTemplate^.height + 1), IPL_DEPTH_32F, 1);
imgMat := cvCreateImage(cvSize(Source.IpImage^.Width - IPLTemplate^.Width + 1, Source.IpImage^.height - IPLTemplate^.height + 1),
IPL_DEPTH_32F, 1);
cvMatchTemplate(Source.IpImage, IPLTemplate, imgMat, Integer(FMethod));
if Assigned(OnMathTemplateRect) or DrawRect.Enabled then
@ -2402,8 +2382,7 @@ begin
storage := cvCreateMemStorage(0);
FContours := AllocMem(SizeOf(TCvSeq));
try
cvFindContours(ThresholdImage.IpImage, storage, @FContours, SizeOf(TCvContour), CV_RETR_LIST,
CV_CHAIN_APPROX_SIMPLE, cvPoint(0, 0));
cvFindContours(ThresholdImage.IpImage, storage, @FContours, SizeOf(TCvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0, 0));
black := CV_RGB(0, 0, 0);
white := CV_RGB(255, 255, 255);
@ -2422,8 +2401,7 @@ begin
cvClearMemStorage(storage);
SetLength(Rects, 0);
cvFindContours(ThresholdImage.IpImage, storage, @FContours, SizeOf(TCvContour), CV_RETR_LIST,
CV_CHAIN_APPROX_NONE, cvPoint(0, 0));
cvFindContours(ThresholdImage.IpImage, storage, @FContours, SizeOf(TCvContour), CV_RETR_LIST, CV_CHAIN_APPROX_NONE, cvPoint(0, 0));
if Assigned(FContours) then
begin
@ -2440,17 +2418,15 @@ begin
else if CalcRectType = mdMinAreaRect then
begin
Rect2d := cvMinAreaRect2(c);
Rects[i] := ocvRect(Round(Rect2d.Center.X - Rect2d.Size.Width / 2),
Round(Rect2d.Center.Y - Rect2d.Size.height / 2), Round(Rect2d.Center.X + Rect2d.Size.Width / 2),
Round(Rect2d.Center.Y + Rect2d.Size.height / 2));
Rects[i] := ocvRect(Round(Rect2d.Center.X - Rect2d.Size.Width / 2), Round(Rect2d.Center.Y - Rect2d.Size.height / 2),
Round(Rect2d.Center.X + Rect2d.Size.Width / 2), Round(Rect2d.Center.Y + Rect2d.Size.height / 2));
end;
if DrawMotionRect.Enabled then
begin
GetRGBValue(DrawMotionRect.Color, r, g, b);
cvRectangle(Destanation.IpImage, cvPoint(Rects[i].Left, Rects[i].Top),
cvPoint(Rects[i].Right, Rects[i].Bottom), CV_RGB(r, g, b), DrawMotionRect.Thickness,
cLineType[DrawMotionRect.LineType], DrawMotionRect.Shift);
cvRectangle(Destanation.IpImage, cvPoint(Rects[i].Left, Rects[i].Top), cvPoint(Rects[i].Right, Rects[i].Bottom),
CV_RGB(r, g, b), DrawMotionRect.Thickness, cLineType[DrawMotionRect.LineType], DrawMotionRect.Shift);
end;
Inc(i);
c := c.h_next;
@ -2821,8 +2797,7 @@ begin
warp_matrix := cvCreateMat(3, 3, CV_32FC1);
dst := cvCloneImage(Source.IpImage);
cvGetPerspectiveTransform(@srcQuad, @dstQuad, warp_matrix);
cvWarpPerspective(Source.IpImage, dst, warp_matrix, CV_INTER_LINEAR or CV_WARP_FILL_OUTLIERS,
ColorToCvRGB(FillColor));
cvWarpPerspective(Source.IpImage, dst, warp_matrix, CV_INTER_LINEAR or CV_WARP_FILL_OUTLIERS, ColorToCvRGB(FillColor));
Destanation := TocvImage.Create(dst);
end
else
@ -3041,24 +3016,23 @@ Var
p: pFloatArray;
D: IocvImage;
begin
SetLength(Circles, 0);
Finalize(Circles);
Destanation := Source;
try
storage := cvCreateMemStorage(0);
results := nil;
// results := nil;
try
if Smooth.Enabled then
begin
D := Source.Same;
cvSmooth(Source.IpImage, D.IpImage, ocvSmoothOperations[Smooth.SmoothType], Smooth.size1, Smooth.size2,
Smooth.sigma1, Smooth.sigma2);
cvSmooth(Source.IpImage, D.IpImage, ocvSmoothOperations[Smooth.SmoothType], Smooth.size1, Smooth.size2, Smooth.sigma1,
Smooth.sigma2);
end
else
D := Source;
results := cvHoughCircles(D.GrayImage.IpImage, storage, Integer(Method), InverseRatio, MinDist, Param1, Param2,
MinRadius, MaxRadius);
results := cvHoughCircles(D.GrayImage.IpImage, storage, Integer(Method), InverseRatio, MinDist, Param1, Param2, MinRadius, MaxRadius);
if Assigned(results) then
begin
SetLength(Circles, results^.total);
@ -3073,13 +3047,15 @@ begin
DrawCircle.Thickness, DrawCircle.cvLineType, DrawCircle.Shift);
end;
end;
if Assigned(OnCircles) and ((Length(Circles) > 0) or (not NotifyOnlyWhenFound)) then
OnCircles(Self, Destanation, Circles);
Result := True;
finally
cvReleaseMemStorage(storage);
end;
except
Result := False;
end;
if Assigned(OnCircles) and ((Length(Circles) > 0) or (not NotifyOnlyWhenFound)) then
OnCircles(Self, Destanation, Circles);
end;
{ TocvHoughLines }
@ -3123,8 +3099,8 @@ Var
i: Integer;
ocvlines: TocvLines;
begin
lines := nil;
SetLength(ocvlines, 0);
// lines := nil;
Finalize(ocvlines);
Destanation := Source;
try
storage := cvCreateMemStorage(0);
@ -3142,18 +3118,19 @@ begin
ocvlines[i].S := line^[0];
ocvlines[i].E := line^[1];
if DrawLines.Enabled then
cvLine(Destanation.IpImage, line^[0], line^[1], DrawLines.cvColor, DrawLines.Thickness,
DrawLines.cvLineType, DrawLines.Shift);
cvLine(Destanation.IpImage, line^[0], line^[1], DrawLines.cvColor, DrawLines.Thickness, DrawLines.cvLineType, DrawLines.Shift);
end;
end;
if Assigned(OnLines) and ((Length(ocvlines) > 0) or (not NotifyOnlyWhenFound)) then
OnLines(Self, Destanation, ocvlines);
Result := True;
finally
cvReleaseMemStorage(storage);
end;
except
Result := False;
end;
end;
@ -3360,6 +3337,7 @@ Var
D: pIplImage;
begin
Destanation := Source;
Result := False;
if (DestWidth <> 0) and (DestHeight <> 0) then
try
D := cvCreateImage(cvSize(DestWidth, DestHeight), Source.IpImage^.Depth, Source.IpImage^.nChannels);
@ -3367,7 +3345,6 @@ begin
Destanation := TocvImage.Create(D);
Result := True;
except
Result := False;
end;
end;

View File

@ -25,16 +25,16 @@ implementation
Uses
{$IFDEF HAS_UNITSCOPE}
{$IFDEF MSWINDOWS}
{$IFDEF MSWINDOWS}
Winapi.Windows,
{$ENDIF MSWINDOWS}
{$ENDIF MSWINDOWS}
System.SysUtils,
System.Classes,
System.ZLib,
{$ELSE}
{$IFDEF MSWINDOWS}
{$IFDEF MSWINDOWS}
Windows,
{$ENDIF MSWINDOWS}
{$ENDIF MSWINDOWS}
SysUtils,
Classes,
ZLib,
@ -101,7 +101,7 @@ Var
detected_objects: pCvSeq;
i: Integer;
cvr: pCvRect;
r, g, b: byte;
// r, g, b: byte;
begin
SetLength(HaarRects, 0);
Result := False;

View File

@ -578,9 +578,9 @@ end;
function TocvImage.AsBitmap: TBitmap;
var
deep: Integer;
i, j, K, wStep, Channels: Integer;
data: PByteArray;
pb: PByteArray;
// i, j, K, wStep, Channels: Integer;
// data: PByteArray;
// pb: PByteArray;
begin
if (FImage <> NIL) then
begin
@ -931,7 +931,7 @@ end;
function TocvFont.GetFontName: string;
begin
Result := FCvFont.nameFont;
Result := String(FCvFont.nameFont);
end;
function TocvFont.GetFontThickness: Integer;
@ -984,8 +984,8 @@ end;
{ TocvRectHelper }
function TocvRectHelper.cvRect: TcvRect;
Var
R: TcvRect;
//Var
// R: TcvRect;
begin
Result.x := Left;
Result.y := Top;

View File

@ -127,13 +127,14 @@ Type
* @{
*)
const
// #define FF_LAMBDA_SHIFT 7
// #define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
// #define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
// #define FF_LAMBDA_MAX (256*128-1)
//
// #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
//
FF_LAMBDA_SHIFT = 7;
FF_LAMBDA_SCALE = 1 shl FF_LAMBDA_SHIFT;
FF_QP2LAMBDA = 118;
/// < factor to convert from H.263 QP to lambda
FF_LAMBDA_MAX = (256 * 128 - 1);
FF_QUALITY_SCALE = FF_LAMBDA_SCALE; // FIXME maybe remove
(*
// * @}
// * @defgroup lavu_time Timestamp specific

View File

@ -1,5 +1,6 @@
unit ffm.cls.videoencoder;
{$I OpenCV.inc}
{$POINTERMATH ON}
interface
@ -90,7 +91,9 @@ Type
implementation
Uses
{$IFDEF MSWINDOWS}
Winapi.Windows,
{$ENDIF MSWINDOWS}
System.SysUtils,
System.AnsiStrings,
System.Math,
@ -101,8 +104,8 @@ Uses
{ TNVRVideoEncoder }
function TFFMVideoEncoder.AddAudioSample(const pFormatContext: pAVFormatContext; const pStream: pAVStream;
const soundBuffer: pByte; const soundBufferSize: Integer): boolean;
function TFFMVideoEncoder.AddAudioSample(const pFormatContext: pAVFormatContext; const pStream: pAVStream; const soundBuffer: pByte;
const soundBufferSize: Integer): boolean;
Var
pCodecCxt: pAVCodecContext;
packSizeInSize: Integer; // DWORD;
@ -242,8 +245,8 @@ begin
// RGB to YUV420P.
if not Assigned(pImgConvertCtx) then
begin
pImgConvertCtx := sws_getContext(pVideoCodec^.width, pVideoCodec^.height, framepixfmt, pVideoCodec^.width,
pVideoCodec^.height, pVideoCodec^.pix_fmt, SWS_BICUBLIN, nil, nil, nil);
pImgConvertCtx := sws_getContext(pVideoCodec^.width, pVideoCodec^.height, framepixfmt, pVideoCodec^.width, pVideoCodec^.height,
pVideoCodec^.pix_fmt, SWS_BICUBLIN, nil, nil, nil);
end;
// Allocate picture.
@ -252,8 +255,7 @@ begin
// if NeedConvert(framepixfmt) and Assigned(pImgConvertCtx) then
// begin
// Convert RGB to YUV.
sws_scale(pImgConvertCtx, @frame^.data, @frame^.linesize, 0, pVideoCodec^.height, @pCurrentPicture^.data,
@pCurrentPicture^.linesize);
sws_scale(pImgConvertCtx, @frame^.data, @frame^.linesize, 0, pVideoCodec^.height, @pCurrentPicture^.data, @pCurrentPicture^.linesize);
// end;
Result := AddVideoFrame(pCurrentPicture, pVideoStream^.codec);
@ -563,8 +565,7 @@ begin
if Assigned(pFormatContext) then
begin
pFormatContext^.oformat := pOutFormat;
CopyMemory(@pFormatContext^.filename, filename, min(System.AnsiStrings.strlen(filename),
sizeof(pFormatContext^.filename)));
CopyMemory(@pFormatContext^.filename, filename, min(System.AnsiStrings.strlen(filename), sizeof(pFormatContext^.filename)));
// Add video and audio stream
pVideoStream := AddVideoStream(pFormatContext, pOutFormat^.video_codec);
@ -581,8 +582,7 @@ begin
if Assigned(pAudioStream) then
Result := OpenAudio(pFormatContext, pAudioStream);
if Result and ((pOutFormat^.flags and AVFMT_NOFILE) = 0) and
(avio_open(pFormatContext^.pb, filename, AVIO_FLAG_WRITE) < 0) then
if Result and ((pOutFormat^.flags and AVFMT_NOFILE) = 0) and (avio_open(pFormatContext^.pb, filename, AVIO_FLAG_WRITE) < 0) then
begin
Result := false;
// printf(" Cannot open file\ n ");

View File

@ -48,7 +48,7 @@ type
*)
pAVRational = ^TAVRational;
TAVRational = {packed} record
TAVRational = { packed } record
num: Integer;
/// < numerator
den: Integer;
@ -162,6 +162,14 @@ type
// * @}
// */
function AVRational(const num, den: Integer): TAVRational; inline;
implementation
function AVRational(const num, den: Integer): TAVRational;
begin
Result.num := num;
Result.den := den;
end;
end.

View File

@ -62,7 +62,7 @@ unit ocv.core;
interface
uses
ocv.mat, ocv.core.types_c, Winapi.Windows;
ocv.mat, ocv.core.types_c;
Type
@ -166,7 +166,7 @@ Type
// returns (v0, -v1, -v2, -v3)
function conj: TccvScalar_<Tp>; virtual; stdcall; abstract;
// returns true iff v1 == v2 == v3 == 0
function isReal: bool; virtual; stdcall; abstract;
function isReal: LongBool; virtual; stdcall; abstract;
//
function GetVec(const Index: integer): Tp; virtual; stdcall; abstract;
procedure SetVec(const Index: integer; const Value: Tp); virtual; stdcall; abstract;
@ -207,7 +207,7 @@ procedure line(img: TccvMat; pt1, pt2: TccvPoint; color: TccvScalar; thickness:
// int thickness=1, int lineType=8,
// bool bottomLeftOrigin=false );
procedure putText(img: TccvMat; text: String; org: TccvPoint; fontFace: integer; fontScale: double; color: TccvScalar;
thickness: integer = 1; lineType: integer = 8; bottomLeftOrigin: bool = false); stdcall;
thickness: integer = 1; lineType: integer = 8; bottomLeftOrigin: LongBool = false); stdcall;
/// ////////////////////////////////////////////////////////////////////////
// function CreateVec3d(): TccvVec3d; stdcall; overload;

View File

@ -89,6 +89,8 @@ type
Float = Single;
pFloat = ^Float;
ppFloat = ^pFloat;
pPointer = ^Pointer;
ppvoid = pPointer;
TSingleArray1D = array [0 .. 1] of Single;
pSingleArray1D = ^TSingleArray1D;
@ -279,7 +281,7 @@ function cvRNG(seed: int64 = -1): TCvRNG; {$IFDEF USE_INLINE}inline; {$ENDIF}
* Copyright (c) 1995 Intel Corporation.
*)
const
IPL_DEPTH_SIGN = $80000000;
IPL_DEPTH_SIGN = Integer($80000000);
{$EXTERNALSYM IPL_DEPTH_SIGN}
IPL_DEPTH_1U = 1;
{$EXTERNALSYM IPL_DEPTH_1U}
@ -293,7 +295,7 @@ const
floating point data in IplImage's }
IPL_DEPTH_64F = 64;
{$EXTERNALSYM IPL_DEPTH_64F}
IPL_DEPTH_8S: TCvRNG = (IPL_DEPTH_SIGN or 8);
IPL_DEPTH_8S: TCvRNG = TCvRNG(IPL_DEPTH_SIGN or 8);
{$EXTERNALSYM IPL_DEPTH_8S}
IPL_DEPTH_16S = (IPL_DEPTH_SIGN or 16);
{$EXTERNALSYM IPL_DEPTH_16S}

View File

@ -1,50 +1,51 @@
// **************************************************************************************************
// Project Delphi-OpenCV
// **************************************************************************************************
// Contributors:
// Laentir Valetov
// email:laex@bk.ru
// Mikhail Grigorev
// Email: sleuthhound@gmail.com
// **************************************************************************************************
// 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
// **************************************************************************************************
// Warning: Using Delphi XE3 syntax!
// **************************************************************************************************
// 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 file:
// opencv\modules\core\include\opencv2\core\core_c.h
// *************************************************************************************************
(*
**************************************************************************************************
Project Delphi-OpenCV
**************************************************************************************************
Contributors:
Laentir Valetov
email:laex@bk.ru
Mikhail Grigorev
Email: sleuthhound@gmail.com
**************************************************************************************************
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
**************************************************************************************************
Warning: Using Delphi XE3 syntax!
**************************************************************************************************
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 file:
opencv\modules\core\include\opencv2\core\core_c.h
*************************************************************************************************
*)
//
{$I OpenCV.inc}
//
{$IFDEF DEBUG}
@ -63,7 +64,9 @@ unit ocv.core_c;
interface
uses
{$IFDEF MSWINDOWS}
WinApi.Windows,
{$ENDIF ~MSWINDOWS}
ocv.core.types_c;
{ ****************************************************************************************
@ -100,8 +103,8 @@ function cvCreateImageHeader(size: TCvSize; depth: Integer; channels: Integer):
int align CV_DEFAULT(4));
}
{$EXTERNALSYM cvInitImageHeader}
function cvInitImageHeader(image: pIplImage; size: TCvSize; depth: Integer; channels: Integer; origin: Integer = 0;
align: Integer = 4): pIplImage; cdecl;
function cvInitImageHeader(image: pIplImage; size: TCvSize; depth: Integer; channels: Integer; origin: Integer = 0; align: Integer = 4)
: pIplImage; cdecl;
{ Creates IPL image (header and data
CVAPI(IplImage*) cvCreateImage( CvSize size, int depth, int channels );
@ -173,8 +176,8 @@ const
int step CV_DEFAULT(CV_AUTOSTEP) );
}
{$EXTERNALSYM cvInitMatHeader}
function cvInitMatHeader(mat: pCvMat; rows: Integer; cols: Integer; _type: Integer; data: Pointer = nil;
step: Integer = CV_AUTOSTEP): pCvMat; cdecl;
function cvInitMatHeader(mat: pCvMat; rows: Integer; cols: Integer; _type: Integer; data: Pointer = nil; step: Integer = CV_AUTOSTEP)
: pCvMat; cdecl;
{ Allocates and initializes CvMat header and allocates data
CVAPI(CvMat*) cvCreateMat( int rows, int cols, int type );
@ -251,8 +254,7 @@ function cvGetSubRect(arr: pCvArr; submat: pCvArr; rect: TCvRect): pCvMat; cdecl
int delta_row CV_DEFAULT(1));
}
{$EXTERNALSYM cvGetRows}
function cvGetRows(const arr: pCvArr; submat: pCvMat; start_row, end_row: Integer; delta_row: Integer = 1)
: pCvMat; cdecl;
function cvGetRows(const arr: pCvArr; submat: pCvMat; start_row, end_row: Integer; delta_row: Integer = 1): pCvMat; cdecl;
(*
CV_INLINE CvMat* cvGetRow( const pCvArr* arr, CvMat* submat, int row )
@ -312,8 +314,7 @@ function cvCreateMatND(dims: Integer; const sizes: pInteger; cType: Integer): pC
int type, void* data CV_DEFAULT(NULL) );
}
{$EXTERNALSYM cvInitMatNDHeader}
function cvInitMatNDHeader(mat: pCvMatND; dims: Integer; const sizes: pInteger; cType: Integer; data: pCvArr = nil)
: pCvMatND; cdecl;
function cvInitMatNDHeader(mat: pCvMatND; dims: Integer; const sizes: pInteger; cType: Integer; data: pCvArr = nil): pCvMatND; cdecl;
(*
Releases CvMatND
@ -378,8 +379,8 @@ const
int flags CV_DEFAULT(0) );
}
{$EXTERNALSYM cvInitNArrayIterator}
function cvInitNArrayIterator(count: Integer; arrs: pCvArr; const mask: pCvArr; stubs: pCvMatND;
array_iterator: pCvNArrayIterator; flags: Integer = 0): Integer; cdecl;
function cvInitNArrayIterator(count: Integer; arrs: pCvArr; const mask: pCvArr; stubs: pCvMatND; array_iterator: pCvNArrayIterator;
flags: Integer = 0): Integer; cdecl;
{ returns zero value if iteration is finished, non-zero (slice length) otherwise */
CVAPI(int) cvNextNArraySlice( CvNArrayIterator* array_iterator );
@ -432,8 +433,8 @@ function cvPtr3D(const arr: pCvArr; idx0, idx1, idx2: Integer; cType: pInteger =
unsigned* precalc_hashval CV_DEFAULT(NULL));
}
{$EXTERNALSYM cvPtrND}
function cvPtrND(const arr: pCvArr; idx: pInteger; cType: pInteger = nil; create_node: Integer = 1;
precalc_hashval: punsigned = nil): pCvArr; cdecl;
function cvPtrND(const arr: pCvArr; idx: pInteger; cType: pInteger = nil; create_node: Integer = 1; precalc_hashval: punsigned = nil)
: pCvArr; cdecl;
{ value = arr(idx0,idx1,...)
CVAPI(CvScalar) cvGet1D( const pCvArr* arr, int idx0 );
@ -539,11 +540,11 @@ function cvGetImage(const arr: pCvArr; image_header: pIplImage): pIplImage; cdec
(new_cn), (new_dims), (new_sizes))
}
{$EXTERNALSYM cvReshapeMatND}
function cvReshapeMatND(const arr: pCvArr; sizeof_header: Integer; header: pCvArr; new_cn, new_dims: Integer;
new_sizes: pInteger): pCvArr; cdecl;
function cvReshapeMatND(const arr: pCvArr; sizeof_header: Integer; header: pCvArr; new_cn, new_dims: Integer; new_sizes: pInteger)
: pCvArr; cdecl;
{$EXTERNALSYM cvReshapeND}
function cvReshapeND(const arr: pCvArr; sizeof_header: Integer; header: pCvArr; new_cn, new_dims: Integer;
new_sizes: pInteger): pCvArr; {$IFDEF USE_INLINE}inline; {$ENDIF}
function cvReshapeND(const arr: pCvArr; sizeof_header: Integer; header: pCvArr; new_cn, new_dims: Integer; new_sizes: pInteger): pCvArr;
{$IFDEF USE_INLINE}inline; {$ENDIF}
{ CVAPI(CvMat*) cvReshape( const pCvArr* arr, CvMat* header,
int new_cn, int new_rows CV_DEFAULT(0) );
}
@ -581,7 +582,7 @@ procedure cvSetData(arr: pCvArr; data: Pointer; step: Integer); cdecl;
int* step CV_DEFAULT(NULL),
CvSize* roi_size CV_DEFAULT(NULL));
}
procedure cvGetRawData(arr: pCvArr; data: puchar; step: pInteger = nil; roi_size: pCvSize = nil); cdecl;
procedure cvGetRawData(arr: pCvArr; data: pByte; step: pInteger = nil; roi_size: pCvSize = nil); cdecl;
{ Returns width and height of array in elements
CVAPI(CvSize) cvGetSize( const pCvArr* arr );
@ -623,8 +624,7 @@ procedure cvSplit(const src: pCvArr; dst0: pCvArr; dst1: pCvArr; dst2: pCvArr; d
const pCvArr* src2, const pCvArr* src3,
pCvArr* dst );
}
procedure cvMerge(const src0: pIplImage; const src1: pIplImage; const src2: pIplImage; const src3: pIplImage;
dst: pIplImage); cdecl;
procedure cvMerge(const src0: pIplImage; const src1: pIplImage; const src2: pIplImage; const src3: pIplImage; dst: pIplImage); cdecl;
{ Copies several channels from input arrays to
certain channels of output arrays */
@ -632,8 +632,8 @@ procedure cvMerge(const src0: pIplImage; const src1: pIplImage; const src2: pIpl
pCvArr** dst, int dst_count,
const int* from_to, int pair_count );
}
procedure cvMixChannels(src: Array of pCvArr; src_count: Integer; dst: Array of pCvArr; dst_count: Integer;
const from_to: pInteger; pair_count: Integer); cdecl;
procedure cvMixChannels(src: Array of pCvArr; src_count: Integer; dst: Array of pCvArr; dst_count: Integer; const from_to: pInteger;
pair_count: Integer); cdecl;
{ Performs linear transformation on every source array element:
dst(x,y,c) = scale*src(x,y,c)+shift.
@ -670,8 +670,7 @@ procedure cvConvertScaleAbs(const src: pCvArr; dst: pCvArr; scale: double = 1; s
double default_eps,
int default_max_iters );
}
function cvCheckTermCriteria(criteria: TCvTermCriteria; default_eps: double; default_max_iters: Integer)
: TCvTermCriteria; cdecl;
function cvCheckTermCriteria(criteria: TCvTermCriteria; default_eps: double; default_max_iters: Integer): TCvTermCriteria; cdecl;
{ ***************************************************************************************
* Arithmetic, logic and comparison operations *
@ -740,8 +739,7 @@ procedure cvAXPY(A: pIplImage; real_scalar: double; B, C: pIplImage); {$IFDEF US
const pCvArr* src2, double beta,
double gamma, pCvArr* dst );
}
procedure cvAddWeighted(const src1: pIplImage; alpha: double; const src2: pIplImage; beta: double; gamma: double;
dst: pIplImage); cdecl;
procedure cvAddWeighted(const src1: pIplImage; alpha: double; const src2: pIplImage; beta: double; gamma: double; dst: pIplImage); cdecl;
{ result = sum_i(src1(i) * src2(i)) (results for all channels are accumulated together)
CVAPI(double) cvDotProduct( const pCvArr* src1, const pCvArr* src2 );
@ -760,8 +758,7 @@ procedure cvAbsDiff(const src1: pCvArr; const src2: pCvArr; dst: pCvArr); cdecl;
function cvGet(const mat: pCvMat; i, j: Integer): Single; {$IFDEF USE_INLINE}inline; {$ENDIF}
procedure cvCopyImage(const src: pIplImage; dst: pIplImage; const mask: pIplImage = nil); cdecl;
procedure cvCvtPixToPlane(const src: pIplImage; dst0: pIplImage; dst1: pIplImage; dst2: pIplImage;
dst3: pIplImage); cdecl;
procedure cvCvtPixToPlane(const src: pIplImage; dst0: pIplImage; dst1: pIplImage; dst2: pIplImage; dst3: pIplImage); cdecl;
procedure cvCvtPlaneToPix(const src0: pIplImage; const src1: pIplImage; const src2: pIplImage; const src3: pIplImage;
dst: pIplImage); cdecl;
@ -837,8 +834,7 @@ procedure cvSolvePoly(const coeffs: pCvMat; roots2: pCvMat; maxiter: Integer = 2
// CVAPI(void) cvCartToPolar( const CvArr* x, const CvArr* y,
// CvArr* magnitude, CvArr* angle CV_DEFAULT(NULL),
// int angle_in_degrees CV_DEFAULT(0));
procedure cvCartToPolar(const x: pCvArr; const y: pCvArr; magnitude: pCvArr; angle: pCvArr = nil;
angle_in_degrees: Integer = 0); cdecl;
procedure cvCartToPolar(const x: pCvArr; const y: pCvArr; magnitude: pCvArr; angle: pCvArr = nil; angle_in_degrees: Integer = 0); cdecl;
// * Does polar->cartesian coordinates conversion.
// Either of output components (magnitude or angle) is optional.
@ -846,8 +842,7 @@ procedure cvCartToPolar(const x: pCvArr; const y: pCvArr; magnitude: pCvArr; ang
// CVAPI(void) cvPolarToCart( const CvArr* magnitude, const CvArr* angle,
// CvArr* x, CvArr* y,
// int angle_in_degrees CV_DEFAULT(0));
procedure cvPolarToCart(const magnitude: pCvArr; const angle: pCvArr; x: pCvArr; y: pCvArr;
angle_in_degrees: Integer = 0); cdecl;
procedure cvPolarToCart(const magnitude: pCvArr; const angle: pCvArr; x: pCvArr; y: pCvArr; angle_in_degrees: Integer = 0); cdecl;
// * Does powering: dst(idx) = src(idx)^power */
// CVAPI(void) cvPow( const CvArr* src, CvArr* dst, double power );
@ -913,8 +908,7 @@ const
// CVAPI(double) cvNorm( const pCvArr* arr1, const pCvArr* arr2 CV_DEFAULT(NULL),
// int norm_type CV_DEFAULT(CV_L2),
// const pCvArr* mask CV_DEFAULT(NULL) );
function cvNorm(const arr1: pCvArr; const arr2: pCvArr = nil; norm_type: Integer = CV_L2; const mask: pCvArr = nil)
: double; cdecl;
function cvNorm(const arr1: pCvArr; const arr2: pCvArr = nil; norm_type: Integer = CV_L2; const mask: pCvArr = nil): double; cdecl;
(*
@ -1001,8 +995,7 @@ function cvTrace(const mat: pCvArr): TCvScalar; cdecl;
int lowindex CV_DEFAULT(-1),
int highindex CV_DEFAULT(-1));
*)
procedure cvEigenVV(mat: pCvArr; evects: pCvArr; evals: pCvArr; eps: double = 0; lowindex: Integer = -1;
highindex: Integer = -1); cdecl;
procedure cvEigenVV(mat: pCvArr; evects: pCvArr; evals: pCvArr; eps: double = 0; lowindex: Integer = -1; highindex: Integer = -1); cdecl;
/// * Finds selected eigen values and vectors of a symmetric matrix */
// CVAPI(void) cvSelectedEigenVV( CvArr* mat, CvArr* evects, CvArr* evals,
// int lowindex, int highindex );
@ -1053,8 +1046,7 @@ Const
CVAPI(void) cvCalcCovarMatrix( const CvArr** vects, int count,
CvArr* cov_mat, CvArr* avg, int flags );
*)
procedure cvCalcCovarMatrix(const vects: pCvArrArray; count: Integer; cov_mat: pCvArr; avg: pCvArr;
flags: Integer); cdecl;
procedure cvCalcCovarMatrix(const vects: pCvArrArray; count: Integer; cov_mat: pCvArr; avg: pCvArr; flags: Integer); cdecl;
// #define CV_PCA_DATA_AS_ROW 0
// #define CV_PCA_DATA_AS_COL 1
// #define CV_PCA_USE_AVG 2
@ -1104,8 +1096,8 @@ function cvCountNonZero(arr: pIplImage): Integer; cdecl;
{ Finds global minimum, maximum and their positions
CVAPI(void) cvMinMaxLoc(const pCvArr* arr, double* min_val, double* max_val, CvPoint* min_loc CV_DEFAULT(NULL), CvPoint* max_loc CV_DEFAULT(NULL), const pCvArr* mask CV_DEFAULT(NULL) );
}
procedure cvMinMaxLoc(const arr: pIplImage; min_val: pDouble; max_val: pDouble; min_loc: pCVPoint = nil;
max_loc: pCVPoint = nil; const mask: pIplImage = nil); cdecl;
procedure cvMinMaxLoc(const arr: pIplImage; min_val: pDouble; max_val: pDouble; min_loc: pCVPoint = nil; max_loc: pCVPoint = nil;
const mask: pIplImage = nil); cdecl;
// ****************************************************************************************
// * Discrete Linear Transforms and Related Functions
@ -1197,8 +1189,7 @@ function cvMemStorageAllocString(storage: pCvMemStorage; const ptr: pCvChar; len
CVAPI(CvSeq*) cvCreateSeq( int seq_flags, size_t header_size,
size_t elem_size, CvMemStorage* storage );
}
function cvCreateSeq(seq_flags: Integer; header_size: NativeUInt; elem_size: NativeUInt; storage: pCvMemStorage)
: pCvSeq; cdecl;
function cvCreateSeq(seq_flags: Integer; header_size: NativeUInt; elem_size: NativeUInt; storage: pCvMemStorage): pCvSeq; cdecl;
// Removes specified sequence element
// CVAPI(void) cvSeqRemove( CvSeq* seq, int index );
@ -1280,8 +1271,8 @@ procedure cvCvtSeqToArray(const seq: pCvSeq; elements: pCvArr; slice: TCvSlice {
int elem_size, void* elements, int total,
CvSeq* seq, CvSeqBlock* block );
*)
function cvMakeSeqHeaderForArray(seq_type: Integer; header_size: Integer; elem_size: Integer; elements: Pointer;
total: Integer; seq: pCvSeq; block: pCvSeqBlock): pCvSeq; cdecl;
function cvMakeSeqHeaderForArray(seq_type: Integer; header_size: Integer; elem_size: Integer; elements: Pointer; total: Integer;
seq: pCvSeq; block: pCvSeqBlock): pCvSeq; cdecl;
(*
Extracts sequence slice (with or without copying sequence elements)
@ -1290,8 +1281,7 @@ function cvMakeSeqHeaderForArray(seq_type: Integer; header_size: Integer; elem_s
CvMemStorage* storage CV_DEFAULT(NULL),
int copy_data CV_DEFAULT(0));
*)
function cvSeqSlice(const seq: pCvSeq; slice: TCvSlice; storage: pCvMemStorage = nil; copy_data: Integer = 0)
: pCvSeq; cdecl;
function cvSeqSlice(const seq: pCvSeq; slice: TCvSlice; storage: pCvMemStorage = nil; copy_data: Integer = 0): pCvSeq; cdecl;
// ************ Internal sequence functions ************/
@ -1306,8 +1296,7 @@ procedure cvCreateSeqBlock(writer: pCvSeqWriter); cdecl;
CVAPI(CvSet* ) cvCreateSet( int set_flags, int header_size,
int elem_size, CvMemStorage* storage );
*)
function cvCreateSet(set_flags: Integer; header_size: Integer; elem_size: Integer; storage: pCvMemStorage)
: pCvSet; cdecl;
function cvCreateSet(set_flags: Integer; header_size: Integer; elem_size: Integer; storage: pCvMemStorage): pCvSet; cdecl;
(*
Creates new graph
@ -1316,8 +1305,8 @@ function cvCreateSet(set_flags: Integer; header_size: Integer; elem_size: Intege
int vtx_size, int edge_size,
CvMemStorage* storage );
*)
function cvCreateGraph(graph_flags: Integer; header_size: Integer; vtx_size: Integer; edge_size: Integer;
storage: pCvMemStorage): pCvGraph; cdecl;
function cvCreateGraph(graph_flags: Integer; header_size: Integer; vtx_size: Integer; edge_size: Integer; storage: pCvMemStorage)
: pCvGraph; cdecl;
(*
Adds new vertex to the graph
@ -1325,8 +1314,7 @@ function cvCreateGraph(graph_flags: Integer; header_size: Integer; vtx_size: Int
CVAPI(int) cvGraphAddVtx( CvGraph* graph, const CvGraphVtx* vtx CV_DEFAULT(NULL),
CvGraphVtx** inserted_vtx CV_DEFAULT(NULL) );
*)
function cvGraphAddVtx(graph: pCvGraph; const vtx: pCvGraphVtx = nil; inserted_vtx: pCvGraphVtxArray = nil)
: Integer; cdecl;
function cvGraphAddVtx(graph: pCvGraph; const vtx: pCvGraphVtx = nil; inserted_vtx: pCvGraphVtxArray = nil): Integer; cdecl;
(*
Removes vertex from the graph together with all incident edges
@ -1359,8 +1347,8 @@ function cvGraphAddEdge(graph: pCvGraph; start_idx: Integer; end_idx: Integer; c
const CvGraphEdge* edge CV_DEFAULT(NULL),
CvGraphEdge** inserted_edge CV_DEFAULT(NULL) );
*)
function cvGraphAddEdgeByPtr(graph: pCvGraph; start_vtx: pCvGraphVtx; end_vtx: pCvGraphVtx;
const edge: pCvGraphEdge = nil; inserted_edge: pCvGraphEdgeArray = nil): Integer; cdecl;
function cvGraphAddEdgeByPtr(graph: pCvGraph; start_vtx: pCvGraphVtx; end_vtx: pCvGraphVtx; const edge: pCvGraphEdge = nil;
inserted_edge: pCvGraphEdgeArray = nil): Integer; cdecl;
(*
Remove edge connecting two vertices
@ -1383,8 +1371,7 @@ function cvFindGraphEdge(const graph: pCvGraph; start_idx: Integer; end_idx: Int
const CvGraphVtx* start_vtx,
const CvGraphVtx* end_vtx );
*)
function cvFindGraphEdgeByPtr(const graph: pCvGraph; const start_vtx: pCvGraphVtx; const end_vtx: pCvGraphVtx)
: pCvGraphEdge; cdecl;
function cvFindGraphEdgeByPtr(const graph: pCvGraph; const start_vtx: pCvGraphVtx; const end_vtx: pCvGraphVtx): pCvGraphEdge; cdecl;
// #define cvGraphFindEdge cvFindGraphEdge
// #define cvGraphFindEdgeByPtr cvFindGraphEdgeByPtr
(*
@ -1478,8 +1465,7 @@ Type
CVAPI(CvGraphScanner * ) cvCreateGraphScanner(CvGraph * graph, CvGraphVtx * vtx CV_DEFAULT(NULL), int mask CV_DEFAULT(CV_GRAPH_ALL_ITEMS));
*)
function cvCreateGraphScanner(graph: pCvGraph; vtx: pCvGraphVtx = nil; mask: Integer = CV_GRAPH_ALL_ITEMS)
: pCvGraphScanner; cdecl;
function cvCreateGraphScanner(graph: pCvGraph; vtx: pCvGraphVtx = nil; mask: Integer = CV_GRAPH_ALL_ITEMS): pCvGraphScanner; cdecl;
(*
Releases graph scanner.
@ -1528,8 +1514,7 @@ procedure cvWriteComment(fs: pCvFileStorage; const comment: pCvChar; eol_comment
// or user-defined type */
// CVAPI(void) cvWrite( CvFileStorage* fs, const char* name, const void* ptr,
// CvAttrList attributes CV_DEFAULT(cvAttrList()));
procedure cvWrite(fs: pCvFileStorage; const name: pCvChar; const ptr: pCvArr;
attributes: TCvAttrList { = cvAttrList() } ); cdecl;
procedure cvWrite(fs: pCvFileStorage; const name: pCvChar; const ptr: pCvArr; attributes: TCvAttrList { = cvAttrList() } ); cdecl;
(*
starts the next stream
@ -1552,8 +1537,7 @@ procedure cvWriteRawData(fs: pCvFileStorage; const src: Pointer; len: Integer; c
int len CV_DEFAULT(-1),
int create_missing CV_DEFAULT(0));
*)
function cvGetHashedKey(fs: pCvFileStorage; const name: pCvChar; len: Integer = -1; create_missing: Integer = 0)
: pCvStringHashNode; cdecl;
function cvGetHashedKey(fs: pCvFileStorage; const name: pCvChar; len: Integer = -1; create_missing: Integer = 0): pCvStringHashNode; cdecl;
(*
returns file node with the specified key within the specified map
(collection of named nodes)
@ -1570,14 +1554,12 @@ function cvGetRootFileNode(const fs: pCvFileStorage; stream_index: Integer = 0):
const CvStringHashNode* key,
int create_missing CV_DEFAULT(0) );
*)
function cvGetFileNode(fs: pCvFileStorage; map: pCvFileNode; const key: pCvStringHashNode; create_missing: Integer = 0)
: pCvFileNode; cdecl;
function cvGetFileNode(fs: pCvFileStorage; map: pCvFileNode; const key: pCvStringHashNode; create_missing: Integer = 0): pCvFileNode; cdecl;
type
TCvCmpFunc = function(const A: Pointer; const B: Pointer; userdata: Pointer): Integer; cdecl;
function cvSeqPartition(const seq: pCvSeq; storage: pCvMemStorage; labels: pCvSeq; is_equal: TCvCmpFunc;
userdata: Pointer): Integer; cdecl;
function cvSeqPartition(const seq: pCvSeq; storage: pCvMemStorage; labels: pCvSeq; is_equal: TCvCmpFunc; userdata: Pointer): Integer; cdecl;
(*
Finds element in a [sorted] sequence
@ -1586,8 +1568,8 @@ function cvSeqPartition(const seq: pCvSeq; storage: pCvMemStorage; labels: pCvSe
int is_sorted, int* elem_idx,
void* userdata CV_DEFAULT(NULL) );
*)
function cvSeqSearch(seq: pCvSeq; const elem: Pointer; func: TCvCmpFunc; is_sorted: Integer; elem_idx: pInteger;
userdata: Pointer = nil): pschar; cdecl;
function cvSeqSearch(seq: pCvSeq; const elem: Pointer; func: TCvCmpFunc; is_sorted: Integer; elem_idx: pInteger; userdata: Pointer = nil)
: pschar; cdecl;
{ ****************************************************************************************
* Drawing *
@ -1612,16 +1594,16 @@ procedure cvLine(img: pCvArr; pt1, pt2: TCvPoint; color: TCvScalar; thickness: I
{ Draws a rectangle specified by a CvRect structure
procedure cvRectangleR(8: v1: ); shift CV_DEFAULT(0): Integer): Integer;
}
procedure cvRectangle(img: pCvArr; pt1: TCvPoint; pt2: TCvPoint; color: TCvScalar; thickness: Integer = 1;
line_type: Integer = 8; shift: Integer = 0); cdecl;
procedure cvRectangle(img: pCvArr; pt1: TCvPoint; pt2: TCvPoint; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8;
shift: Integer = 0); cdecl;
{ Draws a circle with specified center and radius.
Thickness works in the same way as with cvRectangle
CVAPI(void) cvCircle( pCvArr* img, CvPoint center, int radius,
CvScalar color, int thickness CV_DEFAULT(1), int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
}
procedure cvCircle(img: pCvArr; center: TCvPoint; radius: Integer; color: TCvScalar; thickness: Integer = 1;
line_type: Integer = 8; shift: Integer = 0); cdecl;
procedure cvCircle(img: pCvArr; center: TCvPoint; radius: Integer; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8;
shift: Integer = 0); cdecl;
{ Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector,
depending on <thickness>, <start_angle> and <end_angle> parameters. The resultant figure
@ -1631,8 +1613,8 @@ procedure cvCircle(img: pCvArr; center: TCvPoint; radius: Integer; color: TCvSca
CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
}
procedure cvEllipse(img: pIplImage; center: TCvPoint; axes: TCvSize; angle: double; start_angle: double;
nd_angle: double; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); cdecl;
procedure cvEllipse(img: pIplImage; center: TCvPoint; axes: TCvSize; angle: double; start_angle: double; nd_angle: double; color: TCvScalar;
thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); cdecl;
{ CV_INLINE void cvEllipseBox( pCvArr* img, CvBox2D box, CvScalar color,
int thickness CV_DEFAULT(1),
@ -1644,8 +1626,8 @@ procedure cvEllipse(img: pIplImage; center: TCvPoint; axes: TCvSize; angle: doub
cvEllipse( img, cvPointFrom32f( box.center ), axes, box.angle,
0, 360, color, thickness, line_type, shift );
}
procedure cvEllipseBox(img: pIplImage; box: TCvBox2D; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8;
shift: Integer = 0); {$IFDEF USE_INLINE}inline; {$ENDIF}
procedure cvEllipseBox(img: pIplImage; box: TCvBox2D; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0);
{$IFDEF USE_INLINE}inline; {$ENDIF}
{ Fills convex or monotonous polygon.
CVAPI(void) cvFillConvexPoly( pCvArr* img, const CvPoint* pts, int npts, CvScalar color,
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
@ -1659,8 +1641,8 @@ procedure cvFillConvexPoly(img: pIplImage;
int is_closed, CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
}
procedure cvPolyLine(img: pIplImage; pts: pCVPoint; const npts: pInteger; contours: Integer; is_closed: Integer;
color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); cdecl;
procedure cvPolyLine(img: pIplImage; pts: pCVPoint; const npts: pInteger; contours: Integer; is_closed: Integer; color: TCvScalar;
thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); cdecl;
(*
Clips the line segment connecting *pt1 and *pt2
@ -1681,8 +1663,8 @@ function cvClipLine(img_size: TCvSize; pt1: pCVPoint; pt2: pCVPoint): Integer; c
int connectivity CV_DEFAULT(8),
int left_to_right CV_DEFAULT(0));
*)
function cvInitLineIterator(const image: pCvArr; pt1: TCvPoint; pt2: TCvPoint; line_iterator: pCvLineIterator;
connectivity: Integer = 8; left_to_right: Integer = 0): Integer; cdecl;
function cvInitLineIterator(const image: pCvArr; pt1: TCvPoint; pt2: TCvPoint; line_iterator: pCvLineIterator; connectivity: Integer = 8;
left_to_right: Integer = 0): Integer; cdecl;
{ basic font types }
const
@ -1731,8 +1713,8 @@ type
double hscale, double vscale, double shear CV_DEFAULT(0),
int thickness CV_DEFAULT(1), int line_type CV_DEFAULT(8));
}
procedure cvInitFont(font: pCvFont; font_face: Integer; hscale: double; vscale: double; shear: double = 0;
thickness: Integer = 1; line_type: Integer = 8); cdecl;
procedure cvInitFont(font: pCvFont; font_face: Integer; hscale: double; vscale: double; shear: double = 0; thickness: Integer = 1;
line_type: Integer = 8); cdecl;
function cvFont(scale: double; thickness: Integer = 1): TCvFont; {$IFDEF USE_INLINE}inline; {$ENDIF}
{ CVAPI(void) cvPutText( pCvArr* img, const char* text, CvPoint org,
@ -1743,8 +1725,7 @@ procedure cvPutText(img: pCvArr; const text: pCvChar; org: TCvPoint; const font:
// * Calculates bounding box of text stroke (useful for alignment) */
// CVAPI(void) cvGetTextSize( const char* text_string, const CvFont* font,
// CvSize* text_size, int* baseline );
procedure cvGetTextSize(const text_string: pCvChar; const font: pCvFont; text_size: pCvSize;
Var baseline: Integer); cdecl;
procedure cvGetTextSize(const text_string: pCvChar; const font: pCvFont; text_size: pCvSize; Var baseline: Integer); cdecl;
(*
Unpacks color value, if arrtype is CV_8UC?, <color> is treated as
@ -1766,8 +1747,8 @@ function cvColorToScalar(packed_color: double; arrtype: Integer): TCvScalar; cde
CVAPI(int) cvEllipse2Poly( CvPoint center, CvSize axes,
int angle, int arc_start, int arc_end, CvPoint * pts, int delta );
*)
function cvEllipse2Poly(center: TCvPoint; axes: TCvSize; angle: Integer; arc_start: Integer; arc_end: Integer;
pts: pCVPoint; delta: Integer): Integer; cdecl;
function cvEllipse2Poly(center: TCvPoint; axes: TCvSize; angle: Integer; arc_start: Integer; arc_end: Integer; pts: pCVPoint;
delta: Integer): Integer; cdecl;
{ Draws contour outlines or filled interiors on the image
CVAPI(void) cvDrawContours( pCvArr *img, CvSeq* contour,
@ -1822,9 +1803,8 @@ const
// CvTermCriteria termcrit, int attempts CV_DEFAULT(1),
// CvRNG* rng CV_DEFAULT(0), int flags CV_DEFAULT(0),
// CvArr* _centers CV_DEFAULT(0), double* compactness CV_DEFAULT(0) );
function cvKMeans2(const samples: pCvArr; cluster_count: Integer; labels: pCvArr; termcrit: TCvTermCriteria;
attempts: Integer = 1; rng: pCvRNG = nil; flags: Integer = 0; _centers: pCvArr = nil; compactness: pDouble = nil)
: Integer; cdecl;
function cvKMeans2(const samples: pCvArr; cluster_count: Integer; labels: pCvArr; termcrit: TCvTermCriteria; attempts: Integer = 1;
rng: pCvRNG = nil; flags: Integer = 0; _centers: pCvArr = nil; compactness: pDouble = nil): Integer; cdecl;
(*
***************************************************************************************\
@ -1850,8 +1830,7 @@ function cvUseOptimized(on_off: Integer): Integer; cdecl;
const char** version,
const char** loaded_addon_plugins );
*)
procedure cvGetModuleInfo(const module_name: pCvChar; const version: ppCvChar;
const loaded_addon_plugins: ppCvChar); cdecl;
procedure cvGetModuleInfo(const module_name: pCvChar; const version: ppCvChar; const loaded_addon_plugins: ppCvChar); cdecl;
Type
(* typedef void* (CV_CDECL *CvAllocFunc)(size_t size, void* userdata); *)
@ -1866,16 +1845,14 @@ Type
CvFreeFunc free_func CV_DEFAULT(NULL),
void* userdata CV_DEFAULT(NULL));
*)
procedure cvSetMemoryManager(alloc_func: TCvAllocFunc = nil; free_func: TCvFreeFunc = nil;
userdata: Pointer = nil); cdecl;
procedure cvSetMemoryManager(alloc_func: TCvAllocFunc = nil; free_func: TCvFreeFunc = nil; userdata: Pointer = nil); cdecl;
type
(* typedef IplImage* (CV_STDCALL* Cv_iplCreateImageHeader)
(int,int,int,char*,char*,int,int,int,int,int,
IplROI*,IplImage*,void*,IplTileInfo *)
TCv_iplCreateImageHeader = function(A: Integer; B: Integer; C: Integer; D: pCvChar; E: pCvChar; F: Integer;
g: Integer; H: Integer; i: Integer; j: Integer; K: pIplROI; L: pIplImage; M: Pointer; N: PIplTileInfo)
: pIplImage; stdcall;
TCv_iplCreateImageHeader = function(A: Integer; B: Integer; C: Integer; D: pCvChar; E: pCvChar; F: Integer; g: Integer; H: Integer;
i: Integer; j: Integer; K: pIplROI; L: pIplImage; M: Pointer; N: PIplTileInfo): pIplImage; stdcall;
(* typedef void (CV_STDCALL* Cv_iplAllocateImageData)(IplImage*,int,int); *)
TCv_iplAllocateImageData = procedure(A: pIplImage; B: Integer); stdcall;
@ -1908,8 +1885,8 @@ procedure cvSetIPLAllocators(create_header: TCv_iplCreateImageHeader; allocate_d
CVAPI(CvFileStorage*) cvOpenFileStorage( const char* filename, CvMemStorage* memstorage,
int flags, const char* encoding CV_DEFAULT(NULL) );
}
function cvOpenFileStorage(const filename: pCvChar; memstorage: pCvMemStorage; flags: Integer;
const encoding: pCvChar = nil): pCvFileStorage; cdecl;
function cvOpenFileStorage(const filename: pCvChar; memstorage: pCvMemStorage; flags: Integer; const encoding: pCvChar = nil)
: pCvFileStorage; cdecl;
{ closes file storage and deallocates buffers
CVAPI(void) cvReleaseFileStorage( CvFileStorage** fs );
@ -1940,8 +1917,8 @@ function cvReadInt(const node: pCvFileNode; default_value: Integer = 0): Integer
{
return cvReadInt( cvGetFileNodeByName( fs, map, name ), default_value );
}
function cvReadIntByName(const fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar;
default_value: Integer = 0): Integer; {$IFDEF USE_INLINE}inline; {$ENDIF}
function cvReadIntByName(const fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar; default_value: Integer = 0): Integer;
{$IFDEF USE_INLINE}inline; {$ENDIF}
// CV_INLINE const char* cvReadString( const CvFileNode* node,
// const char* default_value CV_DEFAULT(NULL) )
// {
@ -1954,8 +1931,8 @@ function cvReadString(const node: pCvFileNode; const default_value: pCvChar = ni
// {
// return cvReadString( cvGetFileNodeByName( fs, map, name ), default_value );
// }
function cvReadStringByName(const fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar;
const default_value: pCvChar = nil): pCvChar; {$IFDEF USE_INLINE}inline; {$ENDIF}
function cvReadStringByName(const fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar; const default_value: pCvChar = nil)
: pCvChar; {$IFDEF USE_INLINE}inline; {$ENDIF}
{ decodes standard or user-defined object and returns it
CVAPI(void*) cvRead( CvFileStorage* fs, CvFileNode* node,
CvAttrList* attributes CV_DEFAULT(NULL));
@ -1965,8 +1942,7 @@ function cvRead(fs: pCvFileStorage; node: pCvFileNode; attributes: pCvAttrList =
// * decodes standard or user-defined object and returns it */
// CV_INLINE void* cvReadByName( CvFileStorage* fs, const CvFileNode* map, const char* name, CvAttrList* attributes CV_DEFAULT(NULL) )
// {return cvRead( fs, cvGetFileNodeByName( fs, map, name ), attributes );}
function cvReadByName(fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar;
attributes: pCvAttrList = nil): Pointer;
function cvReadByName(fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar; attributes: pCvAttrList = nil): Pointer;
(*
starts reading data from sequence or scalar numeric node
@ -1981,8 +1957,7 @@ procedure cvStartReadRawData(const fs: pCvFileStorage; const src: pCvFileNode; r
CVAPI(void) cvReadRawDataSlice( const CvFileStorage* fs, CvSeqReader* reader,
int count, void* dst, const char* dt );
*)
procedure cvReadRawDataSlice(const fs: pCvFileStorage; reader: pCvSeqReader; count: Integer; dst: Pointer;
const dt: pCvChar); cdecl;
procedure cvReadRawDataSlice(const fs: pCvFileStorage; reader: pCvSeqReader; count: Integer; dst: Pointer; const dt: pCvChar); cdecl;
(*
combination of two previous functions for easier reading of whole sequences
@ -1996,8 +1971,7 @@ procedure cvReadRawData(const fs: pCvFileStorage; const src: pCvFileNode; dst: P
CVAPI(void) cvWriteFileNode( CvFileStorage* fs, const char* new_node_name,
const CvFileNode* node, int embed );
*)
procedure cvWriteFileNode(fs: pCvFileStorage; const new_node_name: pCvChar; const node: pCvFileNode;
embed: Integer); cdecl;
procedure cvWriteFileNode(fs: pCvFileStorage; const new_node_name: pCvChar; const node: pCvFileNode; embed: Integer); cdecl;
(*
returns name of file node
*)
@ -2051,12 +2025,12 @@ function cvClone(const struct_ptr: Pointer): Pointer; cdecl;
const char** real_name CV_DEFAULT(NULL) );
}
procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar; const comment: pCvChar;
attributes: TCvAttrList); cdecl; overload;
procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar = Nil;
const comment: pCvChar = Nil); overload; {$IFDEF USE_INLINE}inline; {$ENDIF}
function cvLoad(const filename: pCvChar; memstorage: pCvMemStorage = Nil; const name: pCvChar = nil;
const real_name: ppCvChar = nil): Pointer; cdecl;
procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar; const comment: pCvChar; attributes: TCvAttrList);
cdecl; overload;
procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar = Nil; const comment: pCvChar = Nil); overload;
{$IFDEF USE_INLINE}inline; {$ENDIF}
function cvLoad(const filename: pCvChar; memstorage: pCvMemStorage = Nil; const name: pCvChar = nil; const real_name: ppCvChar = nil)
: Pointer; cdecl;
{ *********************************** Measuring Execution Time *************************** }
@ -2135,8 +2109,7 @@ function cvErrorStr(status: Integer): pCvChar; cdecl;
CVAPI(int) cvGetErrInfo( const char** errcode_desc, const char** description,
const char** filename, int* line );
*)
function cvGetErrInfo(const errcode_desc: ppCvChar; const description: ppCvChar; const filename: ppCvChar;
line: pInteger): Integer; cdecl;
function cvGetErrInfo(const errcode_desc: ppCvChar; const description: ppCvChar; const filename: ppCvChar; line: pInteger): Integer; cdecl;
(*
Maps IPP error codes to the counterparts from OpenCV
@ -2147,8 +2120,8 @@ function cvErrorFromIppStatus(ipp_status: Integer): Integer; cdecl;
Type
(* typedef int (CV_CDECL *CvErrorCallback)( int status, const char* func_name,
const char* err_msg, const char* file_name, int line, void* userdata ); *)
TCvErrorCallback = function(status: Integer; const func_name: pCvChar; const err_msg: pCvChar;
const file_name: pCvChar; line: Integer; userdata: Pointer): Integer; cdecl;
TCvErrorCallback = function(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar; line: Integer;
userdata: Pointer): Integer; cdecl;
(*
Assigns a new error-handling function
@ -2157,8 +2130,7 @@ Type
void* userdata CV_DEFAULT(NULL),
void** prev_userdata CV_DEFAULT(NULL) );
*)
function cvRedirectError(error_handler: TCvErrorCallback; userdata: Pointer = nil; prev_userdata: ppvoid = nil)
: TCvErrorCallback; cdecl;
function cvRedirectError(error_handler: TCvErrorCallback; userdata: Pointer = nil; prev_userdata: ppvoid = nil): TCvErrorCallback; cdecl;
(*
@ -2172,20 +2144,20 @@ function cvRedirectError(error_handler: TCvErrorCallback; userdata: Pointer = ni
CVAPI(int) cvNulDevReport( int status, const char* func_name, const char* err_msg,
const char* file_name, int line, void* userdata );
*)
function cvNulDevReport(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar;
line: Integer; userdata: Pointer): Integer; cdecl;
function cvNulDevReport(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar; line: Integer;
userdata: Pointer): Integer; cdecl;
(*
CVAPI(int) cvStdErrReport( int status, const char* func_name, const char* err_msg,
const char* file_name, int line, void* userdata );
*)
function cvStdErrReport(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar;
line: Integer; userdata: Pointer): Integer; cdecl;
function cvStdErrReport(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar; line: Integer;
userdata: Pointer): Integer; cdecl;
(*
CVAPI(int) cvGuiBoxReport( int status, const char* func_name, const char* err_msg,
const char* file_name, int line, void* userdata );
*)
function cvGuiBoxReport(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar;
line: Integer; userdata: Pointer): Integer; cdecl;
function cvGuiBoxReport(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar; line: Integer;
userdata: Pointer): Integer; cdecl;
implementation
@ -2328,8 +2300,8 @@ function cvGetMat; external core_lib;
function cvGetImage; external core_lib;
function cvReshapeMatND; external core_lib;
function cvReshapeND(const arr: pCvArr; sizeof_header: Integer; header: pCvArr; new_cn, new_dims: Integer;
new_sizes: pInteger): pCvArr; {$IFDEF USE_INLINE}inline; {$ENDIF}
function cvReshapeND(const arr: pCvArr; sizeof_header: Integer; header: pCvArr; new_cn, new_dims: Integer; new_sizes: pInteger): pCvArr;
{$IFDEF USE_INLINE}inline; {$ENDIF}
begin
result := cvReshapeMatND(arr, sizeof(sizeof_header), header, new_cn, new_dims, new_sizes);
end;
@ -2378,7 +2350,7 @@ procedure cvSet(arr: pCvArr; value: TCvScalar;
procedure cvSet(mat: pCvMat; i, j: Integer; val: Single); {$IFDEF USE_INLINE}inline; {$ENDIF}
var
type_: Integer;
ptr: puchar;
ptr: pByte;
pf: PSingle;
begin
type_ := CV_MAT_TYPE(mat._type);
@ -2456,11 +2428,11 @@ begin
result := CvScalar(B, g, r, 0);
end;
procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar; const comment: pCvChar;
attributes: TCvAttrList); external core_lib; overload;
procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar; const comment: pCvChar; attributes: TCvAttrList);
external core_lib; overload;
procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar = Nil;
const comment: pCvChar = Nil); overload; {$IFDEF USE_INLINE}inline; {$ENDIF}
procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar = Nil; const comment: pCvChar = Nil); overload;
{$IFDEF USE_INLINE}inline; {$ENDIF}
begin
cvSave(filename, struct_ptr, name, comment, ZeroCvAttrList);
end;
@ -2497,8 +2469,8 @@ begin
// return !node ? default_value :
// CV_NODE_IS_INT(node->tag) ? node->data.i :
// CV_NODE_IS_REAL(node->tag) ? cvRound(node->data.f) : 0x7fffffff;
result := iif(not Assigned(node), default_value, iif(CV_NODE_IS_INT(node^.tag), node^.i,
iif(CV_NODE_IS_REAL(node^.tag), node^.F, $7FFFFFFF)));
result := iif(not Assigned(node), default_value, iif(CV_NODE_IS_INT(node^.tag), node^.i, iif(CV_NODE_IS_REAL(node^.tag), node^.F,
$7FFFFFFF)));
end;
function cvReadIntByName;
@ -2546,7 +2518,7 @@ function cvGet(
const mat: pCvMat; i, j: Integer): Single; {$IFDEF USE_INLINE}inline; {$ENDIF}
var
type_: Integer;
ptr: puchar;
ptr: pByte;
pf: PSingle;
begin
type_ := CV_MAT_TYPE(mat^._type);
@ -2560,6 +2532,8 @@ end;
procedure cvRelease(var struct_ptr: Pointer); external core_lib name 'cvRelease';
procedure cvRelease(var struct_ptr: pCvSeq); external core_lib name 'cvRelease';
{$IFDEF MSWINDOWS}
function cvGetTickCount;
begin
result := GetTickCount;
@ -2572,6 +2546,7 @@ begin
QueryPerformanceFrequency(freq);
result := freq;
end;
{$ENDIF ~MSWINDOWS}
function cvGetTickFrequency: double;
begin

View File

@ -575,6 +575,7 @@ begin
H := 2 + (B - R) / Range;
2:
H := 4 + (R - G) / Range;
else H:=0;
end;
S := Range / rgb[MaxIndex];
V := rgb[MaxIndex];

View File

@ -24,10 +24,14 @@
*)
unit ocv.features2d;
{$I OpenCV.inc}
interface
Uses
WinApi.Windows,
{$IFDEF MSWINDOWS}
Winapi.Windows,
{$ENDIF MSWINDOWS}
ocv.cclasses,
ocv.mat;

View File

@ -1,57 +1,61 @@
(*
**************************************************************************************************
Project Delphi-OpenCV
**************************************************************************************************
Contributor:
Laentir Valetov
email:laex@bk.ru
Mikhail Grigorev
email:sleuthound@gmail.com
**************************************************************************************************
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/
**************************************************************************************************
Project Delphi-OpenCV
**************************************************************************************************
Contributor:
Laentir Valetov
email:laex@bk.ru
Mikhail Grigorev
email:sleuthound@gmail.com
**************************************************************************************************
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.
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.
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
**************************************************************************************************
Warning: Using Delphi XE3 syntax!
**************************************************************************************************
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 file:
opencv\modules\highgui\include\opencv2\highgui.hpp
*************************************************************************************************
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
**************************************************************************************************
Warning: Using Delphi XE3 syntax!
**************************************************************************************************
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 file:
opencv\modules\highgui\include\opencv2\highgui.hpp
*************************************************************************************************
*)
unit ocv.highgui;
{$I OpenCV.inc}
interface
uses
WinApi.Windows,
{$IFDEF MSWINDOWS}
Winapi.Windows,
{$ENDIF MSWINDOWS}
ocv.mat,
ocv.core.types_c,
ocv.highgui_c;
@ -120,7 +124,7 @@ function createTrackbar(const trackbarname: String; const winname: String; value
// CV_EXPORTS_W Mat imread( const string& filename, int flags=1 );
function imread(const filename: string; flag: Integer = 1): TccvMat;
// CV_EXPORTS_W bool imwrite( const string& filename, InputArray img, const vector<int>& params=vector<int>());
//function imwrite(const filename: String; const img: TccvMat): bool;
// function imwrite(const filename: String; const img: TccvMat): bool;
type
TIplImageRecordHelper = record helper for TIplImage

View File

@ -27,10 +27,14 @@
unit ocv.mat;
{$I OpenCV.inc}
interface
uses
WinApi.Windows,
{$IFDEF MSWINDOWS}
Winapi.Windows,
{$ENDIF MSWINDOWS}
ocv.core.types_c,
ocv.core_c,
ocv.highgui_c;

View File

@ -45,12 +45,15 @@
unit ocv.ml;
{$I OpenCV.inc}
{$POINTERMATH ON}
interface
Uses
WinApi.Windows,
{$IFDEF MSWINDOWS}
Winapi.Windows,
{$ENDIF MSWINDOWS}
ocv.core.types_c;
(* ***************************************************************************************
@ -250,14 +253,14 @@ const
// \*************************************************************************************** *)
Type
TCvKNearest = class(TObject)
function train(const trainData: pCvMat; const responses: pCvMat; const sampleIdx: pCvMat = nil;
is_regression: bool = false; maxK: Integer = 32; updateBase: bool = false): bool; virtual; stdcall; abstract;
function train(const trainData: pCvMat; const responses: pCvMat; const sampleIdx: pCvMat = nil; is_regression: bool = false;
maxK: Integer = 32; updateBase: bool = false): bool; virtual; stdcall; abstract;
function find_nearest(const samples: pCvMat; k: Integer; results: pCvMat = nil; const neighbors: PSingle = nil;
neighborResponses: pCvMat = nil; dist: pCvMat = nil): float; virtual; stdcall; abstract;
// -----------------------------------
class function Create: TCvKNearest; overload;
class function Create(const trainData: pCvMat; const responses: pCvMat; const sampleIdx: pCvMat = nil;
isRegression: bool = false; max_k: Integer = 32): TCvKNearest; overload;
class function Create(const trainData: pCvMat; const responses: pCvMat; const sampleIdx: pCvMat = nil; isRegression: bool = false;
max_k: Integer = 32): TCvKNearest; overload;
procedure Free; reintroduce;
end;
@ -2178,8 +2181,8 @@ implementation
uses ocv.lib;
function CreateCvKNearest: TCvKNearest; stdcall; external opencv_classes_lib; overload;
function CreateCvKNearest(const trainData: pCvMat; const responses: pCvMat; const sampleIdx: pCvMat = nil;
isRegression: bool = false; max_k: Integer = 32): TCvKNearest; stdcall; external opencv_classes_lib; overload;
function CreateCvKNearest(const trainData: pCvMat; const responses: pCvMat; const sampleIdx: pCvMat = nil; isRegression: bool = false;
max_k: Integer = 32): TCvKNearest; stdcall; external opencv_classes_lib; overload;
procedure ReleaseCvKNearest(ex: TCvKNearest); stdcall; external opencv_classes_lib;
function CV_IS_ROW_SAMPLE(flags: Integer): Boolean;
@ -2210,8 +2213,7 @@ begin
Result := CreateCvKNearest;
end;
class function TCvKNearest.Create(const trainData, responses, sampleIdx: pCvMat; isRegression: bool; max_k: Integer)
: TCvKNearest;
class function TCvKNearest.Create(const trainData, responses, sampleIdx: pCvMat; isRegression: bool; max_k: Integer): TCvKNearest;
begin
Result := CreateCvKNearest(trainData, responses, sampleIdx, isRegression, max_k);
end;

View File

@ -24,10 +24,14 @@
*)
unit ocv.objdetect;
{$I OpenCV.inc}
interface
Uses
WinApi.Windows,
{$IFDEF MSWINDOWS}
Winapi.Windows,
{$ENDIF MSWINDOWS}
ocv.Mat,
ocv.cclasses,
ocv.core.types_c;