void Start() { string palmPath = Path.Combine(Application.streamingAssetsPath, palmModelFile); palmDetect = new PalmDetect(palmPath); string landmarkPath = Path.Combine(Application.streamingAssetsPath, landmarkModelFile); landmarkDetect = new HandLandmarkDetect(landmarkPath); Debug.Log($"landmark dimension: {landmarkDetect.Dim}"); string cameraName = WebCamUtil.FindName(new WebCamUtil.PreferSpec() { isFrontFacing = false, kind = WebCamKind.WideAngle, }); webcamTexture = new WebCamTexture(cameraName, 1280, 720, 30); cameraView.texture = webcamTexture; webcamTexture.Play(); Debug.Log($"Starting camera: {cameraName}"); // Init frames frames = new Image[PalmDetect.MAX_PALM_NUM]; var parent = cameraView.transform; for (int i = 0; i < frames.Length; i++) { frames[i] = Instantiate(framePrefab, Vector3.zero, Quaternion.identity, parent); frames[i].transform.localPosition = Vector3.zero; } }
void Start() { string path = Path.Combine(Application.streamingAssetsPath, fileName); ssd = new SSD(path); // Init camera string cameraName = WebCamUtil.FindName(); webcamTexture = new WebCamTexture(cameraName, 1280, 720, 30); cameraView.texture = webcamTexture; webcamTexture.Play(); Debug.Log($"Starting camera: {cameraName}"); // Init frames frames = new Text[10]; var parent = cameraView.transform; for (int i = 0; i < frames.Length; i++) { frames[i] = Instantiate(framePrefab, Vector3.zero, Quaternion.identity, parent); } // Labels labels = labelMap.text.Split('\n'); }
void Update() { poseDetect.Invoke(webcamTexture); cameraView.material = poseDetect.transformMat; var pose = poseDetect.GetResults(0.7f, 0.3f); UpdateFrame(ref pose); if (pose.score < 0) { return; } poseLandmark.Invoke(webcamTexture, pose); debugView.texture = poseLandmark.inputTex; landmarkResult = poseLandmark.GetResult(useLandmarkFilter); { // Apply webcam rotation to draw landmarks correctly Matrix4x4 mtx = WebCamUtil.GetMatrix(-webcamTexture.videoRotationAngle, false, webcamTexture.videoVerticallyMirrored); for (int i = 0; i < landmarkResult.joints.Length; i++) { landmarkResult.joints[i] = mtx.MultiplyPoint3x4(landmarkResult.joints[i]); } } RectTransformationCalculator.ApplyToRectTransform(poseLandmark.CropMatrix, croppedFrame.rectTransform); }
void Start() { // Init model string detectionPath = Path.Combine(Application.streamingAssetsPath, poseDetectionModelFile); poseDetect = new PoseDetect(detectionPath); string landmarkPath = Path.Combine(Application.streamingAssetsPath, poseLandmarkModelFile); poseLandmark = new PoseLandmarkDetect(landmarkPath); // Init camera string cameraName = WebCamUtil.FindName(new WebCamUtil.PreferSpec() { isFrontFacing = false, kind = WebCamKind.WideAngle, }); webcamTexture = new WebCamTexture(cameraName, 1280, 720, 30); cameraView.texture = webcamTexture; webcamTexture.Play(); Debug.Log($"Starting camera: {cameraName}"); // Init frame frame = Instantiate(framePrefab, Vector3.zero, Quaternion.identity, cameraView.transform); draw = new PrimitiveDraw() { color = Color.blue, }; }
private void InitWebCam(string camName) { string cameraName = WebCamUtil.FindName(new WebCamUtil.PreferSpec() { isFrontFacing = true, kind = WebCamKind.WideAngle, }); WebCamDevice[] devices = WebCamTexture.devices; m_webcamTexture = new WebCamTexture(cameraName, m_capSize.x, m_capSize.y, 30); if (devices.Length > 0) { for (int i = 0; i < devices.Length; i++) { Debug.Log("[DEBUG Cam Name] " + devices[i].name); if (devices[i].name == camName) { m_webcamTexture.deviceName = devices[i].name; } } } viewWebCam.texture = m_webcamTexture; m_webcamTexture.Play(); Debug.Log($"Starting camera: {cameraName}"); }
private void initCamera() { string cameraName = WebCamUtil.FindName(); webcamTexture = new WebCamTexture(cameraName, 640, 480, 30); webcamTexture.Play(); cameraView.texture = webcamTexture; }
void Start() { string path = Path.Combine(Application.streamingAssetsPath, fileName); poseNet = new PoseNet(path); // Init camera string cameraName = WebCamUtil.FindName(); webcamTexture = new WebCamTexture(cameraName, 640, 480, 30); webcamTexture.Play(); cameraView.texture = webcamTexture; glDrawer.OnDraw += OnGLDraw; }
void Start() { string cameraName = WebCamUtil.FindName(new WebCamUtil.PreferSpec() { isFrontFacing = false, kind = WebCamKind.WideAngle, }); webcamTexture = new WebCamTexture(cameraName, 1280, 720, 30); webcamTexture.Play(); rawInputView.texture = webcamTexture; resizer = new TextureResizer(); resizeOptions = new TextureResizer.ResizeOptions() { aspectMode = TextureResizer.AspectMode.Fill, rotationDegree = 0, mirrorHorizontal = false, mirrorVertical = false, width = 720, height = 720, }; // Setup UIs // Dropdown var modes = Enum.GetValues(typeof(TextureResizer.AspectMode)).Cast <TextureResizer.AspectMode>(); aspectModeDropdown.ClearOptions(); aspectModeDropdown.AddOptions(modes.Select(m => new Dropdown.OptionData(m.ToString())).ToList()); aspectModeDropdown.SetValueWithoutNotify((int)resizeOptions.aspectMode); aspectModeDropdown.onValueChanged.AddListener((int index) => { resizeOptions.aspectMode = (TextureResizer.AspectMode)index; }); // Mirror mirrorHorizontalToggle.SetIsOnWithoutNotify(resizeOptions.mirrorHorizontal); mirrorHorizontalToggle.onValueChanged.AddListener((bool isOn) => { resizeOptions.mirrorHorizontal = isOn; }); mirrorVerticalToggle.SetIsOnWithoutNotify(resizeOptions.mirrorVertical); mirrorVerticalToggle.onValueChanged.AddListener((bool isOn) => { resizeOptions.mirrorVertical = isOn; }); }
void Start() { string detectionPath = Path.Combine(Application.streamingAssetsPath, faceModelFile); faceDetect = new FaceDetect(detectionPath); string cameraName = WebCamUtil.FindName(new WebCamUtil.PreferSpec() { isFrontFacing = false, kind = WebCamKind.WideAngle, }); webcamTexture = new WebCamTexture(cameraName, 1280, 720, 30); cameraView.texture = webcamTexture; webcamTexture.Play(); Debug.Log($"Starting camera: {cameraName}"); draw = new PrimitiveDraw(Camera.main, gameObject.layer); }
void Start() { // Init model string detectionPath = Path.Combine(Application.streamingAssetsPath, poseDetectionModelFile); string landmarkPath = Path.Combine(Application.streamingAssetsPath, poseLandmarkModelFile); switch (mode) { case Mode.UpperBody: poseDetect = new PoseDetectUpperBody(detectionPath); poseLandmark = new PoseLandmarkDetectUpperBody(landmarkPath); break; case Mode.FullBody: poseDetect = new PoseDetectFullBody(detectionPath); poseLandmark = new PoseLandmarkDetectFullBody(landmarkPath); break; default: throw new System.NotSupportedException($"Mode: {mode} is not supported"); } // Init camera string cameraName = WebCamUtil.FindName(new WebCamUtil.PreferSpec() { isFrontFacing = false, kind = WebCamKind.WideAngle, }); webcamTexture = new WebCamTexture(cameraName, 1280, 720, 30); cameraView.texture = webcamTexture; webcamTexture.Play(); Debug.Log($"Starting camera: {cameraName}"); draw = new PrimitiveDraw(Camera.main, gameObject.layer); worldJoints = new Vector3[poseLandmark.JointCount]; cancellationToken = this.GetCancellationTokenOnDestroy(); }
void Start() { // Init camera string cameraName = WebCamUtil.FindName(); webcamTexture = new WebCamTexture(cameraName, 640, 480, 30); webcamTexture.Play(); camTexture = WebCamTexture2D(webcamTexture); // ML string path = Path.Combine(Application.streamingAssetsPath, fileName); deepLab = new DeepLab(path, compute); deeplabTexture = new Texture2D(webcamTexture.width, webcamTexture.height, TextureFormat.ARGB32, false); var resizeOptions = deepLab.ResizeOptions; resizeOptions.rotationDegree = webcamTexture.videoRotationAngle; deepLab.ResizeOptions = resizeOptions; //startThred(); }
void Start() { string palmPath = Path.Combine(Application.streamingAssetsPath, palmModelFile); palmDetect = new PalmDetect(palmPath); string landmarkPath = Path.Combine(Application.streamingAssetsPath, landmarkModelFile); landmarkDetect = new HandLandmarkDetect(landmarkPath); Debug.Log($"landmark dimension: {landmarkDetect.Dim}"); string cameraName = WebCamUtil.FindName(new WebCamUtil.PreferSpec() { isFrontFacing = false, kind = WebCamKind.WideAngle, }); webcamTexture = new WebCamTexture(cameraName, 1280, 720, 30); cameraView.texture = webcamTexture; webcamTexture.Play(); Debug.Log($"Starting camera: {cameraName}"); draw = new PrimitiveDraw(); }