FFMpeg IPCam Source

Signed-off-by: Laentir Valetov <laex@bk.ru>
This commit is contained in:
Laentir Valetov 2014-05-23 00:31:51 +04:00
parent a016c463c5
commit e74ee8bbe5
25 changed files with 697 additions and 153 deletions

View File

@ -108,7 +108,7 @@
<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=22.05.2014 18:38:28</VerInfo_Keys>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;LastCompiledTime=22.05.2014 23:26:02</VerInfo_Keys>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>

View File

@ -146,10 +146,11 @@ object MainForm: TMainForm
Top = 40
end
object ocvpcmsrc1: TocvIPCamSource
Enabled = True
UserName = 'admin'
Password = 'admin'
IP = '10.1.1.202'
Postfix = 'cam/realmonitor?channel=1&subtype=0'
URI = '/cam/realmonitor?channel=1&subtype=0'
Left = 336
Top = 44
end

View File

@ -0,0 +1,14 @@
program cFFmpegIPCamSource;
uses
Vcl.Forms,
uMainForm in 'uMainForm.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,143 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{08BFF34B-6FF9-468C-9AB2-3F76BBC9E351}</ProjectGuid>
<ProjectVersion>15.4</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<MainSource>cFFmpegIPCamSource.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>3</TargetedPlatforms>
<AppType>Application</AppType>
</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="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
<Cfg_1_Win64>true</Cfg_1_Win64>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<SanitizedProjectName>cFFmpegIPCamSource</SanitizedProjectName>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1049</VerInfo_Locale>
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<DCC_UsePackage>dxSkinOffice2007BlackRS19;JvGlobus;JvMM;JvManagedThreads;dxSkinLiquidSkyRS19;cxBarEditItemRS19;OverbyteIcsDXE5Run;FireDACPgDriver;dxWizardControlRS19;dxPScxCommonRS19;tmswizdXE5;dxThemeRS19;JvCrypt;XiButtonXE4;cxGridRS19;dxPScxExtCommonRS19;DBXInterBaseDriver;DataSnapServer;DataSnapCommon;cxSchedulerRS19;JvNet;JvDotNetCtrls;DbxCommonDriver;vclimg;dbxcds;dxFlowChartRS19;DatasnapConnectorsFreePascal;JvXPCtrls;dxdbtrRS19;dxSkinSpringTimeRS19;vcldb;dxdborRS19;dxDockingRS19;dxSkinsdxDLPainterRS19;cxSpreadSheetRS19;dxtrmdRS19;dxSpellCheckerRS19;CustomIPTransport;dxTileControlRS19;dsnap;IndyIPServer;dxPSCoreRS19;dxSkinFoggyRS19;IndyCore;cxSchedulerGridRS19;cxPivotGridOLAPRS19;dxSkinStardustRS19;CloudService;FmxTeeUI;FireDACIBDriver;dxSkinXmas2008BlueRS19;JvDB;JvRuntimeDesign;dxSkinValentineRS19;fsIBX20;dsnapxml;dxPScxSchedulerLnkRS19;dxSkinDarkSideRS19;FireDACDb2Driver;dxSkinLondonLiquidSkyRS19;JclDeveloperTools;dxBarExtDBItemsRS19;dxTabbedMDIRS19;OpenCV200;dxSkinOffice2013WhiteRS19;dxSkinSharpRS19;bindcompfmx;dxSkinBlueprintRS19;dxSkinOffice2007PinkRS19;frx20;vcldbx;cxExportRS19;FireDACODBCDriver;RESTBackendComponents;dxSkinCoffeeRS19;dbrtl;FireDACCommon;bindcomp;inetdb;dxSkinBlueRS19;JvPluginSystem;dxServerModeRS19;DBXOdbcDriver;JvCmp;vclFireDAC;dxSkinMoneyTwinsRS19;cxPivotGridChartRS19;xmlrtl;dxSkiniMaginaryRS19;ibxpress;JvTimeFramework;dxSkinOffice2007GreenRS19;FireDACCommonDriver;bindengine;vclactnband;soaprtl;FMXTee;dxRibbonRS19;bindcompvcl;dxADOServerModeRS19;Jcl;vclie;dxPSdxLCLnkRS19;dxSkinBlackRS19;dxSkinOffice2010BlackRS19;dxSkinSevenClassicRS19;FireDACMSSQLDriver;DBXInformixDriver;Intraweb;DataSnapServerMidas;dsnapcon;DBXFirebirdDriver;dxSkinsdxNavBarPainterRS19;inet;dxPSdxFCLnkRS19;dxSkinscxSchedulerPainterRS19;JvPascalInterpreter;FireDACMySQLDriver;soapmidas;vclx;dxPSPrVwRibbonRS19;dxPSDBTeeChartRS19;DBXSybaseASADriver;RESTComponents;dxSkinLilianRS19;dxSkinscxPCPainterRS19;dbexpress;IndyIPClient;JvBDE;tmsdXE5;cxSchedulerTreeBrowserRS19;dxPScxSSLnkRS19;dxPScxPivotGridLnkRS19;dxSkinSharpPlusRS19;FireDACSqliteDriver;autoupgrXE5;FireDACDSDriver;ZComponent;DBXSqliteDriver;dxPSdxDBTVLnkRS19;dxSkinOffice2007BlueRS19;cxDataRS19;cxLibraryRS19;fmx;JvDlgs;IndySystem;RVButtonXE6;TeeDB;tethering;dxPsPrVwAdvRS19;dxSkinHighContrastRS19;inetdbbde;vclib;DataSnapClient;DataSnapProviderClient;DBXSybaseASEDriver;dxmdsRS19;dxSkinOffice2010SilverRS19;dxSkinsdxBarPainterRS19;fsBDE20;MetropolisUILiveTile;dxPSdxOCLnkRS19;vcldsnap;fmxFireDAC;DBXDb2Driver;dxSkinDevExpressDarkStyleRS19;DBXOracleDriver;dxBarDBNavRS19;JvCore;vclribbon;dxSkinSilverRS19;dxSkinVS2010RS19;fmxase;vcl;dxPSdxDBOCLnkRS19;DBXMSSQLDriver;IndyIPCommon;CodeSiteExpressPkg;dxBarRS19;cxTreeListdxBarPopupMenuRS19;DataSnapFireDAC;FireDACDBXDriver;JvAppFrm;soapserver;dxFireDACServerModeRS19;inetdbxpress;fsTee20;frxTee20;cxEditorsRS19;dxSkinMcSkinRS19;FireDACInfxDriver;JvDocking;adortl;dxSkinOffice2007SilverRS19;frxDB20;JvWizards;FireDACASADriver;dxSkinSevenRS19;JvHMI;dxDBXServerModeRS19;dxLayoutControlRS19;dxPSTeeChartRS19;dxSkinWhiteprintRS19;cxPageControlRS19;fsADO20;JvBands;ZDbc;rtl;dcldxSkinsCoreRS19;DbxClientDriver;ZPlain;dxPScxGridLnkRS19;Tee;cxPageControldxBarPopupMenuRS19;cxVerticalGridRS19;JclContainers;CPortLibDXE;JvSystem;DataSnapNativeClient;svnui;dxSkinsdxRibbonPainterRS19;dxSkinSummer2008RS19;cxPivotGridRS19;dxComnRS19;IndyProtocols;DBXMySQLDriver;dxSkinTheAsphaltWorldRS19;JvControls;tmsxlsdXE5;dxPSLnksRS19;viTimeLineDPK;bindcompdbx;TeeUI;JvJans;JvPrintPreview;JvPageComps;dxSkinDarkRoomRS19;JvStdCtrls;JvCustom;dxSkinPumpkinRS19;dxBarExtItemsRS19;FireDACADSDriver;vcltouch;ZCore;dxNavBarRS19;VclSmp;FireDAC;VCLRESTComponents;dxGDIPlusRS19;DataSnapConnectors;dxCoreRS19;dxPScxVGridLnkRS19;fsDB20;dxPScxTLLnkRS19;dxSkinsCoreRS19;fmxobj;dxSkinGlassOceansRS19;JclVcl;ZParseSql;dxPScxPCProdRS19;fs20;svn;tmsexdXE5;dxSkinOffice2010BlueRS19;FireDACOracleDriver;fmxdae;dxorgcRS19;bdertl;cxTreeListRS19;FireDACMSAccDriver;DataSnapIndy10ServerTransport;dxSkinDevExpressStyleRS19;dxSkinCaramelRS19;$(DCC_UsePackage)</DCC_UsePackage>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<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="'$(Base_Win64)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
<DCC_UsePackage>dxSkinOffice2007BlackRS19;dxSkinLiquidSkyRS19;cxBarEditItemRS19;OverbyteIcsDXE5Run;FireDACPgDriver;dxWizardControlRS19;dxPScxCommonRS19;dxThemeRS19;cxGridRS19;dxPScxExtCommonRS19;DBXInterBaseDriver;DataSnapServer;DataSnapCommon;cxSchedulerRS19;DbxCommonDriver;vclimg;dbxcds;dxFlowChartRS19;DatasnapConnectorsFreePascal;dxdbtrRS19;dxSkinSpringTimeRS19;vcldb;dxdborRS19;dxDockingRS19;dxSkinsdxDLPainterRS19;cxSpreadSheetRS19;dxtrmdRS19;dxSpellCheckerRS19;CustomIPTransport;dxTileControlRS19;dsnap;IndyIPServer;dxPSCoreRS19;dxSkinFoggyRS19;IndyCore;cxSchedulerGridRS19;cxPivotGridOLAPRS19;dxSkinStardustRS19;CloudService;FmxTeeUI;FireDACIBDriver;dxSkinXmas2008BlueRS19;dxSkinValentineRS19;dsnapxml;dxPScxSchedulerLnkRS19;dxSkinDarkSideRS19;FireDACDb2Driver;dxSkinLondonLiquidSkyRS19;dxBarExtDBItemsRS19;dxTabbedMDIRS19;OpenCV200;dxSkinOffice2013WhiteRS19;dxSkinSharpRS19;bindcompfmx;dxSkinBlueprintRS19;dxSkinOffice2007PinkRS19;cxExportRS19;FireDACODBCDriver;RESTBackendComponents;dxSkinCoffeeRS19;dbrtl;FireDACCommon;bindcomp;inetdb;dxSkinBlueRS19;dxServerModeRS19;DBXOdbcDriver;vclFireDAC;dxSkinMoneyTwinsRS19;cxPivotGridChartRS19;xmlrtl;dxSkiniMaginaryRS19;ibxpress;dxSkinOffice2007GreenRS19;FireDACCommonDriver;bindengine;vclactnband;soaprtl;FMXTee;dxRibbonRS19;bindcompvcl;dxADOServerModeRS19;vclie;dxPSdxLCLnkRS19;dxSkinBlackRS19;dxSkinOffice2010BlackRS19;dxSkinSevenClassicRS19;FireDACMSSQLDriver;DBXInformixDriver;Intraweb;DataSnapServerMidas;dsnapcon;DBXFirebirdDriver;dxSkinsdxNavBarPainterRS19;inet;dxPSdxFCLnkRS19;dxSkinscxSchedulerPainterRS19;FireDACMySQLDriver;soapmidas;vclx;dxPSPrVwRibbonRS19;DBXSybaseASADriver;RESTComponents;dxSkinLilianRS19;dxSkinscxPCPainterRS19;dbexpress;IndyIPClient;tmsdXE5;cxSchedulerTreeBrowserRS19;dxPScxSSLnkRS19;dxPScxPivotGridLnkRS19;dxSkinSharpPlusRS19;FireDACSqliteDriver;FireDACDSDriver;ZComponent;DBXSqliteDriver;dxPSdxDBTVLnkRS19;dxSkinOffice2007BlueRS19;cxDataRS19;cxLibraryRS19;fmx;IndySystem;TeeDB;tethering;dxPsPrVwAdvRS19;dxSkinHighContrastRS19;vclib;DataSnapClient;DataSnapProviderClient;DBXSybaseASEDriver;dxmdsRS19;dxSkinOffice2010SilverRS19;dxSkinsdxBarPainterRS19;MetropolisUILiveTile;dxPSdxOCLnkRS19;vcldsnap;fmxFireDAC;DBXDb2Driver;dxSkinDevExpressDarkStyleRS19;DBXOracleDriver;dxBarDBNavRS19;vclribbon;dxSkinSilverRS19;dxSkinVS2010RS19;fmxase;vcl;dxPSdxDBOCLnkRS19;DBXMSSQLDriver;IndyIPCommon;dxBarRS19;cxTreeListdxBarPopupMenuRS19;DataSnapFireDAC;FireDACDBXDriver;soapserver;dxFireDACServerModeRS19;inetdbxpress;cxEditorsRS19;dxSkinMcSkinRS19;FireDACInfxDriver;adortl;dxSkinOffice2007SilverRS19;FireDACASADriver;dxSkinSevenRS19;dxDBXServerModeRS19;dxLayoutControlRS19;dxSkinWhiteprintRS19;cxPageControlRS19;ZDbc;rtl;dcldxSkinsCoreRS19;DbxClientDriver;ZPlain;dxPScxGridLnkRS19;Tee;cxPageControldxBarPopupMenuRS19;cxVerticalGridRS19;DataSnapNativeClient;dxSkinsdxRibbonPainterRS19;dxSkinSummer2008RS19;cxPivotGridRS19;dxComnRS19;IndyProtocols;DBXMySQLDriver;dxSkinTheAsphaltWorldRS19;tmsxlsdXE5;dxPSLnksRS19;bindcompdbx;TeeUI;dxSkinDarkRoomRS19;dxSkinPumpkinRS19;dxBarExtItemsRS19;FireDACADSDriver;vcltouch;ZCore;dxNavBarRS19;VclSmp;FireDAC;VCLRESTComponents;dxGDIPlusRS19;DataSnapConnectors;dxCoreRS19;dxPScxVGridLnkRS19;dxPScxTLLnkRS19;dxSkinsCoreRS19;fmxobj;dxSkinGlassOceansRS19;ZParseSql;dxPScxPCProdRS19;tmsexdXE5;dxSkinOffice2010BlueRS19;FireDACOracleDriver;fmxdae;dxorgcRS19;cxTreeListRS19;FireDACMSAccDriver;DataSnapIndy10ServerTransport;dxSkinDevExpressStyleRS19;dxSkinCaramelRS19;$(DCC_UsePackage)</DCC_UsePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;LastCompiledTime=23.05.2014 0:25:10</VerInfo_Keys>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_RemoteDebug>false</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;LastCompiledTime=23.05.2014 0:30:09</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="uMainForm.pas">
<Form>Form1</Form>
<FormType>dfm</FormType>
</DCCReference>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<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">cFFmpegIPCamSource.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k200.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp200.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Deployment/>
<Platforms>
<Platform value="Win32">True</Platform>
<Platform value="Win64">True</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>

View File

@ -0,0 +1,33 @@
object Form1: TForm1
Left = 0
Top = 0
Caption = 'FFMpeg IP Camera source'
ClientHeight = 273
ClientWidth = 356
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object ocvw1: TocvView
Left = 0
Top = 0
Width = 356
Height = 273
VideoSource = ocvfmpgpcmsrc1
Align = alClient
end
object ocvfmpgpcmsrc1: TocvFFMpegIPCamSource
Enabled = True
UserName = 'admin'
Password = 'admin'
IP = '10.1.1.202'
URI = '/cam/realmonitor?channel=1&subtype=0'
Left = 76
Top = 40
end
end

View File

@ -0,0 +1,26 @@
unit uMainForm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uOCVTypes, uOCVSource, uOCVView;
type
TForm1 = class(TForm)
ocvfmpgpcmsrc1: TocvFFMpegIPCamSource;
ocvw1: TocvView;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.

View File

@ -35,9 +35,10 @@
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<SanitizedProjectName>cls2DPointClassification</SanitizedProjectName>
<DCC_E>false</DCC_E>
<DCC_ExeOutput>..\..\..\bin\</DCC_ExeOutput>
<DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput>
<VerInfo_Locale>1049</VerInfo_Locale>
<DCC_DebugInformation>true</DCC_DebugInformation>
<DCC_ImageBase>00400000</DCC_ImageBase>
@ -68,7 +69,6 @@
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<Manifest_File>None</Manifest_File>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
@ -145,8 +145,8 @@
<VersionInfoKeys Name="theme"/>
</VersionInfoKeys>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k190.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp190.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k200.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp200.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>

View File

@ -3,7 +3,7 @@
// Copyright (C) 2013 Project Delphi-OpenCV
// ****************************************************************
// Contributor:
// Laentir Valetov
// Laentir Valetov
// email:laex@bk.ru
// ****************************************************************
// You may retrieve the latest version of this file at the GitHub,
@ -35,17 +35,18 @@ uses
System.Classes,
ocv.Core.types_c,
ocv.core_c,
ocv.ml;
ocv.ml,
uResourcePaths;
{ DEFINE Test }
{DEFINE Test}
Const
CarTrain_FileName = 'resource\car.train';
CarTrain_FileName = cResourceMedia + 'car.train';
{$IFDEF Test}
CarTest_FileName = 'resource\car.test';
CarTest_FileName = cResourceMedia + 'car.test';
NUMBER_OF_TESTING_SAMPLES = 345;
{$ELSE}
CarTest_FileName = 'resource\car.data';
CarTest_FileName = cResourceMedia + 'car.data';
NUMBER_OF_TESTING_SAMPLES = 1728;
{$ENDIF}
ATTRIBUTES_PER_SAMPLE = 6; // not the last as this is the class
@ -191,12 +192,14 @@ begin
end;
end;
WriteLn(Format('Results on the testing database: %s'#13#10#9'Correct classification: %d (%4.2f%%)'#13#10#9 + 'Wrong classifications: %d (%4.2f%%)',
[CarTest_FileName, correct_class, correct_class * 100 / NUMBER_OF_TESTING_SAMPLES, wrong_class, wrong_class * 100 / NUMBER_OF_TESTING_SAMPLES]));
WriteLn(Format('Results on the testing database: %s'#13#10#9'Correct classification: %d (%4.2f%%)'#13#10#9 +
'Wrong classifications: %d (%4.2f%%)', [CarTest_FileName, correct_class,
correct_class * 100 / NUMBER_OF_TESTING_SAMPLES, wrong_class, wrong_class * 100 / NUMBER_OF_TESTING_SAMPLES]));
for i := 0 to NUMBER_OF_CLASSES - 1 do
begin
WriteLn(Format(#9'Class %s false postives %d (%4.2f%%)', [Classes[i], false_positives[i], false_positives[i] * 100 / NUMBER_OF_TESTING_SAMPLES]));
WriteLn(Format(#9'Class %s false postives %d (%4.2f%%)', [Classes[i], false_positives[i],
false_positives[i] * 100 / NUMBER_OF_TESTING_SAMPLES]));
end;
end;
finally

View File

@ -35,9 +35,10 @@
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<SanitizedProjectName>clsKNN</SanitizedProjectName>
<DCC_E>false</DCC_E>
<DCC_ExeOutput>..\..\..\bin\</DCC_ExeOutput>
<DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput>
<VerInfo_Locale>1049</VerInfo_Locale>
<DCC_DebugInformation>true</DCC_DebugInformation>
<DCC_ImageBase>00400000</DCC_ImageBase>
@ -68,7 +69,6 @@
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<Manifest_File>None</Manifest_File>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
@ -145,8 +145,8 @@
<VersionInfoKeys Name="theme"/>
</VersionInfoKeys>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k190.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp190.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k200.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp200.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>

View File

@ -35,9 +35,10 @@
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<SanitizedProjectName>clsMat</SanitizedProjectName>
<DCC_E>false</DCC_E>
<DCC_ExeOutput>..\..\..\bin\</DCC_ExeOutput>
<DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput>
<VerInfo_Locale>1049</VerInfo_Locale>
<DCC_DebugInformation>true</DCC_DebugInformation>
<DCC_ImageBase>00400000</DCC_ImageBase>
@ -68,7 +69,6 @@
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<Manifest_File>None</Manifest_File>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
@ -145,8 +145,8 @@
<VersionInfoKeys Name="theme"/>
</VersionInfoKeys>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k190.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp190.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k200.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp200.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>

View File

@ -3,7 +3,7 @@
<ProjectGuid>{C63D42FE-D135-473C-A773-6EFDE83EAE78}</ProjectGuid>
<MainSource>clsVideoCapture.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Config Condition="'$(Config)'==''">Release</Config>
<TargetedPlatforms>17</TargetedPlatforms>
<AppType>Console</AppType>
<FrameworkType>None</FrameworkType>
@ -35,11 +35,12 @@
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<SanitizedProjectName>clsVideoCapture</SanitizedProjectName>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<DCC_DebugInformation>true</DCC_DebugInformation>
<DCC_K>false</DCC_K>
<DCC_ExeOutput>..\..\..\bin\</DCC_ExeOutput>
<DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput>
<DCC_S>false</DCC_S>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_F>false</DCC_F>
@ -66,7 +67,6 @@
<DCC_Optimize>false</DCC_Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<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>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>
@ -145,8 +145,8 @@
<VersionInfoKeys Name="theme"/>
</VersionInfoKeys>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k190.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp190.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k200.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp200.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>

View File

@ -190,7 +190,7 @@
<DCC_UnitSearchPath>..;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=OpenCV Component;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=OpenCV Component;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=;FileDescription=OpenCV Component;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=OpenCV Component;ProductVersion=1.0.0.0;Comments=;LastCompiledTime=23.05.2014 0:24:38</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>

View File

@ -123,7 +123,7 @@
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=OpenCV Component;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=OpenCV Component;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=;FileDescription=OpenCV Component;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=OpenCV Component;ProductVersion=1.0.0.0;Comments=;LastCompiledTime=23.05.2014 0:24:42</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>

View File

@ -3,7 +3,7 @@
// Copyright (C) 2013 Project Delphi-OpenCV
// ****************************************************************
// Contributor:
// Laentir Valetov
// Laentir Valetov
// email:laex@bk.ru
// ****************************************************************
// You may retrieve the latest version of this file at the GitHub,
@ -22,9 +22,7 @@
// *******************************************************************
{$IFNDEF CLR}
{$I OpenCV.inc}
unit uOCVIOProperties;
{$ENDIF}
@ -34,11 +32,11 @@ uses
{$IFDEF CLR}
Borland.Vcl.Design.DesignEditors, Borland.Vcl.Design.DesignIntf,
{$ELSE}
{$IFDEF FPC}
PropEdits, ComponentEditors, LResources,
{$ELSE}
{$IFDEF VER6P}DesignEditors, DesignIntf, System.Classes,{$ELSE}DsgnIntf, Classes,{$ENDIF VER6P}
{$ENDIF FPC}
{$IFDEF FPC}
PropEdits, ComponentEditors, LResources,
{$ELSE}
{$IFDEF VER6P}DesignEditors, DesignIntf, System.Classes, {$ELSE}DsgnIntf, Classes, {$ENDIF VER6P}
{$ENDIF FPC}
{$ENDIF}
uOCVImageOperation;
@ -108,15 +106,15 @@ type
implementation
uses
{$IFDEF VER6P}
{$IFDEF VER6P}
System.SysUtils,
System.TypInfo,
System.RTLConsts,
{$ELSE}
{$ELSE}
SysUtils,
TypInfo,
RTLConsts,
{$ENDIF VER6P}
{$ENDIF VER6P}
uOCVTypes;
{TImageOperationProperty}
@ -314,7 +312,8 @@ end;
initialization
RegisterPropertyEditor(TypeInfo(TocvCustomImageOperation), TocvImageOperation, 'Operation', TImageOperationProperty);
RegisterPropertyEditor(TypeInfo(TocvCustomImageOperation), TocvImageOperationCollectionItem, 'Operation', TImageOperationCollectionItemProperty);
RegisterPropertyEditor(TypeInfo(TocvCustomImageOperation), TocvImageOperationCollectionItem, 'Operation',
TImageOperationCollectionItemProperty);
RegisterPropertyEditor(TypeInfo(TocvCustomImageOperation), TocvContoursOperation, 'Preprocessing', TImageContourPrepProperty);
RegisterPropertyEditor(TypeInfo(TocvCustomImageOperation), TocvMotionDetect, 'Threshold', TImageMotionDetectThresholdProperty);

View File

@ -3,7 +3,7 @@
// Copyright (C) 2013 Project Delphi-OpenCV
// ****************************************************************
// Contributor:
// Laentir Valetov
// Laentir Valetov
// email:laex@bk.ru
// ****************************************************************
// You may retrieve the latest version of this file at the GitHub,

View File

@ -49,7 +49,7 @@ uses
procedure Register;
begin
RegisterComponents('OpenCV', [TocvImageOperation, TocvCameraSource, TocvView, TocvFileSource, TocvIPCamSource]);
RegisterComponents('OpenCV', [TocvImageOperation, TocvCameraSource, TocvView, TocvFileSource, TocvIPCamSource,TocvFFMpegIPCamSource]);
RegisterClasses([TocvNoneOperation, TocvGrayScaleOperation, TovcCannyOperation, TovcSmoothOperation, TovcErodeOperation,
TovcDilateOperation, TocvLaplaceOperation, TovcSobelOperation, TocvThresholdOperation, TocvAdaptiveThresholdOperation,
TocvContoursOperation, TocvRotateOperation, TocvAbsDiff, TocvHaarCascade, TocvMatchTemplate, TocvMotionDetect,

View File

@ -1,45 +1,43 @@
//*****************************************************************
// 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.
// *******************************************************************
{$IFNDEF CLR}
{$I OpenCV.inc}
unit uOCVSource;
{$ENDIF}
interface
uses
{$IFDEF VER6P}
{$IFDEF VER6P}
System.SysUtils,
System.Classes,
System.SyncObjs,
{$ELSE}
{$ELSE}
SysUtils,
Classes,
SyncObjs,
{$ENDIF VER6P}
{$ENDIF VER6P}
ocv.core.types_c,
ocv.highgui_c,
uOCVTypes;
@ -87,36 +85,25 @@ type
FOnNoData: TNotifyEvent;
FThreadDelay: Integer;
FLock: TCriticalSection;
procedure SetCapture(const Value: pCvCapture); virtual;
protected
FCapture: pCvCapture;
public
constructor Create(CreateSuspended: Boolean);
destructor Destroy; override;
property OnNoData: TNotifyEvent Read FOnNoData write FOnNoData;
property OnNotifyData: TOnOcvNotify Read FOnNotifyData write FOnNotifyData;
property Capture: pCvCapture read FCapture write SetCapture;
end;
TocvCaptureThread = class(TocvCustomSourceThread)
protected
procedure Execute; override;
end;
TocvCustomSource = class(TocvDataSource)
protected
FCapture: pCvCapture;
FSourceThread: TocvCustomSourceThread;
FThreadDelay: Integer;
procedure OnNotifyData(Sender: TObject; const IplImage: IocvImage);
procedure SetEnabled(Value: Boolean); virtual;
procedure Loaded; override;
function GetEnabled: Boolean; override;
private
FEnabled: Boolean;
FOnImage: TOnOcvNotify;
procedure TerminateSourceThread;
procedure ReleaseSource;
procedure ReleaseSource; virtual;
function GetHeight: Integer; virtual;
function GetWidth: Integer; virtual;
public
@ -129,9 +116,19 @@ type
property ImageHeight: Integer Read GetHeight;
end;
TocvCaptureSource = class(TocvCustomSource)
protected
FCapture: pCvCapture;
procedure Loaded; override;
private
procedure ReleaseSource; override;
public
constructor Create(AOwner: TComponent); override;
end;
TocvResolution = (r160x120, r320x240, r424x240, r640x360, r800x448, r960x544, r1280x720);
TocvCameraSource = class(TocvCustomSource)
TocvCameraSource = class(TocvCaptureSource)
protected
procedure SetEnabled(Value: Boolean); override;
private
@ -149,7 +146,7 @@ type
property Resolution: TocvResolution read FResolution write SetResolution;
end;
TocvFileSource = class(TocvCustomSource)
TocvFileSource = class(TocvCaptureSource)
protected
procedure SetEnabled(Value: Boolean); override;
procedure OnNoData(Sender: TObject);
@ -169,14 +166,15 @@ type
property OnEndOfFile: TNotifyEvent read FOnEndOfFile Write FOnEndOfFile;
end;
TocvIPCamSource = class(TocvCustomSource)
TocvIPCamSource = class(TocvCaptureSource)
private
FPort: Word;
FPassword: string;
FIP: string;
FUserName: String;
FPostfix: string;
FURI: string;
protected
function GetIPCamTarget: AnsiString;
procedure SetEnabled(Value: Boolean); override;
public
constructor Create(AOwner: TComponent); override;
@ -184,14 +182,66 @@ type
property UserName: String read FUserName write FUserName;
property Password: string read FPassword write FPassword;
property IP: string read FIP write FIP;
property Postfix: string read FPostfix write FPostfix; {TODO: Need rename}
property URI: string read FURI write FURI; {TODO: Need rename}
property Port: Word read FPort write FPort default 554;
end;
TocvFFMpegIPCamSource = class(TocvCustomSource)
private
FPort: Word;
FPassword: string;
FIP: string;
FUserName: String;
FURI: string;
protected
function GetIPCamTarget: AnsiString;
procedure SetEnabled(Value: Boolean); override;
procedure Loaded; override;
public
constructor Create(AOwner: TComponent); override;
published
property UserName: String read FUserName write FUserName;
property Password: string read FPassword write FPassword;
property IP: string read FIP write FIP;
property URI: string read FURI write FURI; {TODO: Need rename}
property Port: Word read FPort write FPort default 554;
end;
implementation
uses
ocv.core_c;
ocv.core_c,
ffm.avformat,
ffm.dict,
ffm.libavcodec.avcodec,
ffm.avutil,
ffm.frame, ffm.swscale, ffm.pixfmt;
Type
TocvCaptureThread = class(TocvCustomSourceThread)
private
procedure SetCapture(const Value: pCvCapture); virtual;
protected
FCapture: pCvCapture;
protected
procedure Execute; override;
public
property Capture: pCvCapture read FCapture write SetCapture;
end;
TocvFFMpegIPCamSourceThread = class(TocvCustomSourceThread)
private
FEnabled: Boolean;
FIPCamURL: AnsiString;
FSuspendEvent: TEvent;
procedure TerminatedSet; override;
protected
procedure Execute; override;
public
constructor Create(CreateSuspended: Boolean);
destructor Destroy; override;
procedure SetIPCamUrl(const AIPCam: AnsiString; const AEnabled: Boolean);
end;
const
ocvCameraCaptureSource: array [TocvCameraCaptureSource] of Longint =
@ -307,7 +357,7 @@ begin
begin
if Assigned(FCapture) and FEnabled then
begin
FSourceThread.Capture := nil;
(FSourceThread as TocvCaptureThread).Capture := nil;
cvReleaseCapture(FCapture);
FCapture := Nil;
end;
@ -317,7 +367,7 @@ begin
if Assigned(FCapture) then
begin
SetCameraResolution;
FSourceThread.Capture := FCapture;
(FSourceThread as TocvCaptureThread).Capture := FCapture;
FSourceThread.Resume;
end;
end;
@ -360,13 +410,6 @@ end;
constructor TocvCustomSource.Create(AOwner: TComponent);
begin
inherited;
if not(csDesigning in ComponentState) then
begin
FSourceThread := TocvCaptureThread.Create(True);
FSourceThread.OnNotifyData := OnNotifyData;
FSourceThread.FThreadDelay := FThreadDelay;
FSourceThread.FreeOnTerminate := True;
end;
FThreadDelay := 10;
FEnabled := False;
end;
@ -393,17 +436,6 @@ begin
Result := 0;
end;
procedure TocvCustomSource.Loaded;
begin
inherited;
if Enabled and (not Assigned(FCapture)) then
begin
// Hack
FEnabled := False;
Enabled := True;
end;
end;
procedure TocvCustomSource.OnNotifyData(Sender: TObject; const IplImage: IocvImage);
begin
FImage := IplImage.Clone;
@ -430,11 +462,7 @@ end;
procedure TocvCustomSource.ReleaseSource;
begin
if Assigned(FCapture) then
begin
cvReleaseCapture(FCapture);
FCapture := nil;
end;
end;
{TocvFileSourceclass}
@ -475,7 +503,7 @@ begin
begin
if Assigned(FCapture) and FEnabled then
begin
FSourceThread.Capture := nil;
(FSourceThread as TocvCaptureThread).Capture := nil;
cvReleaseCapture(FCapture);
FCapture := Nil;
end;
@ -484,7 +512,7 @@ begin
FCapture := cvCreateFileCapture(PAnsiChar(AnsiString(FileName)));
if Assigned(FCapture) then
begin
FSourceThread.Capture := FCapture;
(FSourceThread as TocvCaptureThread).Capture := FCapture;
FSourceThread.Resume;
end;
end;
@ -521,7 +549,140 @@ begin
inherited;
end;
procedure TocvCustomSourceThread.SetCapture(const Value: pCvCapture);
{TocvIPCamSource}
constructor TocvIPCamSource.Create(AOwner: TComponent);
begin
inherited;
FPort := 554;
end;
function TocvIPCamSource.GetIPCamTarget: AnsiString;
begin
Result := 'rtsp://';
if Length(Trim(UserName)) <> 0 then
Result := Result + AnsiString(Trim(UserName)) + ':' + AnsiString(Trim(Password)) + '@';
Result := Result + AnsiString(IP) + ':' + AnsiString(IntToStr(Port));
if Length(Trim(URI)) > 0 then
begin
if (Result[Length(Result)] <> '/') and (URI[1] <> '/') then
Result := Result + '/';
Result := Result + AnsiString(URI);
end;
end;
procedure TocvIPCamSource.SetEnabled(Value: Boolean);
begin
if FEnabled <> Value then
begin
if not(csDesigning in ComponentState) then
begin
if Assigned(FCapture) and FEnabled then
begin
(FSourceThread as TocvCaptureThread).Capture := nil;
cvReleaseCapture(FCapture);
FCapture := Nil;
end;
if Value then
begin
FCapture := cvCreateFileCapture(PAnsiChar(GetIPCamTarget));
if Assigned(FCapture) then
begin
(FSourceThread as TocvCaptureThread).Capture := FCapture;
FSourceThread.Resume;
end;
end;
end;
FEnabled := Value;
end;
end;
{TocvCaptureSource}
constructor TocvCaptureSource.Create(AOwner: TComponent);
begin
inherited;
if not(csDesigning in ComponentState) then
begin
FSourceThread := TocvCaptureThread.Create(True);
FSourceThread.OnNotifyData := OnNotifyData;
FSourceThread.FThreadDelay := FThreadDelay;
FSourceThread.FreeOnTerminate := True;
end;
end;
procedure TocvCaptureSource.Loaded;
begin
inherited;
if Enabled and (not Assigned(FCapture)) then
begin
// Hack
FEnabled := False;
Enabled := True;
end;
end;
procedure TocvCaptureSource.ReleaseSource;
begin
inherited;
if Assigned(FCapture) then
begin
cvReleaseCapture(FCapture);
FCapture := nil;
end;
end;
{TocvFFMpegIPCamSource}
constructor TocvFFMpegIPCamSource.Create(AOwner: TComponent);
begin
inherited;
FPort := 554;
if not(csDesigning in ComponentState) then
begin
FSourceThread := TocvFFMpegIPCamSourceThread.Create(False);
FSourceThread.OnNotifyData := OnNotifyData;
FSourceThread.FThreadDelay := FThreadDelay;
FSourceThread.FreeOnTerminate := True;
end;
end;
function TocvFFMpegIPCamSource.GetIPCamTarget: AnsiString;
begin
Result := 'rtsp://';
if Length(Trim(UserName)) <> 0 then
Result := Result + AnsiString(Trim(UserName)) + ':' + AnsiString(Trim(Password)) + '@';
Result := Result + AnsiString(IP) + ':' + AnsiString(IntToStr(Port));
if Length(Trim(URI)) > 0 then
begin
if (Result[Length(Result)] <> '/') and (URI[1] <> '/') then
Result := Result + '/';
Result := Result + AnsiString(URI);
end;
end;
procedure TocvFFMpegIPCamSource.Loaded;
begin
inherited;
if Enabled then
begin
// Hack
FEnabled := False;
Enabled := True;
end;
end;
procedure TocvFFMpegIPCamSource.SetEnabled(Value: Boolean);
begin
if FEnabled <> Value then
begin
if not(csDesigning in ComponentState) then
(FSourceThread as TocvFFMpegIPCamSourceThread).SetIPCamUrl(GetIPCamTarget, Value);
FEnabled := Value;
end;
end;
procedure TocvCaptureThread.SetCapture(const Value: pCvCapture);
begin
FLock.Enter;
try
@ -531,50 +692,212 @@ begin
end;
end;
{TocvIPCamSource}
{TocvFFMpegIPCamSourceThread}
constructor TocvIPCamSource.Create(AOwner: TComponent);
constructor TocvFFMpegIPCamSourceThread.Create(CreateSuspended: Boolean);
begin
inherited;
FPort := 554;
inherited Create(False);
FSuspendEvent := TEvent.Create;
FSuspendEvent.ResetEvent;
end;
procedure TocvIPCamSource.SetEnabled(Value: Boolean);
Var
IPCam: AnsiString;
destructor TocvFFMpegIPCamSourceThread.Destroy;
begin
if FEnabled <> Value then
FSuspendEvent.Free;
inherited;
end;
procedure TocvFFMpegIPCamSourceThread.Execute;
Var
optionsDict: pAVDictionary;
pFormatCtx: pAVFormatContext;
pCodecCtx: pAVCodecContext;
pCodec: pAVCodec;
packet: TAVPacket;
img_convert_context: pSwsContext;
frame: pAVFrame;
iplframe: pIplImage;
procedure ReleaseAllocatedData;
begin
if not(csDesigning in ComponentState) then
if Assigned(pCodecCtx) then
begin
if Assigned(FCapture) and FEnabled then
avcodec_close(pCodecCtx);
pCodecCtx := nil;
end;
if Assigned(pFormatCtx) then
begin
avformat_close_input(pFormatCtx);
pFormatCtx := nil;
end;
if Assigned(iplframe) then
begin
cvReleaseImage(iplframe);
iplframe := nil;
end;
if Assigned(frame) then
begin
av_frame_free(frame);
frame := nil;
end;
if Assigned(optionsDict) then
begin
av_dict_free(optionsDict);
optionsDict := nil;
end;
end;
Var
i, ret, videoStream: Integer;
frame_finished: Integer;
linesize: array [0 .. 3] of Integer;
isReconnect: Boolean;
begin
av_register_all();
avformat_network_init();
optionsDict := nil;
pFormatCtx := nil;
pCodecCtx := nil;
iplframe := nil;
frame := nil;
isReconnect := False;
While (not Terminated) do
begin
FSuspendEvent.WaitFor;
if Terminated then
Break;
ReleaseAllocatedData;
if isReconnect then
begin
i := 0;
while (not Terminated) and (i < 10) do
begin
FSourceThread.Capture := nil;
cvReleaseCapture(FCapture);
FCapture := Nil;
Sleep(100);
Inc(i);
end;
if Value then
if Terminated then
Break;
isReconnect := False;
end;
av_dict_set(optionsDict, 'rtsp_transport', 'tcp', 0);
av_dict_set(optionsDict, 'stimeout', '1000000', 0);
ret := avformat_open_input(pFormatCtx, PAnsiChar(FIPCamURL), nil, @optionsDict); // pFormatCtx
if ret < 0 then
begin
isReconnect := True;
Continue;
end;
av_dict_free(optionsDict);
optionsDict := nil;
if avformat_find_stream_info(pFormatCtx, nil) < 0 then
begin
isReconnect := True;
Continue;
end;
// Dump information about file onto standard error
av_dump_format(pFormatCtx, 0, PAnsiChar(FIPCamURL), 0);
// Find the first video stream
videoStream := -1;
for i := 0 to pFormatCtx^.nb_streams - 1 do
if (pFormatCtx^.streams[i]^.codec^.codec_type = AVMEDIA_TYPE_VIDEO) then
begin
IPCam := 'rtsp://';
if Length(Trim(UserName)) <> 0 then
IPCam := IPCam + Trim(UserName) + ':' + Trim(Password) + '@';
IPCam := IPCam + IP + ':' + Port.ToString;
if Length(Trim(Postfix)) > 0 then
videoStream := i;
Break;
end;
if videoStream = -1 then
begin
isReconnect := True;
Continue;
end;
// Get a pointer to the codec context for the video stream
pCodecCtx := pFormatCtx^.streams[videoStream]^.codec; // pCodecCtx
// Find the decoder for the video stream
pCodec := avcodec_find_decoder(pCodecCtx^.codec_id);
if not Assigned(pCodec) then
begin
isReconnect := True;
Continue;
end;
if (pCodec^.capabilities and CODEC_CAP_TRUNCATED) = 0 then
pCodecCtx^.flags := pCodecCtx^.flags or CODEC_FLAG_TRUNCATED; (*we dont send complete frames*)
// Open codec
if avcodec_open2(pCodecCtx, pCodec, nil) < 0 then
begin
isReconnect := True;
Continue;
end;
img_convert_context := sws_getCachedContext(nil, pCodecCtx^.width, pCodecCtx^.height, pCodecCtx^.pix_fmt, pCodecCtx^.width,
pCodecCtx^.height, AV_PIX_FMT_BGR24, SWS_BILINEAR, nil, nil, nil);
if (img_convert_context = nil) then
begin
isReconnect := True;
Continue;
end;
frame := av_frame_alloc();
iplframe := cvCreateImage(CvSize(pCodecCtx^.width, pCodecCtx^.height), IPL_DEPTH_8U, 3); // iplframe
FillChar(linesize, SizeOf(linesize), 0);
linesize[0] := iplframe^.widthStep;
while (not Terminated) and (FSuspendEvent.WaitFor(0) = wrSignaled) do
begin
if av_read_frame(pFormatCtx, packet) >= 0 then
begin
if (packet.stream_index = videoStream) then
begin
if (IPCam[Length(IPCam)] <> '/') and (Postfix[1] <> '/') then
IPCam := IPCam + '/';
IPCam := IPCam + Postfix;
end;
FCapture := cvCreateFileCapture(PAnsiChar(IPCam));
if Assigned(FCapture) then
// Video stream packet
avcodec_decode_video2(pCodecCtx, frame, frame_finished, @packet);
if (frame_finished <> 0) then
begin
sws_scale(img_convert_context, @frame^.data, @frame^.linesize, 0, pCodecCtx^.height, @iplframe^.imageData, @linesize);
if Assigned(OnNotifyData) then
Synchronize(
procedure
begin
OnNotifyData(Self, TocvImage.CreateClone(iplframe));
end);
end;
end
else
begin
FSourceThread.Capture := FCapture;
FSourceThread.Resume;
isReconnect := True;
Break;
end;
end;
end;
FEnabled := Value;
end;
ReleaseAllocatedData;
avformat_network_deinit;
end;
procedure TocvFFMpegIPCamSourceThread.SetIPCamUrl(const AIPCam: AnsiString; const AEnabled: Boolean);
begin
if (FEnabled <> AEnabled) or (FIPCamURL <> AIPCam) then
begin
FSuspendEvent.ResetEvent;
FIPCamURL := AIPCam;
FEnabled := AEnabled;
if FEnabled then
FSuspendEvent.SetEvent;
end;
end;
procedure TocvFFMpegIPCamSourceThread.TerminatedSet;
begin
inherited;
FSuspendEvent.ResetEvent;
end;
end.

View File

@ -3,7 +3,7 @@
// Copyright (C) 2013 Project Delphi-OpenCV
// ****************************************************************
// Contributor:
// Laentir Valetov
// Laentir Valetov
// email:laex@bk.ru
// ****************************************************************
// You may retrieve the latest version of this file at the GitHub,
@ -80,7 +80,7 @@ Type
end;
TOnOcvNotifyCollectionItem = procedure(PrevOperation, Operation, NextOperation: TObject; const IplImage: IocvImage;
Var ContinueTransform:Boolean) of object;
Var ContinueTransform: Boolean) of object;
TOnOcvNotify = procedure(Sender: TObject; const IplImage: IocvImage) of object;
TOnOcvAfterTransform = TOnOcvNotify;

View File

@ -3,7 +3,7 @@
// Copyright (C) 2013 Project Delphi-OpenCV
// ****************************************************************
// Contributor:
// Laentir Valetov
// Laentir Valetov
// email:laex@bk.ru
// ****************************************************************
// You may retrieve the latest version of this file at the GitHub,
@ -167,7 +167,7 @@ begin
begin
w := cw;
h := Trunc(cw / xyaspect);
if h > ch then // woops, too big
if h > ch then // woops, too big
begin
h := ch;
w := Trunc(ch * xyaspect);
@ -177,7 +177,7 @@ begin
begin
h := ch;
w := Trunc(ch * xyaspect);
if w > cw then // woops, too big
if w > cw then // woops, too big
begin
w := cw;
h := Trunc(cw / xyaspect);

View File

@ -1,6 +1,8 @@
; ocvclass.def : Declares the module parameters for the DLL.
LIBRARY "ocvclasses.DLL"
LIBRARY "opencv_classes249d.dll"
DESCRIPTION 'Wrapper for OpenCV classes'
EXPORTS

View File

@ -45,14 +45,14 @@
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\OpenCV\build\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\OpenCV\build\x86\vc12\lib\;$(LibraryPath)</LibraryPath>
<OutDir>..\..\bin\</OutDir>
<OutDir>..\..\..\bin\Win32</OutDir>
<TargetName>opencv_classes249d</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>C:\OpenCV\build\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\OpenCV\build\x86\vc12\lib\;$(LibraryPath)</LibraryPath>
<OutDir>..\..\bin\</OutDir>
<OutDir>..\..\..\bin\Win32</OutDir>
<TargetName>opencv_classes249</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">