ark::image

Enums

  • CvImageConvertFlags (uint32_t)
    Flags used while converting Ark-style images to OpenCV-style images.

  • TransformType (int32_t)
    Defines the transformation type that will be executed on an image.

  • VideoStreamType (uint32_t)
    Supported capture types (if you want to capture video data or metadata).

Typedefs

Defined in “ark/image/abstract_video_compressor.hh”:

  • using CompressorCodecConfig = std::map< std::string, std::string >
    A dictionary of codec configuration values that are passed to the compressor.

  • using AbstractVideoCompressorPtr = std::shared_ptr< AbstractVideoCompressor >

Defined in “ark/image/abstract_video_decompressor.hh”:

Defined in “ark/image/video_device.hh”:

Classes

  • ark::image::AbstractVideoCompressor
    This class represents a basic video compressor, which can take input images in and produce compressed (JPEG, H264, etc) output images.

    There are several video compressor implementations, depending on what codecs you want to use and your system availability.

  • ark::image::AbstractVideoDecompressor
    This class represents a basic video decompressor, which can take input images compressed with (JPEG, H264, etc) and then output decompressed images.

    There are several video compressor implementations, depending on what codecs you want to use and your system availability.

  • ark::image::AutoBrightnessStage
    This stage will watch incoming images, compute the overall brightness, and then publish a message that controls the overall camera exposure/gains.

    It’s intended to be used when there is no hardware auto-exposure, as a lightweight method to do it in software.

  • ark::image::AvcodecVideoCompressor
    An implementation of the abstract video interface, backed by libavcodec. This is essentially a compressor that allows you to compress to any number of codecs provided by libavcodec.

    Note that at the moment, this assumes you are emitting H264-style images.

  • ark::image::AvcodecVideoDecompressor
    An implementation of the abstract decompressor interface, backed by libavcodec. This is essentially a decompressor that allows you to decompress to any number of codecs provided by libavcodec.

  • ark::image::CameraCollectionPlugin
    A simple plugin that can display camera images and a few basic camera statistics.

  • ark::image::CameraControlWidget

  • ark::image::CameraImagePlugin
    A simple plugin that can display camera images and a few basic camera statistics.

  • ark::image::CameraSettingsPlugin

  • ark::image::CameraSettingsWidget

  • ark::image::JpegVideoCompressor
    An implementation of the abstract video compressor interface, for JPEG images.

  • ark::image::JpegVideoDecompressor
    An implementation of the abstract video decompressor interface, for JPEG images.

  • ark::image::ScopedVideoBuffer
    A “safe buffer” this can be read from “read scoped buffer”, and will automatically release the video buffer when it falls out of scope.

  • ark::image::ThumbnailGenerationStage
    This stage will receive camera images on a particular channel (via configuration), and then write out to disk a single thumbnail. It does this by waiting for a fixed number of frames to be received if it doesn’t get to that number by shutdown time, it will write out the most recent image.

  • ark::image::V4lVideoCompressor
    An implementation of the abstract video compressor interface, for V4L devices.

  • ark::image::VideoCaptureStage
    This stage will use a video device to connect to a camera, and then stream camera images over the pipeline.

  • ark::image::VideoCompressionStage
    This stage will pull in camera images from the camera publisher in a target namespace, and put them out in that same namespace under a “compressed_image” publisher.

  • ark::image::VideoDecompressionStage
    This stage will pull in camera images from the camera publisher in a target namespace, and put them out in that same namespace under a “image” publisher.

    It is typically used to decompress images for playback (so we only decompress once), or to decompress onboard to get deterministic algorithm behavior.

  • ark::image::VideoDevice
    This class represents a video device. It allows you to open a single device (video4linux) and then stream camera images. It’s meant to be called from a central command loop.

  • ark::image::VideoEncoder
    This class can be used to consume images and emit an encoded video stream to an output path. The type of container is dependent on the extension given.

  • ark::image::VideoEncodingStage
    This stage will pull in camera images and encode them into a video (defined by configuration). The video can then (optionally) be uploaded to a remote location during shutdown.

  • ark::image::VideoIspStage
    This stage will pull in camera images from the camera publisher in a target namespace, pass them through a hardware-based ISP to further process them, and then publish them under a ‘processed_image’ publisher.

  • ark::image::VideoScaleStage
    This stage will pull in images from the given named channel, rescale them to the dimensions desired, and then publish the result over the channel specified.

    This is all configured through the configuration structure.

  • ark::image::WriteImageStage
    This stage will receive camera images on a particular channel (via configuration), and then write them out to disk as individual files.

  • ark::image::AvcodecVideoCompressorConfiguration
    Configuration for this compressor.

  • ark::image::ImageMetrics
    The metrics returned from the analysis.

  • ark::image::ImageMetricsConfiguration
    Configuration for computing image metrics. This allows you to tweak various settings when analyzing images.

  • ark::image::NvImagePlanes
    A structure containing NV image planes. Many operations like to have access to individual planes, rather than a flat image buffer.

  • ark::image::V4lVideoCompressorConfiguration
    Configuration for this compressor.

  • ark::image::VideoBuffer
    A buffer that is coming from the device. Contains basic metadata surrounding the frame. When you are done with it, manually release it against the given video device.

    The contents of this buffer are shared, so if you hold onto it for too long, the host device my end up timing out.

  • ark::image::VideoBufferConfiguration
    Used to pass back the configuration that is actually used for a particular camera. Typically this is what you configured, but if you left some fields as defaults, this will contain what the camera is actually using.

  • ark::image::VideoBufferPlane
    A plane from the video device. In most cases, there is one plane, but some formats/configurations request multiple planes. This contains the raw bytes/sizes from the device.

  • ark::image::VideoDeviceConfiguration
    A configuration for the given video device.

  • ark::image::VideoEncodingConfiguration
    This structure holds configuration settings related to how you want your images to be encoded into video.

  • ark::image::VideoEncodingStatistics
    Statistics emitted from his stage, mostly used for testing purposes.

  • ark::image::VideoStreamConfiguration
    A configuration for an individual video stream. A video device may have multiple streams.

  • ark::image::VideoStreamState
    Maintains state/buffers for an individual stream.

  • ark::image::YuvImagePlanes
    A structure containing YUV image planes. Many operations like to have access to individual planes, rather than a flat image buffer.

Functions

Declared in “ark/image/abstract_video_compressor.hh”:

  • AbstractVideoCompressorPtr create_video_compressor(const std::string & codec_name, const CompressorCodecConfig & codec_config)
    Constructs an appropriate video compressor based on system settings and codec.

Declared in “ark/image/abstract_video_decompressor.hh”:

  • AbstractVideoDecompressorPtr create_video_decompressor(ImageDataFormat format)
    Constructs an appropriate video decompressor based on the image data format.

Declared in “ark/image/codecs.hh”:

  • const char * preferred_codec_name()
    Returns a codec name that is available and generally considered the “nicest” codec available. This is all subjective. This is intended to provide a codec name that could change or upgrade over time.

Declared in “ark/image/convert.hh”:

  • bool is_image_compressed(const Image & image)
    Returns true if the given image is compressed or not.

  • Image decompress(const Image & image)
    Decompresses the given image (throws if the image is not compressed).

  • Image format_convert(const Image & image, ImageDataFormat desired_format)
    Converts the given image into the desired pixel format (image data format). If the image is compressed, it will be decompressed automatically.

  • void convert_yuyvi_to_422p_format(uint8_t *__restrict__ plane_y, uint8_t *__restrict__ plane_u, uint8_t *__restrict__ plane_v, const size_t plane_y_stride, const size_t plane_u_stride, const size_t plane_v_stride, const uint8_t *__restrict__ image_data, const size_t image_width, const size_t image_height)
    Converts a YUYV interlaced image into a YUV 4:2:2 planar image. Operates on the raw bytes, and handles different stride (bytes-per-line) levels.

  • Image convert_bayer_rg_to_bgr_format(const Image & source)
    Converts a Bayer RGGB (10-bit or 12-bit) to a BGR image. This conversion discards the upper bits if the input is 10-bit, or the lower bits if it’s 12-bit. TODO: We may want to support arbitrary conversion methods here (which should be configurable rather than hardcoded based on the input format).

Declared in “ark/image/depth.hh”:

  • Image apply_jet_colors_to_z16(const Image & image)
    Takes a Z16 image and applies depth colors to it, returning a RGB image. This will normalize the image based on the min/max within the image.

Declared in “ark/image/detail/avcodec_weak_functions.hh”:

  • AbstractVideoCompressorPtr make_avcodec_compressor(const CompressorCodecConfig & codec_config)
    Defines a weak function that may or may not provide a avcodec-based compressor, depending on what you linked in.

  • AbstractVideoDecompressorPtr make_avcodec_decompressor()
    Defines a weak function that may or may not provide a avcodec-based compressor, depending on what you linked in.

Declared in “ark/image/h264.hh”:

  • Image h264_compress(const Image & input)
    Takes the given H264 message and compresses it, returning a compressed image.

  • Image h264_decompress(const Image & input)
    Takes the given compressed H264 message and decompresses it, returning a decompressed image.

Declared in “ark/image/image_metrics.hh”:

  • ImageMetrics compute_image_metrics(const ImageMetricsConfiguration & config, const Image & image)
    Computes image metrics based on the given configuration and image. At the moment, only some pixel formats are supported (notably, YUV420).

Declared in “ark/image/image_timestamp.hh”:

  • std::optional< std::chrono::steady_clock::time_point > extract_image_time(const Image & msg)
    Function to extract the timestamp from the Camera Image message.

Declared in “ark/image/jpeg.hh”:

  • Image jpeg_compress(const Image & input, size_t jpeg_quality)
    Takes the specified camera image and compresses it with a JPEG compressor, at the given JPEG quality level.

  • Image jpeg_decompress(const std::filesystem::path & path)
    Reads the given JPEG image from the specified path, decoding it and returning it as a camera image.

  • Image jpeg_decompress(const Image & input)
    Takes the given compressed JPEG image and decompresses it, returning a decompressed image.

Declared in “ark/image/monobit.hh”:

  • core::ByteBuffer convert_to_monobit(const ark::image::Image & image)
    Takes the given image and converts it to monobit, using some internal thresholding. Returns a byte buffer containing a series of bits, where the bit is set if a pixel should be drawn.

    Note that we assume black is ‘1’ (drawn) and white is ‘0’ (not drawn). The supplied image must be greyscale.

Declared in “ark/image/opencv_image.hh”:

  • cv::Mat to_opencv(Image & image, CvImageConvertFlags flags)
    Converts the given Ark image type into an OpenCV image type, returning a reference to it. This matrix is just wrapping the original data; you must keep the original object in scope while working with this object.

Declared in “ark/image/planes.hh”:

  • YuvImagePlanes compute_yuv420_image_planes(const void * data, std::size_t width, std::size_t height)
    Computes the image planes for a YUV420P image.

  • YuvImagePlanes compute_yuv422_image_planes(const void * data, std::size_t width, std::size_t height)
    Computes the image planes for a YUV422P image.

  • YuvImagePlanes compute_yuv444_image_planes(const void * data, std::size_t width, std::size_t height)
    Computes the image planes for a YUV444P image.

  • NvImagePlanes compute_nv12_image_planes(const void * data, std::size_t width, std::size_t height)
    Computes the image planes for a YUV420P image.

Declared in “ark/image/scale.hh”:

  • Image scale_image(const Image & source, uint32_t width, uint32_t height)
    Scales the given image to the dimensions specified. Returns the scaled image.

  • void scale_to_yuv420_planes(const Image & source, uint32_t desired_width, uint32_t desired_height, uint8_t * plane_y, uint8_t * plane_u, uint8_t * plane_v, size_t plane_y_stride, size_t plane_u_stride, size_t plane_v_stride)
    Copies the given image to individual YUV planes for further compression, taking the given strides into account. The image will be converted from whichever format it is provided in to YUV420P.

  • bool is_natively_scalable(ImageDataFormat format)
    Returns true if the given image format can be scaled natively (without additional colorspace conversion). If this returns false, scale_image may throw if you don’t first convert it to a different format.

  • Image scale_image(const Image & source, uint32_t width, uint32_t height, ImageDataFormat format)
    Scales the given image to the dimensions specified, while converting from the source data format to the given data format. Returns the scaled image.

Declared in “ark/image/test/generated_images.hh”:

  • Image make_rgb_image(uint32_t width, uint32_t height)
    Creates a RGB image with a fixed pattern at the given resolution.

  • Image make_rggb_image(uint32_t width, uint32_t height)
    Creates a Bayer (RG8) image with a fixed pattern at the given resolution.

  • Image make_greyscale_image(uint32_t width, uint32_t height)
    Creates a greyscale image with a fixed pattern at the given resolution.

  • Image make_uv8_image(uint32_t width, uint32_t height)
    Creates a UV8 image with a fixed pattern at the given resolution.

  • Image make_z16_image(uint32_t width, uint32_t height)
    Creates a Z16 image with a fixed pattern at the given resolution.

Declared in “ark/image/transform.hh”:

  • ark::image::Image transform_image(const ark::image::Image & image, TransformType type)
    Transforms the given image based on the type provided. Returns a copy of the transformed image.

Declared in “ark/image/utilities.hh”:

  • double percentage_nonzero_pixels(const Image & image, size_t channel_count)
    Calcuate the percentage of non-zero pixel in the given image.

    PixelRepresentation: The basic data type that make up a pixel. Ex: char for 8 bit color or b/w images. uint16_t for disparity or depth images.

Declared in “ark/image/validate.hh”:

  • void validate_image(const Image & image)
    Validates the given image. Throws if the image is inconsistent in some way, for example, either with invalid dimensions, or insufficient data.