class P1::ImageSdk::RawImage

Overview

A handle to a Phase One IIQ image file, either on the file system or in a memory buffer More…

#include <P1ImageRawImage.hpp>

class RawImage
{
public:
    // construction

    RawImage();
    RawImage(std::string iiqPath);
    RawImage(std::shared_ptr<const uint8_t> buffer, uint32_t bufferByteSize);
    RawImage(const RawImage& other);

    // methods

    RawImage& operator = (const RawImage& other);
    uint32_t Width() const;
    uint32_t Height() const;
    uint32_t RawSensorWidth() const;
    uint32_t RawSensorHeight() const;
    Size GetDimensions() const;
    ImageTag GetTag(TagId id) const;
    bool TagExists(TagId id) const;
    BitmapImage GetPreview(std::allocator<uint8_t> alloc = std::allocator<uint8_t>());

    SensorBayerOutput Decode(
        const DecodeConfig& config,
        std::allocator<uint8_t> alloc = std::allocator<uint8_t>()
        ) const;

    BitmapImage Convert(
        const ConvertConfig& config,
        std::allocator<uint8_t> alloc = std::allocator<uint8_t>(),
        BitmapImage* maskImage = nullptr,
        bool waitWhenBusy = true
        ) const;

    std::string GetXmpPacket(std::allocator<char> alloc = std::allocator<char>()) const;
    GpsData GetGpsData() const;
    int32_t GetGpsEventId() const;
    ImuData GetImuData() const;

    Color PickWhiteBalance(
        const ConvertConfig config,
        const Point2D point,
        int sampleSize
        ) const;

    Size GetCanvasSize(const ConvertConfig config) const;
    GeometricCorrection GetGeometricAberration() const;
};

Detailed Documentation

A handle to a Phase One IIQ image file, either on the file system or in a memory buffer

Construction

RawImage()

Constructs an empty and invalid RawImage object.

RawImage(std::string iiqPath)

Construct a RawImage from a file path.

RawImage(std::shared_ptr<const uint8_t> buffer, uint32_t bufferByteSize)

Construct a RawImage from a memory pointer, to a complete in-memory IIQ file.

Methods

uint32_t Width() const

Get the image width, in pixels, of the exposed sensor area.

uint32_t Height() const

Get the image height, in pixels, of the exposed sensor area.

uint32_t RawSensorWidth() const

Get full width of the raw sensor output in pixels (including un-exposed area)

uint32_t RawSensorHeight() const

Get the full height of the raw sensor output in pixels (including un-exposed area)

Size GetDimensions() const

Get the image dimensions, in pixels, of the exposed sensor area.

ImageTag GetTag(TagId id) const

Extract and return meta data from the image container file (IIQ)

bool TagExists(TagId id) const

Check if a certain meta data tag exists in the image file.

BitmapImage GetPreview(std::allocator<uint8_t> alloc = std::allocator<uint8_t>())

Extract any RGB bitmap preview / thumbnail from meta data.

IIQ files might contain a preview of the full image. This method extracts that image.

Parameters:

alloc

An optional memory allocator. Default is standard C++ new.

SensorBayerOutput Decode(
    const DecodeConfig& config,
    std::allocator<uint8_t> alloc = std::allocator<uint8_t>()
    ) const

Extract the Bayer (i.e RAW) data from the IIQ container file.

This operation consist of a a decompression stage and a calibration stage.

Parameters:

config

The configuration of the static calibration options to be applied the sensor output

alloc

An optional memory allocator. Default is standard C++ new.

BitmapImage Convert(
    const ConvertConfig& config,
    std::allocator<uint8_t> alloc = std::allocator<uint8_t>(),
    BitmapImage* maskImage = nullptr,
    bool waitWhenBusy = true
    ) const

Extract and de-mosaic (RAW convert) the Bayer data into an RGB bitmap image.

Use the ConvertConfig to control cropping and scaling.

Parameters:

config

A configuration object specifying optional crop and scaling

alloc

An optional memory allocator. Default is standard C++ new.

waitWhenBusy

If true the function call will be blocked until the SDK is idle and able to accept the task. If it is false, it will throw an SDKException if the SDK is busy

std::string GetXmpPacket(std::allocator<char> alloc = std::allocator<char>()) const

Convenience method to get the XMP meta data.

This method equivalent to using GetTag() to get the XmpPacket tag, and trimming the output for extranous white space.

Parameters:

alloc

An optional memory allocator. Default is standard C++ new.

GpsData GetGpsData() const

Extract the GPS data embedded in the IIQ files XMP meta data section, if any.

This is a convenience method. It is equal to using the GetXmpPacket method and parsing the GPS data tags.

If no GPS data is embedded in the IIQ file, this method will throw!

int32_t GetGpsEventId() const

Get the GPS Event identifier (ID), if it exists for the IIQ file.

This is a convenience method. It is equal to using the GetXmpPacket method and parsing the GPSEventID tag.

If the IIQ file does not contain a GPSEventId, this method will throw!

ImuData GetImuData() const

Extract the IMU data embedded in the IIQ files XMP meta data section, if any.

This is a convenience method. It is equal to using the GetXmpPacket method and parsing the IMU data tags.

If no IMU data is embedded in the IIQ file, this method will throw!

Color PickWhiteBalance(
    const ConvertConfig config,
    const Point2D point,
    int sampleSize
    ) const

Generates a white balance gain value from a Point defined on the View.

The recommended way to use this function is to present an Image on Screen for the user to select the Point to pick the WB from. Using a pointing device the user could select the Point on that Image View. The coordinate system for that Point should match the Image View’s coordinate system, assuming the origin is the top left corner of that image. To be able to map that Point on the image data, the input ConvertConfig must have the exact same geometry defined (including Crop and Scaling). You can reuse the same ConvertConfig used for the Image as it is not going to be modified. Average RGB gain is calculated from the area defined by sampleSize and used to calculate a white balance.

Parameters:

config

A ConvertConfig object containing the Geometry transformation the view was based upon.

point

The X,Y coordinates of the center of the sampled area based on the View Coordinate System

sampleSize

A value between 1 and 10 that determines the size of the area to average. 1 is a single pixel area, 10 is 10x10 (100) pixels with x,y in the center

Returns:

The white balance calculated based on the input. Note the alpha value of the Color is undefined

GeometricCorrection GetGeometricAberration() const

Returns the geometric aberration information of the camera.

Returns:

The Australis geometric aberration parameters embedded in the raw file