Repository: Legoless/LegoCV
Branch: master
Commit: 5338a3bb0397
Files: 351
Total size: 435.2 KB
Directory structure:
gitextract_zblrltlp/
├── .gitignore
├── .gitmodules
├── LICENSE
├── LegoCV/
│ ├── FaceDetection/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ └── AppIcon.appiconset/
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── Recognition/
│ │ │ ├── FaceDetector.swift
│ │ │ └── FaceRecognizer.swift
│ │ └── View Controllers/
│ │ ├── FaceRecognitionVC.swift
│ │ └── LiveCameraVC.swift
│ ├── LegoCV/
│ │ ├── Info.plist
│ │ ├── LegoCV.h
│ │ └── Wrapper/
│ │ ├── Aruco/
│ │ │ ├── OCVCharucoBoard.h
│ │ │ └── OCVCharucoBoard.m
│ │ ├── BgSegm/
│ │ │ ├── OCVBackgroundSubtractorGMG.h
│ │ │ ├── OCVBackgroundSubtractorGMG.m
│ │ │ ├── OCVBackgroundSubtractorMOG.h
│ │ │ └── OCVBackgroundSubtractorMOG.m
│ │ ├── Core/
│ │ │ ├── Algorithms/
│ │ │ │ ├── OCVLDA.h
│ │ │ │ ├── OCVLDA.mm
│ │ │ │ ├── OCVPCA.h
│ │ │ │ ├── OCVPCA.mm
│ │ │ │ ├── OCVRandomGenerator.h
│ │ │ │ ├── OCVRandomGenerator.mm
│ │ │ │ ├── OCVSVD.h
│ │ │ │ └── OCVSVD.mm
│ │ │ ├── Base/
│ │ │ │ ├── OCVAlgorithm.h
│ │ │ │ ├── OCVAlgorithm.m
│ │ │ │ ├── OCVArrayables.h
│ │ │ │ ├── OCVComplex.h
│ │ │ │ ├── OCVComplex.m
│ │ │ │ ├── OCVEdges.h
│ │ │ │ ├── OCVFormatter.h
│ │ │ │ ├── OCVFormatter.m
│ │ │ │ ├── OCVGeometry.h
│ │ │ │ ├── OCVInputArray.h
│ │ │ │ ├── OCVInputArray.mm
│ │ │ │ ├── OCVInputArrayable.h
│ │ │ │ ├── OCVInputOutputArray.h
│ │ │ │ ├── OCVInputOutputArray.mm
│ │ │ │ ├── OCVInputOutputArrayable.h
│ │ │ │ ├── OCVOutputArray.h
│ │ │ │ ├── OCVOutputArray.mm
│ │ │ │ ├── OCVOutputArrayable.h
│ │ │ │ ├── OCVPoint.h
│ │ │ │ ├── OCVRect.h
│ │ │ │ ├── OCVRect.m
│ │ │ │ ├── OCVScalar.h
│ │ │ │ ├── OCVScalar.m
│ │ │ │ ├── OCVSize.h
│ │ │ │ ├── OCVTypes.h
│ │ │ │ ├── OCVVector.h
│ │ │ │ └── OCVVector.m
│ │ │ ├── Mat/
│ │ │ │ ├── OCVMat.h
│ │ │ │ ├── OCVMat.mm
│ │ │ │ ├── OCVMatDataAllocator.h
│ │ │ │ ├── OCVMatDataAllocator.mm
│ │ │ │ ├── OCVMatExpr.h
│ │ │ │ ├── OCVMatExpr.mm
│ │ │ │ ├── OCVUMat.h
│ │ │ │ └── OCVUMat.m
│ │ │ ├── OCVCore.h
│ │ │ ├── Operations/
│ │ │ │ ├── OCVMinimumMaximum.h
│ │ │ │ ├── OCVMinimumMaximum.m
│ │ │ │ ├── OCVOperation+Bitwise.h
│ │ │ │ ├── OCVOperation+Bitwise.mm
│ │ │ │ ├── OCVOperation+Transform.h
│ │ │ │ ├── OCVOperation+Transform.mm
│ │ │ │ ├── OCVOperation.h
│ │ │ │ ├── OCVOperation.mm
│ │ │ │ ├── OCVTermCriteria.h
│ │ │ │ └── OCVTermCriteria.m
│ │ │ ├── Persistence/
│ │ │ │ ├── OCVFileNode.h
│ │ │ │ ├── OCVFileNode.mm
│ │ │ │ ├── OCVFileStorage.h
│ │ │ │ ├── OCVFileStorage.mm
│ │ │ │ ├── OCVFileStorageFormatDescriptor.h
│ │ │ │ ├── OCVFileStorageFormatDescriptor.m
│ │ │ │ ├── OCVPersistence.h
│ │ │ │ └── OCVSerializable.h
│ │ │ └── Private/
│ │ │ ├── OCVGeometry+Private.h
│ │ │ ├── OCVInputArray+Private.h
│ │ │ ├── OCVInputOutputArray+Private.h
│ │ │ ├── OCVMatDataAllocator+Private.h
│ │ │ ├── OCVOutputArray+Private.h
│ │ │ ├── OCVPoint+Private.h
│ │ │ ├── OCVPoint+Private.mm
│ │ │ ├── OCVRect+Private.h
│ │ │ ├── OCVRect+Private.mm
│ │ │ ├── OCVSize+Private.h
│ │ │ └── OCVSize+Private.mm
│ │ ├── Cuda/
│ │ │ ├── OCVGPUMat.h
│ │ │ └── OCVGPUMat.m
│ │ ├── CvEnum/
│ │ │ ├── OCVStorageOperationType.h
│ │ │ └── OCVStorageOperationType.m
│ │ ├── Cvb/
│ │ │ ├── OCVBlob.h
│ │ │ └── OCVBlob.m
│ │ ├── Dnn/
│ │ │ ├── OCVImporter.h
│ │ │ ├── OCVImporter.m
│ │ │ ├── OCVNet.h
│ │ │ └── OCVNet.m
│ │ ├── Face/
│ │ │ ├── OCVEigenFaceRecognizer.h
│ │ │ ├── OCVEigenFaceRecognizer.m
│ │ │ ├── OCVFaceRecognizer.h
│ │ │ ├── OCVFaceRecognizer.m
│ │ │ ├── OCVFisherFaceRecognizer.h
│ │ │ ├── OCVFisherFaceRecognizer.m
│ │ │ ├── OCVLBPHFaceRecognizer.h
│ │ │ └── OCVLBPHFaceRecognizer.m
│ │ ├── Features2D/
│ │ │ ├── OCVFeature2D.h
│ │ │ └── OCVFeature2D.m
│ │ ├── Flann/
│ │ │ ├── OCVIndex.h
│ │ │ └── OCVIndex.m
│ │ ├── Fuzzy/
│ │ │ ├── OCVFuzzyInvoke.h
│ │ │ └── OCVFuzzyInvoke.m
│ │ ├── Geodetic/
│ │ │ ├── OCVGeodeticCoordinate.h
│ │ │ └── OCVGeodeticCoordinate.m
│ │ ├── ImageProcessing/
│ │ │ ├── OCVColorConversionType.h
│ │ │ ├── OCVContrastLimitedAdaptiveHistogramEqualization.h
│ │ │ ├── OCVContrastLimitedAdaptiveHistogramEqualization.m
│ │ │ ├── OCVGeneralizedHough.h
│ │ │ ├── OCVGeneralizedHough.m
│ │ │ ├── OCVGeneralizedHoughBallard.h
│ │ │ ├── OCVGeneralizedHoughBallard.m
│ │ │ ├── OCVGeneralizedHoughGuil.h
│ │ │ ├── OCVGeneralizedHoughGuil.m
│ │ │ ├── OCVImage.h
│ │ │ ├── OCVImage.m
│ │ │ ├── OCVImageOperation.h
│ │ │ ├── OCVImageOperation.mm
│ │ │ ├── OCVImageProcessing.h
│ │ │ ├── OCVImageTypes.h
│ │ │ ├── OCVInterpolationType.h
│ │ │ ├── OCVLineSegmentDetector.h
│ │ │ ├── OCVLineSegmentDetector.m
│ │ │ ├── OCVSubdiv2D.h
│ │ │ └── OCVSubdiv2D.m
│ │ ├── LineDescriptor/
│ │ │ ├── OCVLSDDetector.h
│ │ │ └── OCVLSDDetector.m
│ │ ├── ML/
│ │ │ ├── Enum/
│ │ │ │ ├── OCVBoostType.h
│ │ │ │ ├── OCVBoostType.m
│ │ │ │ ├── OCVVarType.h
│ │ │ │ └── OCVVarType.m
│ │ │ ├── OCVANNMLP.h
│ │ │ ├── OCVANNMLP.m
│ │ │ ├── OCVBoost.h
│ │ │ ├── OCVBoost.m
│ │ │ ├── OCVDTree.h
│ │ │ ├── OCVDTree.m
│ │ │ ├── OCVEM.h
│ │ │ ├── OCVEM.m
│ │ │ ├── OCVKNearest.h
│ │ │ ├── OCVKNearest.m
│ │ │ ├── OCVLogisticRegression.h
│ │ │ ├── OCVLogisticRegression.m
│ │ │ ├── OCVNormalBayesClassifier.h
│ │ │ ├── OCVNormalBayesClassifier.m
│ │ │ ├── OCVRTree.h
│ │ │ ├── OCVRTree.m
│ │ │ ├── OCVSVM.h
│ │ │ ├── OCVSVM.m
│ │ │ ├── OCVStatModelExtensions.h
│ │ │ ├── OCVStatModelExtensions.m
│ │ │ ├── OCVTrainData.h
│ │ │ ├── OCVTrainData.m
│ │ │ └── Structure/
│ │ │ ├── OCVMCvDTreeNode.h
│ │ │ ├── OCVMCvDTreeNode.m
│ │ │ ├── OCVMCvDTreeSplit.h
│ │ │ ├── OCVMCvDTreeSplit.m
│ │ │ ├── OCVMCvDTreeSplitMOrder.h
│ │ │ ├── OCVMCvDTreeSplitMOrder.m
│ │ │ ├── OCVMCvParamGrid.h
│ │ │ └── OCVMCvParamGrid.m
│ │ ├── OCR/
│ │ │ ├── OCVOrientation.h
│ │ │ ├── OCVOrientation.m
│ │ │ ├── OCVPageIterator.h
│ │ │ ├── OCVPageIterator.m
│ │ │ ├── OCVTesseract.h
│ │ │ ├── OCVTesseract.m
│ │ │ ├── OCVTesseractResult.h
│ │ │ └── OCVTesseractResult.m
│ │ ├── ObjectDetection/
│ │ │ ├── OCVBaseCascadeClassifier.h
│ │ │ ├── OCVBaseCascadeClassifier.m
│ │ │ ├── OCVCascadeClassifier.h
│ │ │ ├── OCVCascadeClassifier.mm
│ │ │ ├── OCVCascadeClassifierOptions.h
│ │ │ ├── OCVCascadeClassifierOptions.m
│ │ │ ├── OCVCascadeClassifierResult.h
│ │ │ └── OCVCascadeClassifierResult.m
│ │ ├── Ocl/
│ │ │ ├── OCVDevice.h
│ │ │ ├── OCVDevice.m
│ │ │ ├── OCVImage2D.h
│ │ │ ├── OCVImage2D.m
│ │ │ ├── OCVKernel.h
│ │ │ ├── OCVKernel.m
│ │ │ ├── OCVKernelConfiguration.h
│ │ │ ├── OCVKernelConfiguration.m
│ │ │ ├── OCVPlatformInfo.h
│ │ │ ├── OCVPlatformInfo.m
│ │ │ ├── OCVProgramSource.h
│ │ │ ├── OCVProgramSource.m
│ │ │ ├── OCVQueue.h
│ │ │ └── OCVQueue.m
│ │ ├── Plot/
│ │ │ ├── OCVPlot.h
│ │ │ └── OCVPlot.m
│ │ ├── Reflection/
│ │ │ ├── OCVReflectImage.h
│ │ │ └── OCVReflectImage.m
│ │ ├── Shape/
│ │ │ ├── OCVAffineTransformer.h
│ │ │ ├── OCVAffineTransformer.m
│ │ │ ├── OCVChiHistogramCostExtractor.h
│ │ │ ├── OCVChiHistogramCostExtractor.m
│ │ │ ├── OCVEMDHistogramCostExtractor.h
│ │ │ ├── OCVEMDHistogramCostExtractor.m
│ │ │ ├── OCVEMDL1HistogramCostExtractor.h
│ │ │ ├── OCVEMDL1HistogramCostExtractor.m
│ │ │ ├── OCVHausdorffDistanceExtractor.h
│ │ │ ├── OCVHausdorffDistanceExtractor.m
│ │ │ ├── OCVHistogramCostExtractor.h
│ │ │ ├── OCVHistogramCostExtractor.m
│ │ │ ├── OCVNormHistogramCostExtractor.h
│ │ │ ├── OCVNormHistogramCostExtractor.m
│ │ │ ├── OCVShapeContextDistanceExtractor.h
│ │ │ ├── OCVShapeContextDistanceExtractor.m
│ │ │ ├── OCVShapeDistanceExtractor.h
│ │ │ ├── OCVShapeDistanceExtractor.m
│ │ │ ├── OCVThinPlateSplineShapeTransformer.h
│ │ │ └── OCVThinPlateSplineShapeTransformer.m
│ │ ├── Stitching/
│ │ │ ├── OCVCompressedRectilinearWarper.h
│ │ │ ├── OCVCompressedRectilinearWarper.m
│ │ │ ├── OCVFeaturesFinder.h
│ │ │ ├── OCVFeaturesFinder.m
│ │ │ ├── OCVFisheyeWarper.h
│ │ │ ├── OCVFisheyeWarper.m
│ │ │ ├── OCVMercatorWarper.h
│ │ │ ├── OCVMercatorWarper.m
│ │ │ ├── OCVOrbFeaturesFinder.h
│ │ │ ├── OCVOrbFeaturesFinder.m
│ │ │ ├── OCVPaniniPortraitWarper.h
│ │ │ ├── OCVPaniniPortraitWarper.m
│ │ │ ├── OCVPaniniWarper.h
│ │ │ ├── OCVPaniniWarper.m
│ │ │ ├── OCVPlaneWarper.h
│ │ │ ├── OCVPlaneWarper.m
│ │ │ ├── OCVSphericalWarper.h
│ │ │ ├── OCVSphericalWarper.m
│ │ │ ├── OCVStereographicWarper.h
│ │ │ ├── OCVStereographicWarper.m
│ │ │ ├── OCVSticher.h
│ │ │ ├── OCVSticher.m
│ │ │ ├── OCVTransverseMercatorWarper.h
│ │ │ ├── OCVTransverseMercatorWarper.m
│ │ │ ├── OCVWarperCreator.h
│ │ │ └── OCVWarperCreator.m
│ │ ├── Structure/
│ │ │ ├── OCVRgb.h
│ │ │ ├── OCVRgb.m
│ │ │ ├── OCVRgba.h
│ │ │ └── OCVRgba.m
│ │ ├── Superres/
│ │ │ ├── OCVFrameSource.h
│ │ │ ├── OCVFrameSource.m
│ │ │ ├── OCVSuperResolution.h
│ │ │ └── OCVSuperResolution.m
│ │ ├── Text/
│ │ │ ├── OCVERFilter.h
│ │ │ ├── OCVERFilter.m
│ │ │ ├── OCVERFilterNM1.h
│ │ │ ├── OCVERFilterNM1.m
│ │ │ ├── OCVERFilterNM2.h
│ │ │ ├── OCVERFilterNM2.m
│ │ │ ├── OCVERStat.h
│ │ │ └── OCVERStat.m
│ │ ├── Tiff/
│ │ │ ├── OCVTiffWriter.h
│ │ │ ├── OCVTiffWriter.m
│ │ │ ├── OCVTileTiffWriter.h
│ │ │ └── OCVTileTiffWriter.m
│ │ ├── Tracking/
│ │ │ ├── OCVMultiTracker.h
│ │ │ ├── OCVMultiTracker.m
│ │ │ ├── OCVTracker.h
│ │ │ └── OCVTracker.m
│ │ ├── UI/
│ │ │ ├── OCVHistogramBox.h
│ │ │ ├── OCVHistogramBox.m
│ │ │ ├── OCVHistogramViewer.h
│ │ │ └── OCVHistogramViewer.m
│ │ ├── Utilities/
│ │ │ ├── OCVObject.h
│ │ │ ├── OCVObject.m
│ │ │ ├── OCVPointerObject.h
│ │ │ ├── OCVPointerObject.m
│ │ │ ├── OCVReferenceObject.h
│ │ │ └── OCVReferenceObject.m
│ │ ├── Video/
│ │ │ ├── OCVCamera+Private.h
│ │ │ ├── OCVCamera.h
│ │ │ ├── OCVCamera.mm
│ │ │ ├── OCVPhotoCamera.h
│ │ │ ├── OCVPhotoCamera.mm
│ │ │ ├── OCVVideo.h
│ │ │ ├── OCVVideoCamera.h
│ │ │ └── OCVVideoCamera.mm
│ │ ├── VideoStab/
│ │ │ ├── OCVGaussianMotionFilter.h
│ │ │ ├── OCVGaussianMotionFilter.m
│ │ │ ├── OCVOnePassStabilizer.h
│ │ │ ├── OCVOnePassStabilizer.m
│ │ │ ├── OCVTwoPassStabilizer.h
│ │ │ ├── OCVTwoPassStabilizer.m
│ │ │ ├── OCVVideoCaptureFrameSource.h
│ │ │ ├── OCVVideoCaptureFrameSource.m
│ │ │ ├── OCVVideoFrameSource.h
│ │ │ └── OCVVideoFrameSource.m
│ │ ├── VideoSurveillance/
│ │ │ ├── OCVBackgroundSubtractor.h
│ │ │ ├── OCVBackgroundSubtractor.m
│ │ │ ├── OCVBackgroundSubtractorKNN.h
│ │ │ ├── OCVBackgroundSubtractorKNN.m
│ │ │ ├── OCVBackgroundSubtractorMOG2.h
│ │ │ └── OCVBackgroundSubtractorMOG2.m
│ │ ├── XFeatures2D/
│ │ │ ├── OCVBriefDescriptorExtractor.h
│ │ │ ├── OCVBriefDescriptorExtractor.m
│ │ │ ├── OCVCudaSURF.h
│ │ │ ├── OCVCudaSURF.m
│ │ │ ├── OCVDAISY.h
│ │ │ ├── OCVDAISY.m
│ │ │ ├── OCVFreak.h
│ │ │ ├── OCVFreak.m
│ │ │ ├── OCVLATCH.h
│ │ │ ├── OCVLATCH.m
│ │ │ ├── OCVLUCID.h
│ │ │ ├── OCVLUCID.m
│ │ │ ├── OCVSIFT.h
│ │ │ ├── OCVSIFT.m
│ │ │ ├── OCVSURF.h
│ │ │ ├── OCVSURF.m
│ │ │ ├── OCVStarDetector.h
│ │ │ └── OCVStarDetector.m
│ │ ├── XImgproc/
│ │ │ ├── OCVDTFilter.h
│ │ │ └── OCVDTFilter.m
│ │ └── XPhoto/
│ │ ├── OCVXPhoto.h
│ │ └── OCVXPhoto.m
│ ├── LegoCV.xcodeproj/
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace/
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata/
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ ├── LegoCV.xcscheme
│ │ └── LegoSwiftCV.xcscheme
│ ├── LegoCVTests/
│ │ ├── Info.plist
│ │ └── LegoCVTests.swift
│ ├── LegoSwiftCV/
│ │ ├── Core/
│ │ │ └── Matrix.swift
│ │ ├── Info.plist
│ │ └── LegoSwiftCV.h
│ ├── LegoSwiftCVTests/
│ │ ├── Info.plist
│ │ └── LegoSwiftCVTests.swift
│ └── Playgrounds/
│ └── MatrixOperations.playground/
│ ├── Contents.swift
│ └── contents.xcplayground
├── LegoCV.podspec
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# OS X
.DS_Store
## Build generated
ios/
opencv2.framework/
build/
DerivedData
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
#
# Code Coverage
#
*.gcda
*.gcno
#
# AppCode
#
.idea/
#
# Dominus
#
dominus.cfg
#
# KZBootstrap
#
KZBootstrapUserMacros.h
#
# R.swift
#
*.generated.swift
================================================
FILE: .gitmodules
================================================
[submodule "opencv"]
path = opencv
url = https://github.com/opencv/opencv.git
================================================
FILE: LICENSE
================================================
By downloading, copying, installing or using the software you agree to this license.
If you do not agree to this license, do not download, install,
copy or use the software.
License Agreement
For Open Source Computer Vision Library
(3-clause BSD License)
Copyright (C) 2000-2016, Intel Corporation, all rights reserved.
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved.
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
Copyright (C) 2015-2016, OpenCV Foundation, all rights reserved.
Copyright (C) 2015-2016, Itseez Inc., all rights reserved.
Copyright (C) 2016-2017, Unified Sense, all rights reserved.
Third party copyrights are property of their respective owners.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the names of the copyright holders nor the names of the contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
This software is provided by the copyright holders and contributors "as is" and
any express or implied warranties, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose are disclaimed.
In no event shall copyright holders or contributors be liable for any direct,
indirect, incidental, special, exemplary, or consequential damages
(including, but not limited to, procurement of substitute goods or services;
loss of use, data, or profits; or business interruption) however caused
and on any theory of liability, whether in contract, strict liability,
or tort (including negligence or otherwise) arising in any way out of
the use of this software, even if advised of the possibility of such damage.
================================================
FILE: LegoCV/FaceDetection/AppDelegate.swift
================================================
//
// AppDelegate.swift
// FaceDetection
//
// Created by Dal Rupnik on 14/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
================================================
FILE: LegoCV/FaceDetection/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: LegoCV/FaceDetection/Base.lproj/LaunchScreen.storyboard
================================================
================================================
FILE: LegoCV/FaceDetection/Base.lproj/Main.storyboard
================================================
================================================
FILE: LegoCV/FaceDetection/Info.plist
================================================
CFBundleDevelopmentRegion
en
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
$(PRODUCT_NAME)
CFBundlePackageType
APPL
CFBundleShortVersionString
1.0.0
CFBundleVersion
1
LSRequiresIPhoneOS
NSCameraUsageDescription
Face Detection
UILaunchStoryboardName
LaunchScreen
UIMainStoryboardFile
Main
UIRequiredDeviceCapabilities
armv7
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UISupportedInterfaceOrientations~ipad
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
================================================
FILE: LegoCV/FaceDetection/Recognition/FaceDetector.swift
================================================
//
// FaceDetector.swift
// LegoCV
//
// Created by Dal Rupnik on 23/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
import LegoCV
class FaceDetector : NSObject, OCVVideoCameraDelegate {
private var imageView : UIImageView
private var scale : CGFloat
private var faceRects : [OCVRect] = []
private var faceImgs : [OCVMat] = []
private var faceDetector = OCVCascadeClassifier()
var videoCamera : OCVVideoCamera!
init(imageView: UIImageView, scale: CGFloat) {
self.imageView = imageView
self.scale = scale
super.init()
setupCamera()
setupClassifier()
}
func startCapture () {
videoCamera.start()
}
func stopCapture () {
videoCamera.stop()
}
func detectedFaces () -> [CGRect] {
var rects : [CGRect] = []
for faceRect in faceRects {
let rect = CGRect(x: scale * CGFloat(faceRect.origin.x) / 480.0, y: scale * CGFloat(faceRect.origin.y) / 640.0, width: scale * CGFloat(faceRect.size.width) / 480.0, height: scale * CGFloat(faceRect.size.height) / 640.0)
rects.append(rect)
}
return rects
}
func face(with index: Int) -> UIImage? {
guard index < faceImgs.count else {
return nil
}
return faceImgs[index].image()
}
func processImage(_ image: OCVMat) {
let faces = detectFaces(on: image, with: Double(scale))
draw(faces: faces.0, on: image, with: faces.1)
}
private func setupCamera () {
videoCamera = OCVVideoCamera(parentView: imageView)
videoCamera.defaultAVCaptureDevicePosition = .front
videoCamera.defaultAVCaptureSessionPreset = AVCaptureSession.Preset.vga640x480
videoCamera.defaultAVCaptureVideoOrientation = .portrait
videoCamera.defaultFPS = 30
videoCamera.grayscaleMode = false
videoCamera.delegate = self
}
private func setupClassifier () {
if let path = Bundle.main.path(forResource: "haarcascade_frontalface_alt2", ofType: "xml", inDirectory: "data/haarcascades") {
faceDetector.loadPath(path)
}
}
private func detectFaces (on image: OCVMat, with scale: Double) -> ([OCVRect], OCVMat) {
let scaleFactor = 1.1
let minRects = 2
var minSize = OCVSize()
minSize.width = 30
minSize.height = 30
let gray = OCVMat()
let smallImage = OCVMat(rows: Int(round(Double(image.rows) / scale)), cols: Int(round(Double(image.cols) / scale)), type: .cv8U, channels: 1)
OCVImageOperation.convertColor(fromSource: image, toDestination: gray, with: .typeBGR2GRAY)
OCVImageOperation.resize(fromSource: gray, toDestination: smallImage, size: smallImage.size, fx: 0, fy: 0, interpolation: .linear)
OCVImageOperation.equalizeHistogram(fromSource: smallImage, toDestination: smallImage)
return (faceDetector.detectMultiScale(onImage: smallImage, scaleFactor: scaleFactor, minNeighbours: minRects, flags: 0, minSize: minSize).map { $0.rect }, smallImage)
}
private func draw(faces: [OCVRect], on image: OCVMat, with smallImage: OCVMat) {
let colors : [OCVScalar] = [
OCVScalar(r: 0, g: 0, b: 255),
OCVScalar(r: 0, g: 128, b: 255),
OCVScalar(r: 0, g: 255, b: 255),
OCVScalar(r: 0, g: 255, b: 0),
OCVScalar(r: 255, g: 128, b: 0),
OCVScalar(r: 255, g: 255, b: 0),
OCVScalar(r: 255, g: 0, b: 0),
OCVScalar(r: 255, g: 0, b: 255)
]
var faceImages : [OCVMat] = []
var i = 0
for face in faces {
let color = colors[i % colors.count]
var point1 = OCVPoint()
point1.x = Int(CGFloat(face.origin.x) * scale)
point1.y = Int(CGFloat(face.origin.y) * scale)
var point2 = OCVPoint()
point2.x = Int(CGFloat(face.origin.x + face.size.width - 1) * scale)
point2.y = Int(CGFloat(face.origin.y + face.size.height - 1) * scale)
OCVImageOperation.rectangle(onSource: image, from: point1, to: point2, withColor: color, thickness: 1, lineType: 8, shift: 0)
let smallImageROI = smallImage.submatrix(with: face)
faceImages.append(smallImageROI.clone())
i += 1
}
self.faceImgs = faceImages
}
}
================================================
FILE: LegoCV/FaceDetection/Recognition/FaceRecognizer.swift
================================================
//
// FaceRecognizer.swift
// LegoCV
//
// Created by Dal Rupnik on 23/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
import UIKit
class FaceRecognizer: NSObject {
}
================================================
FILE: LegoCV/FaceDetection/View Controllers/FaceRecognitionVC.swift
================================================
//
// FaceRecognitionVC.swift
// LegoCV
//
// Created by Dal Rupnik on 23/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
import UIKit
class FaceRecognitionVC: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
================================================
FILE: LegoCV/FaceDetection/View Controllers/LiveCameraVC.swift
================================================
//
// LiveCameraVC.swift
// LegoCV
//
// Created by Dal Rupnik on 23/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
import UIKit
class LiveCameraVC: UIViewController {
@IBOutlet weak var cameraView : UIImageView!
var faceDetector : FaceDetector!
override func viewDidLoad() {
super.viewDidLoad()
faceDetector = FaceDetector(imageView: cameraView, scale: 2.0)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
faceDetector.startCapture()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
faceDetector.stopCapture()
}
}
================================================
FILE: LegoCV/LegoCV/Info.plist
================================================
CFBundleDevelopmentRegion
en
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
$(PRODUCT_NAME)
CFBundlePackageType
FMWK
CFBundleShortVersionString
1.0.0
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
NSPrincipalClass
================================================
FILE: LegoCV/LegoCV/LegoCV.h
================================================
//
// LegoCV.h
// LegoCV
//
// Created by Dal Rupnik on 14/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
@import Foundation;
//! Project version number for LegoCV.
FOUNDATION_EXPORT double LegoCVVersionNumber;
//! Project version string for LegoCV.
FOUNDATION_EXPORT const unsigned char LegoCVVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import
#if __has_include("OCVCore.h")
#import "OCVCore.h"
#endif
#if __has_include("OCVImageProcessing.h")
#import "OCVImageProcessing.h"
#endif
#if __has_include("OCVVideo.h")
#import "OCVVideo.h"
#endif
================================================
FILE: LegoCV/LegoCV/Wrapper/Aruco/OCVCharucoBoard.h
================================================
//
// OCVCharucoBoard.h
// LegoCV
//
// Created by Dal Rupnik on 18/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
@interface OCVCharucoBoard : OCVObject
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Aruco/OCVCharucoBoard.m
================================================
//
// OCVCharucoBoard.m
// LegoCV
//
// Created by Dal Rupnik on 18/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVCharucoBoard.h"
@implementation OCVCharucoBoard
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/BgSegm/OCVBackgroundSubtractorGMG.h
================================================
//
// OCVBackgroundSubtractorGMG.h
// LegoCV
//
// Created by Dal Rupnik on 18/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
@interface OCVBackgroundSubtractorGMG : OCVObject
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/BgSegm/OCVBackgroundSubtractorGMG.m
================================================
//
// OCVBackgroundSubtractorGMG.m
// LegoCV
//
// Created by Dal Rupnik on 18/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVBackgroundSubtractorGMG.h"
@implementation OCVBackgroundSubtractorGMG
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/BgSegm/OCVBackgroundSubtractorMOG.h
================================================
//
// OCVBackgroundSubtractorMOG.h
// LegoCV
//
// Created by Dal Rupnik on 18/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
@interface OCVBackgroundSubtractorMOG : OCVObject
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/BgSegm/OCVBackgroundSubtractorMOG.m
================================================
//
// OCVBackgroundSubtractorMOG.m
// LegoCV
//
// Created by Dal Rupnik on 18/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVBackgroundSubtractorMOG.h"
@implementation OCVBackgroundSubtractorMOG
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Algorithms/OCVLDA.h
================================================
//
// OCVLDA.h
// LegoCV
//
// Created by Dal Rupnik on 07/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
#import "OCVInputArrayable.h"
#import "OCVMat.h"
NS_ASSUME_NONNULL_BEGIN
/*!
* Discriminant Analysis
*/
@interface OCVLDA : OCVObject
@property (nonatomic, readonly) OCVMat *eigenVectors;
@property (nonatomic, readonly) OCVMat *eigenValues;
- (instancetype)initWithNumberOfComponents:(NSInteger)numberOfComponents;
- (instancetype)initWithSource:(NSArray *)source labels:(id)labels;
- (instancetype)initWithSource:(NSArray *)source labels:(id)labels numberOfComponents:(NSInteger)numberOfComponents;
//
// TODO: Serializable implementation
//
- (void)computeWithSource:(NSArray *)source labels:(id)labels;
- (OCVMat *)projectWithSource:(id)source;
- (OCVMat *)reconstructWithSource:(id)source;
+ (OCVMat *)subspaceProjectWithW:(id)w mean:(id)mean source:(id)source;
+ (OCVMat *)subspaceReconstructWithW:(id)w mean:(id)mean source:(id)source;
@end
NS_ASSUME_NONNULL_END
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Algorithms/OCVLDA.mm
================================================
//
// OCVLDA.mm
// LegoCV
//
// Created by Dal Rupnik on 07/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVLDA.h"
@implementation OCVLDA
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Algorithms/OCVPCA.h
================================================
//
// OCVPCA.h
// LegoCV
//
// Created by Dal Rupnik on 06/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
#import "OCVInputArrayable.h"
#import "OCVOutputArrayable.h"
#import "OCVMat.h"
/*!
* Reference type: cv::PCA Flags
*/
typedef NS_OPTIONS(NSInteger, OCVPCAFlags) {
OCVPCAFlagDataAsRow = 0, //!< indicates that the input samples are stored as matrix rows
OCVPCAFlagDataAsColumn = 1, //!< indicates that the input samples are stored as matrix columns
OCVPCAFlagUseAvg = 2
};
NS_ASSUME_NONNULL_BEGIN
/*!
* Principal Component Analysis
*/
@interface OCVPCA : OCVObject
@property (nonatomic, readonly) OCVMat* eigenVectors;
@property (nonatomic, readonly) OCVMat* eigenValues;
@property (nonatomic, readonly) OCVMat* mean;
#pragma mark - Initialization
- (instancetype)initWithData:(id)data mean:(id)mean flags:(OCVPCAFlags)flags maxComponents:(NSInteger)maxComponents;
- (instancetype)initWithData:(id)data mean:(id)mean flags:(OCVPCAFlags)flags retainedVariance:(double)retainedVariance;
#pragma mark - Public Methods
- (OCVPCA *)performWithData:(id)data mean:(id)mean flags:(OCVPCAFlags)flags maxComponents:(NSInteger)maxComponents;
- (OCVPCA *)performWithData:(id)data mean:(id)mean flags:(OCVPCAFlags)flags retainedVariance:(double)retainedVariance;
- (OCVMat *)projectWithVector:(id)vector;
- (void)projectWithVector:(id)vector toDestination:(id)destination;
- (OCVMat *)backProjectWithVector:(id)vector;
- (void)backProjectWithVector:(id)vector toDestination:(id)destination;
//
// TODO: Implement OCV FileStorage and OCV FileNode, for serialization
//
- (void)writeToPath:(NSString *)path;
- (void)loadFrompath:(NSString *)path;
@end
NS_ASSUME_NONNULL_END
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Algorithms/OCVPCA.mm
================================================
//
// OCVPCA.mm
// LegoCV
//
// Created by Dal Rupnik on 06/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVPCA.h"
@implementation OCVPCA
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Algorithms/OCVRandomGenerator.h
================================================
//
// OCVRandomGenerator.h
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
#import "OCVInputArrayable.h"
#import "OCVOutputArrayable.h"
#import "OCVInputOutputArrayable.h"
#import "OCVGeometry.h"
#import "OCVTypes.h"
typedef NS_ENUM(NSInteger, OCVRandomType) {
OCVRandomTypeUniform = 0,
OCVRandomTypeNormal = 1,
};
/*!
* cv::RNG
*/
@interface OCVRandomGenerator : OCVObject
@property (nonatomic, assign) unsigned long long state;
#pragma mark - Initialization
- (instancetype)initWithState:(unsigned long long)state;
#pragma mark - Public Methods
- (char)nextChar;
- (unsigned char)nextUnsignedChar;
- (short)nextShort;
- (unsigned short)nextUnsignedShort;
- (int)nextInt;
- (unsigned int)nextUnsignedInt;
- (unsigned long long)nextUnsignedLong;
- (float)nextFloat;
- (double)nextDouble;
- (int)uniformWithLower:(int)lower upper:(int)upper;
- (float)uniformFloatWithLower:(float)lower upper:(float)upper;
- (double)uniformDoubleWithLower:(double)lower upper:(double)upper;
- (void)fillSource:(id)source type:(OCVRandomType)type distributionA:(id)distributionA distributionB:(id)distributionB;
- (void)fillSource:(id)source type:(OCVRandomType)type distributionA:(id)distributionA distributionB:(id)distributionB saturateRange:(BOOL)saturateRange;
- (double)gaussianForSigma:(double)sigma;
/*!
* cv::randShuffle()
*
* @note: While OpenCV provides a static method here for randShuffle, this is an instance method, since it requires random generator object.
*/
- (void)randShuffleToDestination:(id)destination;
- (void)randShuffleToDestination:(id)destination iterationFactor:(double)iterationFactor;
#pragma mark - Class Methods
/*!
* cv::theRNG()
*/
+ (instancetype)defaultGenerator;
/*!
* cv::setRNGSeed()
*/
+ (void)setSeed:(NSInteger)seed;
/*!
* cv::randu()
*/
+ (void)randUniformToDestination:(id)destination withLowBoundary:(id)lowBoundary withHighBoundary:(id)highBoundary;
/*!
* cv::randn()
*/
+ (void)randNormallyToDestination:(id)destination mean:(id)mean standardDeviation:(id)standardDeviation;
@end
/*!
* cv::RNG_MT19937
*/
@interface OCVMersenneTwisterRandomGenerator : OCVRandomGenerator
- (void)seedWithState:(unsigned long long)state;
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Algorithms/OCVRandomGenerator.mm
================================================
//
// OCVRandomGenerator.mm
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVRandomGenerator.h"
@implementation OCVRandomGenerator
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Algorithms/OCVSVD.h
================================================
//
// OCVSVD.h
// LegoCV
//
// Created by Dal Rupnik on 06/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
#import "OCVInputArrayable.h"
#import "OCVOutputArrayable.h"
#import "OCVMat.h"
/*!
* Reference type: cv::PCA Flags
*/
typedef NS_OPTIONS(NSInteger, OCVSVDFlags) {
OCVSVDModifyA = 0,
OCVSVDNoUV = 1,
OCVSVDFullUV = 4
};
NS_ASSUME_NONNULL_BEGIN
/*!
* Singular Value Decomposition
*/
@interface OCVSVD : OCVObject
@property (nonatomic, strong) OCVMat* u;
@property (nonatomic, strong) OCVMat* w;
@property (nonatomic, strong) OCVMat* vt;
- (instancetype)initWithSource:(id)source;
- (instancetype)initWithSource:(id)source flags:(OCVSVDFlags)flags;
- (OCVSVD *)performWithSource:(id)source;
- (OCVSVD *)performWithSource:(id)source flags:(OCVSVDFlags)flags;
+ (void)computeWithSource:(id)source w:(id)w u:(id)u vt:(id)vt;
+ (void)computeWithSource:(id)source w:(id)w u:(id)u vt:(id)vt flags:(OCVSVDFlags)flags;
+ (void)computeWithSource:(id)source w:(id)w;
+ (void)computeWithSource:(id)source w:(id)w flags:(OCVSVDFlags)flags;
+ (void)backSubstitutionWithW:(id)w u:(id)u vt:(id)vt rightHandSide:(id)rightHandSide toDestination:(id)destination;
+ (void)solveZWithSource:(id)source toDestination:(id)destination;
+ (void)backSubstitutionWithRightHandSide:(id)rightHandSide toDestination:(id)destination;
@end
NS_ASSUME_NONNULL_END
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Algorithms/OCVSVD.mm
================================================
//
// OCVSVD.mm
// LegoCV
//
// Created by Dal Rupnik on 06/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVSVD.h"
@implementation OCVSVD
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVAlgorithm.h
================================================
//
// OCVAlgorithm.h
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
@interface OCVAlgorithm : OCVObject
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVAlgorithm.m
================================================
//
// OCVAlgorithm.m
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVAlgorithm.h"
@implementation OCVAlgorithm
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVArrayables.h
================================================
//
// OCVArrayables.h
// LegoCV
//
// Created by Dal Rupnik on 18/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#ifndef OCVArrayables_h
#define OCVArrayables_h
#import "OCVInputArrayable.h"
#import "OCVOutputArrayable.h"
#import "OCVInputOutputArrayable.h"
#endif /* OCVData_h */
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVComplex.h
================================================
//
// OCVComplex.h
// LegoCV
//
// Created by Dal Rupnik on 16/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import
@interface OCVComplex : NSObject
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVComplex.m
================================================
//
// OCVComplex.m
// LegoCV
//
// Created by Dal Rupnik on 16/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVComplex.h"
@implementation OCVComplex
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVEdges.h
================================================
//
// OCVEdgs.h
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#ifndef OCVEdges_h
#define OCVEdges_h
typedef struct OCVEdges {
NSInteger top, left, bottom, right;
} OCVEdges;
#endif /* OCVEdges_h */
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVFormatter.h
================================================
//
// OCVFormatter.h
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
@interface OCVFormatter : OCVObject
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVFormatter.m
================================================
//
// OCVFormatter.m
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVFormatter.h"
@implementation OCVFormatter
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVGeometry.h
================================================
//
// OCVGeometry.h
// LegoCV
//
// Created by Dal Rupnik on 30/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#ifndef OCVGeometry_h
#define OCVGeometry_h
#import "OCVScalar.h"
#import "OCVPoint.h"
#import "OCVSize.h"
#import "OCVRect.h"
#endif
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVInputArray.h
================================================
//
// OCVInputArray.h
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVReferenceObject.h"
#import "OCVGeometry.h"
typedef NS_ENUM(NSInteger, OCVInputArrayType) {
OCVInputArrayTypeMat = 65536,
OCVInputArrayTypeExpression = 393216
};
@class OCVMat;
@interface OCVInputArray : OCVReferenceObject
#pragma mark - Public Properties
@property (nonatomic, readonly) OCVInputArrayType type;
@property (nonatomic, readonly) OCVSize size;
@property (nonatomic, readonly) NSInteger channels;
@property (nonatomic, readonly) NSInteger depth;
@property (nonatomic, readonly) NSInteger dims;
@property (nonatomic, readonly) BOOL isEmpty;
@property (nonatomic, readonly) BOOL isMat;
#pragma mark - Initialization
- (void)setup;
#pragma mark - Public Methods
- (NSInteger)channelsWithIndex:(NSInteger)index;
- (NSInteger)depthWithIndex:(NSInteger)index;
- (NSInteger)dimsWithIndex:(NSInteger)index;
- (OCVMat *)mat;
- (OCVMat *)matWithIndex:(NSInteger)index;
#pragma mark - Static Factory Methods
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVInputArray.mm
================================================
//
// OCVInputArray.mm
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVInputArray+Private.h"
#import "OCVInputArray.h"
#import "OCVMatDataAllocator+Private.h"
#import "OCVMat.h"
@interface OCVInputArray () {
cv::_InputArray *_arrayReference;
}
@end
@implementation OCVInputArray
- (cv::_InputArray *)arrayReference {
return _arrayReference;
}
- (void)setArrayReference:(cv::_InputArray *)arrayReference {
_arrayReference = arrayReference;
}
- (cv::_InputArray *)_input {
[self setup];
return self.arrayReference;
}
- (NSInteger)channels {
return [self channelsWithIndex:-1];
}
- (NSInteger)depth {
return [self depthWithIndex:-1];
}
- (NSInteger)dims {
return [self dimsWithIndex:-1];
}
#pragma mark - Initialization
- (instancetype)init {
[NSException raise:@"InitNotImplemented" format:@"Direct initialization not supported."];
return nil;
}
- (void)dealloc {
if (_arrayReference != NULL) {
free(_arrayReference);
}
_arrayReference = NULL;
}
#pragma mark - Public Methods
- (NSInteger)channelsWithIndex:(NSInteger)index {
return self._input->channels((int)index);
}
- (NSInteger)depthWithIndex:(NSInteger)index {
return self._input->depth((int)index);
}
- (NSInteger)dimsWithIndex:(NSInteger)index {
return self._input->dims((int)index);
}
- (OCVMat *)mat {
return [self matWithIndex:-1];
}
- (OCVMat *)matWithIndex:(NSInteger)index {
cv::Mat mat = self._input->getMat((int)index);
return [[OCVMat alloc] initWithMatInstance:&mat];
}
#pragma mark - Protected Methods
- (void)setup {
if ([self.object isKindOfClass:[OCVMatDataAllocator class]]) {
cv::Mat *mat = [self.object source];
_arrayReference = new cv::_InputArray(*mat);
}
}
#pragma mark - Factory Methods
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVInputArrayable.h
================================================
//
// OCVInputArrayable.h
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVInputArray.h"
@protocol OCVInputArrayable
@property (nonatomic, readonly) OCVInputArray *input;
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVInputOutputArray.h
================================================
//
// OCVInputOutputArray.h
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVOutputArray.h"
@interface OCVInputOutputArray : OCVOutputArray
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVInputOutputArray.mm
================================================
//
// OCVInputOutputArray.m
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVMatDataAllocator+Private.h"
#import "OCVInputOutputArray.h"
#import "OCVInputOutputArray+Private.h"
#import "OCVInputArray+Private.h"
@implementation OCVInputOutputArray
- (cv::_InputOutputArray *)_inputOutput {
[self setup];
return (cv::_InputOutputArray *)self.arrayReference;
}
- (void)setup {
if ([self.object isKindOfClass:[OCVMatDataAllocator class]]) {
cv::Mat *mat = [self.object source];
self.arrayReference = new cv::_InputOutputArray(*mat);
}
}
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVInputOutputArrayable.h
================================================
//
// OCVInputOutputArrayable.h
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVInputOutputArray.h"
@protocol OCVInputOutputArrayable
@property (nonatomic, readonly) OCVInputOutputArray *inputOutput;
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVOutputArray.h
================================================
//
// OCVOutputArray.h
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVInputArray.h"
@interface OCVOutputArray : OCVInputArray
@property (nonatomic, readonly) BOOL isFixedSize;
@property (nonatomic, readonly) BOOL isFixedType;
@property (nonatomic, readonly) BOOL isNeeded;
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVOutputArray.mm
================================================
//
// OCVOutputArray.m
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVMatDataAllocator+Private.h"
#import "OCVOutputArray.h"
#import "OCVInputArray+Private.h"
@implementation OCVOutputArray
- (cv::_OutputArray *)_output {
[self setup];
return (cv::_OutputArray *)self.arrayReference;
}
- (void)setup {
if ([self.object isKindOfClass:[OCVMatDataAllocator class]]) {
cv::Mat *mat = [self.object source];
self.arrayReference = new cv::_OutputArray(*mat);
}
}
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVOutputArrayable.h
================================================
//
// OCVOutputArrayable.h
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVOutputArray.h"
@protocol OCVOutputArrayable
@property (nonatomic, readonly) OCVOutputArray *output;
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVPoint.h
================================================
//
// OCVPoint.h
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import
/*!
* Reference type: cv::Point, cv::Point2i, cv::Point_
*/
typedef struct OCVPoint
{
NSInteger x;
NSInteger y;
}
OCVPoint;
/*!
* Reference type: cv::Point2f, cv::Point_
*/
typedef struct OCVPoint2f {
float x;
float y;
} OCVPoint2f;
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVRect.h
================================================
//
// OCVRect.h
// LegoCV
//
// Created by Dal Rupnik on 22/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import
#import "OCVPoint.h"
#import "OCVSize.h"
typedef struct OCVRect
{
OCVPoint origin;
OCVSize size;
}
OCVRect;
/*!
* Objective-C class immutable wrapper for OCVRect struct
*/
@interface OCVRectValue : NSObject
@property (nonatomic, readonly) OCVRect rect;
- (instancetype)initWithRect:(OCVRect)rect;
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVRect.m
================================================
//
// OCVRect.m
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVRect.h"
@interface OCVRectValue ()
@property (nonatomic, readwrite, assign) OCVRect rect;
@end
@implementation OCVRectValue
- (instancetype)initWithRect:(OCVRect)rect {
self = [super init];
if (self) {
self.rect = rect;
}
return self;
}
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVScalar.h
================================================
//
// OCVScalar.h
// LegoCV
//
// Created by Dal Rupnik on 30/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import
typedef struct OCVScalar {
double value[4];
}
OCVScalar;
OCVScalar OCVScalarRGB(double r, double g, double b) CF_SWIFT_NAME(OCVScalar.init(r:g:b:));
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVScalar.m
================================================
//
// OCVScalar.m
// LegoCV
//
// Created by Dal Rupnik on 30/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVScalar.h"
OCVScalar OCVScalarRGB(double r, double g, double b) {
OCVScalar scalar;
scalar.value[0] = r;
scalar.value[1] = g;
scalar.value[2] = b;
scalar.value[3] = 0.0;
return scalar;
}
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVSize.h
================================================
//
// OCVSize.h
// LegoCV
//
// Created by Dal Rupnik on 16/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import
typedef struct OCVSize
{
NSInteger width;
NSInteger height;
}
OCVSize;
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVTypes.h
================================================
//
// OCVTypes.h
// LegoCV
//
// Created by Dal Rupnik on 16/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVEdges.h"
typedef NS_ENUM(NSInteger, OCVDepthType) {
OCVDepthTypeDefault = -1,
OCVDepthTypeCv8U = 0,
OCVDepthTypeCv8S = 1,
OCVDepthTypeCv16U = 2,
OCVDepthTypeCv16S = 3,
OCVDepthTypeCv32S = 4,
OCVDepthTypeCv32F = 5,
OCVDepthTypeCv64F = 6
};
#pragma mark - Types from base.hpp
/*!
* Reference type: cv::DecompTypes
*/
typedef NS_ENUM(NSInteger, OCVDecompositionType) {
OCVDecompositionTypeLU = 0,
OCVDecompositionTypeSVD = 1,
OCVDecompositionTypeEIG = 2,
OCVDecompositionTypeCholesky = 3,
OCVDecompositionTypeQR = 4,
OCVDecompositionTypeNormal = 16
};
/*!
* Reference type: cv::BorderTypes
*/
typedef NS_ENUM(NSInteger, OCVBorderType) {
OCVBorderTypeConstant = 0, //!< `iiiiii|abcdefgh|iiiiiii` with some specified `i`
OCVBorderTypeReplicate = 1, //!< `aaaaaa|abcdefgh|hhhhhhh`
OCVBorderTypeReflect = 2, //!< `fedcba|abcdefgh|hgfedcb`
OCVBorderTypeWrap = 3, //!< `cdefgh|abcdefgh|abcdefg`
OCVBorderTypeReflect101 = 4, //!< `gfedcb|abcdefgh|gfedcba`
OCVBorderTypeTransparent = 5, //!< `uvwxyz|absdefgh|ijklmno`
OCVBorderTypeDefault = OCVBorderTypeReflect101, //!< same as OCVBorderTypeReflect101
OCVBorderTypeIsolated = 16 //!< do not look outside of ROI
};
/*!
* Reference type: cv::NormTypes
*/
typedef NS_ENUM(NSInteger, OCVNormType) {
OCVNormTypeINF = 1,
OCVNormTypeL1 = 2,
OCVNormTypeL2 = 4,
OCVNormTypeL2SQR = 5,
OCVNormTypeHamming = 6,
OCVNormTypeHamming2 = 7,
OCVNormTypeMask = 7,
OCVNormTypeRelative = 8, //!< flag
OCVNormTypeMinMax = 32 //!< flag
};
/*!
* Reference type: cv::CmpTypes
*/
typedef NS_ENUM(NSInteger, OCVCompareType) {
OCVCompareTypeEqual = 0, //!< src1 is equal to src2.
OCVCompareTypeGreater = 1, //!< src1 is greater than src2.
OCVCompareTypeGreaterOrEqual = 2, //!< src1 is greater than or equal to src2.
OCVCompareTypeLess = 3, //!< src1 is less than src2.
OCVCompareTypeLessOrEqual = 4, //!< src1 is less than or equal to src2.
OCVCompareTypeNotEqual = 5 //!< src1 is unequal to src2.
};
/*!
* Reference type: cv::GemmFlags
*/
typedef NS_OPTIONS(NSInteger, OCVGemmFlags) {
OCVGemmFlag1T = 1, //!< transposes src1
OCVGemmFlag2T = 2, //!< transposes src2
OCVGemmFlag3T = 4 //!< transposes src3
};
/*!
* Reference type: cv::DftFlags
*/
typedef NS_OPTIONS(NSInteger, OCVTransformFlags) {
OCVTransformInverse = 1,
OCVTransformScale = 2,
OCVTransformRows = 4,
OCVTransformComplexOutput = 16,
OCVTransformRealOutput = 32,
};
#pragma mark - Types from core.hpp
/*!
* Reference type: cv::KmeansFlags
*/
typedef NS_OPTIONS(NSInteger, OCVKMeansTypes) {
OCVKMeansTypeRandomCenters = 0,
OCVKMeansPPCenters = 2,
OCVKMeansUseInitialLabels = 1
};
/*!
* Reference type: cv::LineTypes
*/
typedef NS_ENUM(NSInteger, OCVLineType) {
OCVLineTypeFilled = -1,
OCVLineTypeLine4 = 4, //!< 4-connected line
OCVLineTypeLine8 = 8, //!< 8-connected line
OCVLineTypeLineAA = 16 //!< antialiased line
};
/*!
* Reference type: cv::HersheyFonts
*/
typedef NS_ENUM(NSInteger, OCVHersheyFont) {
OCVHersheyFontSimplex = 0, //!< normal size sans-serif font
OCVHersheyFontPlain = 1, //!< small size sans-serif font
OCVHersheyFontDuplex = 2, //!< normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX)
OCVHersheyFontComplex = 3, //!< normal size serif font
OCVHersheyFontTriplex = 4, //!< normal size serif font (more complex than FONT_HERSHEY_COMPLEX)
OCVHersheyFontComplexSmall = 5, //!< smaller version of FONT_HERSHEY_COMPLEX
OCVHersheyFontScriptSimplex = 6, //!< hand-writing style font
OCVHersheyFontScriptComplex = 7, //!< more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX
OCVHersheyFontItalic = 16 //!< flag for italic font
};
/*!
* Reference type: cv::ReduceTypes
*/
typedef NS_ENUM(NSInteger, OCVReduceType) {
OCVReduceTypeSum = 0, //!< the output is the sum of all rows/columns of the matrix.
OCVReduceTypeAvg = 1, //!< the output is the mean vector of all rows/columns of the matrix.
OCVReduceTypeMax = 2, //!< the output is the maximum (column/row-wise) of all rows/columns of the matrix.
OCVReduceTypeMin = 3 //!< the output is the minimum (column/row-wise) of all rows/columns of the matrix.
};
/*!
* Reference type: core.hpp cv::flip() function codes
*/
typedef NS_ENUM(NSInteger, OCVFlipCode) {
OCVFlipCodeXAxis = 0,
OCVFlipCodeYAxis = 1,
OCVFlipCodeBoth = -1
};
/*!
* Reference type: cv::RotateFlags
*/
typedef NS_OPTIONS(NSInteger, OCVRotationTypes) {
OCVRotationType90Clockwise = 0, //Rotate 90 degrees clockwise
OCVRotationType180 = 1, //Rotate 180 degrees clockwise
OCVRotationType90CounterClockwise = 2, //Rotate 270 degrees clockwise
};
/*!
* Reference type: cv::SortFlags
*/
typedef NS_OPTIONS(NSInteger, OCVSortTypes) {
OCVSortTypeEveryRow = 0, //!< each matrix row is sorted independently
OCVSortTypeEveryColumn = 1, //!< each matrix column is sorted
//!< independently; this flag and the previous one are
//!< mutually exclusive.
OCVSortTypeAscending = 0, //!< each matrix row is sorted in the ascending
//!< order.
OCVSortTypeDescending = 16 //!< each matrix row is sorted in the
//!< descending order; this flag and the previous one are also
//!< mutually exclusive.
};
/*!
* Reference type: cv::CovarFlags
*/
typedef NS_OPTIONS(NSInteger, OCVCovarTypes) {
OCVCovarTypeScrambled = 0,
OCVCovarTypeNormal = 1,
OCVCovarTypeUseAvg = 2,
OCVCovarTypeScale = 4,
OCVCovarTypeRows = 8,
OCVCovarTypeCols = 16
};
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVVector.h
================================================
//
// OCVVector.h
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
/*!
* Custom OpenCV vector of data (wraps std::vector)
*/
@interface OCVVector : OCVObject
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Base/OCVVector.m
================================================
//
// OCVVector.m
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVVector.h"
@implementation OCVVector
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Mat/OCVMat.h
================================================
//
// OCVMat.h
// LegoCV
//
// Created by Dal Rupnik on 16/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVMatDataAllocator.h"
#import "OCVTypes.h"
#import "OCVGeometry.h"
#import "OCVMatExpr.h"
#import "OCVInputArrayable.h"
#import "OCVOutputArrayable.h"
#import "OCVInputOutputArrayable.h"
NS_ASSUME_NONNULL_BEGIN
/*!
* OCVMat is a simple Objective-C wrapper around cv::Mat instance.
*/
@interface OCVMat : OCVMatDataAllocator
#pragma mark - Public Properties
@property (nonatomic, readonly) NSInteger rows;
@property (nonatomic, readonly) NSInteger cols;
@property (nonatomic, readonly) NSInteger dims;
@property (nonatomic, readonly) BOOL isSubmatrix;
@property (nonatomic, readonly) BOOL isContinuous;
@property (nonatomic, readonly) BOOL isEmpty;
@property (nonatomic, readonly) NSInteger total;
@property (nonatomic, readonly) NSInteger elemSize;
@property (nonatomic, readonly) NSInteger elemSize1;
@property (nonatomic, readonly) OCVDepthType type;
@property (nonatomic, readonly) NSInteger channels;
@property (nonatomic, readonly) OCVSize size;
#pragma mark - Initialization
- (instancetype)initWithRows:(NSInteger)rows cols:(NSInteger)cols;
- (instancetype)initWithRows:(NSInteger)rows cols:(NSInteger)cols type:(OCVDepthType)type channels:(NSInteger)channels;
- (instancetype)initWithSize:(OCVSize)size type:(OCVDepthType)type channels:(NSInteger)channels;
/*!
* Creates a new deep copy of the matrix
*/
- (instancetype)initWithMat:(OCVMat *)mat;
#pragma mark - Public Methods
/*!
* Creates a deep copy of the OCVMat underlying matrix, same as [self copy], as supported by NSCopying.
*/
- (OCVMat *)clone;
/*!
* Returns OCVMat with submatrix (data is not copied and remains in original matrix)
*/
- (OCVMat *)submatrixWithRect:(OCVRect)rect;
#pragma mark - Operations
- (OCVMat *)reshapeWithChannels:(NSInteger)channels;
- (OCVMat *)reshapeWithChannels:(NSInteger)channels rows:(NSInteger)rows;
- (OCVMat *)transpose;
- (OCVMat *)inverse;
- (OCVMat *)inverseWithMethod:(OCVDecompositionType)method;
- (OCVMat *)multiplyWithArray:(id)inputArray;
- (OCVMat *)multiplyWithArray:(id)inputArray scale:(double)scale;
- (OCVMat *)crossWithArray:(id)inputArray;
- (double)dotWithArray:(id)inputArray;
#pragma mark - Public Factory Methods
+ (instancetype)zerosWithRows:(NSInteger)rows cols:(NSInteger)cols type:(OCVDepthType)type channels:(NSInteger)channels;
+ (instancetype)zerosWithSize:(OCVSize)size type:(OCVDepthType)type channels:(NSInteger)channels;
+ (instancetype)onesWithRows:(NSInteger)rows cols:(NSInteger)cols type:(OCVDepthType)type channels:(NSInteger)channels;
+ (instancetype)onesWithSize:(OCVSize)size type:(OCVDepthType)type channels:(NSInteger)channels;
@end
NS_ASSUME_NONNULL_END
#pragma mark - iOS Extensions
#import
NS_ASSUME_NONNULL_BEGIN
@interface OCVMat (UIKit)
- (instancetype)initWithImage:(UIImage *)image;
- (UIImage *)image;
@end
NS_ASSUME_NONNULL_END
#import
NS_ASSUME_NONNULL_BEGIN
@interface OCVMat (CoreGraphics)
- (instancetype)initWithImageRef:(CGImageRef)imageRef;
- (instancetype)initWithCGSize:(CGSize)size;
- (instancetype)initWithCGSize:(CGSize)size type:(OCVDepthType)type channels:(NSInteger)channels;
/*!
* Construct image reference and returns it
*/
- (CGImageRef)imageRef;
NS_ASSUME_NONNULL_END
@end
#import
NS_ASSUME_NONNULL_BEGIN
@interface OCVMat (CoreVideo)
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)buffer;
@end
NS_ASSUME_NONNULL_END
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Mat/OCVMat.mm
================================================
//
// OCVMat.mm
// LegoCV
//
// Created by Dal Rupnik on 16/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVGeometry+Private.h"
#import "OCVMatDataAllocator+Private.h"
#import "OCVInputArray+Private.h"
#import "OCVOutputArray.h"
#import "OCVInputOutputArray.h"
#import "OCVMat.h"
@interface OCVMat ()
// A reference to output array proxy, to guarantee a single one is passed.
@property (nonatomic, strong) OCVInputOutputArray* inputOutput;
@end
@implementation OCVMat
#pragma mark - Private Properties
#pragma mark - Public Properties
- (BOOL)isSubmatrix {
return self.source->isSubmatrix();
}
- (NSInteger)rows {
return self.source->rows;
}
- (NSInteger)cols {
return self.source->cols;
}
- (NSInteger)channels {
return self.source->channels();
}
- (OCVDepthType)type {
return (OCVDepthType)self.source->depth();
}
- (OCVSize)size {
return convertSize(self.source->size());
}
- (NSString *)description {
return [NSString stringWithFormat:@"OCVMat: [%ld, %ld], channels: %ld, type: %ld]", (long)self.rows, (long)self.cols, (long)self.channels, (long)self.type];
}
#pragma mark - Initialization
- (instancetype)init {
return [super initWithMatInstance:new cv::Mat()];
}
- (instancetype)initWithSize:(OCVSize)size type:(OCVDepthType)type channels:(NSInteger)channels {
return [self initWithRows:size.height cols:size.width type:type channels:channels];
}
- (instancetype)initWithRows:(NSInteger)rows cols:(NSInteger)cols {
return [self initWithRows:rows cols:cols type:OCVDepthTypeCv8U channels:4];
}
- (instancetype)initWithRows:(NSInteger)rows cols:(NSInteger)cols type:(OCVDepthType)type channels:(NSInteger)channels {
// Convert type to OpenCV type
int cvType = (int)CV_MAKETYPE(type, channels);
return [super initWithMatInstance:new cv::Mat((int)rows, (int)cols, cvType)];
}
#pragma mark - Convenience Initialization
- (instancetype)initWithMat:(OCVMat *)mat {
cv::Mat *matSource = new cv::Mat(mat.source->clone());
return [self initWithMatInstance:matSource];
}
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)buffer {
cv::Mat mat = [self.class matFromBuffer:buffer];
return [self initWithMatInstance:&mat];
}
- (instancetype)initWithImage:(UIImage *)image {
cv::Mat mat = [self.class matFromImage:image];
return [self initWithMatInstance:&mat];
}
- (instancetype)initWithImageRef:(CGImageRef)imageRef {
cv::Mat mat = [self.class matFromImageRef:imageRef];
return [self initWithMatInstance:&mat];
}
- (instancetype)initWithCGSize:(CGSize)size {
return [self initWithCGSize:size type:OCVDepthTypeCv8U channels:4];
}
- (instancetype)initWithCGSize:(CGSize)size type:(OCVDepthType)type channels:(NSInteger)channels {
return [self initWithRows:(NSInteger)size.height cols:(NSInteger)size.width type:type channels:channels];
}
#pragma mark - NSCopying
- (instancetype)copyWithZone:(NSZone *)zone {
return [[[self class] alloc] initWithMat:self];
}
#pragma mark - Public Methods
- (OCVMat *)clone {
cv::Mat *mat = new cv::Mat(self.source->clone());
return [[OCVMat alloc] initWithMatInstance:mat];
}
- (OCVMat *)submatrixWithRect:(OCVRect)rect {
cv::Mat sourceMat = *self.source;
cv::Mat mat = sourceMat(convertRect(rect));
return [[OCVMat alloc] initWithMatInstance:new cv::Mat(mat)];
}
- (CGImageRef)imageRef {
if (self.source == NULL) {
return nil;
}
return [self.class imageRefFromMat:*(self.source)];
}
- (UIImage *)image {
CGImageRef imageRef = [self imageRef];
return [UIImage imageWithCGImage:imageRef];
}
- (OCVMat *)reshapeWithChannels:(NSInteger)channels {
return [self reshapeWithChannels:channels rows:0];
}
- (OCVMat *)reshapeWithChannels:(NSInteger)channels rows:(NSInteger)rows {
cv::Mat mat = self.source->reshape((int)channels, (int)rows);
return [[OCVMat alloc] initWithMatInstance:new cv::Mat(mat)];
}
- (OCVMat *)transpose {
cv::Mat mat = self.source->t();
return [[OCVMat alloc] initWithMatInstance:new cv::Mat(mat)];
}
- (OCVMat *)inverse {
return [self inverseWithMethod:OCVDecompositionTypeLU];
}
- (OCVMat *)inverseWithMethod:(OCVDecompositionType)method {
cv::Mat mat = self.source->inv((int)method);
return [[OCVMat alloc] initWithMatInstance:new cv::Mat(mat)];
}
- (OCVMat *)multiplyWithArray:(id)inputArray {
return [self multiplyWithArray:inputArray scale:1];
}
- (OCVMat *)multiplyWithArray:(id)inputArray scale:(double)scale {
cv::Mat mat = self.source->mul(*inputArray.input._input, scale);
return [[OCVMat alloc] initWithMatInstance:new cv::Mat(mat)];
}
- (OCVMat *)crossWithArray:(id)inputArray {
cv::Mat mat = self.source->cross(*inputArray.input._input);
return [[OCVMat alloc] initWithMatInstance:new cv::Mat(mat)];
}
- (double)dotWithArray:(id)inputArray {
return self.source->dot(*inputArray.input._input);
}
#pragma mark - OCVInputOutputArrayable
- (OCVInputOutputArray *)inputOutput {
if (!_inputOutput) {
_inputOutput = [[OCVInputOutputArray alloc] initWithObject:self];
}
return _inputOutput;
}
#pragma mark - OCVInputArrayable
- (OCVInputArray *)input {
return self.inputOutput;
}
#pragma mark - OCVOutputArrayable
- (OCVOutputArray *)output {
return self.inputOutput;
}
#pragma mark - Public Factory Methods
+ (instancetype)zerosWithSize:(OCVSize)size type:(OCVDepthType)type channels:(NSInteger)channels {
return [self zerosWithRows:size.height cols:size.width type:type channels:channels];
}
+ (instancetype)zerosWithRows:(NSInteger)rows cols:(NSInteger)cols type:(OCVDepthType)type channels:(NSInteger)channels {
int cvType = (int)CV_MAKETYPE(type, channels);
cv::Mat mat = cv::Mat::zeros((int)rows, (int)cols, cvType);
return [[OCVMat alloc] initWithMatInstance:new cv::Mat(mat)];
}
+ (instancetype)onesWithSize:(OCVSize)size type:(OCVDepthType)type channels:(NSInteger)channels {
return [self onesWithRows:size.height cols:size.width type:type channels:channels];
}
+ (instancetype)onesWithRows:(NSInteger)rows cols:(NSInteger)cols type:(OCVDepthType)type channels:(NSInteger)channels {
int cvType = (int)CV_MAKETYPE(type, channels);
cv::Mat mat = cv::Mat::ones((int)rows, (int)cols, cvType);
return [[OCVMat alloc] initWithMatInstance:new cv::Mat(mat)];
}
#pragma mark - Private Utility Methods
+ (cv::Mat)matFromImageRef:(CGImageRef)imageRef {
CGColorSpaceRef colorSpace = CGImageGetColorSpace(imageRef);
size_t cols = CGImageGetWidth(imageRef);
size_t rows = CGImageGetHeight(imageRef);
cv::Mat cvMat((int)rows, (int)cols, CV_8UC4);
CGContextRef contextRef = CGBitmapContextCreate(
cvMat.data, // Pointer to data
cols, // Width of bitmap
rows, // Height of bitmap
8, // Bits per component
cvMat.step[0], // Bytes per row
colorSpace, // Colorspace
kCGImageAlphaNoneSkipLast|kCGBitmapByteOrderDefault // Bitmap info flags
);
CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), imageRef);
CGContextRelease(contextRef);
CGColorSpaceRelease(colorSpace);
return cvMat;
}
+ (cv::Mat)matFromImage:(UIImage *)image {
CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage);
CGFloat cols = image.size.width;
CGFloat rows = image.size.height;
cv::Mat cvMat(rows, cols, CV_8UC4);
CGContextRef contextRef = CGBitmapContextCreate(
cvMat.data, // Pointer to data
cols, // Width of bitmap
rows, // Height of bitmap
8, // Bits per component
cvMat.step[0], // Bytes per row
colorSpace, // Colorspace
kCGImageAlphaNoneSkipLast|kCGBitmapByteOrderDefault // Bitmap info flags
);
CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), image.CGImage);
CGContextRelease(contextRef);
CGColorSpaceRelease(colorSpace);
return cvMat;
}
+ (cv::Mat)matFromBuffer:(CVPixelBufferRef)buffer {
size_t cols = CVPixelBufferGetWidth(buffer);
size_t rows = CVPixelBufferGetHeight(buffer);
cv::Mat cvMat((int)rows, (int)cols, CV_8UC4); // 8 bits per component, 4 channels (color channels + alpha)
CVPixelBufferLockBaseAddress(buffer, 0);
void *baseAddress = CVPixelBufferGetBaseAddress(buffer);
size_t dataSize = CVPixelBufferGetDataSize(buffer);
size_t targetDataSize = rows * cols * 4;
if (dataSize >= targetDataSize) {
std::memcpy(cvMat.data, baseAddress, targetDataSize);
}
CVPixelBufferUnlockBaseAddress(buffer, 0);
return cvMat;
}
+ (CGImageRef)imageRefFromMat:(cv::Mat)cvMat {
NSData *data = [NSData dataWithBytes:cvMat.data length:cvMat.elemSize()*cvMat.total()];
CGColorSpaceRef colorSpace;
CGBitmapInfo bitmapInfo;
if (cvMat.elemSize() == 1) {
colorSpace = CGColorSpaceCreateDeviceGray();
bitmapInfo = kCGImageAlphaNone | kCGBitmapByteOrderDefault;
}
else {
colorSpace = CGColorSpaceCreateDeviceRGB();
bitmapInfo = kCGImageAlphaLast | kCGBitmapByteOrderDefault;
}
CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);
CGImageRef imageRef = CGImageCreate(
cvMat.cols, //width
cvMat.rows, //height
8, //bits per component
8 * cvMat.elemSize(), //bits per pixel
cvMat.step[0], //bytesPerRow
colorSpace, //colorspace
bitmapInfo, // bitmap info
provider, //CGDataProviderRef
NULL, //decode
false, //should interpolate
kCGRenderingIntentDefault //intent
);
CGDataProviderRelease(provider);
CGColorSpaceRelease(colorSpace);
return imageRef;
}
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Mat/OCVMatDataAllocator.h
================================================
//
// OCVMatDataAllocator.h
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
@interface OCVMatDataAllocator : OCVObject
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Mat/OCVMatDataAllocator.mm
================================================
//
// OCVMatDataAllocator.mm
// LegoCV
//
// Created by Dal Rupnik on 24/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import
#import "OCVMatDataAllocator.h"
@interface OCVMatDataAllocator () {
cv::Mat *source;
}
@end
@implementation OCVMatDataAllocator
- (cv::Mat *)source {
return source;
}
- (instancetype)initWithMatInstance:(cv::Mat *)mat {
self = [super init];
if (self) {
self->source = mat;
}
return self;
}
- (void)dealloc {
if (source) {
free(source);
}
source = NULL;
}
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Mat/OCVMatExpr.h
================================================
//
// OCVMatExpr.h
// LegoCV
//
// Created by Dal Rupnik on 16/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import
@interface OCVMatExpr : NSObject
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Mat/OCVMatExpr.mm
================================================
//
// OCVMatExpr.m
// LegoCV
//
// Created by Dal Rupnik on 16/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVMatExpr.h"
@implementation OCVMatExpr
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Mat/OCVUMat.h
================================================
//
// OCVUMat.h
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
@interface OCVUMat : OCVObject
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Mat/OCVUMat.m
================================================
//
// OCVUMat.m
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVUMat.h"
@implementation OCVUMat
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/OCVCore.h
================================================
//
// OCVCore.h
// LegoCV
//
// Created by Dal Rupnik on 23/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#ifndef OCVCore_h
#define OCVCore_h
#import "OCVMat.h"
#import "OCVOperation.h"
#import "OCVInputArrayable.h"
#import "OCVOutputArrayable.h"
#import "OCVInputOutputArray.h"
#import "OCVInputOutputArrayable.h"
#import "OCVCascadeClassifier.h"
#endif /* OCVCore_h */
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Operations/OCVMinimumMaximum.h
================================================
//
// OCVMinimumMaximum.h
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVGeometry.h"
#import "OCVObject.h"
@interface OCVMinimumMaximumLocation : OCVObject
@property (nonatomic, assign) double minimumValue;
@property (nonatomic, assign) double maximumValue;
@property (nonatomic, assign) OCVPoint minimumLocation;
@property (nonatomic, assign) OCVPoint maximumLocation;
@end
@interface OCVMinimumMaximumIndex : OCVObject
@property (nonatomic, assign) double minimumValue;
@property (nonatomic, assign) double maximumValue;
@property (nonatomic, assign) NSInteger minimumIndex;
@property (nonatomic, assign) NSInteger maximumIndex;
@end
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Operations/OCVMinimumMaximum.m
================================================
//
// OCVMinimumMaximum.m
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVMinimumMaximum.h"
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Operations/OCVOperation+Bitwise.h
================================================
//
// OCVOperation+Bitwise.h
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
#import "OCVInputArrayable.h"
#import "OCVOutputArrayable.h"
#import "OCVInputOutputArrayable.h"
#import "OCVGeometry.h"
#import "OCVTypes.h"
#import "OCVOperation.h"
NS_ASSUME_NONNULL_BEGIN
/*!
* Wraps bitwise operations defined in core.hpp
*/
@interface OCVOperation (Bitwise)
/*!
* cv::bitwise_and()
*/
+ (void)bitwiseAndWithSource:(id)source1 withSource:(id)source2 toDestination:(id)destination;
+ (void)bitwiseAndWithSource:(id)source1 withSource:(id)source2 toDestination:(id)destination withMask:(id)mask;
/*!
* cv::bitwise_or()
*/
+ (void)bitwiseOrWithSource:(id)source1 withSource:(id)source2 toDestination:(id)destination;
+ (void)bitwiseOrWithSource:(id)source1 withSource:(id)source2 toDestination:(id)destination withMask:(id)mask;
/*!
* cv::bitwise_xor()
*/
+ (void)bitwiseXorWithSource:(id)source1 withSource:(id)source2 toDestination:(id)destination;
+ (void)bitwiseXorWithSource:(id)source1 withSource:(id)source2 toDestination:(id)destination withMask:(id)mask;
/*!
* cv::bitwise_not()
*/
+ (void)bitwiseNotWithSource:(id)source toDestination:(id)destination;
+ (void)bitwiseNotWithSource:(id)source toDestination:(id)destination withMask:(id)mask;
@end
NS_ASSUME_NONNULL_END
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Operations/OCVOperation+Bitwise.mm
================================================
//
// OCVOperation+Bitwise.mm
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVOperation+Bitwise.h"
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Operations/OCVOperation+Transform.h
================================================
//
// OCVOperation+Transform.h
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
#import "OCVInputArrayable.h"
#import "OCVOutputArrayable.h"
#import "OCVInputOutputArrayable.h"
#import "OCVGeometry.h"
#import "OCVTypes.h"
#import "OCVOperation.h"
NS_ASSUME_NONNULL_BEGIN
/*!
* Wraps transform operations defined in core.hpp such as DFT and DCT
*/
@interface OCVOperation (Transform)
/*!
* cv::dft()
*/
+ (BOOL)dftWithSource:(id)source toDestination:(id)destinatio;
+ (BOOL)dftWithSource:(id)source toDestination:(id)destination flags:(OCVTransformFlags)flags;
+ (BOOL)dftWithSource:(id)source toDestination:(id)destination flags:(OCVTransformFlags)flags nonZeroRows:(NSInteger)nonZeroRows;
/*!
* cv::idft()
*/
+ (BOOL)idftWithSource:(id)source toDestination:(id)destinatio;
+ (BOOL)idftWithSource:(id)source toDestination:(id)destination flags:(OCVTransformFlags)flags;
+ (BOOL)idftWithSource:(id)source toDestination:(id)destination flags:(OCVTransformFlags)flags nonZeroRows:(NSInteger)nonZeroRows;
/*!
* cv::dct()
*/
+ (BOOL)dctWithSource:(id)source toDestination:(id)destinatio;
+ (BOOL)dctWithSource:(id)source toDestination:(id)destination flags:(OCVTransformFlags)flags;
+ (BOOL)dctWithSource:(id)source toDestination:(id)destination flags:(OCVTransformFlags)flags nonZeroRows:(NSInteger)nonZeroRows;
/*!
* cv::idct()
*/
+ (BOOL)idctWithSource:(id)source toDestination:(id)destinatio;
+ (BOOL)idctWithSource:(id)source toDestination:(id)destination flags:(OCVTransformFlags)flags;
+ (BOOL)idctWithSource:(id)source toDestination:(id)destination flags:(OCVTransformFlags)flags nonZeroRows:(NSInteger)nonZeroRows;
/*!
* cv::mulSpectrums()
*/
+ (BOOL)multiplySpectrumsWithSource:(id)source1 withSource:(id)source2 toDestination:(id)destinatio;
+ (BOOL)multiplySpectrumsWithSource:(id)source1 withSource:(id)source2 toDestination:(id)destination flags:(OCVTransformFlags)flags;
+ (BOOL)multiplySpectrumsWithSource:(id)source1 withSource:(id)source2 toDestination:(id)destination flags:(OCVTransformFlags)flags conjugateSecond:(BOOL)conjugateSecond;
/*!
* cv::getOptimalDFTSize()
*/
+ (NSInteger)optimalDFTSizeForVectorSize:(NSInteger)vectorSize;
@end
NS_ASSUME_NONNULL_END
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Operations/OCVOperation+Transform.mm
================================================
//
// OCVOperation+Transform.mm
// LegoCV
//
// Created by Dal Rupnik on 04/03/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVOperation+Transform.h"
================================================
FILE: LegoCV/LegoCV/Wrapper/Core/Operations/OCVOperation.h
================================================
//
// OCVOperation.h
// LegoCV
//
// Created by Dal Rupnik on 23/01/2017.
// Copyright © 2017 Unified Sense. All rights reserved.
//
#import "OCVObject.h"
#import "OCVInputArrayable.h"
#import "OCVOutputArrayable.h"
#import "OCVInputOutputArrayable.h"
#import "OCVGeometry.h"
#import "OCVTypes.h"
#import "OCVVector.h"
#import "OCVUMat.h"
#import "OCVMinimumMaximum.h"
#import "OCVTermCriteria.h"
NS_ASSUME_NONNULL_BEGIN
/*!
* Wraps operations defined in core.hpp
*/
@interface OCVOperation : OCVObject
+ (void)swapMat:(OCVMat *)a toMat:(OCVMat *)b;
+ (void)swapUMat:(OCVUMat *)a toUMat:(OCVUMat *)b;
+ (NSInteger)borderInterpolateWithPixel:(NSInteger)pixel ofLength:(NSInteger)length withBorderType:(OCVBorderType)borderType;
/*!
* cv::copyMakeBorder()
*/
+ (OCVScalar)copyMakeBorderFromSource:(id)source toDestination:(id)destination withTop:(NSInteger)top withBottom:(NSInteger)bottom withLeft:(NSInteger)left withRight:(NSInteger)right withBorderType:(OCVBorderType)borderType;
/*!
* cv::copyMakeBorder() - Convenience method with custom struct
*/
+ (OCVScalar)copyMakeBorderFromSource:(id)source toDestination:(id)destination withEdges:(OCVEdges)edges withBorderType:(OCVBorderType)borderType;
#pragma mark - Basic operations
/*!
* cv::add()
*/
+ (void)addSource:(id)source1 toSource:(id)source2 toDestination:(id)destination;
+ (void)addSource:(id)source1 toSource:(id)source2 toDestination:(id)destination withMask:(id)mask;
+ (void)addSource:(id)source1 toSource:(id)source2 toDestination:(id)destination withMask:(id)mask ofDepthType:(NSInteger)depthType;
/*!
* cv::subtract()
*/
+ (void)subtractSource:(id)source1 fromSource:(id)source2 toDestination:(id)destination;
+ (void)subtractSource:(id)source1 fromSource:(id)source2 toDestination:(id)destination withMask:(id)mask;
+ (void)subtractSource:(id)source1 fromSource:(id)source2 toDestination:(id)destination withMask:(id)mask ofDepthType:(NSInteger)depthType;
/*!
* cv::multiply()
*/
+ (void)multiplySource:(id)source1 withSource:(id)source2 toDestination:(id)destination;
+ (void)multiplySource:(id)source1 withSource:(id)source2 toDestination:(id)destination withScale:(double)scale;
+ (void)multiplySource:(id)source1 withSource:(id)source2 toDestination:(id)destination withScale:(double)scale ofDepthType:(NSInteger)depthType;
/*!
* cv::divide()
*/
+ (void)divideSource:(id)source1 withSource:(id)source2 toDestination:(id)destination;
+ (void)divideSource:(id)source1 withSource:(id)source2 toDestination:(id)destination withScale:(double)scale;
+ (void)divideSource:(id)source1 withSource:(id)source2 toDestination:(id)destination withScale:(double)scale ofDepthType:(NSInteger)depthType;
+ (void)divideScale:(double)scale withSource:(id)source2 toDestination:(id)destination;
+ (void)divideScale:(double)scale withSource:(id)source2 toDestination:(id)destination ofDepthType:(NSInteger)depthType;
/*!
* cv::scaleAdd()
*/
+ (void)scaleAddSource:(id)source1 withAlpha:(double)alpha withSource:(id)source2 toDestination:(id)destination;
/*!
* cv::addWeighted()
*/
+ (void)addWeightedSource:(id)source1 withAlpha:(double)alpha withSource:(id)source2 withBeta:(double)beta withGamma:(double)gamma toDestination:(id)destination;
+ (void)addWeightedSource:(id)source1 withAlpha:(double)alpha withSource:(id)source2 withBeta:(double)beta withGamma:(double)gamma toDestination:(id)destination ofDepthType:(NSInteger)depthType;
/*!
* cv::convertScaleAbs()
*/
+ (void)convertScaleAbsoluteWithSource:(id)source toDestination:(id)destination;
+ (void)convertScaleAbsoluteWithSource:(id)source toDestination:(id)destination withAlpha:(double)alpha;
+ (void)convertScaleAbsoluteWithSource:(id)source toDestination:(id)destination withAlpha:(double)alpha withBeta:(double)beta;
/*!
* cv::convertFp16()
*/
+ (void)convertFp16Source:(id)source toDestination:(id)destination;
/*!
* cv::LUT()
*/
+ (void)lookupTableTransformWithSource:(id)source withLookupTable:(id)lookupTable toDestination:(id)destination;
/*!
* cv::sum()
*/
+ (OCVScalar)sumOfSource:(id)source;
/*!
* cv::countNonZero()
*/
+ (NSInteger)countNonZeroInSource:(id)source;
/*!
* cv::findNonZero()
*/
+ (void)findNonZeroInSource:(id)source toDestination:(id)destination;
/*!
* cv::mean()
*/
+ (OCVScalar)meanOfSource:(id)source;
+ (OCVScalar)meanOfSource:(id)source withMask:(id)mask;
/*!
* cv::meanStdDev()
*/
+ (void)meanStandardDeviationOfSource:(id)source withMean:(id)mean withStandardDeviation:(id)standardDeviation;
+ (void)meanStandardDeviationOfSource:(id)source withMean:(id)mean withStandardDeviation:(id)standardDeviation withMask:(id)mask;
/*!
* cv::norm()
*/
+ (double)normOfSource:(id)source;
+ (double)normOfSource:(id)source withType:(OCVNormType)normType;
+ (double)normOfSource:(id)source withType:(OCVNormType)normType withMask:(id)mask;
/*!
* cv::PSNR()
*/
+ (double)PSNROfSource:(id)source1 withSource:(id)source2;
/*!
* cv::batchDistance()
*/
+ (void)batchDistanceOfSource:(id)source1 toSource:(id)source2 toDestination:(id)destination ofDepthType:(NSInteger)depthType toIndex:(id)index;
+ (void)batchDistanceOfSource:(id)source1 toSource:(id)source2 toDestination:(id)destination ofDepthType:(NSInteger)depthType toIndex:(id)index withNormType:(OCVNormType)normType;
+ (void)batchDistanceOfSource:(id)source1 toSource:(id)source2 toDestination:(id)destination ofDepthType:(NSInteger)depthType toIndex:(id)index withNormType:(OCVNormType)normType withK:(NSInteger)k;
+ (void)batchDistanceOfSource:(id)source1 toSource:(id)source2 toDestination:(id)destination ofDepthType:(NSInteger)depthType toIndex:(id