Common Vision Blox 15.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Friends Modules Pages
Loading, Saving and, Creating Images

Supported File Formats

Common Vision Blox supports a variety of different image and video formats.

Overview

This is an overview for the supported file formats in CVB. For more detailed information about specific formats see the sections about individual formats further down below.

Common Raster Image Formats

Extension(s) Description
.jpg, .jpeg, .jpe, .jif, .jfif Standard JPEG image formats
.png Portable Network Graphics
.bmp Bitmap image
.tif, .tiff Tagged Image File Format

Professional & Editing Formats

Extension(s) Description
.psd Adobe Photoshop Document
.clp Windows Clipboard Image (legacy)
.xif Xerox Image Format (scanner image)
.thm Thumbnail image file (from cameras)

JPEG 2000 & Variants

Extension(s) Description
.j2k, .jp2, .jp2k, .j2c, .jpc, .jpx JPEG 2000 formats

Other / Legacy Formats

Extension(s) Description
.iff Interchange File Format (Amiga)
.pct Macintosh Picture file
.dcx Multipage PCX
.pcx Paintbrush Bitmap Image
.tga Targa Graphic
.ras Sun Rasterfile
.wmf Windows Metafile

BMP

The Windows Bitmap format (*.bmp) is perhaps the most important format on the PC platform. CVB supports BMP files with either 8 bits/Pixel (monochrome) or 24 bits/Pixel (colour). RLE-compressed BMP can neither be loaded nor saved with CVB.

Tiff

The TIFF-format (*.tif, *.tiff, *.xif) is a very widespread format on several computer platforms. However, the TIFF standard itself is quite complex and offers a huge variety of pixel formats, additional tags, planes etc. Therefore almost all software packages support only a certain subset of the official TIFF standard - and CVB is no exception to this. TIFF formats supported by CVB are from 8 to 16 bits/pixel (bpp) for one (monochrome) or 3 channels (colour). Reading is supported for uncompressed images, LZW77 compressed images and Packbits compressed images. Huffman-coding and Fax-coding are not supported as they would result in images with less than 8 bpp. TIFF support in CVB is achieved through the libtiff library, version 3.5.7, Copyright (c) 1988-1997 Sam Leffler, Copyright (c) 1991-1997 Silicon Graphics, Inc. The source of libtiff is available from https://gitlab.com/libtiff/libtiff.

JPEG

The JPEG format (*.jpg, *.jpeg, *.jpe, *.jif, *.jfif) is the perhaps most popular and most widespread image format with lossy compression. JPEG support in CVB comprises 8 bpp images (monochrome) and 24 bpp images (colour) with jpeg compression. There is an inherent limitation to images of 65536 pixels width and height in jpeg formats.

JPEG2000

The comparatively young JPEG2000 format (*.j2k, *.jp2, *.jp2k, *.jpc, *.jpx) is - much like its ancestor JPEG - a lossy image compression format based on wavelet compression technology. It is recommended to use this image format only on fairly up-to-date computers, because JPEG2000 compression and decompression are extremely time consuming. The boon of using JPEG2000 is a comparatively good image quality even at higher compression ratios. Under CVB, JPEG2000 supports image formats with 8, 10, 12 or 16 bpp (monochrome) as well as 3x8, 3x10, 3x12, 3x16 bpp (colour). JPEG2000 support in CVB is based on the free j2000 codec available from https://jpeg.org/jpeg2000/.

MIO

The Minos Image Object (*.mio) file format is proprietary to CVB. This format saves the image data as well as the coordinate system and origin information. This extended information could be used to store calibrated spatial information, coordinate information used for correlation or simply information about a processed image.

The MIO format allows to store images with more than 8 bit image data called High Dynamic range images (HDR).

Image Loading & Saving

#include <cvb/image.hpp>
// CVB_LIT makes sure the given string works under Windows and UNIX by
// using a const wchar_t* for Windows and a const char* for UNIX.
auto image = Cvb::Image::Load(CVB_LIT("path/to/file.bmp"));
image->Save(CVB_LIT("path/to/destination/file.bmp"));
static std::unique_ptr< Image > Load(const String &fileName)

var image = Image.FromFile("path/to/file.bmp");
image.Save("path/to/destination/file.bmp");
__int3264 Image

import cvb
image = cvb.Image("path/to/file.bmp")
image.save("path/to/destination/file.bmp")

Image Creation

#include <cvb/image.hpp>
// create a 128x128 RGB image with 8 bits per pixel
auto image = Cvb::Image::Create(128, 128, 3, DataType::Int8BppUnsigned());
static std::unique_ptr< Image > Create(Size2D< int > size, int numPlanes=1, DataType dataType=DataType::Int8BppUnsigned())

// create a 128x128 RGB image with 8 bits per pixel
var image = new Image(128, 128, 3, PixelDataType.UInt , 8)

import cvb
# create a 128x128 RGB image with 8 bits per pixel
cvb.DataType int8_bpp_unsigned()
cvb.Image create(int width, int height, Optional[int] num_planes, Optional[cvb.DataType] data_type)