Skip to content
Gao Xiang edited this page May 2, 2014 · 9 revisions

Welcome to the ccv wiki!

Intro

A modified version of libccv which adopt cbufp and torrent interface in Composite.

Latest Version

As cos_ccv is still under development, some code haven't been merged into master branch, latest code can be found at https://github.com/patriot7/Composite.git

Usage

Currently there are three components available:

ccv_rs.o - image resample
ccv_fd.o - face detect
ccv_ed.o - edge detect

Following example shows the basic usage of ccv torrents:

#include <torrent.h>
#include "../../../lib/libccv/cbuf_ccv.h"

/* Create a ccv torrent for resampling */
td = tsplit(cos_spd_id(), td_root, "5", strlen("5"), TOR_ALL, evtid);

/* Read input image */
ccv_dense_matrix_t *input = NULL;
ccv_read("photo.bmp", &ccv_mat_input, CCV_IO_ANY_FILE | CCV_IO_GRAY);

/* Use the helper function to construct a cbufp matrix from original ccv_matrix */
cbuf_matrix_t *cbuf_mat = ccv2cbufmat(ccv_mat_input);

/* send the cbufp_matrix to the torrent you just created to process */
cbufp_send(cbuf_mat->cbid);
twritep(cos_spd_id(), td, cbuf_mat->cbid, cbuf_mat->size);

Thanks to the universal of torrent interface, the usage of ccv torrents are almost identical.

The only thing to notice is the parameter argument of tsplit.

ccv_rs: how many times the image to be downsampled.
ccv_fd: the name of the directory which includes the casade files for face detection
ccv_ed: the threhold of the edge detection