#include "fie.h"
#include <stdio.h>
#define RESULT_N 5 //マッチングの最大検出数
VOID sample_fpm_corr_edge()
{
FHANDLE hImage = NULL ;
FHANDLE hImageChild = NULL;
FHANDLE hfpm = NULL ;
F_FPM_FEATURE feature_param;
F_FPM_MATCH matching_param;
F_FPM_AREASCORE areascore_param;
enum f_fpm_mode matching_mode;
enum f_fpm_featedge method;
F_EDGE_CORR_PARAMS corr;
BOX_T win;
DPNT_T offset;
INT result_num;
F_SEARCH_RESULT result[ RESULT_N ];
INT image_width, image_height;
INT child_sx, child_sy;
INT child_width, child_height;
INT err_code;
matching_mode = F_FPM_NORMAL_MODE;
method = F_FPM_CORR_EDGE;
matching_param.require_result_num = RESULT_N;
matching_param.min_angle = -45;
matching_param.max_angle = 45;
matching_param.min_scale = 100;
matching_param.max_scale = 100;
matching_param.polarity = F_FPM_SAME_POLARITY;
matching_param.coarse_highcomp_threshold = 50;
matching_param.coarse_lowcomp_threshold = 60;
matching_param.coarse_err_wide = 1;
matching_param.coarse_comp_rate = 3;
matching_param.refine_execute = TRUE;
matching_param.refine_err_wide = 1;
matching_param.refine_threshold = 70;
areascore_param.err_wide = 1;
areascore_param.err_wide_tx = 0.5;
areascore_param.err_wide_ty = 0.5;
areascore_param.err_wide_tq = 0.5;
areascore_param.err_wide_ts = 0.5;
areascore_param.noise_weight = 0.5;
areascore_param.threshold = 70;
corr.width = 13;
corr.height = 5;
corr.sigmoid_k = 1.0;
corr.var_threshold = 25;
corr.mag_threshold = 160;
corr.nms_length = corr.width/2;
feature_param.corr_edge = corr;
fnFIE_load_bmp( "FPM_SampleSrc.bmp", &hImage, F_COLOR_IMG_TYPE_UC8 );
image_width = fnFIE_img_get_width ( hImage );
image_height = fnFIE_img_get_height( hImage );
child_sx = 100;
child_sy = 100;
child_width = 150;
child_height = 150;
hImageChild = fnFIE_img_child_alloc( hImage, child_sx, child_sy, child_width, child_height );
offset.x = child_width /2.0;
offset.y = child_height /2.0;
hfpm = fnFIE_fpm_alloc( hImageChild, NULL, offset, matching_mode, method, &feature_param, &err_code );
win.st.x = 0;
win.st.y = 0;
win.ed.x = image_width - 1;
win.ed.y = image_height - 1;
fnFIE_fpm_matching( hfpm, hImage, NULL, win, method, &feature_param, &matching_param, &areascore_param, result, &result_num );
{
INT i;
for(i = 0; i < result_num; i++ )
{
printf( "[x, y]=[%8.3f,%8.3f] theta=[%8.3f] scale=[%8.3f] score=[%3d] \n", result[i].x, result[i].y, result[i].q, result[i].s, result[i].score );
}
}
fnFIE_free_object( hImage );
fnFIE_free_object( hImageChild );
fnFIE_free_object( hfpm );
}
INT main(VOID)
{
fnFIE_setup();
sample_fpm_corr_edge();
fnFIE_teardown();
return 0;
}
#include "fie.h"
#include <stdio.h>
#define RESULT_N 5 //マッチングの最大検出数
VOID sample_fpm_sobel_edge()
{
FHANDLE hImage = NULL ;
FHANDLE hImageChild = NULL;
FHANDLE hfpm = NULL ;
F_FPM_FEATURE feature_param;
F_FPM_MATCH matching_param;
F_FPM_AREASCORE areascore_param;
enum f_fpm_mode matching_mode;
enum f_fpm_featedge method;
F_EDGE_SOBEL_PARAMS sobel;
BOX_T win;
DPNT_T offset;
INT result_num;
F_SEARCH_RESULT result[ RESULT_N ];
INT image_width, image_height;
INT child_sx, child_sy;
INT child_width, child_height;
INT err_code;
matching_mode = F_FPM_NORMAL_MODE;
method = F_FPM_SOBEL_EDGE;
matching_param.require_result_num = RESULT_N;
matching_param.min_angle = -45;
matching_param.max_angle = 45;
matching_param.min_scale = 100;
matching_param.max_scale = 100;
matching_param.polarity = F_FPM_SAME_POLARITY;
matching_param.coarse_highcomp_threshold = 50;
matching_param.coarse_lowcomp_threshold = 60;
matching_param.coarse_err_wide = 1;
matching_param.coarse_comp_rate = 3;
matching_param.refine_execute = TRUE;
matching_param.refine_err_wide = 1;
matching_param.refine_threshold = 70;
areascore_param.err_wide = 1;
areascore_param.err_wide_tx = 0.5;
areascore_param.err_wide_ty = 0.5;
areascore_param.err_wide_tq = 0.5;
areascore_param.err_wide_ts = 0.5;
areascore_param.noise_weight = 0.5;
areascore_param.threshold = 70;
sobel.nms_length = 1;
sobel.mag_threshold = 40;
feature_param.sobel_edge = sobel;
fnFIE_load_bmp( "FPM_SampleSrc.bmp", &hImage, F_COLOR_IMG_TYPE_UC8 );
image_width = fnFIE_img_get_width ( hImage );
image_height = fnFIE_img_get_height( hImage );
child_sx = 100;
child_sy = 100;
child_width = 150;
child_height = 150;
hImageChild = fnFIE_img_child_alloc( hImage, child_sx, child_sy, child_width, child_height );
offset.x = child_width /2.0;
offset.y = child_height /2.0;
hfpm = fnFIE_fpm_alloc( hImageChild, NULL, offset, matching_mode, method, &feature_param, &err_code );
win.st.x = 0;
win.st.y = 0;
win.ed.x = image_width - 1;
win.ed.y = image_height - 1;
fnFIE_fpm_matching( hfpm, hImage, NULL, win, method, &feature_param, &matching_param, &areascore_param, result, &result_num );
{
INT i;
for(i = 0; i < result_num; i++ )
{
printf( "[x, y]=[%8.3f,%8.3f] theta=[%8.3f] scale=[%8.3f] score=[%3d] \n", result[i].x, result[i].y, result[i].q, result[i].s, result[i].score );
}
}
fnFIE_free_object( hImage );
fnFIE_free_object( hImageChild );
fnFIE_free_object( hfpm );
}
INT main(VOID)
{
fnFIE_setup();
sample_fpm_sobel_edge();
fnFIE_teardown();
return 0;
}