KudanAR - iOS
ARCameraStream Class Reference

#import <ARCameraStream.h>

+ Inheritance diagram for ARCameraStream:
+ Collaboration diagram for ARCameraStream:

Instance Methods

(ARColour *) - averageColourFromData:withChannels:downsamplingWidth:height:
 
(void) - initialise
 
(void) - deinitialise
 
(void) - start
 
(void) - stop
 
(void) - addDelegate:
 
(void) - removeDelegate:
 
(void) - removeDelegates
 

Class Methods

(ARCameraStream *) + getInstance
 

Properties

float width
 
float height
 
float padding
 
ARTexturecameraTexture
 
NSArray * delegates
 
ARTexturecameraTextureY
 
ARTexturecameraTextureUV
 

Detailed Description

A manager class for handling the camera stream.

Method Documentation

- (void) addDelegate: (id< ARCameraStreamEvent >)  delegate
Parameters
delegateThe delegate to add. Add a delegate for camera update event notifications.
- (ARColour *) averageColourFromData: (NSData *)  data
withChannels: (int)  channels
downsamplingWidth: (int)  width
height: (int)  height 

Returns the average colour of an image expressed as a byte array. The image will be downsized before computation of the average. Smaller images will compute faster at the expense of accuracy. It is recommended to reduce image size as much as possible.

Example of use:

UIImage *image = [[UIImage alloc] initWithContentsOfFile:@"example.jpg"];
NSData *data = UIImagePNGRepresentation(image);
ARColour *averageColour = [[ARCameraStream getInstance] averageColourFromData:data withChannels:3 downSamplingWidth:64 height:64];

By using similar code with the didReceiveNewFrame event, it is possible to get the average colour of each frame as it becomes available.

Parameters
dataNSData object containing the image data.
channelsThe number of channels contained within the image data. For example, RGB data would contain 3 channels.
widthThe width, in pixels, to which the image will be scaled before computing the average.
heightThe height, in pixels, to which the image will be scaled before computing the average.
Returns
Average colour of the image as an ARColour object.
- (void) deinitialise

Deinitialise the camera. This is usually handled automatically.

Example of use:

+ (ARCameraStream *) getInstance

Gets the instance of the camera stream singleton.

Example of use:

Returns
The singleton instance.
- (void) initialise

Initialise the camera. This is usually handled automatically.

Example of use:

- (void) removeDelegate: (id< ARCameraStreamEvent >)  delegate
Parameters
delegateThe delegate to remove. Remove a delegate from camera update event notifications.
- (void) removeDelegates

Removes all ARCameraStreamEvent delegates currently associated with this singleton.

- (void) start

Start the camera stream. This is usually handled automatically.

Example of use:

- (void) stop

Stop the camera stream. This is usually handled automatically.

Example of use:

Property Documentation

- (ARTexture*) cameraTexture
readwritenonatomicassign

The camera texture.

- (ARTexture*) cameraTextureUV
readwritenonatomicassign

Camera chroma texture.

- (ARTexture*) cameraTextureY
readwritenonatomicassign

Camera luma texture.

- (NSArray*) delegates
readwritenonatomicassign

Array containing all ARCameraStreamEvent delegates that have been added to this singleton.

- (float) height
readwritenonatomicassign

The height of the camera image, in pixels.

- (float) padding
readwritenonatomicassign

The padding of the camera image in pixels.

- (float) width
readwritenonatomicassign

The width of the camera image, in pixels.


The documentation for this class was generated from the following file: