// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor>(); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper>(); #if UNITY_WEBGL && !UNITY_EDITOR getFilePath_Coroutine = GetFilePath(); StartCoroutine(getFilePath_Coroutine); #else if (!string.IsNullOrEmpty(classes)) { classes_filepath = Utils.getFilePath("dnn/" + classes); } if (!string.IsNullOrEmpty(config)) { config_filepath = Utils.getFilePath("dnn/" + config); } if (!string.IsNullOrEmpty(model)) { model_filepath = Utils.getFilePath("dnn/" + model); } Run(); #endif }
// Use this for initialization void Start() { menuVariables = GameObject.Find("EventSystem").GetComponent <MenuVariables>(); scanTime = scanPeriod; processTime = processPeriod; webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper>(); #if UNITY_WEBGL && !UNITY_EDITOR getFilePath_Coroutine = GetFilePath(); StartCoroutine(getFilePath_Coroutine); #else if (!string.IsNullOrEmpty(classes)) { classes_filepath = Utils.getFilePath("dnn/" + classes); } if (!string.IsNullOrEmpty(config)) { config_filepath = Utils.getFilePath("dnn/" + config); } if (!string.IsNullOrEmpty(model)) { model_filepath = Utils.getFilePath("dnn/" + model); } Run(); #endif }
// Use this for initialization void Start() { #if !UNITY_WEBGL || UNITY_EDITOR weightsPositionsSmoothing.Add(1); weightsSizesSmoothing.Add(0.5f); weightsSizesSmoothing.Add(0.3f); weightsSizesSmoothing.Add(0.2f); //parameters.minObjectSize = 96; //parameters.maxObjectSize = int.MaxValue; //parameters.scaleFactor = 1.1f; //parameters.minNeighbors = 2; parameters.maxTrackLifetime = 5; innerParameters.numLastPositionsToTrack = 4; innerParameters.numStepsToWaitBeforeFirstShow = 6; innerParameters.numStepsToTrackWithoutDetectingIfObjectHasNotBeenShown = 3; innerParameters.numStepsToShowWithoutDetecting = 3; innerParameters.coeffTrackingWindowSize = 2.0f; innerParameters.coeffObjectSizeToTrack = 0.85f; innerParameters.coeffObjectSpeedUsingInPrediction = 0.8f; #endif webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); webCamTextureToMatHelper.Init(); }
// Use this for initialization void Start() { // Utils.setDebugMode (true); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); webCamTextureToMatHelper.Init(); }
// Use this for initialization void Start() { webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_WEBGL && !UNITY_EDITOR var getFilePath_Coroutine = Utils.getFilePathAsync("lbpcascade_frontalface.xml", (result) => { coroutines.Clear(); cascade = new CascadeClassifier(); cascade.load(result); webCamTextureToMatHelper.Initialize(); }); coroutines.Push(getFilePath_Coroutine); StartCoroutine(getFilePath_Coroutine); #else cascade = new CascadeClassifier(); cascade.load(Utils.getFilePath("lbpcascade_frontalface.xml")); // cascade = new CascadeClassifier (); // cascade.load (Utils.getFilePath ("haarcascade_frontalface_alt.xml")); // if (cascade.empty ()) { // Debug.LogError ("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. "); // } webCamTextureToMatHelper.Initialize(); #endif }
// Use this for initialization void Start() { //if true, The error log of the Native side OpenCV will be displayed on the Unity Editor Console. Utils.setDebugMode(true); classNames = readClassNames(Utils.getFilePath("dnn/coco.names")); #if !UNITY_WSA_10_0 if (classNames == null) { Debug.LogError("class names list file is not loaded.The model and class names list can be downloaded here: \"https://github.com/pjreddie/darknet/tree/master/data/coco.names\".Please copy to “Assets/StreamingAssets/dnn/” folder. "); } #endif string modelConfiguration = Utils.getFilePath("dnn/tiny-yolo.cfg"); string modelBinary = Utils.getFilePath("dnn/tiny-yolo.weights"); if (string.IsNullOrEmpty(modelConfiguration) || string.IsNullOrEmpty(modelBinary)) { Debug.LogError("model file is not loaded. the cfg-file and weights-file can be downloaded here: https://github.com/pjreddie/darknet/blob/master/cfg/tiny-yolo.cfg and https://pjreddie.com/media/files/tiny-yolo.weights. Please copy to “Assets/StreamingAssets/dnn/” folder. "); } else { //! [Initialize network] net = Dnn.readNetFromDarknet(modelConfiguration, modelBinary); //! [Initialize network] } resized = new Mat(); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); webCamTextureToMatHelper.Initialize(); }
// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor> (); markerTypeDropdown.value = (int)markerType; dictionaryIdDropdown.value = (int)dictionaryId; showRejectedCornersToggle.isOn = showRejectedCorners; refineMarkerDetectionToggle.isOn = refineMarkerDetection; refineMarkerDetectionToggle.interactable = (markerType == MarkerType.GridBoard || markerType == MarkerType.ChArUcoBoard); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_ANDROID && !UNITY_EDITOR // Set the requestedFPS parameter to avoid the problem of the WebCamTexture image becoming low light on some Android devices. (Pixel, pixel 2) // https://forum.unity.com/threads/android-webcamtexture-in-low-light-only-some-models.520656/ // https://forum.unity.com/threads/released-opencv-for-unity.277080/page-33#post-3445178 rearCameraRequestedFPS = webCamTextureToMatHelper.requestedFPS; if (webCamTextureToMatHelper.requestedIsFrontFacing) { webCamTextureToMatHelper.requestedFPS = 15; webCamTextureToMatHelper.Initialize(); } else { webCamTextureToMatHelper.Initialize(); } #else webCamTextureToMatHelper.Initialize(); #endif }
// Use this for initialization IEnumerator Start() { webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); // fix the screen orientation. Screen.orientation = ScreenOrientation.LandscapeLeft; // wait for the screen orientation to change. yield return(null); if (markerTypeDropdown.value != markerType || dictionaryIdDropdown.value != dictionaryId || squaresXDropdown.value != squaresX - 1 || squaresYDropdown.value != squaresY - 1) { markerTypeDropdown.value = markerType; dictionaryIdDropdown.value = dictionaryId; squaresXDropdown.value = squaresX - 1; squaresYDropdown.value = squaresY - 1; } dictionaryIdDropdown.interactable = (markerType == (int)MarkerType.ChArUcoBoard); #if UNITY_WEBGL && !UNITY_EDITOR isImagesInputMode = false; #endif if (isImagesInputMode) { isImagesInputMode = InitializeImagesInputMode(); } if (!isImagesInputMode) { webCamTextureToMatHelper.Initialize(); } }
private void Run() { Utils.setDebugMode(true); er_filter1 = OpenCVForUnity.Text.createERFilterNM1(trained_classifierNM1_xml_filepath, 8, 0.00015f, 0.13f, 0.2f, true, 0.1f); er_filter2 = OpenCVForUnity.Text.createERFilterNM2(trained_classifierNM2_xml_filepath, 0.5f); Mat transition_p = new Mat(62, 62, CvType.CV_64FC1); // string filename = "OCRHMM_transitions_table.xml"; // FileStorage fs(filename, FileStorage::READ); // fs["transition_probabilities"] >> transition_p; // fs.release(); //Load TransitionProbabilitiesData. transition_p.put(0, 0, GetTransitionProbabilitiesData(OCRHMM_transitions_table_xml_filepath)); Mat emission_p = Mat.eye(62, 62, CvType.CV_64FC1); string voc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; decoder = OCRHMMDecoder.create(OCRHMM_knn_model_data_xml_gz_filepath, voc, transition_p, emission_p); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); webCamTextureToMatHelper.Initialize(); flipVerticalToggle.isOn = webCamTextureToMatHelper.flipVertical; flipHorizontalToggle.isOn = webCamTextureToMatHelper.flipHorizontal; }
// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor> (); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_ANDROID && !UNITY_EDITOR // Set the requestedFPS parameter to avoid the problem of the WebCamTexture image becoming low light on some Android devices. (Pixel, pixel 2) // https://forum.unity.com/threads/android-webcamtexture-in-low-light-only-some-models.520656/ // https://forum.unity.com/threads/released-opencv-for-unity.277080/page-33#post-3445178 rearCameraRequestedFPS = webCamTextureToMatHelper.requestedFPS; if (webCamTextureToMatHelper.requestedIsFrontFacing) { webCamTextureToMatHelper.requestedFPS = 15; webCamTextureToMatHelper.Initialize(); } else { webCamTextureToMatHelper.Initialize(); } #else webCamTextureToMatHelper.Initialize(); #endif backgroundSubstractorMOG2 = Video.createBackgroundSubtractorMOG2(); // backgroundSubstractorMOG2.setHistory (2); // backgroundSubstractorMOG2.setVarThreshold (16); // backgroundSubstractorMOG2.setDetectShadows (true); }
// Use this for initialization void Start() { #if UNITY_WEBGL && !UNITY_EDITOR Utils.registerWebGLPlugin(); #endif renderThreadCoroutine = CallAtEndOfFrames(); fpsMonitor = GetComponent <FpsMonitor> (); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); int width, height; Dimensions(requestedResolution, out width, out height); webCamTextureToMatHelper.requestedWidth = width; webCamTextureToMatHelper.requestedHeight = height; webCamTextureToMatHelper.requestedFPS = (int)requestedFPS; webCamTextureToMatHelper.Initialize(); // Update GUI state requestedResolutionDropdown.value = (int)requestedResolution; string[] enumNames = System.Enum.GetNames(typeof(FPSPreset)); int index = Array.IndexOf(enumNames, requestedFPS.ToString()); requestedFPSDropdown.value = index; rotate90DegreeToggle.isOn = webCamTextureToMatHelper.rotate90Degree; flipVerticalToggle.isOn = webCamTextureToMatHelper.flipVertical; flipHorizontalToggle.isOn = webCamTextureToMatHelper.flipHorizontal; }
// Use this for initialization IEnumerator Start() { webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); // fix the screen orientation. Screen.orientation = ScreenOrientation.LandscapeLeft; // wait for the screen orientation to change. yield return(null); markerTypeDropdown.value = (int)markerType; dictionaryIdDropdown.value = (int)dictionaryId; squaresXDropdown.value = (int)squaresX - 1; squaresYDropdown.value = (int)squaresY - 1; dictionaryIdDropdown.interactable = (markerType == MarkerType.ChArUcoBoard); #if UNITY_WEBGL && !UNITY_EDITOR isImagesInputMode = false; #endif if (isImagesInputMode) { isImagesInputMode = InitializeImagesInputMode(); } if (!isImagesInputMode) { #if UNITY_ANDROID && !UNITY_EDITOR // Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2). webCamTextureToMatHelper.avoidAndroidFrontCameraLowLightIssue = true; #endif webCamTextureToMatHelper.Initialize(); } }
// Use this for initialization void Start() { menuVariables = GameObject.Find("EventSystem").GetComponent <MenuVariables>(); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper>(); #if UNITY_WEBGL && !UNITY_EDITOR getFilePath_Coroutine = GetFilePath(); StartCoroutine(getFilePath_Coroutine); #else if (!string.IsNullOrEmpty(classes)) { classes_filepath = Utils.getFilePath("dnn/" + classes); } if (!string.IsNullOrEmpty(config)) { config_filepath = Utils.getFilePath("dnn/" + config); } if (!string.IsNullOrEmpty(model)) { model_filepath = Utils.getFilePath("dnn/" + model); } Run(); EnglishText.text = "EN"; SpanishText.text = "ES"; FrenchText.text = "FR"; GermanText.text = "DE"; ItalianText.text = "IT"; #endif }
// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor> (); imageOptimizationHelper = gameObject.GetComponent <ImageOptimizationHelper> (); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_ANDROID && !UNITY_EDITOR // Set the requestedFPS parameter to avoid the problem of the WebCamTexture image becoming low light on some Android devices. (Pixel, pixel 2) // https://forum.unity.com/threads/android-webcamtexture-in-low-light-only-some-models.520656/ // https://forum.unity.com/threads/released-opencv-for-unity.277080/page-33#post-3445178 rearCameraRequestedFPS = webCamTextureToMatHelper.requestedFPS; if (webCamTextureToMatHelper.requestedIsFrontFacing) { webCamTextureToMatHelper.requestedFPS = 15; webCamTextureToMatHelper.Initialize(); } else { webCamTextureToMatHelper.Initialize(); } #else webCamTextureToMatHelper.Initialize(); #endif }
// Use this for initialization void Start() { roiPointList = new List <Point> (); termination = new TermCriteria(TermCriteria.EPS | TermCriteria.COUNT, 10, 1); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); webCamTextureToMatHelper.Initialize(); }
// Use this for initialization void Start() { webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); webCamTextureToMatHelper.Initialize(); flipVerticalToggle.isOn = webCamTextureToMatHelper.flipVertical; flipHorizontalToggle.isOn = webCamTextureToMatHelper.flipHorizontal; }
// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor>(); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper>(); facemark_cascade_filepath = Utils.getFilePath(FACEMARK_CASCADE_FILENAME); facemark_model_filepath = Utils.getFilePath(FACEMARK_MODEL_FILENAME); Run(); }
// Use this for initialization void Start() { webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); webCamTextureToMatHelper.Init(); backgroundSubstractorMOG2 = Video.createBackgroundSubtractorMOG2(); // backgroundSubstractorMOG2.setHistory (2); // backgroundSubstractorMOG2.setVarThreshold (16); // backgroundSubstractorMOG2.setDetectShadows (true); }
// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor> (); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_ANDROID && !UNITY_EDITOR // Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2). webCamTextureToMatHelper.avoidAndroidFrontCameraLowLightIssue = true; #endif webCamTextureToMatHelper.Initialize(); }
// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor> (); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_WEBGL && !UNITY_EDITOR var getFilePath_Coroutine = Utils.getFilePathAsync("lbpcascade_frontalface.xml", (result) => { coroutines.Clear(); cascade = new CascadeClassifier(); cascade.load(result); if (cascade.empty()) { Debug.LogError("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. "); } webCamTextureToMatHelper.Initialize(); }); coroutines.Push(getFilePath_Coroutine); StartCoroutine(getFilePath_Coroutine); #else cascade = new CascadeClassifier(); cascade.load(Utils.getFilePath("lbpcascade_frontalface.xml")); // cascade = new CascadeClassifier (); // cascade.load (Utils.getFilePath ("haarcascade_frontalface_alt.xml")); #if !UNITY_WSA_10_0 if (cascade.empty()) { Debug.LogError("cascade file is not loaded.Please copy from “OpenCVForUnity/StreamingAssets/” to “Assets/StreamingAssets/” folder. "); } #endif #if UNITY_ANDROID && !UNITY_EDITOR // Set the requestedFPS parameter to avoid the problem of the WebCamTexture image becoming low light on some Android devices. (Pixel, pixel 2) // https://forum.unity.com/threads/android-webcamtexture-in-low-light-only-some-models.520656/ // https://forum.unity.com/threads/released-opencv-for-unity.277080/page-33#post-3445178 rearCameraRequestedFPS = webCamTextureToMatHelper.requestedFPS; if (webCamTextureToMatHelper.requestedIsFrontFacing) { webCamTextureToMatHelper.requestedFPS = 15; webCamTextureToMatHelper.Initialize(); } else { webCamTextureToMatHelper.Initialize(); } #else webCamTextureToMatHelper.Initialize(); #endif #endif }
// Use this for initialization void Start() { webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_WEBGL && !UNITY_EDITOR var getFilePath_Coroutine = GetFilePath(); coroutines.Push(getFilePath_Coroutine); StartCoroutine(getFilePath_Coroutine); #else tensorflow_inception_graph_pb_filepath = Utils.getFilePath("dnn/tensorflow_inception_graph.pb"); imagenet_comp_graph_label_strings_txt_filepath = Utils.getFilePath("dnn/imagenet_comp_graph_label_strings.txt"); Run(); #endif }
// Use this for initialization void Start() { webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_WEBGL && !UNITY_EDITOR var getFilePath_Coroutine = GetFilePath(); coroutines.Push(getFilePath_Coroutine); StartCoroutine(getFilePath_Coroutine); #else MobileNetSSD_deploy_caffemodel_filepath = Utils.getFilePath("dnn/MobileNetSSD_deploy.caffemodel"); MobileNetSSD_deploy_prototxt_filepath = Utils.getFilePath("dnn/MobileNetSSD_deploy.prototxt"); Run(); #endif }
// Use this for initialization void Start() { webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_WEBGL && !UNITY_EDITOR var getFilePath_Coroutine = GetFilePath(); coroutines.Push(getFilePath_Coroutine); StartCoroutine(getFilePath_Coroutine); #else lbpcascade_frontalface_xml_filepath = Utils.getFilePath("lbpcascade_frontalface.xml"); haarcascade_frontalface_alt_xml_filepath = Utils.getFilePath("haarcascade_frontalface_alt.xml"); Run(); #endif }
// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor>(); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper>(); #if UNITY_WEBGL && !UNITY_EDITOR getFilePath_Coroutine = GetFilePath(); StartCoroutine(getFilePath_Coroutine); #else model_filepath = Utils.getFilePath(MODEL_FILENAME); Run(); #endif }
// Use this for initialization void Start() { webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_WEBGL && !UNITY_EDITOR var getFilePath_Coroutine = GetFilePath(); coroutines.Push(getFilePath_Coroutine); StartCoroutine(getFilePath_Coroutine); #else res10_300x300_ssd_iter_140000_caffemodel_filepath = Utils.getFilePath("dnn/res10_300x300_ssd_iter_140000.caffemodel"); deploy_prototxt_filepath = Utils.getFilePath("dnn/deploy.prototxt"); Run(); #endif }
// Use this for initialization void Start() { webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_WEBGL && !UNITY_EDITOR var getFilePath_Coroutine = GetFilePath(); coroutines.Push(getFilePath_Coroutine); StartCoroutine(getFilePath_Coroutine); #else coco_names_filepath = Utils.getFilePath("dnn/coco.names"); tiny_yolo_cfg_filepath = Utils.getFilePath("dnn/tiny-yolo.cfg"); tiny_yolo_weights_filepath = Utils.getFilePath("dnn/tiny-yolo.weights"); Run(); #endif }
// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor> (); roiPointList = new List <Point> (); termination = new TermCriteria(TermCriteria.EPS | TermCriteria.COUNT, 10, 1); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_ANDROID && !UNITY_EDITOR // Avoids the front camera low light issue that occurs in only some Android devices (e.g. Google Pixel, Pixel2). webCamTextureToMatHelper.avoidAndroidFrontCameraLowLightIssue = true; #endif webCamTextureToMatHelper.Initialize(); }
// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor> (); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_WEBGL && !UNITY_EDITOR getFilePath_Coroutine = GetFilePath(); StartCoroutine(getFilePath_Coroutine); #else facemark_cascade_filepath = Utils.getFilePath("lbpcascade_frontalface.xml"); facemark_model_filepath = Utils.getFilePath("facemark/lbfmodel.yaml"); Run(); #endif }
// Use this for initialization void Start() { fpsMonitor = GetComponent <FpsMonitor> (); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); #if UNITY_WEBGL && !UNITY_EDITOR getFilePath_Coroutine = GetFilePath(); StartCoroutine(getFilePath_Coroutine); #else lbp_cascade_filepath = Utils.getFilePath(LBP_CASCADE_FILENAME); haar_cascade_filepath = Utils.getFilePath(HAAR_CASCADE_FILENAME); Run(); #endif }
// Use this for initialization void Start() { if (markerTypeDropdown.value != markerType || dictionaryIdDropdown.value != dictionaryId || showRejectedCornersToggle.isOn != showRejectedCorners || refineMarkerDetectionToggle.isOn != refineMarkerDetection) { markerTypeDropdown.value = markerType; dictionaryIdDropdown.value = dictionaryId; showRejectedCornersToggle.isOn = showRejectedCorners; refineMarkerDetectionToggle.isOn = refineMarkerDetection; } refineMarkerDetectionToggle.interactable = (markerType == (int)MarkerType.GridBoard || markerType == (int)MarkerType.ChArUcoBoard); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper> (); webCamTextureToMatHelper.Initialize(); }