SOD C/C++ API - RealNet Architecture


int sod_realnet_detect(sod_realnet *pNet, const unsigned char *zGrayImg, int width, int height, sod_box **apBox, int *pnBox);


Perform Real-Time detection on an input grayscale image or video frame. A RealNet detection model (one or more) must be registered before via sod_realnet_load_model_from_mem() or sod_realnet_load_model_from_disk(). If no models were registered, then this function is a noop. Pre-trained RealNet models can be downloaded from or trained via the RealNet training interfaces.
The detection process works only on grayscale images or video frames. To convert the colorspace of your input picture to the gray color model, simply call sod_grayscale_image(), sod_grayscale_image_3c() before or load your image from disk using the macro sod_img_load_grayscale(). Once the grayscale image or video frame captured, convert it to BLOB via sod_image_to_blob() as shown in the code snippet below.
If you are using OpenCV to capture video frames, call sod_img_load_cv_ipl(), sod_img_load_from_cv_stream(), sod_img_fill_from_cv_stream() or simply pass the raw grayscale pixels directly and make sure to compile SOD with the directive SOD_ENABLE_OPENCV defined.


sod_realnet    *pNet

A pointer to a valid sod_realnet object obtained from a prior successful call to sod_realnet_create().

const unsigned char    *zGrayImg

The raw pixels (blobs), grayscale colorspace of the input image or video frame to be analyzed.

int    width

Image/Frame width.

int    height

Image/Frame height.

sod_box    **apBox

OUT: A pointer to an array of bounding boxes holding the coordinates, the score & class (name) for each detected object. Each entry of this array is represented by an instance of the sod_box structure.

int    *pnBox

OUT: Total number of extracted bounding boxes (apBox[] length).

Return Value

SOD_OK is returned on success. Any other code indicates failure.


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

See also