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
... | |
Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); | |
Camera.getCameraInfo(index, cameraInfo); | |
... |
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
public static void RotateImage (Color32[] dst, Color32[] src, int width, int height, byte orientation) { | |
int rotation = ..., mirror = ...; // Extract the rotation and mirror bits from the orientation byte | |
Func<int, int> kernel = null; | |
switch (rotation) { | |
case 0: kernel = i => i; break; // 0 | |
case 1: kernel = i => height * (width - 1 - i % width) + i / width; break; // 90 | |
case 2: kernel = i => src.Length - 1 - i; break; // 180 | |
case 3: kernel = i => src.Length - 1 - (height * (width - 1 - i % width) + i / width); break; // 270 | |
} | |
for (int i = 0; i < src.Length; i++) dst[kernel(i)] = src[i]; // Reposition the pixels // Memory accesses for the destination buffer are all over the place |
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
Camera.Parameters params = camera.getParameters(); | |
if (params.getMaxNumMeteringAreas() > 0 && params.getMaxNumFocusAreas() > 0) { | |
... | |
LogVerbose("Attempting to focus camera " + index + " at (" + Math.round(x * 100) / 100f + ", " + Math.round(y * 100) / 100f + ")"); | |
} else { | |
... | |
LogError("Camera "+index+" does not support focus"); // Control only reaches here when the check above fails | |
} |
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
void SwitchCamera () { | |
var newCamera = ...; | |
// Set the new active camera | |
NatCam.Camera = newCamera; | |
} |
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 UnityEngine.UI; | |
using UnityEngine.EventSystems; | |
using Lean.Touch; | |
public class LeanFocuser : MonoBehaviour { | |
public FocusMode focusMode = FocusMode.AutoFocus | FocusMode.TapToFocus; | |
public bool IsTracking {get; private set;} |
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; | |
public class CheckCameras : MonoBehaviour { | |
void Start () { | |
foreach (var camera in NatCam.Cameras) if (camera) { | |
Debug.Log("Found a camera with facing: " + camera.Facing); | |
return; | |
} |
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
import java.util.Arrays; | |
import java.util.ArrayList; | |
public final class Permutations { | |
private static final int input[] = {1, 2, 3}; | |
public static void main (String args[]) { | |
// Permute | |
ArrayList<int[]> permutations = permute(input); |
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 NatCamU; | |
public class ForceRearCamera : NatCamBehaviour { | |
public override void Start () { | |
// Force the rear camera | |
facing = Facing.Rear; | |
// Carry on | |
base.Start(); | |
} |
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.Professional; | |
using OpenCVForUnity; | |
public class DrawLine : OpenCVBehaviour { | |
public override void OnMatrix () { | |
// Draw a diagonal line on our image | |
Imgproc.line(matrix, new Point(0, 0), new Point(matrix.cols(), matrix.rows()), new Scalar(255, 0, 0, 255), 4); |
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
/* | |
* NatCam Test Suite | |
* Copyright (c) 2017 Yusuf Olokoba | |
*/ | |
namespace NatCamU.Tests { | |
using UnityEngine; | |
using Core; | |
using Professional; |
OlderNewer