123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615 |
- using OpenCVForUnity.CoreModule;
- using OpenCVForUnity.UnityUtils;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- namespace OpenCVForUnityExample
- {
- public class OpenCVForUnityExample : MonoBehaviour
- {
- public Text versionInfo;
- public ScrollRect scrollRect;
- static float verticalNormalizedPosition = 1f;
- // Use this for initialization
- void Start()
- {
- versionInfo.text = Core.NATIVE_LIBRARY_NAME + " " + Utils.getVersion() + " (" + Core.VERSION + ")";
- versionInfo.text += " / UnityEditor " + Application.unityVersion;
- versionInfo.text += " / ";
- #if UNITY_EDITOR
- versionInfo.text += "Editor";
- #elif UNITY_STANDALONE_WIN
- versionInfo.text += "Windows";
- #elif UNITY_STANDALONE_OSX
- versionInfo.text += "Mac OSX";
- #elif UNITY_STANDALONE_LINUX
- versionInfo.text += "Linux";
- #elif UNITY_ANDROID
- versionInfo.text += "Android";
- #elif UNITY_IOS
- versionInfo.text += "iOS";
- #elif UNITY_WSA
- versionInfo.text += "WSA";
- #elif UNITY_WEBGL
- versionInfo.text += "WebGL";
- #endif
- versionInfo.text += " ";
- #if ENABLE_MONO
- versionInfo.text += "Mono";
- #elif ENABLE_IL2CPP
- versionInfo.text += "IL2CPP";
- #elif ENABLE_DOTNET
- versionInfo.text += ".NET";
- #endif
- scrollRect.verticalNormalizedPosition = verticalNormalizedPosition;
- #if UNITY_WSA_10_0
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/BarcodeDetectorExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/BarcodeDetectorWebCamExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/FaceDetectorYNWebCamExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/FaceRecognizerSFExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/ColorizationExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/ObjectTrackingDaSiamRPNExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/FastNeuralStyleTransferExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/FaceDetectionResnetSSDExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/FaceDetectionYuNetExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/FaceDetectionYuNetV2ExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/FacialExpressionRecognitionExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/PoseEstimationMediaPipeExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/HandPoseEstimationMediaPipeExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/HumanSegmentationPPHumanSegExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/ImageClassificationMobilenetExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/ImageClassificationPPResnetExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/ObjectDetectionMobileNetSSDExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/ObjectDetectionMobileNetSSDWebCamExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/ObjectDetectionYOLOv4ExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/ObjectDetectionYOLOXExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/ObjectDetectionNanoDetPlusExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/TextRecognitionCRNNExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/TextRecognitionCRNNWebCamExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/ContribModulesGroup/TextDetectionExampleButton").GetComponent<Button>().interactable = false;
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/ContribModulesGroup/TextRecognitionExampleButton").GetComponent<Button>().interactable = false;
- #endif
- #if !UNITY_EDITOR && !UNITY_STANDALONE_WIN && !UNITY_STANDALONE_OSX && !UNITY_LINUX && !UNITY_IOS && !UNITY_ANDROID
- GameObject.Find("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/VideoCaptureCameraInputExampleButton").GetComponent<Button>().interactable = false;
- #endif
- }
- // Update is called once per frame
- void Update()
- {
- }
- public void OnScrollRectValueChanged()
- {
- verticalNormalizedPosition = scrollRect.verticalNormalizedPosition;
- }
- public void OnShowSystemInfoButtonClick()
- {
- SceneManager.LoadScene("ShowSystemInfo");
- }
- public void OnShowLicenseButtonClick()
- {
- SceneManager.LoadScene("ShowLicense");
- }
- #region Basic
- public void OnTexture2DToMatExampleButtonClick()
- {
- SceneManager.LoadScene("Texture2DToMatExample");
- }
- public void OnWebCamTextureToMatExampleButtonClick()
- {
- SceneManager.LoadScene("WebCamTextureToMatExample");
- }
- public void OnWebCamTextureToMatHelperExampleButtonClick()
- {
- SceneManager.LoadScene("WebCamTextureToMatHelperExample");
- }
- public void OnMatBasicProcessingExampleButtonClick()
- {
- SceneManager.LoadScene("MatBasicProcessingExample");
- }
- public void OnUtils_GetFilePathExampleButtonClick()
- {
- SceneManager.LoadScene("Utils_GetFilePathExample");
- }
- #endregion
- #region Advanced
- public void OnImageCorrectionExampleButtonClick()
- {
- SceneManager.LoadScene("ImageCorrectionExample");
- }
- public void OnComicFilterExampleButtonClick()
- {
- SceneManager.LoadScene("ComicFilterExample");
- }
- public void OnDocumentScannerExampleButtonClick()
- {
- SceneManager.LoadScene("DocumentScannerExample");
- }
- public void OnPhysicalGreenScreenExampleButtonClick()
- {
- SceneManager.LoadScene("PhysicalGreenScreenExample");
- }
- public void OnKeyFrameGreenScreenExampleButtonClick()
- {
- SceneManager.LoadScene("KeyFrameGreenScreenExample");
- }
- public void OnCountFingersExampleButtonClick()
- {
- SceneManager.LoadScene("CountFingersExample");
- }
- public void OnMultiObjectTrackingBasedOnColorExampleButtonClick()
- {
- SceneManager.LoadScene("MultiObjectTrackingBasedOnColorExample");
- }
- public void OnPolygonFilterExampleButtonClick()
- {
- SceneManager.LoadScene("PolygonFilterExample");
- }
- public void OnAlphaBlendingExampleButtonClick()
- {
- SceneManager.LoadScene("AlphaBlendingExample");
- }
- #endregion
- #region Main modules
- #region core
- public void OnKMeansClusteringExampleButtonClick()
- {
- SceneManager.LoadScene("KMeansClusteringExample");
- }
- public void OnPCAExampleButtonClick()
- {
- SceneManager.LoadScene("PCAExample");
- }
- #endregion
- #region imgproc
- public void OnCircleDetectionExampleButtonClick()
- {
- SceneManager.LoadScene("CircleDetectionExample");
- }
- public void OnConnectedComponentsExampleButtonClick()
- {
- SceneManager.LoadScene("ConnectedComponentsExample");
- }
- public void OnConvexHullExampleButtonClick()
- {
- SceneManager.LoadScene("ConvexHullExample");
- }
- public void OnDrawingExampleButtonClick()
- {
- SceneManager.LoadScene("DrawingExample");
- }
- public void OnGrabCutExampleButtonClick()
- {
- SceneManager.LoadScene("GrabCutExample");
- }
- public void OnHoughLinesPExampleButtonClick()
- {
- SceneManager.LoadScene("HoughLinesPExample");
- }
- public void OnMatchShapesExampleButtonClick()
- {
- SceneManager.LoadScene("MatchShapesExample");
- }
- public void OnMatchTemplateExampleButtonClick()
- {
- SceneManager.LoadScene("MatchTemplateExample");
- }
- public void OnThresholdExampleButtonClick()
- {
- SceneManager.LoadScene("ThresholdExample");
- }
- public void OnWrapPerspectiveExampleButtonClick()
- {
- SceneManager.LoadScene("WrapPerspectiveExample");
- }
- #endregion
- #region videoio
- public void OnVideoCaptureExampleButtonClick()
- {
- SceneManager.LoadScene("VideoCaptureExample");
- }
- public void OnVideoCaptureCameraInputExampleButtonClick()
- {
- SceneManager.LoadScene("VideoCaptureCameraInputExample");
- }
- public void OnVideoWriterExampleButtonClick()
- {
- SceneManager.LoadScene("VideoWriterExample");
- }
- public void OnVideoWriterAsyncExampleButtonClick()
- {
- SceneManager.LoadScene("VideoWriterAsyncExample");
- }
- #endregion
- #region video
- public void OnCamShiftExampleButtonClick()
- {
- SceneManager.LoadScene("CamShiftExample");
- }
- public void OnKalmanFilterExampleButtonClick()
- {
- SceneManager.LoadScene("KalmanFilterExample");
- }
- public void OnOpticalFlowExampleButtonClick()
- {
- SceneManager.LoadScene("OpticalFlowExample");
- }
- public void OnTransformECCExampleButtonClick()
- {
- SceneManager.LoadScene("TransformECCExample");
- }
- #endregion
- #region calib3d
- public void OnStereoBMExampleButtonClick()
- {
- SceneManager.LoadScene("StereoBMExample");
- }
- #endregion
- #region features2d
- public void OnFeatureMatchingExampleButtonClick()
- {
- SceneManager.LoadScene("FeatureMatchingExample");
- }
- public void OnMSERExampleButtonClick()
- {
- SceneManager.LoadScene("MSERExample");
- }
- public void OnSimpleBlobExampleButtonClick()
- {
- SceneManager.LoadScene("SimpleBlobExample");
- }
- #endregion
- #region imgcodecs
- public void OnImwriteScreenCaptureExampleButtonClick()
- {
- SceneManager.LoadScene("ImwriteScreenCaptureExample");
- }
- #endregion
- #region objdetect
- public void OnArUcoExampleButtonClick()
- {
- SceneManager.LoadScene("ArUcoExample");
- }
- public void OnArUcoWebCamExampleButtonClick()
- {
- SceneManager.LoadScene("ArUcoWebCamExample");
- }
- public void OnArUcoCreateMarkerExampleButtonClick()
- {
- SceneManager.LoadScene("ArUcoCreateMarkerExample");
- }
- public void OnArUcoCameraCalibrationExampleButtonClick()
- {
- SceneManager.LoadScene("ArUcoCameraCalibrationExample");
- }
- public void OnBarcodeDetectorExampleButtonClick()
- {
- SceneManager.LoadScene("BarcodeDetectorExample");
- }
- public void OnBarcodeDetectorWebCamExampleButtonClick()
- {
- SceneManager.LoadScene("BarcodeDetectorWebCamExample");
- }
- public void OnFaceDetectionExampleButtonClick()
- {
- SceneManager.LoadScene("FaceDetectionExample");
- }
- public void OnFaceDetectionWebCamExampleButtonClick()
- {
- SceneManager.LoadScene("FaceDetectionWebCamExample");
- }
- public void OnAsynchronousFaceDetectionWebCamExampleButtonClick()
- {
- SceneManager.LoadScene("AsynchronousFaceDetectionWebCamExample");
- }
- public void OnFaceDetectorYNWebCamExampleButtonClick()
- {
- SceneManager.LoadScene("FaceDetectorYNWebCamExample");
- }
- public void OnFaceRecognizerSFExampleButtonClick()
- {
- SceneManager.LoadScene("FaceRecognizerSFExample");
- }
- public void OnHOGDescriptorExampleButtonClick()
- {
- SceneManager.LoadScene("HOGDescriptorExample");
- }
- public void OnQRCodeDetectorExampleButtonClick()
- {
- SceneManager.LoadScene("QRCodeDetectorExample");
- }
- public void OnQRCodeDetectorWebCamExampleButtonClick()
- {
- SceneManager.LoadScene("QRCodeDetectorWebCamExample");
- }
- public void OnQRCodeEncoderExampleButtonClick()
- {
- SceneManager.LoadScene("QRCodeEncoderExample");
- }
- #endregion
- #region dnn
- public void OnColorizationExampleButtonClick()
- {
- SceneManager.LoadScene("ColorizationExample");
- }
- public void OnObjectTrackingDaSiamRPNExampleButtonClick()
- {
- SceneManager.LoadScene("ObjectTrackingDaSiamRPNExample");
- }
- public void OnFastNeuralStyleTransferExampleButtonClick()
- {
- SceneManager.LoadScene("FastNeuralStyleTransferExample");
- }
- public void OnFaceDetectionResnetSSDExampleButtonClick()
- {
- SceneManager.LoadScene("FaceDetectionResnetSSDExample");
- }
- public void OnFaceDetectionYuNetExampleButtonClick()
- {
- SceneManager.LoadScene("FaceDetectionYuNetExample");
- }
- public void OnFaceDetectionYuNetV2ExampleButtonClick()
- {
- SceneManager.LoadScene("FaceDetectionYuNetV2Example");
- }
- public void OnFacialExpressionRecognitionExampleButtonClick()
- {
- SceneManager.LoadScene("FacialExpressionRecognitionExample");
- }
- public void OnPoseEstimationMediaPipeExampleButtonClick()
- {
- SceneManager.LoadScene("PoseEstimationMediaPipeExample");
- }
- public void OnHandPoseEstimationMediaPipeExampleButtonClick()
- {
- SceneManager.LoadScene("HandPoseEstimationMediaPipeExample");
- }
- public void OnHumanSegmentationPPHumanSegExampleButtonClick()
- {
- SceneManager.LoadScene("HumanSegmentationPPHumanSegExample");
- }
- public void OnImageClassificationMobilenetExampleButtonClick()
- {
- SceneManager.LoadScene("ImageClassificationMobilenetExample");
- }
- public void OnImageClassificationPPResnetExampleButtonClick()
- {
- SceneManager.LoadScene("ImageClassificationPPResnetExample");
- }
- public void OnObjectDetectionMobileNetSSDExampleButtonClick()
- {
- SceneManager.LoadScene("ObjectDetectionMobileNetSSDExample");
- }
- public void OnObjectDetectionMobileNetSSDWebCamExampleButtonClick()
- {
- SceneManager.LoadScene("ObjectDetectionMobileNetSSDWebCamExample");
- }
- public void OnObjectDetectionYOLOv4ExampleButtonClick()
- {
- SceneManager.LoadScene("ObjectDetectionYOLOv4Example");
- }
- public void OnObjectDetectionYOLOXExampleButtonClick()
- {
- SceneManager.LoadScene("ObjectDetectionYOLOXExample");
- }
- public void OnObjectDetectionNanoDetPlusExampleButtonClick()
- {
- SceneManager.LoadScene("ObjectDetectionNanoDetPlusExample");
- }
- public void OnTextRecognitionCRNNExampleButtonClick()
- {
- SceneManager.LoadScene("TextRecognitionCRNNExample");
- }
- public void OnTextRecognitionCRNNWebCamExampleButtonClick()
- {
- SceneManager.LoadScene("TextRecognitionCRNNWebCamExample");
- }
- #endregion
- #region ml
- public void OnKNNExampleButtonClick()
- {
- SceneManager.LoadScene("KNNExample");
- }
- public void OnSVMExampleButtonClick()
- {
- SceneManager.LoadScene("SVMExample");
- }
- #endregion
- #region photo
- public void OnInpaintExampleButtonClick()
- {
- SceneManager.LoadScene("InpaintExample");
- }
- public void OnSeamlessCloneExampleButtonClick()
- {
- SceneManager.LoadScene("SeamlessCloneExample");
- }
- #endregion
- #endregion
- #region Contrib modules
- #region bgsegm
- public void OnBackgroundSubtractorExampleButtonClick()
- {
- SceneManager.LoadScene("BackgroundSubtractorExample");
- }
- #endregion
- #region face
- public void OnFaceMarkExampleButtonClick()
- {
- SceneManager.LoadScene("FaceMarkExample");
- }
- public void OnFaceRecognizerExampleButtonClick()
- {
- SceneManager.LoadScene("FaceRecognizerExample");
- }
- #endregion
- #region plot
- public void OnPlotExampleButtonClick()
- {
- SceneManager.LoadScene("PlotExample");
- }
- #endregion
- #region text
- public void OnTextDetectionExampleButtonClick()
- {
- SceneManager.LoadScene("TextDetectionExample");
- }
- public void OnTextRecognitionExampleButtonClick()
- {
- SceneManager.LoadScene("TextRecognitionExample");
- }
- #endregion
- #region tracking
- public void OnLegacyTrackingExampleButtonClick()
- {
- SceneManager.LoadScene("LegacyTrackingExample");
- }
- public void OnTrackingExampleButtonClick()
- {
- SceneManager.LoadScene("TrackingExample");
- }
- #endregion
- #endregion
- }
- }
|