MAD Gaze GLOW & GLOW PLUS
Camera SDK for Unity

MAD Gaze GLOW & GLOW Plus: Camera SDK for Unity

v2021.2 (Release Date: 06/18/2021)

  • Updates [Scene Tracking SDK]
  1. Standardize application flow for Scene Tracking
  2. Developers can now customise the Animation and Virtual Planes on their apps.
  3. Different callbacks among all state changes are now available.
  4. Two control modes are now available, Arbitary-Placement mode and Center-Placement mode.

View historical changes

Build History

Date Package File (.unitypackage) Demo Project
06/18/2021 v2021.2 v2021.2 (Unity 2020.3.9)
02/10/2021 v2021.1 v2021.1
08/19/2020 v1.3.0 v1.3.0
07/10/2020 v1.1.0 v1.1.0
06/29/2020 v1.0.0 v1.0.0

Capabilities

Camera SDK for Unity provides the following functions with GLOW Camera:

Prerequisite

*This SDK is applicable to both MAD Gaze GLOW and MAD Gaze GLOW Plus model.

The application shall be

  • an Android application
  • with Target SDK at 27 (Android 8.1 'Oreo')
  • with Minimum SDK at 27 (Android 8.1 'Oreo')
  • with Landscape Left/Right orientation

Tested Unity Editor Versions

  • Unity 2019.4.1
  • Unity 2019.3.12
  • Unity 2019.2.3

Getting Started

  1. Download the Unity Package here.
  2. Double Tap on the downloaded package and import the files.
  3. You are ready to develop GLOW-enabled apps.

Adding GLOW Camera into my scene

  1. Drag prefab MGCamera from MADGaze/Demo/Prefabs into your scene.
  2. Create an UI/Image object into your scene.
  3. Set the dimension of the created Image object to 680x480.
  4. Open the Inspector view of MGCamera.
  5. Drag the created Image object to Image Preview of MAD Gaze Camera (Script) in MGCamera.
  6. You are now able to display the camera preview from the created Image object.

Handle Camera Preview manually

  1. Drag prefab MGCamera from MADGaze/Demo/Prefabs into your scene.
  2. You are ready to handle the camera data when it is available.

To retrieve video(preview) data with following code segment.

Texture2D mTexture2D;
public Image ImagePreview;

lock(mTexture2D) {
	byte[] data = SplitCamera.Instance.getPreviewResult();
	//SplitCamera.Instance.getPreviewResult() stores the Bitmap data.
	if(data != null) {
		mTexture2D.LoadImage(data);
		Sprite sprite = Sprite.Create(
			mTexture2D, 
			new Rect(0, 0, mTexture2D.width, mTexture2D.height), 
			new Vector2(.5f, .5f)
		);
	}
}

Photo Capture

SplitCamera.Instance.takePicture(
	(string path)=>{
		//When image is saved succesfully
	},
    (int errorCode)=>{
		//When captured image is not saved successfully.
    }
);

Video Capture

Start Recording

SplitCamera.Instance.startRecording();

Stop Recording

SplitCamera.Instance.stopRecording();

Video Callbacks

SplitCamera.Instance.setRecordVideoCallback(
	(string path) => {
		//When video is saved succesfully
		//path: the file location has been saved.
	},
	(int errorCode) => {
		//When captured video is not saved successfully.
	}
);

Sample Scene

You can check CameraDemo in MADGaze/Demo/Scenes.

Troubleshooting

  • Q: Why the permission dialog never prompt on my Android 10 device?

    It is because the native bug doesn't allow you to prompt the permission dialog on Android Q devices with Target SDK newer than 28. You have to set Target SDK at 27 or below in order to make it work.

Changelog

v2021.2 (Release Date: 06/18/2021)

  • Updates [Scene Tracking SDK]
  1. Standardize application flow for Scene Tracking
  2. Developers can now customise the Animation and Virtual Planes on their apps.
  3. Different callbacks among all state changes are now available.
  4. Two control modes are now available, Arbitary-Placement mode and Center-Placement mode.

v2021.1 (Release Date: 02/10/2021)

v1.3.0 (Release Date: 08/19/2020)

  • First Release
    1. Scene Tracking SDK: This SDK allows user to recognize table-sized plain surface patterns and place the target to the tracked surface.
  • Updates
    1. All SDK: Support USB Connection with MAD Gaze Adapters.

v1.1.0 (Release Date: 07/10/2020)

  • First Release
    1. Head Tracking SDK: This SDK allows users to control the application via operating with head rotation.

v1.0.0 (Release Date: 06/29/2020)

  • First Release
    1. Camera SDK: This SDK allows users to access the camera with codes.

Disclaimer

This library is licensed under the MAD Gaze - Terms of Use.

Copyright © 2021 MAD Gaze. All rights reserved.