SOD C/C++ API Reference - OpenCV Integration


Syntax

sod_img sod_img_load_from_cv(const char *zFile, int nChannels);

Description

Load an image from disk via OpenCV cvLoadImage(). The library must be compiled against OpenCV with the compile-time directive SOD_ENABLE_OPENCV defined. On success, a memory representation of the target image is returned in an instance of the sod_img object which can be processed or analyzed via the exported interfaces.

Parameters

const char    *zFile

Source path of the target image to load.

int    nChannels

Total number of color channels to load. Set this value to 0 for the default behavior. 1 for grayscale conversion or 3 for full color channels.

Return Value

Memory representation of the target image is returned in an instance of the sod_img object. if something goes wrong during loading (i.e. Invalid path, format or running out-of-memory), then an empty image is returned via sod_make_empty_image(). Once done, you must release the memory allocated to this object via sod_free_image() to avoid memory leaks.

Example

Checkout the introduction course, the C/C++ samples on the download page or refer to the SOD Github Repository.

See also

sod_hilditch_thinsod_image_draw_boxsod_image_find_blobssod_hough_lines_detectsod_crop_imagesod_resize_image.



Back