Permalink
Browse files

added default params for dpm, swt, and bbf

  • Loading branch information...
1 parent fd511bf commit 96b7c78b7ce5e6208210c7e36cb696b47a985b35 @liuliu committed Oct 3, 2012
Showing with 55 additions and 43 deletions.
  1. +2 −9 bin/bbfdetect.c
  2. +2 −8 bin/dpmdetect.c
  3. +2 −26 bin/swtdetect.c
  4. +6 −0 lib/ccv.h
  5. +11 −0 lib/ccv_bbf.c
  6. +7 −0 lib/ccv_dpm.c
  7. +25 −0 lib/ccv_swt.c
View
11 bin/bbfdetect.c
@@ -17,17 +17,10 @@ int main(int argc, char** argv)
ccv_dense_matrix_t* image = 0;
ccv_bbf_classifier_cascade_t* cascade = ccv_load_bbf_classifier_cascade(argv[2]);
ccv_read(argv[1], &image, CCV_IO_GRAY | CCV_IO_ANY_FILE);
- ccv_bbf_param_t params = {
- .interval = 5,
- .min_neighbors = 2,
- .accurate = 1,
- .flags = 0,
- .size = ccv_size(24, 24)
- };
if (image != 0)
{
unsigned int elapsed_time = get_current_time();
- ccv_array_t* seq = ccv_bbf_detect_objects(image, &cascade, 1, params);
+ ccv_array_t* seq = ccv_bbf_detect_objects(image, &cascade, 1, ccv_bbf_default_params);
elapsed_time = get_current_time() - elapsed_time;
for (i = 0; i < seq->rnum; i++)
{
@@ -54,7 +47,7 @@ int main(int argc, char** argv)
image = 0;
ccv_read(file, &image, CCV_IO_GRAY | CCV_IO_ANY_FILE);
assert(image != 0);
- ccv_array_t* seq = ccv_bbf_detect_objects(image, &cascade, 1, params);
+ ccv_array_t* seq = ccv_bbf_detect_objects(image, &cascade, 1, ccv_bbf_default_params);
for (i = 0; i < seq->rnum; i++)
{
ccv_comp_t* comp = (ccv_comp_t*)ccv_array_get(seq, i);
View
10 bin/dpmdetect.c
@@ -17,16 +17,10 @@ int main(int argc, char** argv)
ccv_dense_matrix_t* image = 0;
ccv_read(argv[1], &image, CCV_IO_ANY_FILE);
ccv_dpm_mixture_model_t* model = ccv_load_dpm_mixture_model(argv[2]);
- ccv_dpm_param_t params = {
- .interval = 8,
- .min_neighbors = 1,
- .flags = 0,
- .threshold = 0.6,
- };
if (image != 0)
{
unsigned int elapsed_time = get_current_time();
- ccv_array_t* seq = ccv_dpm_detect_objects(image, &model, 1, params);
+ ccv_array_t* seq = ccv_dpm_detect_objects(image, &model, 1, ccv_dpm_default_params);
elapsed_time = get_current_time() - elapsed_time;
if (seq)
{
@@ -60,7 +54,7 @@ int main(int argc, char** argv)
image = 0;
ccv_read(file, &image, CCV_IO_GRAY | CCV_IO_ANY_FILE);
assert(image != 0);
- ccv_array_t* seq = ccv_dpm_detect_objects(image, &model, 1, params);
+ ccv_array_t* seq = ccv_dpm_detect_objects(image, &model, 1, ccv_dpm_default_params);
if (seq != 0)
{
for (i = 0; i < seq->rnum; i++)
View
28 bin/swtdetect.c
@@ -11,37 +11,13 @@ unsigned int get_current_time()
int main(int argc, char** argv)
{
- ccv_swt_param_t params = {
- .interval = 1,
- .same_word_thresh = { 0.1, 0.8 },
- .min_neighbors = 1,
- .scale_invariant = 0,
- .size = 3,
- .low_thresh = 124,
- .high_thresh = 204,
- .max_height = 300,
- .min_height = 8,
- .min_area = 38,
- .letter_occlude_thresh = 3,
- .aspect_ratio = 8,
- .std_ratio = 0.83,
- .thickness_ratio = 1.5,
- .height_ratio = 1.7,
- .intensity_thresh = 31,
- .distance_ratio = 2.9,
- .intersect_ratio = 1.3,
- .letter_thresh = 3,
- .elongate_ratio = 1.9,
- .breakdown = 1,
- .breakdown_ratio = 1.0,
- };
ccv_enable_default_cache();
ccv_dense_matrix_t* image = 0;
ccv_read(argv[1], &image, CCV_IO_GRAY | CCV_IO_ANY_FILE);
if (image != 0)
{
unsigned int elapsed_time = get_current_time();
- ccv_array_t* words = ccv_swt_detect_words(image, params);
+ ccv_array_t* words = ccv_swt_detect_words(image, ccv_swt_default_params);
elapsed_time = get_current_time() - elapsed_time;
if (words)
{
@@ -72,7 +48,7 @@ int main(int argc, char** argv)
image = 0;
printf("%s\n", file);
ccv_read(file, &image, CCV_IO_GRAY | CCV_IO_ANY_FILE);
- ccv_array_t* words = ccv_swt_detect_words(image, params);
+ ccv_array_t* words = ccv_swt_detect_words(image, ccv_swt_default_params);
int i;
for (i = 0; i < words->rnum; i++)
{
View
6 lib/ccv.h
@@ -645,6 +645,8 @@ typedef struct {
double breakdown_ratio;
} ccv_swt_param_t;
+extern ccv_swt_param_t ccv_swt_default_params;
+
void ccv_swt(ccv_dense_matrix_t* a, ccv_dense_matrix_t** b, int type, ccv_swt_param_t params);
ccv_array_t* __attribute__((warn_unused_result)) ccv_swt_detect_words(ccv_dense_matrix_t* a, ccv_swt_param_t params);
@@ -725,6 +727,8 @@ enum {
CCV_DPM_NO_NESTED = 0x10000000,
};
+extern ccv_dpm_param_t ccv_dpm_default_params;
+
void ccv_dpm_mixture_model_new(char** posfiles, ccv_rect_t* bboxes, int posnum, char** bgfiles, int bgnum, int negnum, const char* dir, ccv_dpm_new_param_t params);
ccv_array_t* __attribute__((warn_unused_result)) ccv_dpm_detect_objects(ccv_dense_matrix_t* a, ccv_dpm_mixture_model_t** model, int count, ccv_dpm_param_t params);
ccv_dpm_mixture_model_t* __attribute__((warn_unused_result)) ccv_load_dpm_mixture_model(const char* directory);
@@ -788,6 +792,8 @@ enum {
CCV_BBF_NO_NESTED = 0x10000000,
};
+extern ccv_bbf_param_t ccv_bbf_default_params;
+
void ccv_bbf_classifier_cascade_new(ccv_dense_matrix_t** posimg, int posnum, char** bgfiles, int bgnum, int negnum, ccv_size_t size, const char* dir, ccv_bbf_new_param_t params);
ccv_array_t* __attribute__((warn_unused_result)) ccv_bbf_detect_objects(ccv_dense_matrix_t* a, ccv_bbf_classifier_cascade_t** cascade, int count, ccv_bbf_param_t params);
ccv_bbf_classifier_cascade_t* __attribute__((warn_unused_result)) ccv_load_bbf_classifier_cascade(const char* directory);
View
11 lib/ccv_bbf.c
@@ -9,6 +9,17 @@
#include <omp.h>
#endif
+ccv_bbf_param_t ccv_bbf_default_params = {
+ .interval = 5,
+ .min_neighbors = 2,
+ .accurate = 1,
+ .flags = 0,
+ .size = {
+ 24,
+ 24,
+ },
+};
+
#define _ccv_width_padding(x) (((x) + 3) & -4)
static inline int _ccv_run_bbf_feature(ccv_bbf_feature_t* feature, int* step, unsigned char** u8)
View
7 lib/ccv_dpm.c
@@ -13,6 +13,13 @@
#include <linear.h>
#endif
+ccv_dpm_param_t ccv_dpm_default_params = {
+ .interval = 8,
+ .min_neighbors = 1,
+ .flags = 0,
+ .threshold = 0.6,
+};
+
#define CCV_DPM_WINDOW_SIZE (8)
static int _ccv_dpm_scale_upto(ccv_dense_matrix_t* a, ccv_dpm_mixture_model_t** _model, int count, int interval)
View
25 lib/ccv_swt.c
@@ -1,6 +1,31 @@
#include "ccv.h"
#include "ccv_internal.h"
+ccv_swt_param_t ccv_swt_default_params = {
+ .interval = 1,
+ .same_word_thresh = { 0.1, 0.8 },
+ .min_neighbors = 1,
+ .scale_invariant = 0,
+ .size = 3,
+ .low_thresh = 124,
+ .high_thresh = 204,
+ .max_height = 300,
+ .min_height = 8,
+ .min_area = 38,
+ .letter_occlude_thresh = 3,
+ .aspect_ratio = 8,
+ .std_ratio = 0.83,
+ .thickness_ratio = 1.5,
+ .height_ratio = 1.7,
+ .intensity_thresh = 31,
+ .distance_ratio = 2.9,
+ .intersect_ratio = 1.3,
+ .letter_thresh = 3,
+ .elongate_ratio = 1.9,
+ .breakdown = 1,
+ .breakdown_ratio = 1.0,
+};
+
static inline int _ccv_median(int* buf, int low, int high)
{
int middle, ll, hh, w;

0 comments on commit 96b7c78

Please sign in to comment.