├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── bin ├── opencv_delphi4100.dll └── opencv_delphi4100d.dll ├── cvCheckDep ├── CheckCVDep.dpr ├── CheckCVDep.dproj ├── CheckCVDep.exe ├── CheckCVDep.res ├── uMainForm.dfm └── uMainForm.pas ├── docs └── README.md ├── opencv_delphi ├── delphi_export.h ├── dllmain.cpp ├── opencv_delphi.sln ├── opencv_delphi.vcxproj ├── opencv_delphi.vcxproj.filters └── opencv_delphi.vcxproj.user ├── packages ├── CVClass.pas ├── CVProp.pas ├── CVRegVCL.pas ├── Delphi 10.4 Sydney │ ├── CVClassGroup.groupproj │ ├── dclCVClass.dpk │ ├── dclCVClass.dproj │ ├── dclCVClass.res │ ├── dclCVClassResource.rc │ ├── rtlCVClass.dpk │ ├── rtlCVClass.dproj │ └── rtlCVClass.res ├── Delphi 11 Alexandria │ ├── CVClassGroup.groupproj │ ├── dclCVClass.dpk │ ├── dclCVClass.dproj │ ├── dclCVClass.res │ ├── dclCVClassResource.rc │ ├── rtlCVClass.dpk │ ├── rtlCVClass.dproj │ └── rtlCVClass.res ├── Delphi 12.0 Athens │ ├── CVClassGroup.groupproj │ ├── dclCVClass.dpk │ ├── dclCVClass.dproj │ ├── dclCVClass.res │ ├── dclCVClass.xml │ ├── dclCVClassResource.rc │ ├── rtlCVClass.dpk │ ├── rtlCVClass.dproj │ ├── rtlCVClass.res │ └── rtlCVClass.xml └── resource │ ├── CVCaptureSource.bmp │ ├── CVVideoWriter.bmp │ ├── CVView.bmp │ └── DCV32x32.bmp ├── redist └── opencv_delphi4100.zip ├── samples ├── Component │ └── videocapture_basic │ │ ├── uMain.dfm │ │ ├── uMain.pas │ │ ├── videocapture.dpr │ │ ├── videocapture.dproj │ │ └── videocapture.res ├── Samples.groupproj ├── cpp │ ├── bgfg_segm │ │ ├── bgfg_segm.dpr │ │ ├── bgfg_segm.dproj │ │ └── bgfg_segm.res │ ├── camshiftdemo │ │ ├── camshiftdemo.dpr │ │ ├── camshiftdemo.dproj │ │ └── camshiftdemo.res │ ├── contours2 │ │ ├── contours2.dpr │ │ ├── contours2.dproj │ │ └── contours2.res │ ├── convexhull │ │ ├── cvconvexhull.dpr │ │ ├── cvconvexhull.dproj │ │ └── cvconvexhull.res │ ├── delaunay2 │ │ ├── delaunay2.dpr │ │ ├── delaunay2.dproj │ │ └── delaunay2.res │ ├── dft │ │ ├── cvdft.dpr │ │ ├── cvdft.dproj │ │ └── cvdft.res │ ├── dis_opticalflow │ │ ├── dis_opticalflow.dpr │ │ ├── dis_opticalflow.dproj │ │ └── dis_opticalflow.res │ ├── distrans │ │ ├── distrans.dpr │ │ ├── distrans.dproj │ │ └── distrans.res │ ├── dnn │ │ ├── human_parsing │ │ │ ├── human_parsing.dpr │ │ │ ├── human_parsing.dproj │ │ │ └── human_parsing.res │ │ └── scene_text_recognition │ │ │ ├── scene_text_recognition.dpr │ │ │ ├── scene_text_recognition.dproj │ │ │ └── scene_text_recognition.res │ ├── drawing │ │ ├── drawing.dpr │ │ ├── drawing.dproj │ │ └── drawing.res │ ├── edge │ │ ├── edge.dpr │ │ ├── edge.dproj │ │ └── edge.res │ ├── facedetect │ │ ├── facedetect.dpr │ │ ├── facedetect.dproj │ │ └── facedetect.res │ ├── facial_features │ │ ├── facial_features.dpr │ │ ├── facial_features.dproj │ │ └── facial_features.res │ ├── grabcut │ │ ├── cvgrabcut.dpr │ │ ├── cvgrabcut.dproj │ │ └── cvgrabcut.res │ ├── inpaint │ │ ├── cvinpaint.dpr │ │ ├── cvinpaint.dproj │ │ └── cvinpaint.res │ ├── kalman │ │ ├── kalman.dpr │ │ ├── kalman.dproj │ │ └── kalman.res │ ├── laplace │ │ ├── cv_laplace.dpr │ │ ├── cv_laplace.dproj │ │ └── cv_laplace.res │ ├── lkdemo │ │ ├── lkdemo.dpr │ │ ├── lkdemo.dproj │ │ └── lkdemo.res │ ├── minarea │ │ ├── minarea.dpr │ │ ├── minarea.dproj │ │ └── minarea.res │ ├── morphology2 │ │ ├── morphology2.dpr │ │ ├── morphology2.dproj │ │ └── morphology2.res │ ├── neural_network │ │ ├── neural_network.dpr │ │ ├── neural_network.dproj │ │ └── neural_network.res │ ├── opencv_version │ │ ├── opencv_version.dpr │ │ ├── opencv_version.dproj │ │ └── opencv_version.res │ ├── peopledetect │ │ ├── peopledetect.dpr │ │ ├── peopledetect.dproj │ │ └── peopledetect.res │ ├── phase_corr │ │ ├── phase_corr.dpr │ │ ├── phase_corr.dproj │ │ └── phase_corr.res │ ├── qrcode │ │ ├── qrcode.dpr │ │ ├── qrcode.dproj │ │ └── qrcode.res │ ├── segment_objects │ │ ├── segment_objects.dpr │ │ ├── segment_objects.dproj │ │ └── segment_objects.res │ ├── stitching │ │ ├── stitching.dpr │ │ ├── stitching.dproj │ │ └── stitching.res │ ├── tutorial_code │ │ ├── HighGUI │ │ │ └── BasicLinearTransformsTrackbar │ │ │ │ ├── BasicLinearTransformsTrackbar.dpr │ │ │ │ ├── BasicLinearTransformsTrackbar.dproj │ │ │ │ └── BasicLinearTransformsTrackbar.res │ │ ├── Histograms_Matching │ │ │ └── calcHist_Demo │ │ │ │ ├── calcHist_Demo.dpr │ │ │ │ ├── calcHist_Demo.dproj │ │ │ │ └── calcHist_Demo.res │ │ ├── ImgProc │ │ │ ├── Smoothing │ │ │ │ ├── Smoothing.dpr │ │ │ │ ├── Smoothing.dproj │ │ │ │ └── Smoothing.res │ │ │ ├── Threshold │ │ │ │ ├── Thresholdp.dpr │ │ │ │ ├── Thresholdp.dproj │ │ │ │ └── Thresholdp.res │ │ │ └── morph_lines_detection │ │ │ │ ├── morph_lines_detection.dpr │ │ │ │ ├── morph_lines_detection.dproj │ │ │ │ └── morph_lines_detection.res │ │ ├── ImgTrans │ │ │ └── CannyDetector_Demo │ │ │ │ ├── CannyDetector_Demo.dpr │ │ │ │ ├── CannyDetector_Demo.dproj │ │ │ │ └── CannyDetector_Demo.res │ │ ├── TrackingMotion │ │ │ ├── cornerDetector_Demo │ │ │ │ ├── cornerDetector_Demo.dpr │ │ │ │ ├── cornerDetector_Demo.dproj │ │ │ │ └── cornerDetector_Demo.res │ │ │ └── goodFeaturesToTrack_Demo │ │ │ │ ├── goodFeaturesToTrack_Demo.dpr │ │ │ │ ├── goodFeaturesToTrack_Demo.dproj │ │ │ │ └── goodFeaturesToTrack_Demo.res │ │ ├── core │ │ │ └── AddingImages │ │ │ │ ├── AddingImages.dpr │ │ │ │ ├── AddingImages.dproj │ │ │ │ └── AddingImages.res │ │ ├── ml │ │ │ └── introduction_to_svm │ │ │ │ ├── introduction_to_svm.dpr │ │ │ │ ├── introduction_to_svm.dproj │ │ │ │ └── introduction_to_svm.res │ │ ├── objectDetection │ │ │ ├── objectDetection.dpr │ │ │ ├── objectDetection.dproj │ │ │ └── objectDetection.res │ │ ├── photo │ │ │ ├── decolorization │ │ │ │ ├── cvdecolor.dpr │ │ │ │ ├── cvdecolor.dproj │ │ │ │ └── cvdecolor.res │ │ │ └── non_photorealistic_rendering │ │ │ │ ├── npr_demo.dpr │ │ │ │ ├── npr_demo.dproj │ │ │ │ └── npr_demo.res │ │ ├── snippets │ │ │ └── imgproc_segmentation │ │ │ │ ├── imgproc_segmentation.dpr │ │ │ │ ├── imgproc_segmentation.dproj │ │ │ │ └── imgproc_segmentation.res │ │ ├── video │ │ │ └── optical_flow │ │ │ │ ├── optical_flow.dpr │ │ │ │ ├── optical_flow.dproj │ │ │ │ └── optical_flow.res │ │ └── videoio │ │ │ └── video-write │ │ │ ├── video_write.dpr │ │ │ ├── video_write.dproj │ │ │ └── video_write.res │ ├── videocapture_audio │ │ ├── videocapture_audio.dpr │ │ ├── videocapture_audio.dproj │ │ └── videocapture_audio.res │ ├── videocapture_basic │ │ ├── videocapture_basic.dpr │ │ ├── videocapture_basic.dproj │ │ └── videocapture_basic.res │ ├── videocapture_image_sequence │ │ ├── videocapture_image_sequence.dpr │ │ ├── videocapture_image_sequence.dproj │ │ └── videocapture_image_sequence.res │ ├── videocapture_microphone │ │ ├── videocapture_microphone.dpr │ │ ├── videocapture_microphone.dproj │ │ └── videocapture_microphone.res │ └── videocapture_realsense │ │ ├── videocapture_realsense.dpr │ │ ├── videocapture_realsense.dproj │ │ └── videocapture_realsense.res ├── std │ ├── StdTest.dpr │ ├── StdTest.dproj │ └── StdTest.res ├── tapi │ ├── clahe.dpr │ ├── clahe.dproj │ ├── clahe.dsv │ └── clahe.res └── warpAffine │ ├── WarpAffine_Test.dpr │ ├── WarpAffine_Test.dproj │ └── WarpAffine_Test.res └── source ├── CmdLineParser.pas ├── calib3d.inc ├── core.inc ├── core ├── async.inc ├── base.impl.inc ├── base.inc ├── check.impl.inc ├── check.inc ├── core_c.impl.inc ├── core_c.inc ├── cuda.inc ├── cuda.inl.inc ├── cuda_types.inc ├── cv_cpu_dispatch.inc ├── cvdef.impl.inc ├── cvdef.inc ├── cvstd.impl.inc ├── cvstd.inc ├── cvstd.inl.inc ├── fast_math.impl.inc ├── fast_math.inc ├── hal │ ├── interface.impl.inc │ ├── interface.inc │ └── interface.init.inc ├── mat.impl.inc ├── mat.inc ├── matx.impl.inc ├── matx.inc ├── operations.inc ├── optim.inc ├── ovx.inc ├── persistence.impl.inc ├── persistence.inc ├── saturate.impl.inc ├── saturate.inc ├── traits.impl.inc ├── traits.inc ├── types.inc ├── types_c.impl.inc ├── types_c.inc ├── utility.impl.inc ├── utility.inc └── version.inc ├── cpp.utils.pas ├── cv.external.pas ├── cv.opencv.pas ├── cv.resource.pas ├── cv.utils.pas ├── cvconfig.inc ├── dnn.inc ├── dnn ├── dict.inc ├── dnn.impl.inc ├── dnn.inc ├── dnn.inl.inc ├── layer.inc ├── utils │ └── inference_engine.inc └── version.inc ├── external ├── opencv.external.inc ├── opencv.types.inc └── std.external.inc ├── features2d.inc ├── flann.inc ├── flann ├── any.inc ├── config.inc ├── defines.inc ├── flann_base.inc ├── general.inc ├── matrix.inc ├── miniflann.inc ├── params.inc └── saving.inc ├── highgui.inc ├── highgui ├── highgui_c.impl.inc └── highgui_c.inc ├── imgcodecs.inc ├── imgcodecs └── imgcodecs.inc ├── imgproc.inc ├── imgproc ├── imgproc_c.impl.inc ├── imgproc_c.inc ├── segmentation.impl.inc ├── segmentation.inc ├── types_c.impl.inc └── types_c.inc ├── ml.inc ├── ml └── ml.inl.inc ├── objdetect.inc ├── objdetect ├── detection_based_tracker.inc └── face.inc ├── opencv_modules.inc ├── opt.inc ├── photo.inc ├── stitching.impl.inc ├── stitching.inc ├── stitching ├── detail │ ├── blenders.inc │ ├── camera.inc │ ├── exposure_compensate.inc │ ├── matchers.inc │ ├── motion_estimators.inc │ ├── seam_finders.inc │ ├── util.inc │ ├── util_inl.inc │ ├── warpers.inc │ └── warpers_inl.inc └── warpers.inc ├── vectortype.inc ├── video.impl.inc ├── video.inc ├── video ├── background_segm.impl.inc ├── background_segm.inc ├── tracking.impl.inc └── tracking.inc ├── videoio.impl.inc └── videoio.inc /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [Laex] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | #patreon: # Replace with a single Patreon username 5 | #open_collective: # Replace with a single Open Collective username 6 | #ko_fi: # Replace with a single Ko-fi username 7 | #tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | #community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | #liberapay: # Replace with a single Liberapay username 10 | #issuehunt: # Replace with a single IssueHunt username 11 | #otechie: # Replace with a single Otechie username 12 | custom: ['https://github.com/Laex/Delphi-OpenCV-Class','https://github.com/Laex/Delphi-OpenCV']# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | # 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | #*.res 7 | # 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | # 28 | 29 | # Project temp directory 30 | 31 | # Delphi compiler-generated binaries (safe to delete) 32 | *.exe 33 | *.dll 34 | !opencv_delphi*.dll 35 | !/cvCheckDep/CheckCVDep.exe 36 | *.dsv 37 | *.bpl 38 | *.bpi 39 | *.dcp 40 | *.so 41 | *.apk 42 | *.drc 43 | *.map 44 | *.dres 45 | *.rsm 46 | *.tds 47 | *.dcu 48 | *.lib 49 | *.a 50 | *.o 51 | *.ocx 52 | *.json 53 | 54 | # Delphi local files (user-specific info) 55 | *.local 56 | *.identcache 57 | *.projdata 58 | *.tvsconfig 59 | *.dsk 60 | 61 | # Delphi history and backups 62 | _* 63 | *.~* 64 | 65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 66 | *.stat 67 | 68 | # Boss dependency manager vendor folder https://github.com/HashLoad/boss 69 | modules/ 70 | 71 | # Resource 72 | *.jpg 73 | *.png 74 | *.avi 75 | 76 | # opencv_delphi 77 | *.pb 78 | x64/ 79 | .vs/ 80 | opencv_delphi.tlog/ 81 | *.xml -------------------------------------------------------------------------------- /bin/opencv_delphi4100.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/bin/opencv_delphi4100.dll -------------------------------------------------------------------------------- /bin/opencv_delphi4100d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/bin/opencv_delphi4100d.dll -------------------------------------------------------------------------------- /cvCheckDep/CheckCVDep.dpr: -------------------------------------------------------------------------------- 1 | program CheckCVDep; 2 | 3 | uses 4 | Vcl.Forms, 5 | uMainForm in 'uMainForm.pas' {MainForm}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TMainForm, MainForm); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /cvCheckDep/CheckCVDep.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/cvCheckDep/CheckCVDep.exe -------------------------------------------------------------------------------- /cvCheckDep/CheckCVDep.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/cvCheckDep/CheckCVDep.res -------------------------------------------------------------------------------- /cvCheckDep/uMainForm.dfm: -------------------------------------------------------------------------------- 1 | object MainForm: TMainForm 2 | Left = 0 3 | Top = 0 4 | Caption = 'Verifying OpenCV dependencies' 5 | ClientHeight = 581 6 | ClientWidth = 486 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | Position = poScreenCenter 14 | OnActivate = FormActivate 15 | DesignSize = ( 16 | 486 17 | 581) 18 | TextHeight = 13 19 | object btn1: TButton 20 | Left = 8 21 | Top = 24 22 | Width = 189 23 | Height = 25 24 | Caption = 'Verifying OpenCV dependencies' 25 | TabOrder = 0 26 | OnClick = btn1Click 27 | end 28 | object pb1: TProgressBar 29 | Left = 8 30 | Top = 64 31 | Width = 470 32 | Height = 13 33 | Anchors = [akLeft, akTop, akRight] 34 | TabOrder = 1 35 | ExplicitWidth = 627 36 | end 37 | object redt1: TRichEdit 38 | Left = 0 39 | Top = 84 40 | Width = 486 41 | Height = 497 42 | Align = alBottom 43 | Anchors = [akLeft, akTop, akRight, akBottom] 44 | Font.Charset = RUSSIAN_CHARSET 45 | Font.Color = clWindowText 46 | Font.Height = -11 47 | Font.Name = 'Tahoma' 48 | Font.Style = [] 49 | Lines.Strings = ( 50 | 'redt1') 51 | ParentFont = False 52 | ReadOnly = True 53 | ScrollBars = ssBoth 54 | TabOrder = 2 55 | ExplicitTop = 83 56 | ExplicitHeight = 487 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /opencv_delphi/dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "delphi_export.h" 2 | 3 | BOOL APIENTRY DllMain( HMODULE hModule, 4 | DWORD ul_reason_for_call, 5 | LPVOID lpReserved 6 | ) 7 | { 8 | switch (ul_reason_for_call) 9 | { 10 | case DLL_PROCESS_ATTACH: 11 | case DLL_THREAD_ATTACH: 12 | case DLL_THREAD_DETACH: 13 | case DLL_PROCESS_DETACH: 14 | break; 15 | } 16 | return TRUE; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /opencv_delphi/opencv_delphi.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29403.142 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opencv_delphi", "opencv_delphi.vcxproj", "{4295F469-1E61-49F0-9601-F739F23B246F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {4295F469-1E61-49F0-9601-F739F23B246F}.Debug|x64.ActiveCfg = Debug|x64 15 | {4295F469-1E61-49F0-9601-F739F23B246F}.Debug|x64.Build.0 = Debug|x64 16 | {4295F469-1E61-49F0-9601-F739F23B246F}.Release|x64.ActiveCfg = Release|x64 17 | {4295F469-1E61-49F0-9601-F739F23B246F}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {9304D16F-B8D4-4E3A-A246-3039CFB53A8C} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /opencv_delphi/opencv_delphi.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Файлы заголовков 20 | 21 | 22 | 23 | 24 | Исходные файлы 25 | 26 | 27 | -------------------------------------------------------------------------------- /opencv_delphi/opencv_delphi.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | WindowsLocalDebugger 7 | 8 | 9 | 10 | 11 | WindowsLocalDebugger 12 | 13 | -------------------------------------------------------------------------------- /packages/CVRegVCL.pas: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | unit CVRegVCL; 23 | 24 | {$I opt.inc} 25 | 26 | interface 27 | 28 | procedure Register; 29 | 30 | implementation 31 | 32 | uses 33 | Windows, 34 | System.SysUtils, 35 | System.Classes, 36 | DesignIntf, 37 | ToolsAPI, 38 | CVClass; 39 | 40 | {$I 'core\version.inc'} 41 | 42 | const 43 | PackageText = 'Delphi binding for OpenCV'; 44 | 45 | resourcestring 46 | resPackageName = PackageText + ' ' + CV_VERSION; 47 | resAboutDescription = PackageText; 48 | resAboutURL = 'https://github.com/Laex/Delphi-OpenCV-Class/'; 49 | resAboutCopyright = 'Copyright (c) 2024 Laentir Valetov'; 50 | resLicense = 'Apache-2.0 License'; 51 | // 52 | ResENoSplashServices = 'Unable to get Borland Splash Services'; 53 | ResENoAboutServices = 'Unable to get Borland About Services'; 54 | 55 | procedure Register; 56 | begin 57 | RegisterClasses([TCVWebCameraSource, TCVFileSource]); 58 | RegisterComponents('OpenCV', [TCVView, TCVCaptureSource, TCVVideoWriter]); 59 | end; 60 | 61 | var 62 | AboutBoxServices: IOTAAboutBoxServices = nil; 63 | AboutBoxIndex: Integer = 0; 64 | 65 | procedure RegisterAboutBox; 66 | var 67 | ProductImage: HBITMAP; 68 | begin 69 | Supports(BorlandIDEServices, IOTAAboutBoxServices, AboutBoxServices); 70 | Assert(Assigned(AboutBoxServices), ResENoAboutServices); 71 | ProductImage := LoadBitmap(FindResourceHInstance(HInstance), 'DOCVSPLASH'); 72 | AboutBoxIndex := AboutBoxServices.AddPluginInfo(resPackageName, resAboutDescription, ProductImage, False, resLicense); 73 | end; 74 | 75 | procedure UnregisterAboutBox; 76 | begin 77 | if (AboutBoxIndex <> 0) and Assigned(AboutBoxServices) then 78 | begin 79 | AboutBoxServices.RemovePluginInfo(AboutBoxIndex); 80 | AboutBoxIndex := 0; 81 | AboutBoxServices := nil; 82 | end; 83 | end; 84 | 85 | procedure RegisterSplashScreen; 86 | var 87 | ProductImage: HBITMAP; 88 | begin 89 | Assert(Assigned(SplashScreenServices), ResENoSplashServices); 90 | ProductImage := LoadBitmap(FindResourceHInstance(HInstance), 'DOCVSPLASH'); 91 | SplashScreenServices.AddPluginBitmap(resPackageName, ProductImage, False, resLicense); 92 | end; 93 | 94 | initialization 95 | 96 | RegisterSplashScreen; 97 | RegisterAboutBox; 98 | 99 | finalization 100 | 101 | UnregisterAboutBox; 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /packages/Delphi 10.4 Sydney/CVClassGroup.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {9D8D18F2-680C-4B6E-BA99-948A6FC54221} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Default.Personality.12 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /packages/Delphi 10.4 Sydney/dclCVClass.dpk: -------------------------------------------------------------------------------- 1 | package dclCVClass; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS ON} 17 | {$RANGECHECKS ON} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$DEFINE PACKAGE} 28 | {$ENDIF IMPLICITBUILDING} 29 | {$DESCRIPTION 'Design time Delphi-OpenCV for C++ classes'} 30 | {$LIBSUFFIX '280'} 31 | {$IMPLICITBUILD ON} 32 | 33 | requires 34 | rtl, 35 | designide; 36 | 37 | contains 38 | CVClass in '..\CVClass.pas', 39 | CVProp in '..\CVProp.pas', 40 | CVRegVCL in '..\CVRegVCL.pas'; 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /packages/Delphi 10.4 Sydney/dclCVClass.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/packages/Delphi 10.4 Sydney/dclCVClass.res -------------------------------------------------------------------------------- /packages/Delphi 10.4 Sydney/dclCVClassResource.rc: -------------------------------------------------------------------------------- 1 | DOCVSPLASH BITMAP "..\\resource\\CVClass.bmp" 2 | TCVVIEW BITMAP "..\\resource\\CVView.bmp" 3 | TCVCAPTURESOURCE BITMAP "..\\resource\\CVCaptureSource.bmp" 4 | TCVVIDEOWRITER BITMAP "..\\resource\\CVVideoWriter.bmp" 5 | -------------------------------------------------------------------------------- /packages/Delphi 10.4 Sydney/rtlCVClass.dpk: -------------------------------------------------------------------------------- 1 | package rtlCVClass; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS ON} 17 | {$RANGECHECKS ON} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$DEFINE PACKAGE} 28 | {$ENDIF IMPLICITBUILDING} 29 | {$DESCRIPTION 'Run time Delphi-OpenCV for C++ classes'} 30 | {$LIBSUFFIX '280'} 31 | {$RUNONLY} 32 | {$IMPLICITBUILD ON} 33 | 34 | requires 35 | rtl, 36 | vcl; 37 | 38 | contains 39 | cpp.utils in '..\..\source\cpp.utils.pas', 40 | cv.opencv in '..\..\source\cv.opencv.pas', 41 | cv.external in '..\..\source\cv.external.pas'; 42 | 43 | end. 44 | 45 | -------------------------------------------------------------------------------- /packages/Delphi 10.4 Sydney/rtlCVClass.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/packages/Delphi 10.4 Sydney/rtlCVClass.res -------------------------------------------------------------------------------- /packages/Delphi 11 Alexandria/CVClassGroup.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {9D8D18F2-680C-4B6E-BA99-948A6FC54221} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Default.Personality.12 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /packages/Delphi 11 Alexandria/dclCVClass.dpk: -------------------------------------------------------------------------------- 1 | package dclCVClass; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS ON} 17 | {$RANGECHECKS ON} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$DEFINE PACKAGE} 28 | {$ENDIF IMPLICITBUILDING} 29 | {$DESCRIPTION 'Design time Delphi-OpenCV for C++ classes'} 30 | {$LIBSUFFIX AUTO} 31 | {$IMPLICITBUILD ON} 32 | 33 | requires 34 | rtl, 35 | designide; 36 | 37 | contains 38 | CVClass in '..\CVClass.pas', 39 | CVProp in '..\CVProp.pas', 40 | CVRegVCL in '..\CVRegVCL.pas'; 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /packages/Delphi 11 Alexandria/dclCVClass.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/packages/Delphi 11 Alexandria/dclCVClass.res -------------------------------------------------------------------------------- /packages/Delphi 11 Alexandria/dclCVClassResource.rc: -------------------------------------------------------------------------------- 1 | DOCVSPLASH BITMAP "..\\resource\\CVClass.bmp" 2 | TCVVIEW BITMAP "..\\resource\\CVView.bmp" 3 | TCVCAPTURESOURCE BITMAP "..\\resource\\CVCaptureSource.bmp" 4 | TCVVIDEOWRITER BITMAP "..\\resource\\CVVideoWriter.bmp" 5 | -------------------------------------------------------------------------------- /packages/Delphi 11 Alexandria/rtlCVClass.dpk: -------------------------------------------------------------------------------- 1 | package rtlCVClass; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS ON} 17 | {$RANGECHECKS ON} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$DEFINE PACKAGE} 28 | {$ENDIF IMPLICITBUILDING} 29 | {$DESCRIPTION 'Run time Delphi-OpenCV for C++ classes'} 30 | {$LIBSUFFIX AUTO} 31 | {$RUNONLY} 32 | {$IMPLICITBUILD ON} 33 | 34 | requires 35 | rtl, 36 | vcl; 37 | 38 | end. 39 | 40 | -------------------------------------------------------------------------------- /packages/Delphi 11 Alexandria/rtlCVClass.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/packages/Delphi 11 Alexandria/rtlCVClass.res -------------------------------------------------------------------------------- /packages/Delphi 12.0 Athens/CVClassGroup.groupproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {5CA214BC-3C54-4181-8E53-84B8B2985BA5} 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Default.Personality.12 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /packages/Delphi 12.0 Athens/dclCVClass.dpk: -------------------------------------------------------------------------------- 1 | package dclCVClass; 2 | 3 | {$R *.res} 4 | {$R *.dres} 5 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 6 | {$ALIGN 8} 7 | {$ASSERTIONS ON} 8 | {$BOOLEVAL OFF} 9 | {$DEBUGINFO OFF} 10 | {$EXTENDEDSYNTAX ON} 11 | {$IMPORTEDDATA ON} 12 | {$IOCHECKS ON} 13 | {$LOCALSYMBOLS ON} 14 | {$LONGSTRINGS ON} 15 | {$OPENSTRINGS ON} 16 | {$OPTIMIZATION OFF} 17 | {$OVERFLOWCHECKS ON} 18 | {$RANGECHECKS ON} 19 | {$REFERENCEINFO ON} 20 | {$SAFEDIVIDE OFF} 21 | {$STACKFRAMES ON} 22 | {$TYPEDADDRESS OFF} 23 | {$VARSTRINGCHECKS ON} 24 | {$WRITEABLECONST OFF} 25 | {$MINENUMSIZE 1} 26 | {$IMAGEBASE $400000} 27 | {$DEFINE DEBUG} 28 | {$DEFINE PACKAGE} 29 | {$ENDIF IMPLICITBUILDING} 30 | {$DESCRIPTION 'Design time Delphi-OpenCV for C++ classes'} 31 | {$LIBSUFFIX AUTO} 32 | {$IMPLICITBUILD ON} 33 | 34 | requires 35 | rtl, 36 | designide, 37 | rtlCVClass; 38 | 39 | contains 40 | CVClass in '..\CVClass.pas', 41 | CVProp in '..\CVProp.pas', 42 | CVRegVCL in '..\CVRegVCL.pas', 43 | cpp.utils in '..\..\source\cpp.utils.pas', 44 | cv.external in '..\..\source\cv.external.pas', 45 | cv.opencv in '..\..\source\cv.opencv.pas', 46 | cv.utils in '..\..\source\cv.utils.pas'; 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /packages/Delphi 12.0 Athens/dclCVClass.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/packages/Delphi 12.0 Athens/dclCVClass.res -------------------------------------------------------------------------------- /packages/Delphi 12.0 Athens/dclCVClass.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/Delphi 12.0 Athens/dclCVClassResource.rc: -------------------------------------------------------------------------------- 1 | DOCVSPLASH BITMAP "..\\resource\\DCV32x32.bmp" 2 | TCVCAPTURESOURCE BITMAP "..\\resource\\CVCaptureSource.bmp" 3 | TCVVIDEOWRITER BITMAP "..\\resource\\CVVideoWriter.bmp" 4 | TCVVIEW BITMAP "..\\resource\\CVView.bmp" 5 | -------------------------------------------------------------------------------- /packages/Delphi 12.0 Athens/rtlCVClass.dpk: -------------------------------------------------------------------------------- 1 | package rtlCVClass; 2 | 3 | {$R *.res} 4 | {$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} 5 | {$ALIGN 8} 6 | {$ASSERTIONS ON} 7 | {$BOOLEVAL OFF} 8 | {$DEBUGINFO OFF} 9 | {$EXTENDEDSYNTAX ON} 10 | {$IMPORTEDDATA ON} 11 | {$IOCHECKS ON} 12 | {$LOCALSYMBOLS ON} 13 | {$LONGSTRINGS ON} 14 | {$OPENSTRINGS ON} 15 | {$OPTIMIZATION OFF} 16 | {$OVERFLOWCHECKS ON} 17 | {$RANGECHECKS ON} 18 | {$REFERENCEINFO ON} 19 | {$SAFEDIVIDE OFF} 20 | {$STACKFRAMES ON} 21 | {$TYPEDADDRESS OFF} 22 | {$VARSTRINGCHECKS ON} 23 | {$WRITEABLECONST OFF} 24 | {$MINENUMSIZE 1} 25 | {$IMAGEBASE $400000} 26 | {$DEFINE DEBUG} 27 | {$DEFINE PACKAGE} 28 | {$ENDIF IMPLICITBUILDING} 29 | {$DESCRIPTION 'Run time Delphi-OpenCV for C++ classes'} 30 | {$LIBSUFFIX AUTO} 31 | {$RUNONLY} 32 | {$IMPLICITBUILD ON} 33 | 34 | requires 35 | rtl, 36 | vcl; 37 | 38 | end. 39 | 40 | -------------------------------------------------------------------------------- /packages/Delphi 12.0 Athens/rtlCVClass.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/packages/Delphi 12.0 Athens/rtlCVClass.res -------------------------------------------------------------------------------- /packages/Delphi 12.0 Athens/rtlCVClass.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/resource/CVCaptureSource.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/packages/resource/CVCaptureSource.bmp -------------------------------------------------------------------------------- /packages/resource/CVVideoWriter.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/packages/resource/CVVideoWriter.bmp -------------------------------------------------------------------------------- /packages/resource/CVView.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/packages/resource/CVView.bmp -------------------------------------------------------------------------------- /packages/resource/DCV32x32.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/packages/resource/DCV32x32.bmp -------------------------------------------------------------------------------- /redist/opencv_delphi4100.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/redist/opencv_delphi4100.zip -------------------------------------------------------------------------------- /samples/Component/videocapture_basic/uMain.dfm: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 0 3 | Top = 0 4 | Caption = 'VideoCapture' 5 | ClientHeight = 412 6 | ClientWidth = 1091 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -12 11 | Font.Name = 'Segoe UI' 12 | Font.Style = [] 13 | OnCreate = FormCreate 14 | TextHeight = 15 15 | object lbl1: TLabel 16 | Left = 372 17 | Top = 348 18 | Width = 305 19 | Height = 49 20 | AutoSize = False 21 | Caption = 'lbl1' 22 | WordWrap = True 23 | end 24 | object lbl2: TLabel 25 | Left = 732 26 | Top = 348 27 | Width = 305 28 | Height = 49 29 | AutoSize = False 30 | Caption = 'lbl1' 31 | WordWrap = True 32 | end 33 | object cvw1: TCVView 34 | Left = 8 35 | Top = 32 36 | Width = 305 37 | Height = 305 38 | Source = cvcptrsrcWebCam 39 | end 40 | object cvw2: TCVView 41 | Left = 372 42 | Top = 32 43 | Width = 305 44 | Height = 305 45 | Source = cvcptrsrcFile 46 | end 47 | object cvw3: TCVView 48 | Left = 732 49 | Top = 32 50 | Width = 305 51 | Height = 305 52 | Source = cvcptrsrcStream 53 | end 54 | object chk1: TCheckBox 55 | Left = 8 56 | Top = 8 57 | Width = 305 58 | Height = 17 59 | Caption = 'Web camera' 60 | TabOrder = 3 61 | OnClick = chk1Click 62 | end 63 | object chk2: TCheckBox 64 | Left = 372 65 | Top = 8 66 | Width = 305 67 | Height = 17 68 | Caption = 'File' 69 | TabOrder = 4 70 | OnClick = chk2Click 71 | end 72 | object chk3: TCheckBox 73 | Left = 732 74 | Top = 8 75 | Width = 305 76 | Height = 17 77 | Caption = 'IP Stream' 78 | TabOrder = 5 79 | OnClick = chk3Click 80 | end 81 | object cvcptrsrcWebCam: TCVCaptureSource 82 | SourceTypeClassName = 'TCVWebCameraSource' 83 | Left = 24 84 | Top = 52 85 | end 86 | object cvcptrsrcFile: TCVCaptureSource 87 | SourceTypeClassName = 'TCVFileSource' 88 | SourceType.Delay = 40 89 | SourceType.Loop = True 90 | Left = 384 91 | Top = 56 92 | end 93 | object cvcptrsrcStream: TCVCaptureSource 94 | SourceTypeClassName = 'TCVFileSource' 95 | SourceType.Delay = 40 96 | SourceType.FileName = 'rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4' 97 | Left = 744 98 | Top = 56 99 | end 100 | end 101 | -------------------------------------------------------------------------------- /samples/Component/videocapture_basic/uMain.pas: -------------------------------------------------------------------------------- 1 | unit uMain; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, CVClass, 8 | cv.resource, Vcl.StdCtrls; 9 | 10 | type 11 | TForm1 = class(TForm) 12 | cvcptrsrcWebCam: TCVCaptureSource; 13 | cvcptrsrcFile: TCVCaptureSource; 14 | cvcptrsrcStream: TCVCaptureSource; 15 | cvw1: TCVView; 16 | cvw2: TCVView; 17 | cvw3: TCVView; 18 | chk1: TCheckBox; 19 | chk2: TCheckBox; 20 | chk3: TCheckBox; 21 | lbl1: TLabel; 22 | lbl2: TLabel; 23 | procedure FormCreate(Sender: TObject); 24 | procedure chk1Click(Sender: TObject); 25 | procedure chk2Click(Sender: TObject); 26 | procedure chk3Click(Sender: TObject); 27 | private 28 | { Private declarations } 29 | public 30 | { Public declarations } 31 | end; 32 | 33 | var 34 | Form1: TForm1; 35 | 36 | implementation 37 | 38 | {$R *.dfm} 39 | 40 | procedure TForm1.chk1Click(Sender: TObject); 41 | begin 42 | cvcptrsrcWebCam.Enabled := chk1.Checked; 43 | end; 44 | 45 | procedure TForm1.chk2Click(Sender: TObject); 46 | begin 47 | cvcptrsrcFile.Enabled := chk2.Checked; 48 | end; 49 | 50 | procedure TForm1.chk3Click(Sender: TObject); 51 | begin 52 | cvcptrsrcStream.Enabled := chk3.Checked; 53 | end; 54 | 55 | procedure TForm1.FormCreate(Sender: TObject); 56 | begin 57 | With (cvcptrsrcFile.SourceType as TCVFileSource) do 58 | begin 59 | FileName := OpenCVData + 'Megamind.avi'; 60 | lbl1.Caption := FileName; 61 | end; 62 | 63 | With (cvcptrsrcStream.SourceType as TCVFileSource) do 64 | lbl2.Caption := FileName; 65 | 66 | chk1.Checked := cvcptrsrcWebCam.Enabled; 67 | chk2.Checked := cvcptrsrcFile.Enabled; 68 | chk3.Checked := cvcptrsrcStream.Enabled; 69 | 70 | end; 71 | 72 | end. 73 | -------------------------------------------------------------------------------- /samples/Component/videocapture_basic/videocapture.dpr: -------------------------------------------------------------------------------- 1 | program videocapture; 2 | 3 | uses 4 | Vcl.Forms, 5 | uMain in 'uMain.pas' {Form1}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm1, Form1); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /samples/Component/videocapture_basic/videocapture.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/Component/videocapture_basic/videocapture.res -------------------------------------------------------------------------------- /samples/cpp/bgfg_segm/bgfg_segm.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/bgfg_segm/bgfg_segm.res -------------------------------------------------------------------------------- /samples/cpp/camshiftdemo/camshiftdemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/camshiftdemo/camshiftdemo.res -------------------------------------------------------------------------------- /samples/cpp/contours2/contours2.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/contours2/contours2.res -------------------------------------------------------------------------------- /samples/cpp/convexhull/cvconvexhull.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program cvconvexhull; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | WinApi.Windows, 29 | System.SysUtils, 30 | cpp.utils, 31 | cv.resource, 32 | cv.opencv; 33 | 34 | begin 35 | try 36 | cout + // 37 | '\nThis sample program demonstrates the use of the convexHull() function\n' + // 38 | 'Call:\n' + // 39 | argv[0] + endl; 40 | 41 | Var 42 | img: TMat := TMat.mat(500, 500, CV_8UC3); 43 | Var 44 | rng: TRNG := theRNG(); 45 | 46 | While True do 47 | begin 48 | Var 49 | i: int; 50 | Var 51 | count: UInt := rng; 52 | count := (count mod 100) + 1; 53 | 54 | Var 55 | points: vector; 56 | 57 | for Var j:int := 0 to count - 1 do 58 | begin 59 | Var 60 | pt: TPoint; 61 | pt.x := rng.uniform(img.cols div 4, (img.cols * 3) div 4); 62 | pt.y := rng.uniform(img.rows div 4, (img.rows * 3) div 4); 63 | 64 | points.push_back(pt); 65 | end; 66 | 67 | Var 68 | hull: vector; 69 | convexhull(points, hull, True); 70 | 71 | img.Assign(TScalar.all(0)); 72 | for Var j:int := 0 to count - 1 do 73 | circle(img, points[j], 3, Scalar(0, 0, 255), Int(FILLED), LINE_AA); 74 | 75 | Var 76 | a:TInputArrayOfArrays; 77 | 78 | polylines(img, hull, True, Scalar(0, 255, 0), 1, Int(LINE_AA)); 79 | imshow('hull', img); 80 | 81 | Var 82 | key: char := chr(waitKey()); 83 | if (key = #27) or (key = 'q') or (key = 'Q') then // 'ESC' 84 | break; 85 | end; 86 | 87 | except 88 | on E: Exception do 89 | begin 90 | WriteLn(E.ClassName, ': ', E.Message); 91 | Readln; 92 | end; 93 | end; 94 | 95 | end. 96 | -------------------------------------------------------------------------------- /samples/cpp/convexhull/cvconvexhull.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/convexhull/cvconvexhull.res -------------------------------------------------------------------------------- /samples/cpp/delaunay2/delaunay2.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/delaunay2/delaunay2.res -------------------------------------------------------------------------------- /samples/cpp/dft/cvdft.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program cvdft; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | WinApi.Windows, 29 | System.SysUtils, 30 | cpp.utils, 31 | cv.resource, 32 | cv.opencv; 33 | 34 | procedure help; 35 | begin 36 | printf( // 37 | '\nThis program demonstrated the use of the discrete Fourier transform (dft)\n' + // 38 | 'The dft of an image is taken and it''s power spectrum is displayed.\n' + // 39 | 'Usage:\n ' + argv[0] + ' [image_name -- default lena.jpg]\n'); 40 | end; 41 | 42 | Type 43 | pMat1f = ^TMat1f; 44 | 45 | begin 46 | try 47 | help; 48 | Var 49 | filename: string := OpenCVData + 'lena.jpg'; 50 | Var 51 | img: TMat := imread(filename, IMREAD_GRAYSCALE); 52 | if (img.empty()) then 53 | begin 54 | printf('Cannot read image file: ' + filename + '\n'); 55 | Halt(1); 56 | end; 57 | 58 | Var 59 | m: int := getOptimalDFTSize(img.rows); 60 | Var 61 | N: int := getOptimalDFTSize(img.cols); 62 | Var 63 | padded: TMat; 64 | copyMakeBorder(img, padded, 0, m - img.rows, 0, N - img.cols, BORDER_CONSTANT, TScalar.all(0)); 65 | 66 | Var 67 | planes: TArray := [TMat.Mat(), TMat.zeros(padded.size, CV_32F)]; 68 | 69 | var 70 | planes0: pMat1f := @planes[0]; 71 | 72 | planes0^ := TMat1f.Mat(padded); 73 | 74 | Var 75 | complexImg: TMat; 76 | 77 | merge(planes, complexImg); 78 | 79 | dft(complexImg, complexImg); 80 | 81 | // compute log(1 + sqrt(Re(DFT(img))**2 + Im(DFT(img))**2)) 82 | split(complexImg, planes); 83 | magnitude(planes[0], planes[1], planes[0]); 84 | Var 85 | mag: TMat := planes[0]; 86 | mag := mag + TScalar.all(1); 87 | log(mag, mag); 88 | 89 | // crop the spectrum, if it has an odd number of rows or columns 90 | mag := mag.Mat(Rect(0, 0, mag.cols and -2, mag.rows and -2)); 91 | 92 | Var 93 | cx: int := mag.cols div 2; 94 | Var 95 | cy: int := mag.rows div 2; 96 | 97 | // rearrange the quadrants of Fourier image 98 | // so that the origin is at the image center 99 | Var 100 | tmp: TMat; 101 | Var 102 | q0: TMat := TMat.Mat(mag, Rect(0, 0, cx, cy)); 103 | Var 104 | q1: TMat := TMat.Mat(mag, Rect(cx, 0, cx, cy)); 105 | Var 106 | q2: TMat := TMat.Mat(mag, Rect(0, cy, cx, cy)); 107 | Var 108 | q3: TMat := TMat.Mat(mag, Rect(cx, cy, cx, cy)); 109 | 110 | q0.copyTo(tmp); 111 | q3.copyTo(q0); 112 | tmp.copyTo(q3); 113 | 114 | q1.copyTo(tmp); 115 | q2.copyTo(q1); 116 | tmp.copyTo(q2); 117 | 118 | normalize(mag, mag, 0, 1, NORM_MINMAX); 119 | 120 | imshow('spectrum magnitude', mag); 121 | waitKey(); 122 | except 123 | on E: Exception do 124 | begin 125 | WriteLn(E.ClassName, ': ', E.Message); 126 | Readln; 127 | end; 128 | end; 129 | 130 | end. 131 | -------------------------------------------------------------------------------- /samples/cpp/dft/cvdft.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/dft/cvdft.res -------------------------------------------------------------------------------- /samples/cpp/dis_opticalflow/dis_opticalflow.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program dis_opticalflow; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | WinApi.Windows, 29 | System.SysUtils, 30 | cpp.utils, 31 | cv.resource, 32 | cv.opencv; 33 | 34 | begin 35 | try 36 | // CommandLineParser parser(argc, argv, "{ @video | vtest.avi | use video as input }"); 37 | // string filename = samples::findFileOrKeep(parser.get("@video")); 38 | 39 | Var 40 | filename: string; 41 | if ParamCount > 0 then 42 | filename := ParamStr(1) 43 | else 44 | filename := OpenCVData + 'vtest.avi'; 45 | 46 | Var 47 | cap: TVideoCapture; 48 | cap.open(filename); 49 | 50 | if (not cap.isOpened()) then 51 | begin 52 | WriteLn('ERROR: Cannot open file ', filename); 53 | Halt(1); 54 | end; 55 | 56 | Var 57 | prevgray, gray, rgb, frame: TMat; 58 | Var 59 | flow: TMat; 60 | Var 61 | flow_uv: TArray := [TMat.Mat(), TMat.Mat()]; 62 | Var 63 | mag, ang: TMat; 64 | Var 65 | hsv_split: TArray := [TMat.Mat(), TMat.Mat(), TMat.Mat()]; 66 | Var 67 | hsv: TMat; 68 | 69 | Var 70 | algorithm: TPtr := TDISOpticalFlow.create(TDISOpticalFlow.PRESET_MEDIUM); 71 | 72 | while (true) do 73 | begin 74 | cap > frame; 75 | if (frame.empty()) then 76 | break; 77 | 78 | cvtColor(frame, gray, COLOR_BGR2GRAY); 79 | 80 | if (not prevgray.empty()) then 81 | begin 82 | algorithm.v.calc(prevgray, gray, flow); 83 | split(flow, flow_uv); 84 | multiply(flow_uv[1], -1, flow_uv[1]); 85 | cartToPolar(flow_uv[0], flow_uv[1], mag, ang, true); 86 | normalize(mag, mag, 0, 1, NORM_MINMAX); 87 | hsv_split[0] := ang; 88 | hsv_split[1] := mag; 89 | hsv_split[2] := TMat.ones(ang.size, ang.&type); 90 | merge(hsv_split, { 3, } hsv); 91 | cvtColor(hsv, rgb, COLOR_HSV2BGR); 92 | imshow('flow', rgb); 93 | imshow('orig', frame); 94 | end; 95 | 96 | if (waitKey(20) > 0) then 97 | break; 98 | swap(prevgray, gray); 99 | end; 100 | 101 | except 102 | on E: Exception do 103 | begin 104 | WriteLn(E.ClassName, ': ', E.Message); 105 | Readln; 106 | end; 107 | end; 108 | 109 | end. 110 | -------------------------------------------------------------------------------- /samples/cpp/dis_opticalflow/dis_opticalflow.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/dis_opticalflow/dis_opticalflow.res -------------------------------------------------------------------------------- /samples/cpp/distrans/distrans.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/distrans/distrans.res -------------------------------------------------------------------------------- /samples/cpp/dnn/human_parsing/human_parsing.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/dnn/human_parsing/human_parsing.res -------------------------------------------------------------------------------- /samples/cpp/dnn/scene_text_recognition/scene_text_recognition.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/dnn/scene_text_recognition/scene_text_recognition.res -------------------------------------------------------------------------------- /samples/cpp/drawing/drawing.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/drawing/drawing.res -------------------------------------------------------------------------------- /samples/cpp/edge/edge.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program edge; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cpp.utils, 30 | cv.resource, 31 | cv.opencv; 32 | 33 | Var 34 | edgeThresh: int = 1; 35 | edgeThreshScharr: int = 1; 36 | 37 | image, gray, blurImage, edge1, edge2, cedge: TMat; 38 | 39 | window_name1: CppString; 40 | window_name2: CppString; 41 | 42 | // define a trackbar callback 43 | procedure onTrackbar(a: int; p: pointer); 44 | begin 45 | blur(gray, blurImage, Size(3, 3)); 46 | 47 | // Run the edge detector on grayscale 48 | Canny(blurImage, edge1, edgeThresh, edgeThresh * 3, 3); 49 | cedge.Assign(TScalar.all(0)); 50 | 51 | image.copyTo(cedge, edge1); 52 | imshow(window_name1, cedge); 53 | 54 | /// Canny detector with scharr 55 | Var 56 | dx, dy: TMat; 57 | Scharr(blurImage, dx, CV_16S, 1, 0); 58 | Scharr(blurImage, dy, CV_16S, 0, 1); 59 | Canny(dx, dy, edge2, edgeThreshScharr, edgeThreshScharr * 3); 60 | /// Using Canny's output as a mask, we display our result 61 | cedge.Assign(TScalar.all(0)); 62 | image.copyTo(cedge, edge2); 63 | imshow(window_name2, cedge); 64 | end; 65 | 66 | procedure help; 67 | begin 68 | WriteLn('This sample demonstrates Canny edge detection'#13#10 + 'Call:'#13#10 + ExtractFileName(ParamStr(0)) + 'image_name -- Default is fruits.jpg'); 69 | end; 70 | 71 | begin 72 | try 73 | window_name1 := 'Edge map : Canny default (Sobel gradient)'; 74 | window_name2 := 'Edge map : Canny with custom gradient (Scharr)'; 75 | 76 | help; 77 | 78 | Var 79 | filename: CppString; 80 | if ParamCount > 0 then 81 | filename := ParamStr(1) 82 | else 83 | filename := OpenCVData + 'fruits.jpg'; 84 | 85 | image := imread(filename, IMREAD_COLOR); 86 | if (image.empty()) then 87 | begin 88 | WriteLn('Cannot read image file: ', string(filename)); 89 | help; 90 | Halt(1); 91 | end; 92 | cedge.create(image.Size, image.&type); 93 | cvtColor(image, gray, COLOR_BGR2GRAY); 94 | 95 | // Create a window 96 | namedWindow(window_name1, WINDOW_AUTOSIZE); 97 | namedWindow(window_name2, WINDOW_AUTOSIZE); 98 | 99 | // create a toolbar 100 | createTrackbar('Canny threshold default', window_name1, @edgeThresh, 100, onTrackbar); 101 | createTrackbar('Canny threshold Scharr', window_name2, @edgeThreshScharr, 400, onTrackbar); 102 | 103 | // Show the image 104 | onTrackbar(0, nil); 105 | 106 | // Wait for a key stroke; the same function arranges events processing 107 | waitKey(0); 108 | 109 | except 110 | on E: Exception do 111 | WriteLn(E.ClassName, ': ', E.Message); 112 | end; 113 | 114 | end. 115 | -------------------------------------------------------------------------------- /samples/cpp/edge/edge.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/edge/edge.res -------------------------------------------------------------------------------- /samples/cpp/facedetect/facedetect.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/facedetect/facedetect.res -------------------------------------------------------------------------------- /samples/cpp/facial_features/facial_features.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/facial_features/facial_features.res -------------------------------------------------------------------------------- /samples/cpp/grabcut/cvgrabcut.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/grabcut/cvgrabcut.res -------------------------------------------------------------------------------- /samples/cpp/inpaint/cvinpaint.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program cvinpaint; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | WinApi.Windows, 29 | System.SysUtils, 30 | cpp.utils, 31 | cv.resource, 32 | cv.opencv; 33 | 34 | procedure help; 35 | begin 36 | cout + '\nCool inpainging demo. Inpainting repairs damage to images by floodfilling the damage \n' + // 37 | 'with surrounding image areas.\n' + // 38 | 'Using OpenCV version %s\n' + CV_VERSION + '\n' + // 39 | 'Usage:\n' + argv[0] + ' [image_name -- Default fruits.jpg]\n' + endl; 40 | 41 | cout + 'Hot keys: \n' + // 42 | '\tESC - quit the program\n' + // 43 | '\tr - restore the original image\n' + // 44 | '\ti or SPACE - run inpainting algorithm\n' + // 45 | '\t\t(before running it, paint something on the image)\n' + endl; 46 | end; 47 | 48 | Var 49 | img, inpaintMask: TMat; 50 | prevPt: TPoint; 51 | 52 | procedure onMouse(event: MouseEventTypes; x, y, flags: int; p: pointer); 53 | begin 54 | if (event = EVENT_LBUTTONUP) or ((flags and int(EVENT_FLAG_LBUTTON)) = 0) then 55 | prevPt := Point(-1, -1) 56 | else if (event = EVENT_LBUTTONDOWN) then 57 | prevPt := Point(x, y) 58 | else if (event = EVENT_MOUSEMOVE) and ((flags and int(EVENT_FLAG_LBUTTON)) <> 0) then 59 | begin 60 | Var 61 | pt: TPoint := Point(x, y); 62 | if (prevPt.x < 0) then 63 | prevPt := pt; 64 | line(inpaintMask, prevPt, pt, TScalar.all(255), 5, 8, 0); 65 | line(img, prevPt, pt, TScalar.all(255), 5, 8, 0); 66 | prevPt := pt; 67 | imshow('image', img); 68 | end; 69 | end; 70 | 71 | begin 72 | try 73 | help; 74 | 75 | prevPt := Point(-1, -1); 76 | 77 | Var 78 | filename: string := OpenCVData + 'fruits.jpg'; 79 | if (ParamCount > 0) and (FileExists(ParamStr(1))) then 80 | filename := ParamStr(1); 81 | Var 82 | img0: TMat := imread(filename, IMREAD_COLOR); 83 | if (img0.empty()) then 84 | begin 85 | cout + 'Couldn''t open the image ' + filename + '. Usage: inpaint \n' + endl; 86 | Halt(0); 87 | end; 88 | 89 | namedWindow('image', WINDOW_AUTOSIZE); 90 | 91 | img := img0.clone(); 92 | inpaintMask := TMat.zeros(img.size, CV_8U); 93 | 94 | imshow('image', img); 95 | setMouseCallback('image', onMouse, nil); 96 | 97 | While True do 98 | begin 99 | Var 100 | c: char := chr(waitKey()); 101 | 102 | if (c = #27) then 103 | break; 104 | 105 | if (c = 'r') then 106 | begin 107 | inpaintMask.assign(TScalar.all(0)); 108 | img0.copyTo(img); 109 | imshow('image', img); 110 | end; 111 | 112 | if (c = 'i') or (c = ' ') then 113 | begin 114 | Var 115 | inpainted: TMat; 116 | inpaint(img, inpaintMask, inpainted, 3, INPAINT_TELEA); 117 | imshow('inpainted image', inpainted); 118 | end; 119 | end; 120 | 121 | except 122 | on E: Exception do 123 | begin 124 | WriteLn(E.ClassName, ': ', E.Message); 125 | Readln; 126 | end; 127 | end; 128 | 129 | end. 130 | -------------------------------------------------------------------------------- /samples/cpp/inpaint/cvinpaint.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/inpaint/cvinpaint.res -------------------------------------------------------------------------------- /samples/cpp/kalman/kalman.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/kalman/kalman.res -------------------------------------------------------------------------------- /samples/cpp/laplace/cv_laplace.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/laplace/cv_laplace.res -------------------------------------------------------------------------------- /samples/cpp/lkdemo/lkdemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/lkdemo/lkdemo.res -------------------------------------------------------------------------------- /samples/cpp/minarea/minarea.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program minarea; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cpp.utils, 30 | cv.resource, 31 | cv.opencv; 32 | 33 | procedure help(); 34 | begin 35 | cout + 'This program demonstrates finding the minimum enclosing box, triangle or circle of a set\n'// 36 | + 'of points using functions: minAreaRect() minEnclosingTriangle() minEnclosingCircle().\n'// 37 | + 'Random points are generated and then enclosed.\n\n'// 38 | + 'Press ESC, "q" or "Q" to exit and any other key to regenerate the set of points.\n\n'; 39 | end; 40 | 41 | begin 42 | try 43 | // Sample in OpenCV - not working 44 | except 45 | on E: Exception do 46 | begin 47 | Writeln(E.ClassName, ': ', E.Message); 48 | Readln; 49 | end; 50 | end; 51 | 52 | end. 53 | -------------------------------------------------------------------------------- /samples/cpp/minarea/minarea.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/minarea/minarea.res -------------------------------------------------------------------------------- /samples/cpp/morphology2/morphology2.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/morphology2/morphology2.res -------------------------------------------------------------------------------- /samples/cpp/neural_network/neural_network.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program neural_network; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | WinApi.Windows, 29 | System.SysUtils, 30 | cpp.utils, 31 | cv.resource, 32 | cv.opencv; 33 | 34 | procedure PrintMat(const A: TMat); 35 | Var 36 | i, j: Integer; 37 | begin 38 | for i := 0 to A.rows - 1 do 39 | begin 40 | for j := 0 to A.cols - 1 do 41 | write(A.at(i, j):10:8); 42 | WriteLn; 43 | end; 44 | end; 45 | 46 | begin 47 | try 48 | // create random training data 49 | Var 50 | data: TMat_ := TMat_.Mat(100, 100); 51 | randn(data, TMat.zeros(1, 1, data.&type), TMat.ones(1, 1, data.&type)); 52 | 53 | // half of the samples for each class 54 | Var 55 | responses: TMat_ := TMat_.Mat(data.rows, 2); 56 | for Var i: int := 0 to data.rows - 1 do 57 | begin 58 | if (i < data.rows div 2) then 59 | begin 60 | responses.pt(i, 0)^ := 1; 61 | responses.pt(i, 1)^ := 0; 62 | end 63 | else 64 | begin 65 | responses.pt(i, 0)^ := 0; 66 | responses.pt(i, 1)^ := 1; 67 | end; 68 | end; 69 | 70 | (* 71 | //example code for just a single response (regression) 72 | Mat_ responses(data.rows, 1); 73 | for (int i=0; i := TMat_.Mat(1, 3); 80 | layerSizes.pt(0, 0)^ := data.cols; 81 | layerSizes.pt(0, 1)^ := 20; 82 | layerSizes.pt(0, 2)^ := responses.cols; 83 | 84 | Var 85 | network: TPtr := TANN_MLP.create(); 86 | 87 | network.v.setLayerSizes(layerSizes); 88 | network.v.setActivationFunction(TANN_MLP.ActivationFunctions.SIGMOID_SYM, 0.1, 0.1); 89 | network.v.setTrainMethod(TANN_MLP.TrainingMethods.BACKPROP, 0.1, 0.1); 90 | Var 91 | trainData: TPtr := TTrainData.create(data, ROW_SAMPLE, responses); 92 | 93 | network.v.train(trainData); 94 | if (network.v.isTrained()) then 95 | begin 96 | printf('Predict one-vector:\n'); 97 | Var 98 | result: TMat; 99 | network.v.predict(TMat.ones(1, data.cols, data.&type()), result); 100 | PrintMat(result); 101 | 102 | printf('Predict training data:\n'); 103 | for Var i: int := 0 to data.rows - 1 do 104 | begin 105 | network.v.predict(data.row(i), result); 106 | PrintMat(result); 107 | end; 108 | end; 109 | 110 | except 111 | on E: Exception do 112 | begin 113 | WriteLn(E.ClassName, ': ', E.Message); 114 | Readln; 115 | end; 116 | end; 117 | 118 | end. 119 | -------------------------------------------------------------------------------- /samples/cpp/neural_network/neural_network.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/neural_network/neural_network.res -------------------------------------------------------------------------------- /samples/cpp/opencv_version/opencv_version.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program opencv_version; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | WinApi.Windows, 29 | System.SysUtils, 30 | cpp.utils, 31 | cv.resource, 32 | cv.opencv; 33 | begin 34 | try 35 | cout + getBuildInformation + endl; 36 | cout + 'Welcome to OpenCV ' + CV_VERSION + endl; 37 | WriteLn('Press '); 38 | Readln; 39 | except 40 | on E: Exception do 41 | begin 42 | WriteLn(E.ClassName, ': ', E.Message); 43 | Readln; 44 | end; 45 | end; 46 | 47 | end. 48 | -------------------------------------------------------------------------------- /samples/cpp/opencv_version/opencv_version.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/opencv_version/opencv_version.res -------------------------------------------------------------------------------- /samples/cpp/peopledetect/peopledetect.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/peopledetect/peopledetect.res -------------------------------------------------------------------------------- /samples/cpp/phase_corr/phase_corr.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program phase_corr; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cv.resource, 30 | cpp.utils, 31 | cv.opencv; 32 | 33 | begin 34 | try 35 | Var 36 | video: TVideoCapture := 0; 37 | 38 | Var 39 | frame, curr, prev, curr64f, prev64f, hann: TMat; 40 | Var 41 | key: char; 42 | 43 | repeat 44 | 45 | video > frame; 46 | cvtColor(frame, curr, COLOR_RGB2GRAY); 47 | 48 | if (prev.empty()) then 49 | begin 50 | prev := curr.clone(); 51 | createHanningWindow(hann, curr.size, CV_64F); 52 | end; 53 | 54 | prev.convertTo(prev64f, CV_64F); 55 | curr.convertTo(curr64f, CV_64F); 56 | 57 | Var 58 | shift: TPoint2d := phaseCorrelate(prev64f, curr64f, hann); 59 | Var 60 | radius: double := system.sqrt(shift.x * shift.x + shift.y * shift.y); 61 | 62 | if (radius > 5) then 63 | begin 64 | // draw a circle and line indicating the shift direction... 65 | Var 66 | center: TPoint := Point(curr.cols shr 1, curr.rows shr 1); 67 | circle(frame, center, Trunc(radius), Scalar(0, 255, 0), 3, LINE_AA); 68 | line(frame, center, Point(center.x + Trunc(shift.x), center.y + Trunc(shift.y)), Scalar(0, 255, 0), 3, LINE_AA); 69 | end; 70 | 71 | imshow('phase shift', frame); 72 | key := char(waitKey(2)); 73 | 74 | prev := curr.clone(); 75 | until (key = #27); // Esc to exit... 76 | 77 | except 78 | on E: Exception do 79 | Writeln(E.ClassName, ': ', E.Message); 80 | end; 81 | 82 | end. 83 | -------------------------------------------------------------------------------- /samples/cpp/phase_corr/phase_corr.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/phase_corr/phase_corr.res -------------------------------------------------------------------------------- /samples/cpp/qrcode/qrcode.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/qrcode/qrcode.res -------------------------------------------------------------------------------- /samples/cpp/segment_objects/segment_objects.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/segment_objects/segment_objects.res -------------------------------------------------------------------------------- /samples/cpp/stitching/stitching.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/stitching/stitching.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/HighGUI/BasicLinearTransformsTrackbar/BasicLinearTransformsTrackbar.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program BasicLinearTransformsTrackbar; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cpp.utils, 30 | cv.resource, 31 | cv.opencv; 32 | 33 | (* * Global Variables *) 34 | const 35 | alpha_max: int = 5; 36 | beta_max: int = 125; 37 | 38 | Var 39 | alpha: int; (* *< Simple contrast control *) 40 | beta: int; (* *< Simple brightness control *) 41 | 42 | (* * Matrices to store images *) 43 | image: TMat; 44 | 45 | (* * 46 | * @function on_trackbar 47 | * @brief Called whenever any of alpha or beta changes 48 | *) 49 | procedure on_trackbar(a: int; p: pointer); 50 | begin 51 | Var 52 | new_image: TMat := TMat.zeros(image.size, image.&type); 53 | for Var y: int := 0 to image.rows - 1 do // 54 | for Var x: int := 0 to image.cols - 1 do // 55 | for Var c: int := 0 to 2 do // 56 | pVec3b(new_image.pt(y, x))^[c] := saturate_cast.cast(alpha * (pVec3b(image.pt(y, x))^[c]) + beta); 57 | imshow('New Image', new_image); 58 | end; 59 | 60 | begin 61 | try 62 | /// Read image given by user 63 | Var 64 | imageName: String := OpenCVData + 'lena.jpg'; // by default 65 | if (argc > 1) then 66 | imageName := argv[1]; 67 | image := imread(imageName); 68 | 69 | /// Initialize values 70 | alpha := 1; 71 | beta := 0; 72 | 73 | /// Create Windows 74 | namedWindow('Original Image', 1); 75 | namedWindow('New Image', 1); 76 | 77 | /// Create Trackbars 78 | createTrackbar('Contrast', 'New Image', @alpha, alpha_max, on_trackbar); 79 | createTrackbar('Brightness', 'New Image', @beta, beta_max, on_trackbar); 80 | 81 | /// Show some stuff 82 | imshow('Original Image', image); 83 | imshow('New Image', image); 84 | 85 | /// Wait until user press some key 86 | waitKey(); 87 | except 88 | on E: Exception do 89 | begin 90 | Writeln(E.ClassName, ': ', E.Message); 91 | Readln; 92 | end; 93 | end; 94 | 95 | end. 96 | -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/HighGUI/BasicLinearTransformsTrackbar/BasicLinearTransformsTrackbar.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/HighGUI/BasicLinearTransformsTrackbar/BasicLinearTransformsTrackbar.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/Histograms_Matching/calcHist_Demo/calcHist_Demo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/Histograms_Matching/calcHist_Demo/calcHist_Demo.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/ImgProc/Smoothing/Smoothing.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/ImgProc/Smoothing/Smoothing.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/ImgProc/Threshold/Thresholdp.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program Thresholdp; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cpp.utils, 30 | cv.resource, 31 | cv.opencv; 32 | 33 | const 34 | EXIT_FAILURE = 1; 35 | 36 | Var 37 | /// Global Variables 38 | threshold_value: integer = 0; 39 | threshold_type: integer = 3; 40 | max_value: integer = 255; 41 | max_type: integer = 4; 42 | max_binary_value: integer = 255; 43 | 44 | src, src_gray, dst: TMat; 45 | window_name: string = 'Threshold Demo'; 46 | 47 | trackbar_type: string = 'Type: \n 0: Binary \n 1: Binary Inverted \n 2: Truncate \n 3: To Zero \n 4: To Zero Inverted'; 48 | trackbar_value: string = 'Value'; 49 | 50 | // ![Threshold_Demo] 51 | (* * 52 | * @function Threshold_Demo 53 | *) 54 | procedure Threshold_Demo(a: integer; p: pointer); 55 | begin 56 | (* 0: Binary 57 | 1: Binary Inverted 58 | 2: Threshold Truncated 59 | 3: Threshold to Zero 60 | 4: Threshold to Zero Inverted 61 | *) 62 | threshold(src_gray, dst, threshold_value, max_binary_value, threshold_type); 63 | imshow(window_name, dst); 64 | end; 65 | // ![Threshold_Demo] 66 | 67 | begin 68 | try 69 | 70 | // ! [load] 71 | Var 72 | imageName: CppString := OpenCVData + 'stuff.jpg'; // by default 73 | 74 | if (ParamCount > 0) then 75 | imageName := ParamStr(1); 76 | 77 | src := imread(imageName, IMREAD_COLOR); // Load an image 78 | 79 | if (src.empty()) then 80 | begin 81 | Writeln('Cannot read the image: ' + imageName); 82 | Halt(1); 83 | end; 84 | 85 | cvtColor(src, src_gray, COLOR_BGR2GRAY); // Convert the image to Gray 86 | // ! [load] 87 | 88 | // ! [window] 89 | namedWindow(window_name, WINDOW_AUTOSIZE); // Create a window to display results 90 | // ! [window] 91 | 92 | // ! [trackbar] 93 | createTrackbar(trackbar_type, window_name, @threshold_type, max_type, Threshold_Demo); // Create a Trackbar to choose type of Threshold 94 | 95 | createTrackbar(trackbar_value, window_name, @threshold_value, max_value, Threshold_Demo); // Create a Trackbar to choose Threshold value 96 | // ! [trackbar] 97 | 98 | Threshold_Demo(0, nil); // Call the function to initialize 99 | 100 | /// Wait until the user finishes the program 101 | waitKey(); 102 | 103 | except 104 | on E: Exception do 105 | Writeln(E.ClassName, ': ', E.Message); 106 | end; 107 | 108 | end. 109 | -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/ImgProc/Threshold/Thresholdp.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/ImgProc/Threshold/Thresholdp.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/ImgProc/morph_lines_detection/morph_lines_detection.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/ImgProc/morph_lines_detection/morph_lines_detection.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo/CannyDetector_Demo.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program CannyDetector_Demo; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cv.resource, 30 | cpp.utils, 31 | cv.opencv; 32 | 33 | Var 34 | // ![variables] 35 | src, src_gray: TMat; 36 | dst, detected_edges: TMat; 37 | 38 | lowThreshold: int = 0; 39 | 40 | const 41 | max_lowThreshold: int = 100; 42 | ratio: int = 3; 43 | kernel_size: int = 3; 44 | window_name = 'Edge Map'; 45 | // ![variables] 46 | 47 | procedure CannyThreshold(a: int; p: pointer); 48 | begin 49 | // ![reduce_noise] 50 | /// Reduce noise with a kernel 3x3 51 | blur(src_gray, detected_edges, Size(3, 3)); 52 | // ![reduce_noise] 53 | 54 | // ![canny] 55 | /// Canny detector 56 | Canny(detected_edges, detected_edges, lowThreshold, lowThreshold * ratio, kernel_size); 57 | // ![canny] 58 | 59 | /// Using Canny's output as a mask, we display our result 60 | // ![fill] 61 | dst.assign(TScalar.all(0)); 62 | // ![fill] 63 | 64 | // ![copyto] 65 | src.copyTo(dst, detected_edges); 66 | // ![copyto] 67 | 68 | // ![display] 69 | imshow(window_name, dst); 70 | // ![display] 71 | end; 72 | 73 | begin 74 | try 75 | // ![load] 76 | Var 77 | filename: string := OpenCVData + 'fruits.jpg'; 78 | if (ParamCount > 0) and FileExists(ParamStr(1)) then 79 | filename := ParamStr(1); 80 | src := imread(filename, IMREAD_COLOR); // Load an image 81 | 82 | if (src.empty()) then 83 | begin 84 | cout + 'Could not open or find the image!\n' + endl; 85 | cout + 'Usage: ' + argv[0] + ' ' + endl; 86 | Halt(1); 87 | end; 88 | // ![load] 89 | 90 | // ![create_mat] 91 | /// Create a matrix of the same type and size as src (for dst) 92 | dst.create(src.Size, src.&type); 93 | // ![create_mat] 94 | 95 | // ![convert_to_gray] 96 | cvtColor(src, src_gray, COLOR_BGR2GRAY); 97 | // ![convert_to_gray] 98 | 99 | // ![create_window] 100 | namedWindow(window_name, WINDOW_AUTOSIZE); 101 | // ![create_window] 102 | 103 | // ![create_trackbar] 104 | /// Create a Trackbar for user to enter threshold 105 | createTrackbar('Min Threshold:', window_name, @lowThreshold, max_lowThreshold, CannyThreshold); 106 | // ![create_trackbar] 107 | 108 | /// Show the image 109 | CannyThreshold(0, nil); 110 | 111 | /// Wait until user exit program by pressing a key 112 | waitKey(0); 113 | 114 | except 115 | on E: Exception do 116 | begin 117 | WriteLn(E.ClassName, ': ', E.Message); 118 | Readln; 119 | end; 120 | end; 121 | 122 | end. 123 | -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo/CannyDetector_Demo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/ImgTrans/CannyDetector_Demo/CannyDetector_Demo.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo/cornerDetector_Demo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/TrackingMotion/cornerDetector_Demo/cornerDetector_Demo.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo/goodFeaturesToTrack_Demo.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program goodFeaturesToTrack_Demo; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$POINTERMATH ON} 26 | {$R *.res} 27 | 28 | uses 29 | System.SysUtils, 30 | cpp.utils, 31 | cv.resource, 32 | cv.opencv; 33 | 34 | const 35 | EXIT_FAILURE = 1; 36 | 37 | Var 38 | /// Global variables 39 | src, src_gray: TMat; 40 | 41 | maxCorners: int = 23; 42 | maxTrackbar: int = 100; 43 | 44 | rng: TRNG; 45 | 46 | const 47 | source_window = 'Image'; 48 | 49 | (* * 50 | * @function goodFeaturesToTrack_Demo.cpp 51 | * @brief Apply Shi-Tomasi corner detector 52 | *) 53 | procedure goodFeaturesToTrackProc(a: int; p: Pointer); 54 | 55 | Var 56 | pp: TOutputArray; 57 | 58 | begin 59 | /// Parameters for Shi-Tomasi algorithm 60 | maxCorners := cvMAX(maxCorners, 1); 61 | Var 62 | corners: Vector; 63 | Var 64 | qualityLevel: double := 0.01; 65 | Var 66 | minDistance: double := 10; 67 | Var 68 | blockSize: int := 3; 69 | Var 70 | gradientSize: int := 3; 71 | Var 72 | useHarrisDetector: bool := false; 73 | Var 74 | k: double := 0.04; 75 | 76 | /// Copy the source image 77 | Var 78 | cpy: TMat := src.clone(); 79 | 80 | /// Apply corner detection 81 | goodFeaturesToTrack(src_gray, corners, maxCorners, qualityLevel, minDistance, TMat.Mat, blockSize, gradientSize, useHarrisDetector, k); 82 | 83 | /// Draw corners detected 84 | WriteLn('** Number of corners detected: ', corners.size()); 85 | Var 86 | radius: int := 4; 87 | for Var i := 0 to corners.size() - 1 do 88 | circle(cpy, corners[i], radius, Scalar(rng.uniform(0, 255), rng.uniform(0, 256), rng.uniform(0, 256)), int(FILLED)); 89 | 90 | /// Show what you got 91 | namedWindow(source_window); 92 | imshow(source_window, cpy); 93 | end; 94 | 95 | begin 96 | try 97 | rng := 12345; 98 | 99 | /// Load source image and convert it to gray 100 | // CommandLineParser parser( argc, argv, "{@input | pic3.png | input image}" ); 101 | // src = imread( samples::findFile( parser.get( "@input" ) ) ); 102 | if ParamCount > 0 then 103 | src := imread(ParamStr(1)) 104 | else 105 | src := imread(OpenCVData + 'pic3.png'); 106 | 107 | if (src.empty()) then 108 | begin 109 | WriteLn('Could not open or find the image!'); 110 | WriteLn('Usage: ', ExtractFileName(ParamStr(0)), ' '); 111 | Halt(1); 112 | end; 113 | cvtColor(src, src_gray, COLOR_BGR2GRAY); 114 | 115 | /// Create Window 116 | namedWindow(source_window); 117 | 118 | /// Create Trackbar to set the number of corners 119 | createTrackbar(' MAX corners: ', source_window, @maxCorners, maxTrackbar, goodFeaturesToTrackProc); 120 | 121 | imshow(source_window, src); 122 | 123 | goodFeaturesToTrackProc(0, nil); 124 | 125 | waitKey(); 126 | 127 | except 128 | on E: Exception do 129 | begin 130 | WriteLn(E.ClassName, ': ', E.Message); 131 | Readln; 132 | end; 133 | end; 134 | 135 | end. 136 | -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo/goodFeaturesToTrack_Demo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/TrackingMotion/goodFeaturesToTrack_Demo/goodFeaturesToTrack_Demo.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/core/AddingImages/AddingImages.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program AddingImages; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | CV.Resource, 30 | cpp.utils, 31 | cv.opencv; 32 | 33 | const 34 | EXIT_FAILURE = 1; 35 | 36 | Var 37 | alpha: double = 0.5; 38 | beta, input: double; 39 | src1, src2, dst: TMat; 40 | 41 | begin 42 | try 43 | 44 | /// Ask the user enter alpha 45 | WriteLn(' Simple Linear Blender '); 46 | WriteLn('-----------------------'); 47 | WriteLn(' * Enter alpha[0.0 - 1.0]: '); 48 | Readln(input); 49 | 50 | // We use the alpha provided by the user if it is between 0 and 1 51 | if (input >= 0) and (input <= 1) then 52 | alpha := input; 53 | 54 | // ![load] 55 | /// Read images ( both have to be of the same size and type ) 56 | src1 := imread(OpenCVData + 'LinuxLogo.jpg'); 57 | src2 := imread(OpenCVData + 'WindowsLogo.jpg'); 58 | // ![load] 59 | 60 | if (src1.empty()) then 61 | begin 62 | WriteLn('Error loading src1'); 63 | Halt(EXIT_FAILURE); 64 | end; 65 | if (src2.empty()) then 66 | begin 67 | WriteLn('Error loading src2'); 68 | Halt(EXIT_FAILURE); 69 | end; 70 | 71 | // ![blend_images] 72 | beta := (1.0 - alpha); 73 | addWeighted(src1, alpha, src2, beta, 0.0, dst); 74 | // ![blend_images] 75 | 76 | // ![display] 77 | imshow('Linear Blend', dst); 78 | waitKey(0); 79 | // ![display] 80 | except 81 | on E: Exception do 82 | WriteLn(E.ClassName, ': ', E.Message); 83 | end; 84 | 85 | end. 86 | -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/core/AddingImages/AddingImages.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/core/AddingImages/AddingImages.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/ml/introduction_to_svm/introduction_to_svm.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program introduction_to_svm; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cpp.utils, 30 | cv.resource, 31 | cv.opencv; 32 | 33 | begin 34 | try 35 | // Set up training data 36 | // ! [setup1] 37 | Var 38 | labels: TArray := [1, -1, -1, -1]; 39 | var 40 | trainingData: TArray < TArray < float >> := [[501, 10], [255, 10], [501, 255], [10, 501]]; 41 | 42 | // ! [setup2] 43 | Var 44 | trainingDataMat: TMat := TMat.Mat(4, 2, trainingData); 45 | Var 46 | labelsMat: TMat := TMat.Mat(4, 1, labels); 47 | 48 | // ! [setup2] 49 | 50 | // Train the SVM 51 | // ! [init] 52 | Var 53 | svm: TPtr := TSVM.create(); 54 | 55 | // ! [init] 56 | svm.v.setType(TSVM.C_SVC); 57 | svm.v.setKernel(TSVM.LINEAR); 58 | svm.v.setTermCriteria(TTermCriteria.TermCriteria(TTermCriteria.MAX_ITER, 100, 1E-6)); 59 | // ! [train] 60 | 61 | svm.v.train(trainingDataMat, ROW_SAMPLE, labelsMat); 62 | // ! [train] 63 | 64 | // Data for visual representation 65 | Var 66 | width: Int := 512; 67 | Var 68 | height: Int := 512; 69 | Var 70 | image: TMat := TMat.zeros(height, width, CV_8UC3); 71 | 72 | // Show the decision regions given by the SVM 73 | // ! [show] 74 | Var 75 | green: TVec3b := [0, 255, 0]; 76 | 77 | Var 78 | blue: TVec3b := [255, 0, 0]; 79 | 80 | for Var i: Int := 0 to image.rows - 1 do 81 | for Var j: Int := 0 to image.cols - 1 do 82 | begin 83 | 84 | Var 85 | sampleMat: TMat; // := (Mat_(1, 2) << j, i); 86 | sampleMat.create(1, 2, CV_32F); 87 | pFloat(sampleMat.pT(0, 0))^ := j; 88 | pFloat(sampleMat.pT(0, 1))^ := i; 89 | 90 | Var 91 | response: float := svm.v.predict(sampleMat); 92 | 93 | if (response = 1) then 94 | pVec3b(image.pT(i, j))^ := green 95 | else if (response = -1) then 96 | pVec3b(image.pT(i, j))^ := blue; 97 | end; 98 | 99 | // ! [show] 100 | 101 | // Show the training data 102 | // ! [show_data] 103 | Var 104 | thickness: Int := -1; 105 | circle(image, Point(501, 10), 5, Scalar(0, 0, 0), thickness); 106 | circle(image, Point(255, 10), 5, Scalar(255, 255, 255), thickness); 107 | circle(image, Point(501, 255), 5, Scalar(255, 255, 255), thickness); 108 | circle(image, Point(10, 501), 5, Scalar(255, 255, 255), thickness); 109 | // ! [show_data] 110 | 111 | // Show support vectors 112 | // ! [show_vectors] 113 | thickness := 2; 114 | 115 | Var 116 | sv: TMat := svm.v.getUncompressedSupportVectors(); 117 | 118 | for Var i: Int := 0 to sv.rows - 1 do 119 | begin 120 | Var 121 | v: pFloat := sv.pT(i); 122 | circle(image, Point(Trunc(v[0]), Trunc(v[1])), 6, Scalar(128, 128, 128), thickness); 123 | end; 124 | // ! [show_vectors] 125 | 126 | imwrite('result.png', image); // save the image 127 | 128 | imshow('SVM Simple Example', image); // show it to the user 129 | waitKey(); 130 | 131 | except 132 | on E: Exception do 133 | begin 134 | Writeln(E.ClassName, ': ', E.Message); 135 | Readln; 136 | end; 137 | end; 138 | 139 | end. 140 | -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/ml/introduction_to_svm/introduction_to_svm.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/ml/introduction_to_svm/introduction_to_svm.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/objectDetection/objectDetection.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/objectDetection/objectDetection.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/photo/decolorization/cvdecolor.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program cvdecolor; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cpp.utils, 30 | cv.resource, 31 | cv.opencv; 32 | 33 | begin 34 | try 35 | // CommandLineParser parser( argc, argv, '{@input | HappyFish.jpg | input image}' ); 36 | Var 37 | src: TMat; 38 | if ParamCount = 0 then 39 | src := imread(OpenCVData + 'HappyFish.jpg', IMREAD_COLOR) 40 | else 41 | src := imread(ParamStr(1), IMREAD_COLOR); 42 | if (src.empty()) then 43 | begin 44 | Writeln('Could not open or find the image!'); 45 | Writeln('Usage: ', ParamStr(0), ' '); 46 | Halt(1); 47 | end; 48 | 49 | Var 50 | gray, color_boost: TMat; 51 | 52 | decolor(src, gray, color_boost); 53 | imshow('Source Image', src); 54 | imshow('grayscale', gray); 55 | imshow('color_boost', color_boost); 56 | waitKey(0); 57 | except 58 | on E: Exception do 59 | Writeln(E.ClassName, ': ', E.Message); 60 | end; 61 | 62 | end. 63 | -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/photo/decolorization/cvdecolor.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/photo/decolorization/cvdecolor.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/photo/non_photorealistic_rendering/npr_demo.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program npr_demo; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cv.resource, 30 | cpp.utils, 31 | cv.opencv; 32 | 33 | begin 34 | try 35 | var 36 | num, &type: int; 37 | // CommandLineParser parser(argc, argv, '{@input | lena.jpg | input image}'); 38 | 39 | Var 40 | src: TMat; 41 | 42 | if ParamCount = 0 then 43 | src := imread(OpenCVData + 'lena.jpg', IMREAD_COLOR) 44 | else 45 | src := imread(ParamStr(1), IMREAD_COLOR); 46 | 47 | if (src.empty()) then 48 | begin 49 | Writeln('Could not open or find the image!'); 50 | Writeln('Usage: ', ParamStr(0), ' '); 51 | Halt(1); 52 | end; 53 | 54 | Writeln; 55 | Writeln(' Edge Preserve Filter'); 56 | Writeln('----------------------'); 57 | 58 | Writeln('Options: '); 59 | Writeln; 60 | 61 | Writeln('1) Edge Preserve Smoothing'); 62 | Writeln(' -> Using Normalized convolution Filter'); 63 | Writeln(' -> Using Recursive Filter'); 64 | Writeln('2) Detail Enhancement'); 65 | Writeln('3) Pencil sketch/Color Pencil Drawing'); 66 | Writeln('4) Stylization'); 67 | Writeln; 68 | 69 | Writeln('Press number 1-4 to choose from above techniques: '); 70 | 71 | Readln(num); 72 | 73 | Var 74 | img: TMat; 75 | 76 | if (num = 1) then 77 | begin 78 | Writeln; 79 | Writeln('Press 1 for Normalized Convolution Filter and 2 for Recursive Filter: '); 80 | 81 | Readln(&type); 82 | 83 | edgePreservingFilter(src, img, &type); 84 | imshow('Edge Preserve Smoothing', img); 85 | 86 | end 87 | else if (num = 2) then 88 | begin 89 | detailEnhance(src, img); 90 | imshow('Detail Enhanced', img); 91 | end 92 | else if (num = 3) then 93 | begin 94 | Var 95 | img1: TMat; 96 | pencilSketch(src, img1, img, 10, 0.1, 0.03); 97 | imshow('Pencil Sketch', img1); 98 | imshow('Color Pencil Sketch', img); 99 | end 100 | else if (num = 4) then 101 | begin 102 | stylization(src, img); 103 | imshow('Stylization', img); 104 | end; 105 | waitKey(0); 106 | 107 | except 108 | on E: Exception do 109 | Writeln(E.ClassName, ': ', E.Message); 110 | end; 111 | 112 | end. 113 | -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/photo/non_photorealistic_rendering/npr_demo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/photo/non_photorealistic_rendering/npr_demo.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/snippets/imgproc_segmentation/imgproc_segmentation.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program imgproc_segmentation; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$POINTERMATH ON} 26 | {$R *.res} 27 | 28 | uses 29 | System.SysUtils, 30 | cpp.utils, 31 | cv.resource, 32 | cv.opencv; 33 | 34 | Var 35 | image: TMat; 36 | 37 | begin 38 | try 39 | // Var 40 | image { :TMat } := TMat.Mat(Size(1920, 1080), CV_8UC3, TScalar.all(128)); 41 | 42 | // ! [usage_example_intelligent_scissors] 43 | Var 44 | tool: TIntelligentScissorsMB; 45 | tool.setEdgeFeatureCannyParameters(16, 100) // using Canny() as edge feature extractor 46 | .setGradientMagnitudeMaxLimit(200); 47 | 48 | // calculate image features 49 | tool.applyImage(image); 50 | 51 | // calculate map for specified source point 52 | Var 53 | source_point: TPoint := Point(200, 100); 54 | tool.buildMap(source_point); 55 | 56 | // fast fetching of contours 57 | // for specified target point and the pre-calculated map (stored internally) 58 | Var 59 | target_point: TPoint := Point(400, 300); 60 | Var 61 | pts: vector; 62 | tool.getContour(target_point, pts); 63 | // ! [usage_example_intelligent_scissors] 64 | 65 | WriteLn(pts.size); 66 | 67 | except 68 | on E: Exception do 69 | begin 70 | WriteLn(E.ClassName, ': ', E.Message); 71 | Readln; 72 | end; 73 | end; 74 | 75 | end. 76 | -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/snippets/imgproc_segmentation/imgproc_segmentation.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/snippets/imgproc_segmentation/imgproc_segmentation.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/video/optical_flow/optical_flow.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/video/optical_flow/optical_flow.res -------------------------------------------------------------------------------- /samples/cpp/tutorial_code/videoio/video-write/video_write.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/tutorial_code/videoio/video-write/video_write.res -------------------------------------------------------------------------------- /samples/cpp/videocapture_audio/videocapture_audio.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program videocapture_audio; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cv.resource, 30 | cpp.utils, 31 | cv.opencv; 32 | 33 | begin 34 | try 35 | Var 36 | filename: string := 'soundsample.mp3'; 37 | if (ParamCount > 0) and FileExists(ParamStr(1)) then 38 | filename := ParamStr(1) 39 | else 40 | begin 41 | cerr + 'ERROR! Can''t to open file: ' + filename + endl; 42 | Halt(1); 43 | end; 44 | 45 | Var 46 | frame: TMat; 47 | Var 48 | audioData: vector>; 49 | Var 50 | cap: TVideoCapture; 51 | Var 52 | params: vector := [CAP_PROP_AUDIO_STREAM, 0, CAP_PROP_VIDEO_STREAM, -1, CAP_PROP_AUDIO_DATA_DEPTH, CV_16S]; 53 | 54 | cap.open(filename, CAP_MSMF, params); 55 | if (not cap.isOpened()) then 56 | begin 57 | cerr + 'ERROR! Can''t to open file: ' + filename + endl; 58 | Halt(1); 59 | end; 60 | 61 | const 62 | audioBaseIndex: int = Trunc(cap.get(CAP_PROP_AUDIO_BASE_INDEX)); 63 | const 64 | numberOfChannels: int = Trunc(cap.get(CAP_PROP_AUDIO_TOTAL_CHANNELS)); 65 | cout + 'CAP_PROP_AUDIO_DATA_DEPTH: ' + depthToString(Trunc(cap.get(CAP_PROP_AUDIO_DATA_DEPTH))) + endl; 66 | cout + 'CAP_PROP_AUDIO_SAMPLES_PER_SECOND: ' + cap.get(CAP_PROP_AUDIO_SAMPLES_PER_SECOND) + endl; 67 | cout + 'CAP_PROP_AUDIO_TOTAL_CHANNELS: ' + numberOfChannels + endl; 68 | cout + 'CAP_PROP_AUDIO_TOTAL_STREAMS: ' + cap.get(CAP_PROP_AUDIO_TOTAL_STREAMS) + endl; 69 | 70 | Var 71 | numberOfSamples: int := 0; 72 | audioData.resize(numberOfChannels); 73 | While True do 74 | begin 75 | if (cap.grab()) then 76 | begin 77 | for Var nCh: int := 0 to numberOfChannels - 1 do 78 | begin 79 | cap.retrieve(frame, audioBaseIndex + nCh); 80 | audioData[nCh].push_back(frame); 81 | numberOfSamples := numberOfSamples + frame.cols; 82 | end 83 | end 84 | else 85 | break; 86 | end; 87 | 88 | cout + 'Number of samples: ' + numberOfSamples + endl; 89 | 90 | except 91 | on E: Exception do 92 | begin 93 | Writeln(E.ClassName, ': ', E.Message); 94 | Readln; 95 | end; 96 | end; 97 | 98 | end. 99 | -------------------------------------------------------------------------------- /samples/cpp/videocapture_audio/videocapture_audio.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/videocapture_audio/videocapture_audio.res -------------------------------------------------------------------------------- /samples/cpp/videocapture_basic/videocapture_basic.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program videocapture_basic; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cv.resource, 30 | cpp.utils, 31 | cv.opencv; 32 | 33 | begin 34 | try 35 | Var 36 | frame: TMat; 37 | // --- INITIALIZE VIDEOCAPTURE 38 | Var 39 | cap: TVideoCapture; 40 | // open the default camera using default API 41 | // cap.open(0); 42 | // OR advance usage: select any API backend 43 | Var 44 | deviceID: int := 0; // 0 = open default camera 45 | Var 46 | apiID: TVideoCaptureAPIs := CAP_ANY; // 0 = autodetect default API 47 | // open selected camera using selected API 48 | cap.open(deviceID, apiID); 49 | // check if we succeeded 50 | if (not cap.isOpened()) then 51 | begin 52 | Writeln('ERROR! Unable to open camera'); 53 | Halt(1); 54 | end; 55 | 56 | // --- GRAB AND WRITE LOOP 57 | Writeln('Start grabbing'); 58 | Writeln('Press any key to terminate'); 59 | while True do 60 | begin 61 | // wait for a new frame from camera and store it into 'frame' 62 | cap.read(frame); 63 | // check if we succeeded 64 | if (frame.empty()) then 65 | begin 66 | Writeln('ERROR! blank frame grabbed'); 67 | break; 68 | end; 69 | // show live and wait for a key with timeout long enough to show images 70 | imshow('Live', frame); 71 | if (waitKey(5) >= 0) then 72 | break; 73 | end; 74 | // the camera will be deinitialized automatically in VideoCapture destructor 75 | 76 | except 77 | on E: Exception do 78 | Writeln(E.ClassName, ': ', E.Message); 79 | end; 80 | 81 | end. 82 | -------------------------------------------------------------------------------- /samples/cpp/videocapture_basic/videocapture_basic.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/videocapture_basic/videocapture_basic.res -------------------------------------------------------------------------------- /samples/cpp/videocapture_image_sequence/videocapture_image_sequence.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program videocapture_image_sequence; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cv.resource, 30 | cpp.utils, 31 | cv.opencv; 32 | 33 | procedure help(); 34 | begin 35 | WriteLn('This sample shows you how to read a sequence of images using the VideoCapture interface.'); 36 | WriteLn('Usage: ', ExtractFileName(ParamStr(0)), ' (example mask: example_%02d.jpg)'); 37 | WriteLn('Image mask defines the name variation for the input images that have to be read as a sequence.'); 38 | WriteLn('Using the mask example_%02d.jpg will read in images labeled as ''example_00.jpg'' ''example_01.jpg'' etc.'); 39 | end; 40 | 41 | begin 42 | try 43 | 44 | help(); 45 | // cv::CommandLineParser parser(argc, argv, '{@image| ../data/left%02d.jpg |}'); 46 | // first_file = parser.get('@image'); 47 | Var 48 | first_file: String := OpenCVData + 'left%02d.jpg'; 49 | 50 | if (first_file.Length = 0) then 51 | Halt(1); 52 | 53 | Var 54 | sequence: TVideoCapture := first_file; 55 | 56 | if (not sequence.isOpened()) then 57 | begin 58 | WriteLn('Failed to open the image sequence!'); 59 | Halt(1); 60 | end; 61 | 62 | Var 63 | image: TMat; 64 | namedWindow('Image sequence | press ESC to close', WINDOW_AUTOSIZE); 65 | 66 | while True do 67 | begin 68 | // Read in image from sequence 69 | sequence > image; 70 | 71 | // If no image was retrieved -> end of sequence 72 | if (image.empty()) then 73 | begin 74 | WriteLn('End of Sequence'); 75 | break; 76 | end; 77 | 78 | imshow('Image sequence | press ESC to close', image); 79 | 80 | if (waitKey(500) = 27) then 81 | break; 82 | end; 83 | 84 | except 85 | on E: Exception do 86 | WriteLn(E.ClassName, ': ', E.Message); 87 | end; 88 | 89 | end. 90 | -------------------------------------------------------------------------------- /samples/cpp/videocapture_image_sequence/videocapture_image_sequence.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/videocapture_image_sequence/videocapture_image_sequence.res -------------------------------------------------------------------------------- /samples/cpp/videocapture_microphone/videocapture_microphone.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program videocapture_microphone; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | System.SysUtils, 29 | cv.resource, 30 | cpp.utils, 31 | cv.opencv; 32 | 33 | begin 34 | try 35 | Var 36 | frame: TMat; 37 | Var 38 | audioData: vector; 39 | Var 40 | cap: TVideoCapture; 41 | Var 42 | params: vector := [CAP_PROP_AUDIO_STREAM, 0, CAP_PROP_VIDEO_STREAM, -1]; 43 | 44 | cap.open(0, CAP_MSMF, params); 45 | if (not cap.isOpened()) then 46 | begin 47 | cerr + 'ERROR! Can''t to open microphone' + endl; 48 | Halt(1); 49 | end; 50 | 51 | const 52 | audioBaseIndex: int = Trunc(cap.get(CAP_PROP_AUDIO_BASE_INDEX)); 53 | const 54 | numberOfChannels: int = Trunc(cap.get(CAP_PROP_AUDIO_TOTAL_CHANNELS)); 55 | cout + 'CAP_PROP_AUDIO_DATA_DEPTH: ' + depthToString(Trunc(cap.get(CAP_PROP_AUDIO_DATA_DEPTH))) + endl; 56 | cout + 'CAP_PROP_AUDIO_SAMPLES_PER_SECOND: ' + cap.get(CAP_PROP_AUDIO_SAMPLES_PER_SECOND) + endl; 57 | cout + 'CAP_PROP_AUDIO_TOTAL_CHANNELS: ' + numberOfChannels + endl; 58 | cout + 'CAP_PROP_AUDIO_TOTAL_STREAMS: ' + cap.get(CAP_PROP_AUDIO_TOTAL_STREAMS) + endl; 59 | 60 | const 61 | cvTickFreq: double = getTickFrequency(); 62 | var 63 | sysTimeCurr: int64 := getTickCount(); 64 | Var 65 | sysTimePrev: int64 := sysTimeCurr; 66 | while ((sysTimeCurr - sysTimePrev) / cvTickFreq) < 10 do 67 | begin 68 | if (cap.grab()) then 69 | begin 70 | for Var nCh: int := 0 to numberOfChannels - 1 do 71 | begin 72 | cap.retrieve(frame, audioBaseIndex + nCh); 73 | audioData.push_back(frame); 74 | sysTimeCurr := getTickCount(); 75 | end 76 | end 77 | else 78 | begin 79 | cerr + 'Grab error' + endl; 80 | break; 81 | end; 82 | end; 83 | Var 84 | numberOfSamles: int := 0; 85 | 86 | for var i: int := 0 to audioData.size - 1 do numberOfSamles := numberOfSamles + audioData[i].cols; 87 | 88 | cout + 'Number of samples: ' + numberOfSamles + endl; 89 | 90 | except 91 | on E: Exception do 92 | begin 93 | Writeln(E.ClassName, ': ', E.Message); 94 | Readln; 95 | end; 96 | end; 97 | 98 | end. 99 | -------------------------------------------------------------------------------- /samples/cpp/videocapture_microphone/videocapture_microphone.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/videocapture_microphone/videocapture_microphone.res -------------------------------------------------------------------------------- /samples/cpp/videocapture_realsense/videocapture_realsense.dpr: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | program videocapture_realsense; 23 | 24 | {$APPTYPE CONSOLE} 25 | {$R *.res} 26 | 27 | uses 28 | WinApi.Windows, 29 | System.SysUtils, 30 | cpp.utils, 31 | cv.resource, 32 | cv.opencv; 33 | 34 | begin 35 | try 36 | Var 37 | capture: TVideoCapture := TVideoCapture.capture(0, CAP_INTELPERC); 38 | if capture.isOpened then 39 | While True do 40 | begin 41 | Var 42 | depthMap, image, irImage, adjMap: TMat; 43 | 44 | capture.grab(); 45 | capture.retrieve(depthMap, CAP_INTELPERC_DEPTH_MAP); 46 | capture.retrieve(image, CAP_INTELPERC_IMAGE); 47 | capture.retrieve(irImage, CAP_INTELPERC_IR_MAP); 48 | 49 | if not depthMap.empty then 50 | normalize(depthMap, adjMap, 0, 255, NORM_MINMAX, CV_8UC1); 51 | 52 | if not adjMap.empty then 53 | applyColorMap(adjMap, adjMap, COLORMAP_JET); 54 | 55 | if not image.empty then 56 | imshow('RGB', image); 57 | if not irImage.empty then 58 | imshow('IR', irImage); 59 | if not adjMap.empty then 60 | imshow('DEPTH', adjMap); 61 | 62 | if (waitKey(30) >= 0) then 63 | break; 64 | end; 65 | 66 | except 67 | on E: Exception do 68 | begin 69 | WriteLn(E.ClassName, ': ', E.Message); 70 | Readln; 71 | end; 72 | end; 73 | 74 | end. 75 | -------------------------------------------------------------------------------- /samples/cpp/videocapture_realsense/videocapture_realsense.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/cpp/videocapture_realsense/videocapture_realsense.res -------------------------------------------------------------------------------- /samples/std/StdTest.dpr: -------------------------------------------------------------------------------- 1 | program StdTest; 2 | 3 | {$APPTYPE CONSOLE} 4 | 5 | {$R *.res} 6 | 7 | uses 8 | cpp.utils; 9 | 10 | Var 11 | s:CppString; 12 | r:String; 13 | v:vector; 14 | begin 15 | // CppString 16 | Writeln(s.length); 17 | Writeln(s.size); 18 | s:='sdfgsdfgsdfg'; 19 | r:=s; 20 | Writeln(r); 21 | r:='1234234'; 22 | s:=r; 23 | Writeln(s.length); 24 | Writeln(s.size); 25 | // Vector 26 | end. 27 | -------------------------------------------------------------------------------- /samples/std/StdTest.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/std/StdTest.res -------------------------------------------------------------------------------- /samples/tapi/clahe.dsv: -------------------------------------------------------------------------------- 1 | [ClosedView_RDpcV29yayhkb250IHN5bmMpXE15UmVwXEdpdEh1YlxEZWxwaGktT3BlbkNWLUNsYXNzXHNvdXJj 2 | ZVxpbWdwcm9jLmluYw==] 3 | Module=D:\Work(dont sync)\MyRep\GitHub\Delphi-OpenCV-Class\source\imgproc.inc 4 | CursorX=49 5 | CursorY=6463 6 | TopLine=6439 7 | LeftCol=1 8 | Elisions= 9 | Bookmarks= 10 | EditViewName=D:\Work(dont sync)\MyRep\GitHub\Delphi-OpenCV-Class\source\imgproc.inc 11 | 12 | -------------------------------------------------------------------------------- /samples/tapi/clahe.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/tapi/clahe.res -------------------------------------------------------------------------------- /samples/warpAffine/WarpAffine_Test.dpr: -------------------------------------------------------------------------------- 1 | program WarpAffine_Test; 2 | 3 | {$APPTYPE CONSOLE} 4 | {$R *.res} 5 | 6 | uses 7 | System.SysUtils, 8 | cv.opencv, 9 | cv.resource; 10 | 11 | const 12 | intput_file = OpenCVData + 'lena.jpg'; 13 | 14 | var 15 | srcTri: TAffineTransformPoints; 16 | dstTri: TAffineTransformPoints; 17 | 18 | begin 19 | try 20 | if not FileExists(intput_file) then 21 | begin 22 | Writeln('Could not open or find the image <' + intput_file + '>'); 23 | Halt; 24 | end; 25 | var 26 | src: TMat := imread(intput_file); 27 | 28 | srcTri[0] := Point2f(0, 0); 29 | srcTri[1] := Point2f(src.cols - 1, 0); 30 | srcTri[2] := Point2f(0, src.rows - 1); 31 | 32 | dstTri[0] := Point2f(0, src.rows * 0.33); 33 | dstTri[1] := Point2f(src.cols * 0.85, src.rows * 0.25); 34 | dstTri[2] := Point2f(src.cols * 0.15, src.rows * 0.7); 35 | var 36 | warp_mat: TMat := getAffineTransform(srcTri, dstTri); 37 | var 38 | warp_dst: TMat := TMat.zeros(src.rows, src.cols, src.&type()); 39 | warpAffine(src, warp_dst, warp_mat, warp_dst.size); 40 | var 41 | center: TPoint := Point(warp_dst.cols div 2, warp_dst.rows div 2); 42 | var 43 | angle: double := -50.0; 44 | var 45 | scale: double := 0.6; 46 | var 47 | center2f: TPoint2f; 48 | center2f.x := center.x; 49 | center2f.y := center.y; 50 | var 51 | rot_mat: TMat := getRotationMatrix2D(center2f, angle, scale); 52 | var 53 | warp_rotate_dst: TMat; 54 | warpAffine(warp_dst, warp_rotate_dst, rot_mat, warp_dst.size); 55 | imshow('Source image', src); 56 | imshow('Warp', warp_dst); 57 | imshow('Warp + Rotate', warp_rotate_dst); 58 | waitKey(); 59 | except 60 | on E: Exception do 61 | Writeln(E.ClassName, ': ', E.Message); 62 | end; 63 | 64 | end. 65 | -------------------------------------------------------------------------------- /samples/warpAffine/WarpAffine_Test.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/samples/warpAffine/WarpAffine_Test.res -------------------------------------------------------------------------------- /source/calib3d.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IFDEF INTERFACE} 24 | 25 | {$if not defined(OPENCV_CALIB3D_HPP)} 26 | {$define OPENCV_CALIB3D_HPP} 27 | 28 | {$IFEND OPENCV_CALIB3D_HPP} 29 | 30 | {$ENDIF INTERFACE} 31 | 32 | // =========================================================================== 33 | 34 | {$IFDEF IMPLEMENTATION} 35 | 36 | 37 | {$if defined(OPENCV_CALIB3D_HPP) an (not defined(OPENCV_CALIB3D_HPP_IMPL))} 38 | {$define OPENCV_CALIB3D_HPP_IMPL} 39 | 40 | {$IFEND OPENCV_CALIB3D_HPP} 41 | 42 | {$ENDIF IMPLEMENTATION} 43 | -------------------------------------------------------------------------------- /source/core/async.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$if not defined(OPENCV_CORE_ASYNC_HPP)} 24 | {$define OPENCV_CORE_ASYNC_HPP} 25 | 26 | {$IF not defined(OPENCV_CORE_MAT_HPP)}{$include core/mat.inc}{$IFEND} 27 | 28 | {$if defined(CV_CXX11)} 29 | //{$include 30 | {$include chrono} 31 | {$ifend} 32 | 33 | (** @addtogroup core_async 34 | 35 | @{ 36 | *) 37 | 38 | Type 39 | (** @brief Returns result of asynchronous operations 40 | 41 | Object has attached asynchronous state. 42 | Assignment operator doesn't clone asynchronous state (it is shared between all instances). 43 | 44 | Result can be fetched via get() method only once. 45 | 46 | *) 47 | AsyncArray = record 48 | public 49 | // ~AsyncArray() CV_NOEXCEPT; 50 | // CV_WRAP AsyncArray() CV_NOEXCEPT; 51 | // AsyncArray(const AsyncArray& o) CV_NOEXCEPT; 52 | // AsyncArray& operator=(const AsyncArray& o) CV_NOEXCEPT; 53 | // CV_WRAP void release() CV_NOEXCEPT; 54 | 55 | (** Fetch the result. 56 | @param[out] dst destination array 57 | 58 | Waits for result until container has valid result. 59 | Throws exception if exception was stored as a result. 60 | 61 | Throws exception on invalid container state. 62 | 63 | @note Result or stored exception can be fetched only once. 64 | *) 65 | // CV_WRAP void get(OutputArray dst) const; 66 | 67 | (** Retrieving the result with timeout 68 | @param[out] dst destination array 69 | @param[in] timeoutNs timeout in nanoseconds, -1 for infinite wait 70 | 71 | @returns true if result is ready, false if the timeout has expired 72 | 73 | @note Result or stored exception can be fetched only once. 74 | *) 75 | // bool get(OutputArray dst, int64 timeoutNs) const; 76 | 77 | // CV_WRAP inline 78 | // bool get(OutputArray dst, double timeoutNs) const { return get(dst, (int64)timeoutNs); } 79 | 80 | // bool wait_for(int64 timeoutNs) const; 81 | 82 | // CV_WRAP inline 83 | // bool wait_for(double timeoutNs) const { return wait_for((int64)timeoutNs); } 84 | 85 | // CV_WRAP bool valid() const CV_NOEXCEPT; 86 | 87 | {$ifdef CV_CXX11} 88 | inline AsyncArray(AsyncArray&& o) { p = o.p; o.p = NULL; } 89 | inline AsyncArray& operator=(AsyncArray&& o) CV_NOEXCEPT { std::swap(p, o.p); return *this; } 90 | 91 | template 92 | inline bool get(OutputArray dst, const std::chrono::duration<_Rep, _Period>& timeout) 93 | { 94 | return get(dst, (int64)(std::chrono::nanoseconds(timeout).count())); 95 | } 96 | 97 | template 98 | inline bool wait_for(const std::chrono::duration<_Rep, _Period>& timeout) 99 | { 100 | return wait_for((int64)(std::chrono::nanoseconds(timeout).count())); 101 | } 102 | 103 | {$ifdef 0} 104 | std::future getFutureMat() const; 105 | std::future getFutureUMat() const; 106 | {$endif} 107 | {$endif} 108 | 109 | 110 | // PImpl 111 | // struct Impl; friend struct Impl; 112 | // inline void* _getImpl() const CV_NOEXCEPT { return p; } 113 | private 114 | // Impl* p; 115 | end; 116 | 117 | 118 | //! @} 119 | 120 | {$ifend OPENCV_CORE_ASYNC_HPP} 121 | -------------------------------------------------------------------------------- /source/core/base.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_CORE_BASE_HPP) and (not defined(OPENCV_CORE_BASE_HPP_IMPL))} 24 | {$DEFINE OPENCV_CORE_BASE_HPP_IMPL} 25 | 26 | {$I 'core/check.impl.inc' } 27 | 28 | {$IFEND} -------------------------------------------------------------------------------- /source/core/check.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_CORE_CHECK_HPP) and (not defined(OPENCV_CORE_CHECK_HPP_IMPL))} 24 | {$DEFINE OPENCV_CORE_CHECK_HPP_IMPL} 25 | 26 | function depthToString(depth: int): pCVChar; 27 | begin 28 | {$IF not defined(PACKAGE)} 29 | Result := func_depthToString(depth); 30 | {$IFEND} 31 | end; 32 | 33 | {$IFEND} 34 | -------------------------------------------------------------------------------- /source/core/cvdef.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_CORE_CVDEF_H) and (not defined(OPENCV_CORE_CVDEF_H_IMPL))} 24 | {$DEFINE OPENCV_CORE_CVDEF_H_IMPL} 25 | 26 | function cvMIN(a, b: Int): Int; 27 | begin 28 | Result := System.Math.MIN(a, b); 29 | end; 30 | 31 | function cvMAX(a, b: Int): Int; 32 | begin 33 | Result := System.Math.MAX(a, b); 34 | end; 35 | 36 | function CV_MAT_TYPE(flags:int):int; 37 | begin 38 | Result:= ((flags) and CV_MAT_TYPE_MASK); 39 | end; 40 | 41 | function CV_ELEM_SIZE1(&type:int):int; 42 | begin 43 | // CV_ELEM_SIZE1(type) = ((0x28442211 >> CV_MAT_DEPTH(type)*4) & 15); 44 | Result := (($28442211 shr CV_MAT_DEPTH(&type)*4) and 15); 45 | end; 46 | 47 | function CV_MAT_CN(flags:int):int; 48 | begin 49 | // CV_MAT_CN(flags) = ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1); 50 | Result := ((((flags) and CV_MAT_CN_MASK) shr CV_CN_SHIFT) + 1); 51 | end; 52 | 53 | function CV_ELEM_SIZE(&type:int):int; 54 | begin 55 | // CV_ELEM_SIZE(type) =(CV_MAT_CN(type)*CV_ELEM_SIZE1(type)); 56 | Result := CV_MAT_CN(&type)*CV_ELEM_SIZE1(&type); 57 | end; 58 | 59 | {$if defined(OPENCV_CORE_HAL_INTERFACE_H) and (not defined(OPENCV_CORE_HAL_INTERFACE_H_IMPL))}{$i core/hal/interface.impl.inc}{$ifend} 60 | {$if defined(OPENCV_CORE_FAST_MATH_HPP) and (not defined(OPENCV_CORE_FAST_MATH_HPP_IMPL))}{$i core/fast_math.impl.inc}{$ifend} 61 | 62 | {$IFEND OPENCV_CORE_CVDEF_H_IMPL} 63 | -------------------------------------------------------------------------------- /source/core/cvstd.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_CORE_CVSTD_HPP) and (not defined(OPENCV_CORE_CVSTD_HPP_IMPL))} 24 | {$define OPENCV_CORE_CVSTD_HPP_IMPL} 25 | 26 | {$ifend} -------------------------------------------------------------------------------- /source/core/cvstd.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF not defined(OPENCV_CORE_CVSTD_HPP)} 24 | {$DEFINE OPENCV_CORE_CVSTD_HPP} 25 | // 26 | {$IFEND}// OPENCV_CORE_CVSTD_HPP 27 | -------------------------------------------------------------------------------- /source/core/cvstd.inl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_CORE_CVSTD_HPP) and defined(OPENCV_CORE_CVSTD_HPP_IMPL) and (not defined(OPENCV_CORE_CVSTD_HPP_INL))} 24 | {$define OPENCV_CORE_CVSTD_HPP_INL} 25 | 26 | {$ifend} -------------------------------------------------------------------------------- /source/core/fast_math.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$if defined(OPENCV_CORE_FAST_MATH_HPP) and (not defined(OPENCV_CORE_FAST_MATH_HPP_IMPL))} 24 | {$define OPENCV_CORE_FAST_MATH_HPP_IMPL} 25 | 26 | function cvRound(value:double ):int; 27 | begin 28 | Result := Round(value); 29 | end; 30 | 31 | function cvFloor(value:double ):int; 32 | begin 33 | Result := System.Math.Floor(value); 34 | end; 35 | 36 | function cvCeil(value:double ):int; 37 | begin 38 | Result := System.Math.Ceil(value); 39 | end; 40 | 41 | function cvIsNaN(value:double ):bool; 42 | begin 43 | Result := System.Math.IsNaN(value); 44 | end; 45 | 46 | function cvIsInf(value:double ):bool; 47 | begin 48 | Result := System.Math.IsInfinite(value); 49 | end; 50 | 51 | {$ifend} -------------------------------------------------------------------------------- /source/core/hal/interface.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_CORE_HAL_INTERFACE_H)and (not defined(OPENCV_CORE_HAL_INTERFACE_H_IMPL))} 24 | {$DEFINE OPENCV_CORE_HAL_INTERFACE_H_IMPL} 25 | 26 | function CV_MAT_DEPTH(flags: Int): Int; 27 | begin 28 | Result := flags and CV_MAT_DEPTH_MASK; 29 | end; 30 | 31 | function CV_MAKETYPE(depth, cn: Int): Int; 32 | begin 33 | Result := (CV_MAT_DEPTH(depth) + (((cn) - 1) shl CV_CN_SHIFT)); 34 | end; 35 | 36 | function CV_MAKE_TYPE(depth, cn: Int): Int; 37 | begin 38 | Result := CV_MAKETYPE(depth, cn); 39 | end; 40 | 41 | function CV_8UC(n: Int): Int; 42 | begin 43 | Result := CV_MAKETYPE(CV_8U, n); 44 | end; 45 | 46 | function CV_8SC(n: Int): Int; 47 | begin 48 | Result := CV_MAKETYPE(CV_8S, n); 49 | end; 50 | 51 | function CV_16UC(n: Int): Int; 52 | begin 53 | Result := CV_MAKETYPE(CV_16U, n); 54 | end; 55 | 56 | function CV_16SC(n: Int): Int; 57 | begin 58 | Result := CV_MAKETYPE(CV_16S, n); 59 | end; 60 | 61 | function CV_32SC(n: Int): Int; 62 | begin 63 | Result := CV_MAKETYPE(CV_32S, n); 64 | end; 65 | 66 | function CV_32FC(n: Int): Int; 67 | begin 68 | Result := CV_MAKETYPE(CV_32F, n); 69 | end; 70 | 71 | function CV_64FC(n: Int): Int; 72 | begin 73 | Result := CV_MAKETYPE(CV_64F, n); 74 | end; 75 | 76 | function CV_16FC(n: Int): Int; 77 | begin 78 | Result := CV_MAKETYPE(CV_16F, n); 79 | end; 80 | {$IFEND OPENCV_CORE_HAL_INTERFACE_H} -------------------------------------------------------------------------------- /source/core/hal/interface.init.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_CORE_HAL_INTERFACE_H) and defined(OPENCV_CORE_HAL_INTERFACE_H_IMPL) and (not defined(OPENCV_CORE_HAL_INTERFACE_H_INIT))} 24 | {$DEFINE OPENCV_CORE_HAL_INTERFACE_H_INIT} 25 | 26 | CV_8UC1 := CV_MAKETYPE(CV_8U, 1); 27 | CV_8UC2 := CV_MAKETYPE(CV_8U, 2); 28 | CV_8UC3 := CV_MAKETYPE(CV_8U, 3); 29 | CV_8UC4 := CV_MAKETYPE(CV_8U, 4); 30 | 31 | CV_8SC1 := CV_MAKETYPE(CV_8S, 1); 32 | CV_8SC2 := CV_MAKETYPE(CV_8S, 2); 33 | CV_8SC3 := CV_MAKETYPE(CV_8S, 3); 34 | CV_8SC4 := CV_MAKETYPE(CV_8S, 4); 35 | 36 | CV_16UC1 := CV_MAKETYPE(CV_16U, 1); 37 | CV_16UC2 := CV_MAKETYPE(CV_16U, 2); 38 | CV_16UC3 := CV_MAKETYPE(CV_16U, 3); 39 | CV_16UC4 := CV_MAKETYPE(CV_16U, 4); 40 | 41 | CV_16SC1 := CV_MAKETYPE(CV_16S, 1); 42 | CV_16SC2 := CV_MAKETYPE(CV_16S, 2); 43 | CV_16SC3 := CV_MAKETYPE(CV_16S, 3); 44 | CV_16SC4 := CV_MAKETYPE(CV_16S, 4); 45 | 46 | CV_32SC1 := CV_MAKETYPE(CV_32S, 1); 47 | CV_32SC2 := CV_MAKETYPE(CV_32S, 2); 48 | CV_32SC3 := CV_MAKETYPE(CV_32S, 3); 49 | CV_32SC4 := CV_MAKETYPE(CV_32S, 4); 50 | 51 | CV_32FC1 := CV_MAKETYPE(CV_32F, 1); 52 | CV_32FC2 := CV_MAKETYPE(CV_32F, 2); 53 | CV_32FC3 := CV_MAKETYPE(CV_32F, 3); 54 | CV_32FC4 := CV_MAKETYPE(CV_32F, 4); 55 | 56 | CV_64FC1 := CV_MAKETYPE(CV_64F, 1); 57 | CV_64FC2 := CV_MAKETYPE(CV_64F, 2); 58 | CV_64FC3 := CV_MAKETYPE(CV_64F, 3); 59 | CV_64FC4 := CV_MAKETYPE(CV_64F, 4); 60 | 61 | CV_16FC1 := CV_MAKETYPE(CV_16F, 1); 62 | CV_16FC2 := CV_MAKETYPE(CV_16F, 2); 63 | CV_16FC3 := CV_MAKETYPE(CV_16F, 3); 64 | CV_16FC4 := CV_MAKETYPE(CV_16F, 4); 65 | 66 | {$IFEND} // OPENCV_CORE_HAL_INTERFACE_H 67 | -------------------------------------------------------------------------------- /source/core/matx.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$if defined(OPENCV_CORE_MATX_HPP) and (not defined(OPENCV_CORE_MATX_HPP_IMPL))} 24 | {$DEFINE OPENCV_CORE_MATX_HPP_IMPL} 25 | 26 | function TVec3b.getItem(const index: integer): uchar; 27 | begin 28 | Assert((index >= 0) and (index < 3)); 29 | Result := _Data[index]; 30 | end; 31 | 32 | class operator TVec3b.Implicit(const a: TArray): TVec3b; 33 | begin 34 | Assert(length(a) > 2); 35 | // slow 36 | for Var i := 0 to High(Result._Data) do 37 | Result._Data[i] := a[i]; 38 | end; 39 | 40 | procedure TVec3b.setItem(const index: integer; const Value: uchar); 41 | begin 42 | Assert((index >= 0) and (index < 3)); 43 | _Data[index] := Value; 44 | end; 45 | 46 | function Vec3b(const a,b,c:uchar):TVec3b; 47 | begin 48 | Result := [a,b,c]; 49 | end; 50 | 51 | { TMatSize } 52 | 53 | function TMatSize.getValues(const Index:Integer):Int; 54 | begin 55 | Result := p[Index]; 56 | end; 57 | 58 | {$IF not defined(OPENCV_CORE_SATURATE_HPP_IMPL)}{$I 'core/saturate.impl.inc'}{$ifend} 59 | 60 | {$ifend} -------------------------------------------------------------------------------- /source/core/operations.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF not defined(OPENCV_CORE_OPERATIONS_HPP)} 24 | {$define OPENCV_CORE_OPERATIONS_HPP} 25 | 26 | {$ifend} -------------------------------------------------------------------------------- /source/core/optim.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$if not defined(OPENCV_OPTIM_HPP)} 24 | {$define OPENCV_OPTIM_HPP} 25 | 26 | {$ifend} -------------------------------------------------------------------------------- /source/core/ovx.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$if not defined(OPENCV_OVX_HPP)} 24 | {$define OPENCV_OVX_HPP} 25 | 26 | {$ifend} -------------------------------------------------------------------------------- /source/core/persistence.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_CORE_PERSISTENCE_HPP) and (not defined(OPENCV_CORE_PERSISTENCE_IMPL_HPP))} 24 | {$DEFINE OPENCV_CORE_PERSISTENCE_IMPL_HPP} 25 | 26 | { TFileNode } 27 | class operator TFileNode.Initialize(out Dest: TFileNode); 28 | begin 29 | {$IF not defined(PACKAGE)} 30 | constructor_CV_FILENODE_3(Dest); 31 | {$IFEND} 32 | end; 33 | 34 | { TFileNodeIterator } 35 | class operator TFileNodeIterator.Initialize(out Dest: TFileNodeIterator); 36 | begin 37 | {$IF not defined(PACKAGE)} 38 | constructor_CV_FILENODEITERATOR_2(Dest); 39 | {$IFEND} 40 | end; 41 | 42 | { TFileStorage } 43 | 44 | class operator TFileStorage.Initialize(out Dest: TFileStorage); 45 | begin 46 | {$IF not defined(PACKAGE)} 47 | constructor_CV_FILESTORAGE_2(Dest); 48 | {$IFEND} 49 | end; 50 | 51 | class operator TFileStorage.Finalize(var Dest: TFileStorage); 52 | begin 53 | {$IF not defined(PACKAGE)} 54 | destructor_CV_FILESTORAGE(Dest); 55 | {$IFEND} 56 | end; 57 | 58 | class function TFileStorage.FileStorage(const filename: String; flags: TMode; const encoding: String = ''): TFileStorage; 59 | begin 60 | {$IF not defined(PACKAGE)} 61 | constructor_CV_FILESTORAGE_1(Result, filename, Int(flags), encoding); 62 | {$IFEND} 63 | end; 64 | 65 | class function TFileStorage.FileStorage(): TFileStorage; 66 | begin 67 | {$IF not defined(PACKAGE)} 68 | // called Initialize for Result 69 | {$IFEND} 70 | end; 71 | 72 | function TFileStorage.isOpened(): bool; 73 | begin 74 | {$IF not defined(PACKAGE)} 75 | Result := class_func_CV_FILESTORAGE_isOpened(Self); 76 | {$IFEND} 77 | end; 78 | 79 | {$IFEND} // OPENCV_CORE_PERSISTENCE_IMPL_HPP 80 | -------------------------------------------------------------------------------- /source/core/saturate.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_CORE_SATURATE_HPP) and (not defined(OPENCV_CORE_SATURATE_HPP_IMPL))} 24 | {$DEFINE OPENCV_CORE_SATURATE_HPP_IMPL} 25 | // 26 | {$MESSAGE WARN 'TODO: saturate_cast'} 27 | 28 | class function saturate_cast.cast(const v: Int): T; 29 | begin 30 | Result := TValue(v).AsType; 31 | if TypeInfo(T)=TypeInfo(Int) then 32 | pInt(@Result)^ := v else 33 | if TypeInfo(T)=TypeInfo(uchar) then 34 | pUchar(@Result)^ := uchar(iif.iif(uint(v) <= UCHAR_MAX, v, iif.iif(v > 0, UCHAR_MAX, 0))); 35 | end; 36 | 37 | class function saturate_cast.cast(const v: float): T; 38 | begin 39 | Result := TValue(v).AsType; 40 | end; 41 | 42 | class function saturate_cast.cast(const v: double): T; 43 | begin 44 | Result := TValue(v).AsType; 45 | end; 46 | 47 | {$IFEND} 48 | -------------------------------------------------------------------------------- /source/core/version.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF not defined(OPENCV_VERSION_HPP)} 24 | {$DEFINE OPENCV_VERSION_HPP} 25 | 26 | {$IF not defined(CVOPT)} 27 | {$I opt.inc} 28 | {$IFEND} 29 | 30 | const 31 | {$IFDEF OPENCV_455} 32 | CV_VERSION_MAJOR = '4'; 33 | CV_VERSION_MINOR = '5'; 34 | CV_VERSION_REVISION = '5'; 35 | CV_VERSION_STATUS = ''; 36 | (* old style version constants *) 37 | CV_MAJOR_VERSION = 4; // CV_VERSION_MAJOR; 38 | CV_MINOR_VERSION = 5; // CV_VERSION_MINOR; 39 | CV_SUBMINOR_VERSION = 4; // CV_VERSION_REVISION; 40 | {$ENDIF} 41 | {$IFDEF OPENCV_460} 42 | CV_VERSION_MAJOR = '4'; 43 | CV_VERSION_MINOR = '6'; 44 | CV_VERSION_REVISION = '0'; 45 | CV_VERSION_STATUS = ''; 46 | (* old style version constants *) 47 | CV_MAJOR_VERSION = 4; // CV_VERSION_MAJOR; 48 | CV_MINOR_VERSION = 6; // CV_VERSION_MINOR; 49 | CV_SUBMINOR_VERSION = 0; // CV_VERSION_REVISION; 50 | {$ENDIF} 51 | {$IFDEF OPENCV_470} 52 | CV_VERSION_MAJOR = '4'; 53 | CV_VERSION_MINOR = '7'; 54 | CV_VERSION_REVISION = '0'; 55 | CV_VERSION_STATUS = ''; 56 | (* old style version constants *) 57 | CV_MAJOR_VERSION = 4; // CV_VERSION_MAJOR; 58 | CV_MINOR_VERSION = 7; // CV_VERSION_MINOR; 59 | CV_SUBMINOR_VERSION = 0; // CV_VERSION_REVISION; 60 | {$ENDIF} 61 | 62 | {$IFDEF OPENCV_480} 63 | CV_VERSION_MAJOR = '4'; 64 | CV_VERSION_MINOR = '8'; 65 | CV_VERSION_REVISION = '0'; 66 | CV_VERSION_STATUS = ''; 67 | (* old style version constants *) 68 | CV_MAJOR_VERSION = 4; // CV_VERSION_MAJOR; 69 | CV_MINOR_VERSION = 8; // CV_VERSION_MINOR; 70 | CV_SUBMINOR_VERSION = 0; // CV_VERSION_REVISION; 71 | {$ENDIF} 72 | 73 | {$IFDEF OPENCV_4100} 74 | CV_VERSION_MAJOR = '4'; 75 | CV_VERSION_MINOR = '10'; 76 | CV_VERSION_REVISION = '0'; 77 | CV_VERSION_STATUS = ''; 78 | (* old style version constants *) 79 | CV_MAJOR_VERSION = 4; // CV_VERSION_MAJOR; 80 | CV_MINOR_VERSION = 10; // CV_VERSION_MINOR; 81 | CV_SUBMINOR_VERSION = 0; // CV_VERSION_REVISION; 82 | {$ENDIF} 83 | 84 | CV_VERSION = CV_VERSION_MAJOR + '.' + CV_VERSION_MINOR + '.' + CV_VERSION_REVISION + CV_VERSION_STATUS; 85 | 86 | cvdllversion = CV_VERSION_MAJOR + CV_VERSION_MINOR + CV_VERSION_REVISION; 87 | {$IF not defined(PACKAGE)} 88 | opencv_delphi_dll = 'opencv_delphi' + cvdllversion + {$IFDEF USE_DEBUG_DLLS} 'd' + {$ENDIF} '.dll'; 89 | opencv_world_dll = 'opencv_world' + cvdllversion + {$IFDEF USE_DEBUG_DLLS} 'd' + {$ENDIF} '.dll'; 90 | {$ifend} 91 | 92 | {$ELSE} 93 | {$MESSAGE FATAL 'Duplicate included file - core/version.inc'} 94 | 95 | {$IFEND OPENCV_VERSION_HPP} 96 | -------------------------------------------------------------------------------- /source/cv.external.pas: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | unit cv.external; 24 | 25 | {$I opt.inc} 26 | 27 | interface 28 | 29 | Uses 30 | cv.opencv, 31 | cpp.utils; 32 | 33 | {$IF not defined(PACKAGE)} 34 | {$I 'external/opencv.types.inc'} 35 | {$I 'external/opencv.external.inc'} 36 | {$IFEND} 37 | 38 | implementation 39 | 40 | end. 41 | -------------------------------------------------------------------------------- /source/cv.opencv.pas: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | unit cv.opencv; 24 | 25 | {$I opt.inc} 26 | 27 | interface 28 | 29 | uses 30 | System.Math, 31 | {$IF DEFINED(USE_TYPEINFO)} 32 | System.TypInfo, System.Rtti, 33 | {$IFEND} 34 | cpp.utils; 35 | 36 | {$DEFINE INTERFACE} 37 | {$I cvconfig.inc} 38 | // 39 | { .$DEFINE OPENCV_ALL_HPP } 40 | // 41 | // File that defines what modules where included during the build of OpenCV 42 | // These are purely the defines of the correct HAVE_OPENCV_modulename values 43 | {$I opencv_modules.inc} 44 | // Then the list of defines is checked to include the correct headers 45 | // Core library is always included --> without no OpenCV functionality available 46 | {$I core.inc} 47 | // Then the optional modules are checked 48 | // 49 | {$IF DEFINED(HAVE_OPENCV_CALIB3D) or DEFINED(OPENCV_ALL_HPP)}{$I 'calib3d.inc'}{$IFEND} 50 | {$IF DEFINED(HAVE_OPENCV_FEATURES2D) or DEFINED(OPENCV_ALL_HPP)}{$I 'features2d.inc'}{$IFEND} 51 | {$IF DEFINED(HAVE_OPENCV_DNN) or DEFINED(OPENCV_ALL_HPP)}{$I 'dnn.inc'}{$IFEND} 52 | {$IF DEFINED(HAVE_OPENCV_FLANN) or DEFINED(OPENCV_ALL_HPP)}{$I 'flann.inc'}{$IFEND} 53 | {$IF DEFINED(HAVE_OPENCV_HIGHGUI) or DEFINED(OPENCV_ALL_HPP)}{$I 'highgui.inc'}{$IFEND} 54 | {$IF DEFINED(HAVE_OPENCV_IMGCODECS) or DEFINED(OPENCV_ALL_HPP)}{$I 'imgcodecs.inc'}{$IFEND} 55 | {$IF DEFINED(HAVE_OPENCV_IMGPROC) or DEFINED(OPENCV_ALL_HPP)}{$I 'imgproc.inc'}{$IFEND} 56 | {$IF DEFINED(HAVE_OPENCV_ML) or DEFINED(OPENCV_ALL_HPP)}{$I 'ml.inc'}{$IFEND} 57 | {$IF DEFINED(HAVE_OPENCV_OBJDETECT) or DEFINED(OPENCV_ALL_HPP)}{$I 'objdetect.inc'}{$IFEND} 58 | {$IF DEFINED(HAVE_OPENCV_PHOTO) or DEFINED(OPENCV_ALL_HPP)}{$I 'photo.inc'}{$IFEND} 59 | {$IF DEFINED(HAVE_OPENCV_STITCHING) or DEFINED(OPENCV_ALL_HPP)}{$I 'stitching.inc'}{$IFEND} 60 | {$IF DEFINED(HAVE_OPENCV_VIDEO) or DEFINED(OPENCV_ALL_HPP)}{$I 'video.inc'}{$IFEND} 61 | {$IF DEFINED(HAVE_OPENCV_VIDEOIO) or DEFINED(OPENCV_ALL_HPP)}{$I 'videoio.inc'}{$IFEND} 62 | 63 | {$UNDEF INTERFACE} 64 | 65 | implementation 66 | 67 | uses 68 | cv.external; 69 | 70 | {$DEFINE IMPLEMENTATION} 71 | // Then the list of defines is checked to include the correct headers 72 | // Core library is always included --> without no OpenCV functionality available 73 | {$IF not defined(OPENCV_CORE_HPP_IMPL)} 74 | {$I 'core.inc'} 75 | {$IFEND} 76 | // 77 | // Then the optional modules are checked 78 | {$IF DEFINED(HAVE_OPENCV_CALIB3D)}{$I 'calib3d.inc'}{$IFEND} 79 | {$IF DEFINED(HAVE_OPENCV_FEATURES2D)}{$I 'features2d.inc'}{$IFEND} 80 | {$IF DEFINED(HAVE_OPENCV_DNN)}{$I 'dnn.inc'}{$IFEND} 81 | {$IF DEFINED(HAVE_OPENCV_FLANN)}{$I 'flann.inc'}{$IFEND} 82 | {$IF DEFINED(HAVE_OPENCV_HIGHGUI)}{$I 'highgui.inc'}{$IFEND} 83 | {$IF DEFINED(HAVE_OPENCV_IMGCODECS)}{$I 'imgcodecs.inc'}{$IFEND} 84 | {$IF DEFINED(HAVE_OPENCV_IMGPROC)}{$I 'imgproc.inc'}{$IFEND} 85 | {$IF DEFINED(HAVE_OPENCV_ML)}{$I 'ml.inc'}{$IFEND} 86 | {$IF DEFINED(HAVE_OPENCV_OBJDETECT)}{$I 'objdetect.inc'}{$IFEND} 87 | {$IF DEFINED(HAVE_OPENCV_PHOTO)}{$I 'photo.inc'}{$IFEND} 88 | {$IF DEFINED(HAVE_OPENCV_STITCHING)}{$I 'stitching.impl.inc'}{$IFEND} 89 | {$IF DEFINED(HAVE_OPENCV_VIDEO)}{$I 'video.inc'}{$IFEND} 90 | {$IF DEFINED(HAVE_OPENCV_VIDEOIO)}{$I 'videoio.inc'}{$IFEND} 91 | 92 | initialization 93 | 94 | {$UNDEF INTERFACE} 95 | {$UNDEF IMPLEMENTATION} 96 | {$DEFINE INITIALIZATION} 97 | 98 | {$I 'core.inc'} 99 | 100 | {$IF defined(OPENCV_CORE_HAL_INTERFACE_H) and defined(OPENCV_CORE_HAL_INTERFACE_H_IMPL)} 101 | {$I 'core/hal/interface.init.inc'} 102 | {$IFEND} 103 | 104 | end. 105 | -------------------------------------------------------------------------------- /source/cv.resource.pas: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | It is subject to the license terms in the LICENSE file found in the top-level directory 5 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 6 | Copyright 2021, Laentir Valetov, laex@bk.ru 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | *) 17 | 18 | unit cv.resource; 19 | 20 | {$I opt.inc} 21 | 22 | interface 23 | 24 | const 25 | OpenCVRootPath = 'C:\OpenCV\opencv-4.10.0\'; 26 | OpenCVData = OpenCVRootPath + 'sources\samples\data\'; 27 | OprnCVHaar = OpenCVRootPath + 'sources\data\haarcascades\'; 28 | 29 | implementation 30 | 31 | {$IFDEF DEBUG} 32 | 33 | Uses 34 | System.SysUtils; 35 | 36 | initialization 37 | 38 | Assert(DirectoryExists(OpenCVRootPath), 'Specify the path to OpenCV'); 39 | {$ENDIF} 40 | 41 | end. 42 | 43 | -------------------------------------------------------------------------------- /source/dnn.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IFDEF INTERFACE} 24 | 25 | {$if not defined(OPENCV_DNN_HPP)} 26 | {$define OPENCV_DNN_HPP} 27 | 28 | // This is an umbrella header to include into you project. 29 | // We are free to change headers layout in dnn subfolder, so please include 30 | // this header for future compatibility 31 | 32 | 33 | (** @defgroup dnn Deep Neural Network module 34 | @{ 35 | This module contains: 36 | - API for new layers creation, layers are building bricks of neural networks; 37 | - set of built-in most-useful Layers; 38 | - API to construct and modify comprehensive neural networks from layers; 39 | - functionality for loading serialized networks models from different frameworks. 40 | 41 | Functionality of this module is designed only for forward pass computations (i.e. network testing). 42 | A network training is in principle not supported. 43 | @} 44 | *) 45 | (** @example samples/dnn/classification.cpp 46 | Check @ref tutorial_dnn_googlenet "the corresponding tutorial" for more details 47 | *) 48 | (** @example samples/dnn/colorization.cpp 49 | *) 50 | (** @example samples/dnn/object_detection.cpp 51 | Check @ref tutorial_dnn_yolo "the corresponding tutorial" for more details 52 | *) 53 | (** @example samples/dnn/openpose.cpp 54 | *) 55 | (** @example samples/dnn/segmentation.cpp 56 | *) 57 | (** @example samples/dnn/text_detection.cpp 58 | *) 59 | {$if not defined(OPENCV_DNN_DNN_HPP)}{$i 'dnn/dnn.inc'}{$ifend} 60 | 61 | {$ifend OPENCV_DNN_HPP} 62 | 63 | {$ENDIF INTERFACE} 64 | 65 | // =========================================================================== 66 | 67 | {$IFDEF IMPLEMENTATION} 68 | 69 | {$if defined(OPENCV_DNN_HPP) and (not defined(OPENCV_DNN_HPP_IMPL))} 70 | {$define OPENCV_DNN_HPP_IMPL} 71 | 72 | {$include 'dnn/dnn.impl.inc'} 73 | 74 | {$ifend} 75 | 76 | {$ENDIF IMPLEMENTATION} 77 | 78 | // ============================================================================ 79 | 80 | {$IFDEF INITIALIZATION} 81 | 82 | 83 | {$ENDIF IINITIALIZATION} -------------------------------------------------------------------------------- /source/dnn/dnn.inl.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Laex/Delphi-OpenCV-Class/ef5b742e1318367098447515e8637dcb5ff9aaa6/source/dnn/dnn.inl.inc -------------------------------------------------------------------------------- /source/dnn/layer.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$if not defined(OPENCV_DNN_LAYER_HPP)} 24 | {$define OPENCV_DNN_LAYER_HPP} 25 | 26 | {$if not defined(OPENCV_DNN_DNN_HPP)}{$i 'dnn/dnn.inc'}{$ifend} 27 | 28 | //namespace cv { 29 | //namespace dnn { 30 | //CV__DNN_INLINE_NS_BEGIN 31 | //! @addtogroup dnn 32 | //! @{ 33 | //! 34 | //! @defgroup dnnLayerFactory Utilities for New Layers Registration 35 | //! @{ 36 | 37 | (** @brief %Layer factory allows to create instances of registered layers. *) 38 | //class CV_EXPORTS LayerFactory 39 | //{ 40 | //public: 41 | 42 | //! Each Layer class must provide this function to the factory 43 | // typedef Ptr(*Constructor)(LayerParams ¶ms); 44 | 45 | //! Registers the layer class with typename @p type and specified @p constructor. Thread-safe. 46 | // static void registerLayer(const String &type, Constructor constructor); 47 | 48 | //! Unregisters registered layer with specified type name. Thread-safe. 49 | // static void unregisterLayer(const String &type); 50 | 51 | (** @brief Creates instance of registered layer. 52 | * @param type type name of creating layer. 53 | * @param params parameters which will be used for layer initialization. 54 | * @note Thread-safe. 55 | *) 56 | // static Ptr createLayerInstance(const String &type, LayerParams& params); 57 | 58 | //private: 59 | // LayerFactory(); 60 | //}; 61 | 62 | //! @} 63 | //! @} 64 | //CV__DNN_INLINE_NS_END 65 | //} 66 | //} 67 | 68 | {$ifend OPENCV_DNN_LAYER_HPP} 69 | -------------------------------------------------------------------------------- /source/dnn/utils/inference_engine.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF not defined(OPENCV_DNN_UTILS_INF_ENGINE_HPP)} 24 | {$DEFINE OPENCV_DNN_UTILS_INF_ENGINE_HPP} 25 | 26 | {$if not defined(OPENCV_DNN_DNN_HPP)}{$i 'dnn/dnn.inc'}{$ifend} 27 | 28 | 29 | // namespace cv { namespace dnn { 30 | // CV__DNN_INLINE_NS_BEGIN 31 | 32 | const 33 | (* Values for 'OPENCV_DNN_BACKEND_INFERENCE_ENGINE_TYPE' parameter *) 34 | CV_DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_API = 'NN_BUILDER'; 35 | CV_DNN_BACKEND_INFERENCE_ENGINE_NGRAPH = 'NGRAPH'; 36 | 37 | (* * @brief Returns Inference Engine internal backend API. 38 | * 39 | * See values of `CV_DNN_BACKEND_INFERENCE_ENGINE_*` macros. 40 | * 41 | * Default value is controlled through `OPENCV_DNN_BACKEND_INFERENCE_ENGINE_TYPE` runtime parameter (environment variable). 42 | *) 43 | // CV_EXPORTS_W cv::String getInferenceEngineBackendType(); 44 | 45 | (* * @brief Specify Inference Engine internal backend API. 46 | * 47 | * See values of `CV_DNN_BACKEND_INFERENCE_ENGINE_*` macros. 48 | * 49 | * @returns previous value of internal backend API 50 | *) 51 | // CV_EXPORTS_W cv::String setInferenceEngineBackendType(const cv::String& newBackendType); 52 | 53 | (* * @brief Release a Myriad device (binded by OpenCV). 54 | * 55 | * Single Myriad device cannot be shared across multiple processes which uses 56 | * Inference Engine's Myriad plugin. 57 | *) 58 | // CV_EXPORTS_W void resetMyriadDevice(); 59 | 60 | const 61 | (* Values for 'OPENCV_DNN_IE_VPU_TYPE' parameter *) 62 | CV_DNN_INFERENCE_ENGINE_VPU_TYPE_UNSPECIFIED = ''; 63 | /// Intel(R) Movidius(TM) Neural Compute Stick, NCS (USB 03e7:2150), Myriad2 (https://software.intel.com/en-us/movidius-ncs) 64 | CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_2 = 'Myriad2'; 65 | /// Intel(R) Neural Compute Stick 2, NCS2 (USB 03e7:2485), MyriadX (https://software.intel.com/ru-ru/neural-compute-stick) 66 | CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X = 'MyriadX'; 67 | CV_DNN_INFERENCE_ENGINE_CPU_TYPE_ARM_COMPUTE = 'ARM_COMPUTE'; 68 | CV_DNN_INFERENCE_ENGINE_CPU_TYPE_X86 = 'X86'; 69 | 70 | (* * @brief Returns Inference Engine VPU type. 71 | * 72 | * See values of `CV_DNN_INFERENCE_ENGINE_VPU_TYPE_*` macros. 73 | *) 74 | // CV_EXPORTS_W cv::String getInferenceEngineVPUType(); 75 | 76 | (* * @brief Returns Inference Engine CPU type. 77 | * 78 | * Specify OpenVINO plugin: CPU or ARM. 79 | *) 80 | // CV_EXPORTS_W cv::String getInferenceEngineCPUType(); 81 | 82 | (* * @brief Release a HDDL plugin. 83 | *) 84 | // CV_EXPORTS_W void releaseHDDLPlugin(); 85 | 86 | 87 | // CV__DNN_INLINE_NS_END 88 | // }} // namespace 89 | 90 | {$IFEND OPENCV_DNN_UTILS_INF_ENGINE_HPP} 91 | -------------------------------------------------------------------------------- /source/dnn/version.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF not defined(OPENCV_DNN_VERSION_HPP)} 24 | {$DEFINE OPENCV_DNN_VERSION_HPP} 25 | 26 | /// Use with major OpenCV version only. 27 | const 28 | OPENCV_DNN_API_VERSION = '20240521'; 29 | 30 | // {$if !defined CV_DOXYGEN && !defined CV_STATIC_ANALYSIS && !defined CV_DNN_DONT_ADD_INLINE_NS} 31 | // {$define CV__DNN_INLINE_NS __CV_CAT(dnn4_v, OPENCV_DNN_API_VERSION)} 32 | // {$define CV__DNN_INLINE_NS_BEGIN namespace CV__DNN_INLINE_NS { 33 | // {$define CV__DNN_INLINE_NS_END } 34 | // namespace cv { namespace dnn { namespace CV__DNN_INLINE_NS { } using namespace CV__DNN_INLINE_NS; }} 35 | // {$else 36 | // {$define CV__DNN_INLINE_NS_BEGIN} 37 | // {$define CV__DNN_INLINE_NS_END} 38 | // {$endif} 39 | 40 | {$IFEND OPENCV_DNN_VERSION_HPP} 41 | -------------------------------------------------------------------------------- /source/flann/config.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$ifndef OPENCV_FLANN_CONFIG_H_} 24 | {$define OPENCV_FLANN_CONFIG_H_} 25 | 26 | //! @cond IGNORED 27 | 28 | //#ifdef FLANN_VERSION_ 29 | //#undef FLANN_VERSION_ 30 | //#endif 31 | const 32 | FLANN_VERSION_ = '1.6.10'; 33 | 34 | //! @endcond 35 | 36 | {$endif OPENCV_FLANN_CONFIG_H_} 37 | -------------------------------------------------------------------------------- /source/flann/general.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$ifndef OPENCV_FLANN_GENERAL_H_} 24 | {$define OPENCV_FLANN_GENERAL_H_} 25 | 26 | {$if CV_MAJOR_VERSION <= 4} 27 | 28 | //! @cond IGNORED 29 | 30 | {$IF not defined(OPENCV_CORE_HPP)}{$I 'core.inc'}{$ifend} 31 | 32 | //namespace cvflann 33 | //{ 34 | // 35 | //class FLANNException : public cv::Exception 36 | //{ 37 | //public: 38 | // FLANNException(const char* message) : cv::Exception(0, message, "", __FILE__, __LINE__) { } 39 | // 40 | // FLANNException(const cv::String& message) : cv::Exception(0, message, "", __FILE__, __LINE__) { } 41 | //}; 42 | // 43 | //} 44 | // 45 | //#define FLANN_THROW(TYPE, STR) throw FLANNException(STR) 46 | // 47 | //#else 48 | // 49 | //#define FLANN_THROW(TYPE, STR) CV_Error(TYPE, STR) 50 | 51 | {$endif} 52 | 53 | //! @endcond 54 | 55 | {$endif OPENCV_FLANN_GENERAL_H_} 56 | -------------------------------------------------------------------------------- /source/flann/matrix.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$ifndef OPENCV_FLANN_DATASET_H_} 24 | {$define OPENCV_FLANN_DATASET_H_} 25 | 26 | //! @cond IGNORED 27 | 28 | //#include 29 | 30 | //namespace cvflann 31 | //{ 32 | 33 | (** 34 | * Class that implements a simple rectangular matrix stored in a memory buffer and 35 | * provides convenient matrix-like access using the [] operators. 36 | *) 37 | //template 38 | //class Matrix 39 | //{ 40 | //public: 41 | // typedef T type; 42 | // 43 | // size_t rows; 44 | // size_t cols; 45 | // size_t stride; 46 | // T* data; 47 | // 48 | // Matrix() : rows(0), cols(0), stride(0), data(NULL) 49 | // { 50 | // } 51 | // 52 | // Matrix(T* data_, size_t rows_, size_t cols_, size_t stride_ = 0) : 53 | // rows(rows_), cols(cols_), stride(stride_), data(data_) 54 | // { 55 | // if (stride==0) stride = cols; 56 | // } 57 | // 58 | // (** 59 | // * Convenience function for deallocating the storage data. 60 | // *) 61 | // CV_DEPRECATED void free() 62 | // { 63 | // fprintf(stderr, "The cvflann::Matrix::free() method is deprecated " 64 | // "and it does not do any memory deallocation any more. You are" 65 | // "responsible for deallocating the matrix memory (by doing" 66 | // "'delete[] matrix.data' for example)"); 67 | // } 68 | // 69 | // (** 70 | // * Operator that return a (pointer to a) row of the data. 71 | // *) 72 | // T* operator[](size_t index) const 73 | // { 74 | // return data+index*stride; 75 | // } 76 | //}; 77 | 78 | 79 | //class UntypedMatrix 80 | //{ 81 | //public: 82 | // size_t rows; 83 | // size_t cols; 84 | // void* data; 85 | // flann_datatype_t type; 86 | // 87 | // UntypedMatrix(void* data_, long rows_, long cols_) : 88 | // rows(rows_), cols(cols_), data(data_) 89 | // { 90 | // } 91 | // 92 | // ~UntypedMatrix() 93 | // { 94 | // } 95 | // 96 | // 97 | // template 98 | // Matrix as() 99 | // { 100 | // return Matrix((T*)data, rows, cols); 101 | // } 102 | //}; 103 | 104 | //} 105 | 106 | //! @endcond 107 | 108 | {$endif OPENCV_FLANN_DATASET_H_} 109 | -------------------------------------------------------------------------------- /source/flann/params.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$ifndef OPENCV_FLANN_PARAMS_H_} 24 | {$define OPENCV_FLANN_PARAMS_H_} 25 | 26 | //! @cond IGNORED 27 | 28 | {$I 'flann/any.inc'} 29 | {$I 'flann/general.inc'} 30 | //#include 31 | //#include 32 | 33 | 34 | //namespace cvflann 35 | //{ 36 | 37 | //typedef std::map IndexParams; 38 | // 39 | //struct SearchParams : public IndexParams 40 | //{ 41 | // SearchParams(int checks = 32, float eps = 0, bool sorted = true ) 42 | // { 43 | // init(checks, eps, sorted, false); 44 | // } 45 | // 46 | // SearchParams(int checks, float eps, bool sorted, bool explore_all_trees ) 47 | // { 48 | // init(checks, eps, sorted, explore_all_trees); 49 | // } 50 | // 51 | // void init(int checks = 32, float eps = 0, bool sorted = true, bool explore_all_trees = false ) 52 | // { 53 | // // how many leafs to visit when searching for neighbours (-1 for unlimited) 54 | // (*this)["checks"] = checks; 55 | // // search for eps-approximate neighbours (default: 0) 56 | // (*this)["eps"] = eps; 57 | // // only for radius search, require neighbours sorted by distance (default: true) 58 | // (*this)["sorted"] = sorted; 59 | // // if false, search stops at the tree reaching the number of max checks (original behavior). 60 | // // When true, we do a descent in each tree and. Like before the alternative paths 61 | // // stored in the heap are not be processed further when max checks is reached. 62 | // (*this)["explore_all_trees"] = explore_all_trees; 63 | // } 64 | //}; 65 | // 66 | // 67 | //template 68 | //T get_param(const IndexParams& params, cv::String name, const T& default_value) 69 | //{ 70 | // IndexParams::const_iterator it = params.find(name); 71 | // if (it != params.end()) { 72 | // return it->second.cast(); 73 | // } 74 | // else { 75 | // return default_value; 76 | // } 77 | //} 78 | // 79 | //template 80 | //T get_param(const IndexParams& params, cv::String name) 81 | //{ 82 | // IndexParams::const_iterator it = params.find(name); 83 | // if (it != params.end()) { 84 | // return it->second.cast(); 85 | // } 86 | // else { 87 | // FLANN_THROW(cv::Error::StsBadArg, cv::String("Missing parameter '")+name+cv::String("' in the parameters given")); 88 | // } 89 | //} 90 | // 91 | //inline void print_params(const IndexParams& params, std::ostream& stream) 92 | //{ 93 | // IndexParams::const_iterator it; 94 | // 95 | // for(it=params.begin(); it!=params.end(); ++it) { 96 | // stream << it->first << " : " << it->second << std::endl; 97 | // } 98 | //} 99 | // 100 | //inline void print_params(const IndexParams& params) 101 | //{ 102 | // print_params(params, std::cout); 103 | //} 104 | // 105 | //} 106 | 107 | //! @endcond 108 | 109 | {$endif OPENCV_FLANN_PARAMS_H_} 110 | -------------------------------------------------------------------------------- /source/imgcodecs/imgcodecs.inc: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/imgcodecs.hpp" 49 | -------------------------------------------------------------------------------- /source/imgproc/segmentation.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF DEFINED(OPENCV_IMGPROC_SEGMENTATION_HPP) and (not DEFINED(OPENCV_IMGPROC_SEGMENTATION_HPP_IMPL))} 24 | {$DEFINE OPENCV_IMGPROC_SEGMENTATION_HPP_IMPL} 25 | 26 | { TIntelligentScissorsMB } 27 | 28 | function TIntelligentScissorsMB.applyImage(const image: TInputArray): pIntelligentScissorsMB; 29 | begin 30 | {$IF not defined(PACKAGE)} 31 | Result := pIntelligentScissorsMB(class_func_CV_SEGMENTATION_INTELLIGENTSCISSORSMB_applyImage(Self, image)); 32 | {$IFEND} 33 | end; 34 | 35 | procedure TIntelligentScissorsMB.buildMap(const sourcePt: TPoint); 36 | begin 37 | {$IF not defined(PACKAGE)} 38 | class_proc_CV_SEGMENTATION_INTELLIGENTSCISSORSMB_buildMap(Self, @sourcePt); 39 | {$IFEND} 40 | end; 41 | 42 | class operator TIntelligentScissorsMB.Finalize(var Dest: TIntelligentScissorsMB); 43 | begin 44 | {$IF not defined(PACKAGE)} 45 | destructor_CV_SEGMENTATION_INTELLIGENTSCISSORSMB(Dest); 46 | {$IFEND} 47 | end; 48 | 49 | procedure TIntelligentScissorsMB.getContour(const targetPt: TPoint; const contour: TOutputArray; backward: BOOL); 50 | begin 51 | {$IF not defined(PACKAGE)} 52 | class_proc_CV_SEGMENTATION_INTELLIGENTSCISSORSMB_getContour(Self, @targetPt, contour, backward); 53 | {$IFEND} 54 | end; 55 | 56 | class operator TIntelligentScissorsMB.Initialize(out Dest: TIntelligentScissorsMB); 57 | begin 58 | {$IF not defined(PACKAGE)} 59 | constructor_CV_SEGMENTATION_INTELLIGENTSCISSORSMB_2(Dest); 60 | {$IFEND} 61 | end; 62 | 63 | function TIntelligentScissorsMB.setEdgeFeatureCannyParameters(threshold1, threshold2: double; apertureSize: Int; L2gradient: BOOL): pIntelligentScissorsMB; 64 | begin 65 | {$IF not defined(PACKAGE)} 66 | Result := pIntelligentScissorsMB(class_func_CV_SEGMENTATION_INTELLIGENTSCISSORSMB_setEdgeFeatureCannyParameters(Self, threshold1, threshold2, apertureSize, L2gradient)); 67 | {$IFEND} 68 | end; 69 | 70 | function TIntelligentScissorsMB.setGradientMagnitudeMaxLimit(gradient_magnitude_threshold_max: float): pIntelligentScissorsMB; 71 | begin 72 | {$IF not defined(PACKAGE)} 73 | Result := pIntelligentScissorsMB(class_func_CV_SEGMENTATION_INTELLIGENTSCISSORSMB_setGradientMagnitudeMaxLimit(Self, gradient_magnitude_threshold_max)); 74 | {$IFEND} 75 | end; 76 | 77 | {$IFEND} 78 | -------------------------------------------------------------------------------- /source/imgproc/types_c.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the 'License'); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an 'AS IS' BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_IMGPROC_TYPES_C_H) and (not defined(OPENCV_IMGPROC_TYPES_C_H_IMPL))} 24 | {$DEFINE OPENCV_IMGPROC_TYPES_C_H_IMPL} 25 | 26 | {$if not defined(OPENCV_CORE_TYPES_H_IMPL)}{$i 'core/types_c.impl.inc'}{$ifend} 27 | {$if not defined(OPENCV_CORE_C_H_IMPL)}{$i 'core/core_c.impl.inc'}{$ifend} 28 | 29 | {$IFEND} 30 | -------------------------------------------------------------------------------- /source/ml/ml.inl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) -------------------------------------------------------------------------------- /source/opencv_modules.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF not defined(OPENCV_OPENCV_MODULES_HPP)} 24 | {$DEFINE OPENCV_OPENCV_MODULES_HPP} 25 | 26 | 27 | // This definition means that OpenCV is built with enabled non-free code. 28 | // For example, patented algorithms for non-profit/non-commercial use only. 29 | (* #undef OPENCV_ENABLE_NONFREE *) 30 | 31 | {$DEFINE HAVE_OPENCV_CORE} 32 | {$DEFINE HAVE_OPENCV_CALIB3D} 33 | {$DEFINE HAVE_OPENCV_DNN} 34 | {$DEFINE HAVE_OPENCV_FEATURES2D} 35 | {$DEFINE HAVE_OPENCV_FLANN} 36 | {$DEFINE HAVE_OPENCV_GAPI} 37 | {$DEFINE HAVE_OPENCV_HIGHGUI} {!!!} 38 | {$DEFINE HAVE_OPENCV_IMGCODECS} 39 | {$DEFINE HAVE_OPENCV_IMGPROC} 40 | {$DEFINE HAVE_OPENCV_ML} 41 | {$DEFINE HAVE_OPENCV_OBJDETECT} 42 | {$DEFINE HAVE_OPENCV_PHOTO} 43 | {$DEFINE HAVE_OPENCV_STITCHING} 44 | {$DEFINE HAVE_OPENCV_VIDEO} 45 | {$DEFINE HAVE_OPENCV_VIDEOIO} 46 | {$DEFINE HAVE_OPENCV_WORLD} 47 | 48 | {$ELSE} 49 | {$MESSAGE FATAL 'Duplicate included file - opencv_modules.inc'} 50 | 51 | {$IFEND} //OPENCV_OPENCV_MODULES_HPP 52 | -------------------------------------------------------------------------------- /source/opt.inc: -------------------------------------------------------------------------------- 1 | {$IF not defined(CVOPT)} 2 | {$DEFINE CVOPT} 3 | // 4 | {$IF not defined(PACKAGE) and (not defined(WIN64)) and (CompilerVersion < 34.0)} 5 | {$MESSAGE FATAL 'cv.opencv must be compiled as Delphi 10.4 Sydney WIN64'} 6 | {$IFEND} 7 | // 8 | // Define version of OpenCV 9 | {$DEFINE OPENCV_4100} 10 | // 11 | {$IFDEF DEBUG} 12 | { }{$DEFINE USE_DEBUG_DLLS} // Use debug OpenCV and VisualStudio's DLLs. 13 | {$IFEND} 14 | // 15 | {$IFDEF RELEASE} 16 | { }{$DEFINE DELAYED_LOAD_DLL} 17 | { }{$DEFINE USE_INLINE} 18 | { }{$UNDEF USE_DEBUG_DLLS} // Do not use debug OpenCV and VisualStudio's DLLs. Else - release OpenCV and VisualStudio's DLLs. 19 | {$ENDIF} 20 | // 21 | {$DEFINE USE_TYPEINFO} 22 | // 23 | {$WEAKLINKRTTI ON} 24 | {$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])} 25 | // 26 | {$WARN SYMBOL_PLATFORM OFF} // turns off all warnings about the platform directive on symbols in the current unit. 27 | {$WRITEABLECONST ON} // typed constants can be modified - ON 28 | {$POINTERMATH ON} 29 | {$MINENUMSIZE 4} 30 | {$TYPEDADDRESS ON} 31 | // 32 | {$ELSE} 33 | // 34 | {$MESSAGE FATAL 'Duplicate included file - opt.inc'} 35 | // 36 | {$IFEND} // CVOPT 37 | -------------------------------------------------------------------------------- /source/stitching.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF defined(OPENCV_STITCHING_STITCHER_HPP) and (not defined(OPENCV_STITCHING_STITCHER_HPP_IMPL))} 24 | {$DEFINE OPENCV_STITCHING_STITCHER_HPP_IMPL} 25 | 26 | {$IF defined(OPENCV_FEATURES_2D_HPP) and (not defined(OPENCV_FEATURES_2D_HPP_IMPL))}{$i 'features2d.inc'}{$ifend} 27 | {$IF defined(OPENCV_IMGPROC_HPP) and (not defined(OPENCV_IMGPROC_HPP_IMPL))}{$I 'imgproc.inc'}{$ifend} 28 | 29 | { TStitcher } 30 | 31 | class function TStitcher.Create(const mode: TStitcher.mode = mode.PANORAMA): TPtr; 32 | begin 33 | {$IF not defined(PACKAGE)} 34 | class_proc_CV_STITCHER_create(Result._Ptr, mode); 35 | {$ifend} 36 | end; 37 | 38 | function TStitcher.stitch(const images: TInputArrayOfArrays; const pano: TOutputArray): TStitcher.Status; 39 | begin 40 | {$IF not defined(PACKAGE)} 41 | Result := class_func_CV_STITCHER_stitch_1(Self, images, pano); 42 | {$ifend} 43 | end; 44 | 45 | {$IFEND} 46 | -------------------------------------------------------------------------------- /source/stitching/detail/camera.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$ifndef OPENCV_STITCHING_CAMERA_HPP} 24 | {$define OPENCV_STITCHING_CAMERA_HPP} 25 | 26 | {$IF not defined(OPENCV_CORE_HPP)}{$I 'core.inc'}{$ifend} 27 | 28 | //namespace cv { 29 | //namespace detail { 30 | 31 | //! @addtogroup stitching 32 | //! @{ 33 | 34 | (** @brief Describes camera parameters. 35 | 36 | @note Translation is assumed to be zero during the whole stitching pipeline. : 37 | *) 38 | //struct CV_EXPORTS_W_SIMPLE CameraParams 39 | //{ 40 | // CameraParams(); 41 | // CameraParams(const CameraParams& other); 42 | // CameraParams& operator =(const CameraParams& other); 43 | // CV_WRAP Mat K() const; 44 | // 45 | // CV_PROP_RW double focal; // Focal length 46 | // CV_PROP_RW double aspect; // Aspect ratio 47 | // CV_PROP_RW double ppx; // Principal point X 48 | // CV_PROP_RW double ppy; // Principal point Y 49 | // CV_PROP_RW Mat R; // Rotation 50 | // CV_PROP_RW Mat t; // Translation 51 | //}; 52 | 53 | //! @} 54 | 55 | //} // namespace detail 56 | //} // namespace cv 57 | 58 | {$endif OPENCV_STITCHING_CAMERA_HPP} 59 | -------------------------------------------------------------------------------- /source/stitching/detail/util.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$if not defined(OPENCV_STITCHING_UTIL_HPP)} 24 | {$define OPENCV_STITCHING_UTIL_HPP} 25 | 26 | {$IF not defined(OPENCV_CORE_HPP)}{$I 'core.inc'}{$ifend} 27 | 28 | //namespace cv { 29 | //namespace detail { 30 | 31 | //! @addtogroup stitching 32 | //! @{ 33 | 34 | //class CV_EXPORTS DisjointSets 35 | //{ 36 | //public: 37 | // DisjointSets(int elem_count = 0) { createOneElemSets(elem_count); } 38 | // 39 | // void createOneElemSets(int elem_count); 40 | // int findSetByElem(int elem); 41 | // int mergeSets(int set1, int set2); 42 | // 43 | // std::vector parent; 44 | // std::vector size; 45 | // 46 | //private: 47 | // std::vector rank_; 48 | //}; 49 | 50 | 51 | //struct CV_EXPORTS GraphEdge 52 | //{ 53 | // GraphEdge(int from, int to, float weight); 54 | // bool operator <(const GraphEdge& other) const { return weight < other.weight; } 55 | // bool operator >(const GraphEdge& other) const { return weight > other.weight; } 56 | // 57 | // int from, to; 58 | // float weight; 59 | //}; 60 | 61 | //inline GraphEdge::GraphEdge(int _from, int _to, float _weight) : from(_from), to(_to), weight(_weight) {} 62 | 63 | 64 | //class CV_EXPORTS Graph 65 | //{ 66 | //public: 67 | // Graph(int num_vertices = 0) { create(num_vertices); } 68 | // void create(int num_vertices) { edges_.assign(num_vertices, std::list()); } 69 | // int numVertices() const { return static_cast(edges_.size()); } 70 | // void addEdge(int from, int to, float weight); 71 | // template B forEach(B body) const; 72 | // template B walkBreadthFirst(int from, B body) const; 73 | // 74 | //private: 75 | // std::vector< std::list > edges_; 76 | //}; 77 | 78 | 79 | ////////////////////////////////////////////////////////////////////////////// 80 | // Auxiliary functions 81 | 82 | //CV_EXPORTS_W bool overlapRoi(Point tl1, Point tl2, Size sz1, Size sz2, Rect &roi); 83 | //CV_EXPORTS_W Rect resultRoi(const std::vector &corners, const std::vector &images); 84 | //CV_EXPORTS_W Rect resultRoi(const std::vector &corners, const std::vector &sizes); 85 | //CV_EXPORTS_W Rect resultRoiIntersection(const std::vector &corners, const std::vector &sizes); 86 | //CV_EXPORTS_W Point resultTl(const std::vector &corners); 87 | 88 | // Returns random 'count' element subset of the {0,1,...,size-1} set 89 | //CV_EXPORTS_W void selectRandomSubset(int count, int size, std::vector &subset); 90 | 91 | //CV_EXPORTS_W int& stitchingLogLevel(); 92 | 93 | //! @} 94 | 95 | //} // namespace detail 96 | //} // namespace cv 97 | 98 | {$if not defined(OPENCV_STITCHING_UTIL_HPP)}{$i 'stitching/detail/util.inc'}{$ifend} 99 | 100 | {$ifend} //OPENCV_STITCHING_UTIL_HPP 101 | -------------------------------------------------------------------------------- /source/stitching/detail/util_inl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$if not defined(OPENCV_STITCHING_UTIL_INL_HPP)} 24 | {$define OPENCV_STITCHING_UTIL_INL_HPP} 25 | 26 | {$IF not defined(OPENCV_CORE_HPP)}{$I 'core.inc'}{$ifend} 27 | {$if not defined(OPENCV_STITCHING_UTIL_HPP)}{$i 'stitching/detail/util.inc'}{$ifend} // Make your IDE see declarations 28 | 29 | //! @cond IGNORED 30 | 31 | //namespace cv { 32 | //namespace detail { 33 | 34 | //template 35 | //B Graph::forEach(B body) const 36 | //{ 37 | // for (int i = 0; i < numVertices(); ++i) 38 | // { 39 | // std::list::const_iterator edge = edges_[i].begin(); 40 | // for (; edge != edges_[i].end(); ++edge) 41 | // body(*edge); 42 | // } 43 | // return body; 44 | //} 45 | 46 | 47 | 48 | //template 49 | //B Graph::walkBreadthFirst(int from, B body) const 50 | //{ 51 | // std::vector was(numVertices(), false); 52 | // std::queue vertices; 53 | // 54 | // was[from] = true; 55 | // vertices.push(from); 56 | // 57 | // while (!vertices.empty()) 58 | // { 59 | // int vertex = vertices.front(); 60 | // vertices.pop(); 61 | // 62 | // std::list::const_iterator edge = edges_[vertex].begin(); 63 | // for (; edge != edges_[vertex].end(); ++edge) 64 | // { 65 | // if (!was[edge->to]) 66 | // { 67 | // body(*edge); 68 | // was[edge->to] = true; 69 | // vertices.push(edge->to); 70 | // } 71 | // } 72 | // } 73 | // 74 | // return body; 75 | //} 76 | 77 | 78 | ////////////////////////////////////////////////////////////////////////////// 79 | // Some auxiliary math functions 80 | 81 | //static inline 82 | //float normL2(const Point3f& a) 83 | //{ 84 | // return a.x * a.x + a.y * a.y + a.z * a.z; 85 | //} 86 | 87 | 88 | //static inline 89 | //float normL2(const Point3f& a, const Point3f& b) 90 | //{ 91 | // return normL2(a - b); 92 | //} 93 | 94 | 95 | //static inline 96 | //double normL2sq(const Mat &r) 97 | //{ 98 | // return r.dot(r); 99 | //} 100 | 101 | 102 | //static inline int sqr(int x) { return x * x; } 103 | //static inline float sqr(float x) { return x * x; } 104 | //static inline double sqr(double x) { return x * x; } 105 | 106 | //} // namespace detail 107 | //} // namespace cv 108 | 109 | //! @endcond 110 | 111 | {$ifend} //OPENCV_STITCHING_UTIL_INL_HPP 112 | -------------------------------------------------------------------------------- /source/vectortype.inc: -------------------------------------------------------------------------------- 1 | vtNone = 0, 2 | vtMat = 1, // vector 3 | vtRect = 2, // vector 4 | vtPoint = 3, // vector 5 | vtVectorMat = 4, // vector> 6 | vtVectorRect = 5, // vector> 7 | vtVectorPoint = 6, // vector> 8 | vtPoint2f = 7, // vector 9 | vtScalar = 8, // vector 10 | vtuchar = 9, // vector 11 | vtfloat = 10, // vector 12 | vtint = 11, // vector 13 | vtVec4i = 12, // vector 14 | vtGMat = 13, // vector 15 | vtGCompileArg = 14, // vector 16 | vtVec6f = 15, // vector 17 | vtVectorPoint2f = 16, // vector> 18 | vtString = 17 // vector 19 | -------------------------------------------------------------------------------- /source/video.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$if defined(OPENCV_VIDEO_HPP) and (not defined(OPENCV_VIDEO_HPP_IMPL))} 24 | {$DEFINE OPENCV_VIDEO_HPP_IMPL} 25 | 26 | {$IF defined(OPENCV_IMGPROC_HPP) and (not defined(OPENCV_IMGPROC_HPP_IMPL))} 27 | {$I 'imgproc.inc'} 28 | {$ifend} 29 | 30 | {$I 'video/tracking.impl.inc'} 31 | {$I 'video/background_segm.impl.inc'} 32 | 33 | {$ifend} 34 | -------------------------------------------------------------------------------- /source/video.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IFDEF INTERFACE} 24 | 25 | {$if not defined(OPENCV_VIDEO_HPP)} 26 | {$define OPENCV_VIDEO_HPP} 27 | 28 | {$IF not defined(OPENCV_IMGPROC_HPP)} 29 | {$I 'imgproc.inc'} 30 | {$ifend} 31 | 32 | (** 33 | @defgroup video Video Analysis 34 | @{ 35 | @defgroup video_motion Motion Analysis 36 | @defgroup video_track Object Tracking 37 | @defgroup video_c C API 38 | @} 39 | *) 40 | 41 | {$i 'video/tracking.inc'} 42 | {$i 'video/background_segm.inc'} 43 | 44 | {$ifend OPENCV_VIDEO_HPP} 45 | 46 | {$ENDIF INTERFACE} 47 | 48 | // =========================================================================== 49 | 50 | {$IFDEF IMPLEMENTATION} 51 | 52 | {$if defined(OPENCV_VIDEO_HPP) and (not defined(OPENCV_VIDEO_HPP_IMPL))} 53 | {$DEFINE OPENCV_VIDEO_HPP_IMPL} 54 | 55 | {$IF defined(OPENCV_IMGPROC_HPP) and (not defined(OPENCV_IMGPROC_HPP_IMPL))} 56 | {$I 'imgproc.inc'} 57 | {$ifend} 58 | 59 | {$I 'video/tracking.impl.inc'} 60 | {$I 'video/background_segm.impl.inc'} 61 | 62 | {$ifend} 63 | 64 | {$ENDIF IMPLEMENTATION} 65 | 66 | // ============================================================================ 67 | 68 | {$IFDEF INITIALIZATION} 69 | 70 | {$ENDIF IINITIALIZATION} -------------------------------------------------------------------------------- /source/video/background_segm.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$ifdef OPENCV_BACKGROUND_SEGM_HPP} 24 | 25 | { TBackgroundSubtractorMOG2 } 26 | 27 | procedure TBackgroundSubtractorMOG2.apply(const image: TInputArray; const fgmask: TOutputArray; learningRate: double); 28 | Type 29 | Tapply = procedure(const Obj: TBackgroundSubtractorMOG2; const image: TInputArray; const fgmask: TOutputArray; learningRate: double); 30 | begin 31 | Tapply(vftable(Self.vft, $38 div SizeOf(Pointer)))(Self, image, fgmask, learningRate); 32 | end; 33 | 34 | class operator TBackgroundSubtractorMOG2.Finalize(var Dest: TBackgroundSubtractorMOG2); 35 | begin 36 | {$IF not defined(PACKAGE)} 37 | destructor_CV_BACKGROUNDSUBTRACTORMOG2(Dest); 38 | {$ifend} 39 | end; 40 | 41 | procedure TBackgroundSubtractorMOG2.setVarThreshold(varThreshold: double); 42 | Type 43 | TsetVarThreshold = procedure(const Obj: TBackgroundSubtractorMOG2; varThreshold: double); 44 | begin 45 | TsetVarThreshold(vftable(Self.vft, $80 div SizeOf(Pointer)))(Self, varThreshold); 46 | end; 47 | 48 | { TBackgroundSubtractorHelper } 49 | 50 | procedure TBackgroundSubtractorHelper.apply(const image:TInputArray;const fgmask:TOutputArray; learningRate:double); 51 | Type 52 | Tapply = procedure(const Obj: TBackgroundSubtractor; const image: TInputArray; const fgmask: TOutputArray; learningRate: double); 53 | begin 54 | Tapply(vftable(Self.vft, $38 div SizeOf(Pointer)))(Self, image, fgmask, learningRate); 55 | end; 56 | 57 | procedure TBackgroundSubtractorHelper.getBackgroundImage(const backgroundImage:TOutputArray); 58 | Type 59 | TgetBackgroundImage = procedure(const Obj: TBackgroundSubtractor; const backgroundImage:TOutputArray); 60 | begin 61 | TgetBackgroundImage(vftable(Self.vft, $40 div SizeOf(Pointer)))(Self, backgroundImage); 62 | end; 63 | 64 | function createBackgroundSubtractorMOG2( 65 | history: Int = 500; 66 | varThreshold: double = 16; 67 | detectShadows: BOOL = true): TPtr; 68 | begin 69 | {$IF not defined(PACKAGE)} 70 | Result := func_createBackgroundSubtractorMOG2(history,varThreshold,detectShadows); 71 | {$IFEND} 72 | end; 73 | 74 | function createBackgroundSubtractorKNN(history:int=500; dist2Threshold:double=400.0; detectShadows:bool=true):TPtr; 75 | begin 76 | {$IF not defined(PACKAGE)} 77 | Result := func_createBackgroundSubtractorKNN(history,dist2Threshold,detectShadows); 78 | {$IFEND} 79 | end; 80 | 81 | 82 | {$endif} -------------------------------------------------------------------------------- /source/video/tracking.impl.inc: -------------------------------------------------------------------------------- 1 | (* 2 | This file is part of Delphi-OpenCV-Class project. 3 | https://github.com/Laex/Delphi-OpenCV-Class 4 | 5 | It is subject to the license terms in the LICENSE file found in the top-level directory 6 | of this distribution and at https://www.apache.org/licenses/LICENSE-2.0.txt 7 | 8 | Copyright 2021, Laentir Valetov, laex@bk.ru 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | *) 22 | 23 | {$IF DEFined(OPENCV_TRACKING_HPP) and (not DEFINED(OPENCV_TRACKING_HPP_IMPL))} 24 | {$DEFINE OPENCV_TRACKING_HPP_IMPL} 25 | { TDenseOpticalFlow } 26 | 27 | procedure TDenseOpticalFlow.calc(const i0, i1: TInputArray; const flow: TInputOutputArray); 28 | Type 29 | Tcalc = procedure(const Obj: TDenseOpticalFlow; const i0, i1: TInputArray; const flow: TInputOutputArray); 30 | begin 31 | Tcalc(vftable(Self.vft, $38 div SizeOf(Pointer)))(Self, i0, i1, flow); 32 | end; 33 | 34 | class operator TDenseOpticalFlow.Finalize(var Dest: TDenseOpticalFlow); 35 | begin 36 | {$IF not defined(PACKAGE)} 37 | destructor_CV_DENSEOPTICALFLOW(Dest); 38 | {$IFEND} 39 | end; 40 | 41 | { TDISOpticalFlow } 42 | 43 | class function TDISOpticalFlowHelper.Create(preset: Int): TPtr; 44 | begin 45 | {$IF not defined(PACKAGE)} 46 | class_proc_CV_DISOPTICALFLOW_create(@Result, preset); 47 | {$IFEND} 48 | end; 49 | 50 | class function TDISOpticalFlowHelper.Create(preset: Int = PRESET_FAST): TPtr; 51 | begin 52 | {$IF not defined(PACKAGE)} 53 | class_proc_CV_DISOPTICALFLOW_create(Result, preset); 54 | {$IFEND} 55 | end; 56 | 57 | { TKalmanFilter } 58 | 59 | class function TKalmanFilter.KalmanFilter(const dynamParams, measureParams: Int; const controlParams: Int = 0; const &type: Int = CV_32F): TKalmanFilter; 60 | begin 61 | {$IF not defined(PACKAGE)} 62 | constructor_CV_KALMANFILTER_2(Result, dynamParams, measureParams, controlParams, &type); 63 | {$IFEND} 64 | end; 65 | 66 | function TKalmanFilter.predict(const control: TMat { = Mat() } ): TMat; 67 | begin 68 | {$IF not defined(PACKAGE)} 69 | Result := class_func_CV_KALMANFILTER_predict(Self, control)^; 70 | {$IFEND} 71 | end; 72 | 73 | function TKalmanFilter.predict(): TMat; 74 | Var 75 | M: TMat; 76 | begin 77 | Result := predict(M); 78 | end; 79 | 80 | function TKalmanFilter.correct(const measurement: TMat): TMat; 81 | begin 82 | {$IF not defined(PACKAGE)} 83 | Result := class_func_CV_KALMANFILTER_correct(Self, measurement)^; 84 | {$IFEND} 85 | end; 86 | 87 | function CamShift(const probImage: TInputArray; const window: TRect; const criteria: TTermCriteria): TRotatedRect; 88 | begin 89 | {$IF not defined(PACKAGE)} 90 | Result := func_CamShift(probImage, window, criteria); 91 | {$IFEND} 92 | end; 93 | 94 | procedure calcOpticalFlowPyrLK(const prevImg: TInputArray; const nextImg: TInputArray; const prevPts: TInputArray; const nextPts: TInputOutputArray; const status: TOutputArray; const err: TOutputArray; winSize: TSize { = Size(21,21) }; maxLevel: Int { = 3 }; const criteria: TTermCriteria { = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 0.01) }; flags: Int = 0; minEigThreshold: double = 1E-4); 95 | begin 96 | {$IF not defined(PACKAGE)} 97 | proc_calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, status, err, winSize, maxLevel, criteria, flags, minEigThreshold); 98 | {$IFEND} 99 | end; 100 | 101 | procedure calcOpticalFlowPyrLK(const prevImg: TInputArray; const nextImg: TInputArray; const prevPts: TInputArray; const nextPts: TInputOutputArray; const status: TOutputArray; const err: TOutputArray; winSize: TSize { = Size(21,21) }; maxLevel: Int = 3); 102 | begin 103 | calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, status, err, winSize, maxLevel, TTermCriteria.TermCriteria(TTermCriteria.COUNT + TTermCriteria.EPS, 30, 0.01)); 104 | end; 105 | 106 | procedure calcOpticalFlowPyrLK(const prevImg: TInputArray; const nextImg: TInputArray; const prevPts: TInputArray; const nextPts: TInputOutputArray; const status: TOutputArray; const err: TOutputArray); 107 | begin 108 | calcOpticalFlowPyrLK(prevImg, nextImg, prevPts, nextPts, status, err, Size(21, 21)); 109 | end; 110 | 111 | {$ENDIF} 112 | --------------------------------------------------------------------------------