Skip to content

Instantly share code, notes, and snippets.

@olokobayusuf
Created November 28, 2017 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olokobayusuf/835b1927ccbd49c3c63a9b2893cf2a07 to your computer and use it in GitHub Desktop.
Save olokobayusuf/835b1927ccbd49c3c63a9b2893cf2a07 to your computer and use it in GitHub Desktop.
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