RxPhoto class

Returns a photo as a JPEG image from Frame. Note: The camera sensor on Frame is rotated 90 degrees clockwise, so raw images are rotated, but by default RxPhoto will correct this by rotating -90 degrees. If you want to save the cost of copyRotate here you can specify upright=false in the constructor since some ML packages allow for specifying the orientation of the image when passing it in. Pairs with frame.camera.read_raw(), that is, jpeg header and footer are not sent from Frame - only the content, using non-final and final message types Jpeg header and footer are added in here on the client, so a quality level must be provided to select the correct header. Returns a Stream with exactly one jpeg as bytes, then is Done

Constructors

RxPhoto({int nonFinalChunkFlag = 0x07, int finalChunkFlag = 0x08, bool upright = true, bool isRaw = false, required String quality, required int resolution})

Properties

finalChunkFlag int
final
hashCode int
The hash code for this object.
no setterinherited
isRaw bool
Whether a raw image (without 623-byte jpeg header) will be returned from Frame, hence the corresponding header should be added Note that the first request for an image with a given resolution and quality level MUST be a complete image so the jpeg header can be saved and used for subsequent raw images of the same resolution and quality level
final
nonFinalChunkFlag int
final
quality String
The quality level of the jpeg image to be returned 'VERY_LOW', 'LOW', 'MEDIUM', 'HIGH', 'VERY_HIGH'
final
resolution int
The resolution of the (square) raw image to be returned from Frame Must be an even number between 100 and 720 inclusive
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
upright bool
Whether to rotate the image 90 degrees counter-clockwise to make it upright before returning it
final

Methods

attach(Stream<List<int>> dataResponse) Stream<Uint8List>
Attach this RxPhoto to the Frame's dataResponse characteristic stream. If isRaw is true, then quality and resolution must be specified and match the raw image requested from Frame so that the correct jpeg header can be prepended.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

jpegHeaderMap Map<String, Uint8List>
A map of jpeg headers for each quality level which we fill as we receive the first image of each quality level/resolution Key format is 'quality_resolution' e.g. 'VERY_LOW_512'
final

Static Methods

hasJpegHeader(String quality, int resolution) bool