|
|
|
|
|
|
|
|
// Convert OpenCVSharp Mat object to Unity Texture2D object |
|
|
// Convert OpenCVSharp Mat object to Unity Texture2D object |
|
|
private void MatToTexture(Mat mat) |
|
|
private void MatToTexture(Mat mat) |
|
|
{ |
|
|
{ |
|
|
// cannyImageData is byte array, because canny image is grayscale |
|
|
|
|
|
|
|
|
// cannyImageData is byte array, because canny image is binary |
|
|
mat.GetArray(0, 0, cannyImageData); |
|
|
mat.GetArray(0, 0, cannyImageData); |
|
|
// create Color32 array that can be assigned to Texture2D directly |
|
|
// create Color32 array that can be assigned to Texture2D directly |
|
|
Color32[] c = new Color32[croppedImHeight * imWidth]; |
|
|
Color32[] c = new Color32[croppedImHeight * imWidth]; |