IPSDK 0.2
IPSDK : Image Processing Software Development Kit
IPSDK Concepts documentation See full documentation

Read and write an image from a RAW file in C++

First, the header to include to load and save an image from a RAW file is :

#include <IPSDKImageFile/Raw/RawImageFileUtils.h>

To save an image in a RAW file, only the following instruction is needed :

saveRawImageFile(imageFilePath, pImg);

Since a RAW file stores the data without any header, it is necessary to specify its geometry while loading an image from a RAW file. These following instructions allow to load a two dimensional grey-level image from a RAW file :

ImageGeometryPtr pImageGeometry = geometry2d(inType, sizeX, sizeY);
ImagePtr pImg = loadRawImageFile(imageFilePath, *pImageGeometry);

See Image geometry concepts in IPSDK for more details about image geometry.

Read and write an image from a RAW file in Python

In Python, the following command lines show how to write and read an image from a RAW file :

# Save an image
PyIPSDK.saveRawImageFile(inputImgPath, img)
# Load an image
geometry = PyIPSDK.geometryRgb2d(PyIPSDK.eImageBufferType.eIBT_Int8, sizeX, sizeY)
img = PyIPSDK.loadRawImageFile(inputImgPath, geometry)