UpdateLineMesh() public static method

public static UpdateLineMesh ( OpticalFlowWorker r, Mesh mesh, CvPoint2D32f velocities, float limitVelocity ) : void
r nobnak.OpenCV.OpticalFlowWorker
mesh Mesh
velocities CvPoint2D32f
limitVelocity float
return void
Beispiel #1
0
    void Update()
    {
        if (!_result.completed)
        {
            return;
        }

        if (_firstTimeUpdate)
        {
            _firstTimeUpdate = false;
            UpdateAspectRatio(_result.imageWidth, _result.imageHeight);
            _velocities = new CvPoint2D32f[_mesh.vertexCount / 2];
        }

        ShowImage(_result);
        FlowUtil.CalculateFlowVelocities(_result, ref _velocities);
        FlowUtil.UpdateLineMesh(_result, _mesh, _velocities, limitVelocity);

        _result = _of.CalculateOpticalFlow(_corners0);
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if (!_ofResult.completed)
        {
            return;
        }

        //Debug.Log(string.Format("Optical Flow elapsed time {0:f}(ms)", _ofResult.elapsedMs));
        if (_ofResult.imageWidth != _videoTex.width || _ofResult.imageHeight != _videoTex.height)
        {
            _videoTex.Resize(_ofResult.imageWidth, _ofResult.imageHeight);
            var s = video.transform.localScale;
            s.x = s.y * _ofResult.imageWidth / _ofResult.imageHeight;
            video.transform.localScale = s;
        }
        _videoTex.LoadRawTextureData(_ofResult.imageData);
        _videoTex.Apply();

        FlowUtil.CalculateFlowVelocities(_ofResult, ref _velocities);
        FlowUtil.UpdateLineMesh(_ofResult, _flowMesh, _velocities, limitVelocity);

        _ofResult = _of.CalculateOpticalFlow(_ofResult.corners1);
    }