Skip to main content

STRUCT

RawImage

public struct RawImage

A raw image containing pixel data for ARDK operations.

RawImage provides access to image data in various formats (RGB, grayscale, depth, etc.) used by ARDK features like depth processing, semantic segmentation, and image analysis.

Overview​

Raw images are used throughout ARDK for:

  • Camera frame processing
  • Depth map representation
  • Semantic segmentation results
  • Image format conversions
  • Computer vision operations

Example Usage​

let (status, depthResult) = depthSession.getDepth()
if status.isOk() {
let image = depthResult.image
print("Image size: \(image.width) x \(image.height)")
print("Image type: \(image.type)")

// Access pixel data
let pixelData = image.data
// Process pixel data based on image type
}

Memory Management​

This object's pointers are only valid when the ARDK objects that holds it are still in scope.

Properties​

width​

public let width: UInt

Width of the image in pixels.

This represents the number of pixels in each row of the image.

height​

public let height: UInt

Height of the image in pixels.

This represents the number of rows in the image.

data​

public let data: UnsafeMutableRawPointer

Pointer to the raw pixel data.

This provides direct access to the image's pixel data. The format and interpretation of the data depends on the type property.

type​

public let type: ImageType

Format and type of the image data.

This indicates how the pixel data should be interpreted, including the number of channels, data type, and color space.

Methods​

init(ptr:width:height:type:)​

public init(ptr: UnsafeMutableRawPointer, width: UInt, height: UInt, type: ImageType)