123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471 |
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- using System.Collections;
- using OpenCVForUnity.CoreModule;
- using OpenCVForUnity.UnityUtils;
- 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/MobileNetSSDExampleButton").GetComponent<Button> ().interactable = false;
- GameObject.Find ("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/MobileNetSSDWebCamTextureExampleButton").GetComponent<Button> ().interactable = false;
- GameObject.Find ("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/OpenPoseExampleButton").GetComponent<Button> ().interactable = false;
- GameObject.Find ("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/ResnetSSDFaceDetectionExampleButton").GetComponent<Button> ().interactable = false;
- GameObject.Find ("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/TensorFlowWebCamTextureExampleButton").GetComponent<Button> ().interactable = false;
- GameObject.Find ("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/YoloObjectDetectionExampleButton").GetComponent<Button> ().interactable = false;
- GameObject.Find ("Canvas/Panel/SceneList/ScrollView/List/MainModulesGroup/YoloObjectDetectionWebCamTextureExampleButton").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
- }
-
- // 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 OnComicFilterExampleButtonClick ()
- {
- SceneManager.LoadScene ("ComicFilterExample");
- }
- public void OnGreenScreenExampleButtonClick ()
- {
- SceneManager.LoadScene ("GreenScreenExample");
- }
- public void OnHandPoseEstimationExampleButtonClick ()
- {
- SceneManager.LoadScene ("HandPoseEstimationExample");
- }
- public void OnMultiObjectTrackingBasedOnColorExampleButtonClick ()
- {
- SceneManager.LoadScene ("MultiObjectTrackingBasedOnColorExample");
- }
- public void OnPolygonFilterExampleButtonClick ()
- {
- SceneManager.LoadScene ("PolygonFilterExample");
- }
- public void OnAlphaBlendingExampleButtonClick ()
- {
- SceneManager.LoadScene ("AlphaBlendingExample");
- }
- public void OnMatToTextureInRenderThreadExampleButtonClick ()
- {
- SceneManager.LoadScene ("MatToTextureInRenderThreadExample");
- }
- #endregion
- #region Main modules
- #region core
- 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 OnVideoWriterExampleButtonClick ()
- {
- SceneManager.LoadScene ("VideoWriterExample");
- }
- #endregion
- #region video
- public void OnBackgroundSubtractorMOG2ExampleButtonClick ()
- {
- SceneManager.LoadScene ("BackgroundSubtractorMOG2Example");
- }
- public void OnCamShiftExampleButtonClick ()
- {
- SceneManager.LoadScene ("CamShiftExample");
- }
- public void OnKalmanFilterExampleButtonClick ()
- {
- SceneManager.LoadScene ("KalmanFilterExample");
- }
- public void OnOpticalFlowExampleButtonClick ()
- {
- SceneManager.LoadScene ("OpticalFlowExample");
- }
- #endregion
- #region calib3d
- public void OnStereoBMExampleButtonClick ()
- {
- SceneManager.LoadScene ("StereoBMExample");
- }
- #endregion
- #region features2d
- public void OnFeature2DExampleButtonClick ()
- {
- SceneManager.LoadScene ("Feature2DExample");
- }
- public void OnMSERExampleButtonClick ()
- {
- SceneManager.LoadScene ("MSERExample");
- }
- #endregion
- #region imgcodecs
- public void OnImwriteScreenCaptureExampleButtonClick ()
- {
- SceneManager.LoadScene ("ImwriteScreenCaptureExample");
- }
- #endregion
- #region objdetect
- public void OnFaceDetectionExampleButtonClick ()
- {
- SceneManager.LoadScene ("FaceDetectionExample");
- }
- public void OnFaceDetectionWebCamTextureExampleButtonClick ()
- {
- SceneManager.LoadScene ("FaceDetectionWebCamTextureExample");
- }
- public void OnAsynchronousFaceDetectionWebCamTextureExampleButtonClick ()
- {
- SceneManager.LoadScene ("AsynchronousFaceDetectionWebCamTextureExample");
- }
- public void OnHOGDescriptorExampleButtonClick ()
- {
- SceneManager.LoadScene ("HOGDescriptorExample");
- }
- public void OnQRCodeDetectorExampleButtonClick ()
- {
- SceneManager.LoadScene ("QRCodeDetectorExample");
- }
- public void OnQRCodeDetectorWebCamTextureExampleButtonClick ()
- {
- SceneManager.LoadScene ("QRCodeDetectorWebCamTextureExample");
- }
- #endregion
- #region dnn
- public void OnMobileNetSSDExampleButtonClick ()
- {
- SceneManager.LoadScene ("MobileNetSSDExample");
- }
- public void OnMobileNetSSDWebCamTextureExampleButtonClick ()
- {
- SceneManager.LoadScene ("MobileNetSSDWebCamTextureExample");
- }
- public void OnOpenPoseExampleButtonClick ()
- {
- SceneManager.LoadScene ("OpenPoseExample");
- }
- public void OnResnetSSDFaceDetectionExampleButtonClick ()
- {
- SceneManager.LoadScene ("ResnetSSDFaceDetectionExample");
- }
- public void OnTensorFlowWebCamTextureExampleButtonClick ()
- {
- SceneManager.LoadScene ("TensorFlowWebCamTextureExample");
- }
- public void OnYoloObjectDetectionExampleButtonClick ()
- {
- SceneManager.LoadScene ("YoloObjectDetectionExample");
- }
- public void OnYoloObjectDetectionWebCamTextureExampleButtonClick ()
- {
- SceneManager.LoadScene ("YoloObjectDetectionWebCamTextureExample");
- }
- #endregion
- #region ml
- public void OnSVMExampleButtonClick ()
- {
- SceneManager.LoadScene ("SVMExample");
- }
- #endregion
- #region photo
- public void OnInpaintExampleButtonClick ()
- {
- SceneManager.LoadScene ("InpaintExample");
- }
- public void OnSeamlessCloneExampleButtonClick ()
- {
- SceneManager.LoadScene ("SeamlessCloneExample");
- }
- #endregion
- #region shape
- public void OnThinPlateSplineShapeTransformerExampleButtonClick ()
- {
- SceneManager.LoadScene ("ThinPlateSplineShapeTransformerExample");
- }
- #endregion
- #endregion
- #region Contrib modules
- #region aruco
- public void OnArUcoExampleButtonClick ()
- {
- SceneManager.LoadScene ("ArUcoExample");
- }
- public void OnArUcoWebCamTextureExampleButtonClick ()
- {
- SceneManager.LoadScene ("ArUcoWebCamTextureExample");
- }
- public void OnArUcoCreateMarkerExampleButtonClick ()
- {
- SceneManager.LoadScene ("ArUcoCreateMarkerExample");
- }
- public void OnArUcoCameraCalibrationExampleButtonClick ()
- {
- SceneManager.LoadScene ("ArUcoCameraCalibrationExample");
- }
- #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 OnTrackingExampleButtonClick ()
- {
- SceneManager.LoadScene ("TrackingExample");
- }
- #endregion
- #endregion
- }
- }
|