Created
November 28, 2017 22:45
-
-
Save olokobayusuf/835b1927ccbd49c3c63a9b2893cf2a07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using NatCamU.Core; | |
using NatCamU.Pro; | |
using OpenCVForUnity; | |
public class VisionExample : OpenCVBehaviour { | |
// This function is called on every frame where the preview matrix is updated | |
public override void OnMatrix () { | |
// Do stuff with the preview matrix | |
Imgproc.line(matrix, new Point(0, 0), new Point(matrix.cols(), matrix.rows()), new Scalar(255, 0, 0, 255), 4); | |
// Now, we want to convert the matrix to a texture for display | |
// The OpenCVBehaviour class provides a helper method to do so | |
FlushMatrix(); | |
// Now the `texture` variable contains the result of whatever was in our matrix | |
// Let's display the texture onto our RawImage | |
preview.texture = texture; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment