35 #ifndef __INCLUDE_ACTIVE_SEARCH_H__
36 #define __INCLUDE_ACTIVE_SEARCH_H__
78 namespace _active_search_
92 inline double _minimum(
96 return ( v0 < v1 ) ? v0 : v1;
100 const size_t &overlap,
104 return ( _minimum( sim * size, static_cast< double >( overlap ) ) + size - overlap ) / size;
107 template <
typename Histogram_type >
108 inline double _similarity(
109 const Histogram_type &histo0,
110 const Histogram_type &histo1 )
112 double similarity = 0.0;
113 for(
size_t i = 0 ; i < histo0.size( ) ; i ++ )
115 similarity += _minimum( histo0[ i ], histo1[ i ] );
120 template <
typename Functor >
121 inline void _quantize(
122 const array< typename Functor::argument_type > &in,
123 array< typename Functor::result_type > &out,
126 for(
size_t i = 0 ; i < in.size( ) ; i ++ )
128 out[ i ] = f( in[ i ] );
135 template <
typename Argument_type,
typename Result_type >
136 struct _functor : std::unary_function< Argument_type, Result_type >
138 typedef typename std::unary_function< Argument_type, Result_type > base_type;
139 typedef typename base_type::argument_type argument_type;
140 typedef typename base_type::result_type result_type;
144 const result_type &operator ( )(
const argument_type &v )
const
151 struct _functor< rgb< unsigned char >, unsigned int > : std::unary_function< rgb< unsigned char >, unsigned int >
153 typedef std::unary_function< rgb< unsigned char >,
unsigned int > base_type;
154 typedef base_type::argument_type argument_type;
155 typedef base_type::result_type result_type;
156 unsigned char level_;
159 _functor(
const size_t &num_of_bins ) : level_( static_cast< unsigned char >( ( 256 % num_of_bins == 0 ) ? ( 256 / num_of_bins ) : ( 256 / ( num_of_bins - 1 ) ) ) ), d1_( num_of_bins ), d2_( num_of_bins * num_of_bins )
162 result_type operator ( )(
const argument_type &v )
const
164 return static_cast< result_type
>( ( v.r / level_ ) * d2_ + ( v.g / level_ ) * d1_ + ( v.b / level_ ) );
170 template <
typename Array_type,
typename Histogram_type,
typename Functor >
171 inline void _make_histogram(
172 const Array_type &array,
173 Histogram_type &histo,
179 const double gain = 1.0 / w;
180 for(
size_t i = 0 ; i < w ; i ++ )
182 histo[ f( array[ bi + i ] ) ] += gain;
186 template <
typename Array_type,
typename Histogram_type,
typename Functor >
187 inline void _diff_histogram(
188 const Array_type &array,
189 Histogram_type &histo,
197 const double gain = 1.0 / w;
198 for(
size_t i = 0 ; i < bi - pbi ; i ++ )
200 histo[ f( array[ pbi + i ] ) ] -= gain;
201 histo[ f( array[ pbi + w + i ] ) ] += gain;
206 _make_histogram( array, histo, bi, w, f );
210 template<
typename Table_type >
211 inline void _culling(
216 const double &max_sim )
218 const size_t size = w;
219 for(
size_t i = 0 ; i < w ; i ++ )
221 if( _upper( w - i, size, sim ) < max_sim )
223 c_tab[ bi + i ] =
true;
232 template<
typename Array_type,
typename Functor >
233 inline bool __search(
234 const Array_type &in,
235 const Array_type &ref,
239 const size_t &num_of_bins,
241 const double &b_scale,
242 const double &e_scale,
243 const double &scale_factor )
245 typedef array< double > histogram_type;
247 histogram_type i_histo( num_of_bins );
248 histogram_type r_histo( num_of_bins );
249 _make_histogram( ref, r_histo, 0, ref.size( ), f );
250 array< bool > culling_table( in.size( ) );
253 similarity = ( similarity < 0.0 || 1.0 < similarity ) ? 0.0 : similarity;
257 bool is_found =
false;
259 while( ( scale_factor > 1.0 ) ? ( s <= e_scale ) : ( s >= e_scale ) )
261 w =
static_cast< size_t >( ref.size( ) * s );
262 _make_histogram( in, i_histo, 0, w, f );
264 culling_table.fill(
false );
265 for(
size_t i = 0 ; i < in.size( ) - w + 1 ; i ++ )
267 if( !culling_table[ i ] )
269 _diff_histogram( in, i_histo, i, pi, w, f );
271 sim = _similarity( i_histo, r_histo );
272 if( sim > similarity )
275 x =
static_cast< unsigned int >( i );
279 _culling( culling_table, i, w, sim, similarity );
287 template<
typename Array_type,
typename Functor >
288 inline bool _search_memory(
289 const Array_type &in,
290 const Array_type &ref,
294 const size_t &num_of_bins,
296 const double &b_scale,
297 const double &e_scale,
298 const double &scale_factor )
301 return __search( in, ref, x, scale, similarity, num_of_bins, f, b_scale, e_scale, scale_factor );
304 template<
typename Array_type,
typename Functor >
305 inline bool _search_speed(
306 const Array_type &in2,
307 const Array_type &ref2,
311 const size_t &num_of_bins,
313 const double &b_scale,
314 const double &e_scale,
315 const double &scale_factor )
318 typedef typename Functor::result_type value_type;
319 array< value_type > in( in2.size( ) );
320 _quantize( in2, in, f );
321 array< value_type > ref( ref2.size( ) );
322 _quantize( ref2, ref, f );
323 return __search( in, ref, x, scale, similarity, num_of_bins, _functor< value_type, value_type >( ), b_scale, e_scale, scale_factor );
326 template<
typename Array_type,
typename Functor >
328 const Array_type &input,
329 const Array_type &reference,
335 const double &scale_factor,
336 const size_t &num_of_bins,
340 if( scale_factor <= 0.0 || scale_factor == 1.0 )
344 const double u_bound =
static_cast< double >( input.size( ) ) / reference.size( );
345 const double l_bound = 0.01;
346 min_scale = ( min_scale < l_bound ) ? l_bound : min_scale;
347 min_scale = ( min_scale > u_bound ) ? u_bound : min_scale;
348 max_scale = ( max_scale < l_bound ) ? l_bound : max_scale;
349 max_scale = ( max_scale > u_bound ) ? u_bound : max_scale;
350 if( min_scale > max_scale )
352 double tmp = min_scale;
353 min_scale = max_scale;
356 double begin_scale, end_scale;
357 if( scale_factor > 1.0 )
359 begin_scale = min_scale;
360 end_scale = max_scale;
364 begin_scale = max_scale;
365 end_scale = min_scale;
369 return _search_speed( input, reference, x, scale, similarity, num_of_bins, f, begin_scale, end_scale, scale_factor );
373 return _search_memory( input, reference, x, scale, similarity, num_of_bins, f, begin_scale, end_scale, scale_factor );
381 template <
typename Array_type,
typename Histogram_type,
typename Functor >
382 inline void _make_histogram(
383 const Array_type &array,
384 Histogram_type &histo,
392 const double gain = 1.0 / ( w * h );
393 for(
size_t j = 0 ; j < h ; j ++ )
395 for(
size_t i = 0 ; i < w ; i ++ )
397 histo[ f( array( bi + i, bj + j ) ) ] += gain;
402 template <
typename Array_type,
typename Histogram_type,
typename Functor >
403 inline void _diff_histogram(
404 const Array_type &array,
405 Histogram_type &histo,
416 const double gain = 1.0 / ( w * h );
418 for( ; j < bj - pbj ; j ++ )
420 for(
size_t i = 0 ; i < w ; i ++ )
422 histo[ f( array( pbi + i, pbj + j ) ) ] -= gain;
423 histo[ f( array( bi + i, pbj + h + j ) ) ] += gain;
426 for( ; j < h ; j ++ )
428 for(
size_t i = 0 ; i < bi - pbi ; i ++ )
430 histo[ f( array( pbi + i, pbj + j ) ) ] -= gain;
431 histo[ f( array( pbi + w + i, bj + j ) ) ] += gain;
437 _make_histogram( array, histo, bi, bj, w, h, f );
441 template<
typename Table_type >
442 inline void _culling(
449 const double &max_sim )
451 const size_t size = w * h;
452 for(
size_t j = 0 ; j < h ; j ++ )
454 if( _upper( w * ( h - j ), size, sim ) >= max_sim )
458 for(
size_t i = 0 ; i < w ; i ++ )
460 if( _upper( ( w - i ) * ( h - j ), size, sim ) < max_sim )
462 c_tab( bi + i, bj + j ) =
true;
465 c_tab( bi - i, bj + j ) =
true;
476 template<
typename Array_type,
typename Functor >
477 inline bool __search(
478 const Array_type &in,
479 const Array_type &ref,
484 const size_t &num_of_bins,
486 const double &b_scale,
487 const double &e_scale,
488 const double &scale_factor )
490 typedef array< double > histogram_type;
492 histogram_type i_histo( num_of_bins );
493 histogram_type r_histo( num_of_bins );
494 _make_histogram( ref, r_histo, 0, 0, ref.width( ), ref.height( ), f );
495 array2< bool > culling_table( in.width( ), in.height( ) );
499 similarity = ( similarity < 0.0 || 1.0 < similarity ) ? 0.0 : similarity;
503 histogram_type histo( num_of_bins );
504 bool is_found =
false;
506 while( ( scale_factor > 1.0 ) ? ( s <= e_scale ) : ( s >= e_scale ) )
508 w =
static_cast< size_t >( ref.width( ) * s );
509 h =
static_cast< size_t >( ref.height( ) * s );
510 _make_histogram( in, histo, 0, 0, w, h, f );
511 culling_table.fill(
false );
513 for(
size_t j = 0 ; j < in.height( ) - h + 1 ; j ++ )
515 _diff_histogram( in, histo, 0, j, 0, pj, w, h, f );
519 for(
size_t i = 0 ; i < in.width( ) - w + 1 ; i ++ )
521 if( !culling_table( i, j ) )
523 _diff_histogram( in, i_histo, i, j, pi, pj, w, h, f );
525 sim = _similarity( i_histo, r_histo );
526 if( sim > similarity )
529 x =
static_cast< unsigned int >( i );
530 y =
static_cast< unsigned int >( j );
534 _culling( culling_table, i, j, w, h, sim, similarity );
543 template<
typename Array_type,
typename Functor >
544 inline bool _search_memory(
545 const Array_type &in,
546 const Array_type &ref,
551 const size_t &num_of_bins,
553 const double &b_scale,
554 const double &e_scale,
555 const double &scale_factor )
558 return __search( in, ref, x, y, scale, similarity, num_of_bins, f, b_scale, e_scale, scale_factor );
561 template<
typename Array_type,
typename Functor >
562 inline bool _search_speed(
563 const Array_type &in2,
564 const Array_type &ref2,
569 const size_t &num_of_bins,
571 const double &b_scale,
572 const double &e_scale,
573 const double &scale_factor )
576 typedef typename Functor::result_type value_type;
577 array2< value_type > in( in2.width( ), in2.height( ) );
578 _quantize( in2, in, f );
579 array2< value_type > ref( ref2.width( ), ref2.height( ) );
580 _quantize( ref2, ref, f );
581 return __search( in, ref, x, y, scale, similarity, num_of_bins, _functor< value_type, value_type >( ), b_scale, e_scale, scale_factor );
584 template<
typename Array_type,
typename Functor >
586 const Array_type &input,
587 const Array_type &reference,
594 const double &scale_factor,
595 const size_t &num_of_bins,
599 if( scale_factor <= 0.0 || scale_factor == 1.0 )
603 const double u_bound = _minimum( static_cast< double >( input.width( ) ) / reference.width( ),
static_cast< double >( input.height( ) ) / reference.height( ) );
604 const double l_bound = 0.01;
605 min_scale = ( min_scale < l_bound ) ? l_bound : min_scale;
606 min_scale = ( min_scale > u_bound ) ? u_bound : min_scale;
607 max_scale = ( max_scale < l_bound ) ? l_bound : max_scale;
608 max_scale = ( max_scale > u_bound ) ? u_bound : max_scale;
609 if( min_scale > max_scale )
611 double tmp = min_scale;
612 min_scale = max_scale;
615 double begin_scale, end_scale;
616 if( scale_factor > 1.0 )
618 begin_scale = min_scale;
619 end_scale = max_scale;
623 begin_scale = max_scale;
624 end_scale = min_scale;
628 return _search_speed( input, reference, x, y, scale, similarity, num_of_bins, f, begin_scale, end_scale, scale_factor );
632 return _search_memory( input, reference, x, y, scale, similarity, num_of_bins, f, begin_scale, end_scale, scale_factor );
639 template <
typename Array_type,
typename Histogram_type,
typename Functor >
640 inline void _make_histogram(
641 const Array_type &array,
642 Histogram_type &histo,
652 const double gain = 1.0 / ( w * h * d );
653 for(
size_t k = 0 ; k < d ; k ++ )
655 for(
size_t j = 0 ; j < h ; j ++ )
657 for(
size_t i = 0 ; i < w ; i ++ )
659 histo[ f( array( bi + i, bj + j, bk + k ) ) ] += gain;
665 template <
typename Array_type,
typename Histogram_type,
typename Functor >
666 inline void _diff_histogram(
667 const Array_type &array,
668 Histogram_type &histo,
682 const double gain = 1.0 / ( w * h * d );
684 for( ; k < bk - pbk ; k ++ )
686 for(
size_t j = 0 ; j < h ; j ++ )
688 for(
size_t i = 0 ; i < w ; i ++ )
690 histo[ f( array( pbi + i, pbj + j, pbk + k ) ) ] -= gain;
691 histo[ f( array( bi + i, bj + j, pbk + d + k ) ) ] += gain;
695 for( ; k < d ; k ++ )
698 for( ; j < bj - pbj ; j ++ )
700 for(
size_t i = 0 ; i < w ; i ++ )
702 histo[ f( array( pbi + i, pbj + j, bk + k ) ) ] -= gain;
703 histo[ f( array( bi + i, pbj + h + j, bk + k ) ) ] += gain;
706 for( ; j < h ; j ++ )
708 for(
size_t i = 0 ; i < bi - pbi ; i ++ )
710 histo[ f( array( pbi + i, bj + j, bk + k ) ) ] -= gain;
711 histo[ f( array( pbi + w + i, bj + j, bk + k ) ) ] += gain;
718 _make_histogram( array, histo, bi, bj, bk, w, h, d, f );
722 template<
typename Table_type >
723 inline void _culling(
732 const double &max_sim )
734 const size_t size = w * h * d;
735 for(
size_t k = 0 ; k < d ; k ++ )
737 if( _upper( w * h * ( d - k ), size, sim ) >= max_sim )
741 for(
size_t j = 0 ; j < h ; j ++ )
743 if( _upper( w * ( h - j ) * ( d - k ), size, sim ) >= max_sim )
747 for(
size_t i = 0 ; i < w ; i ++ )
749 if( _upper( ( w - i ) * ( h - j ) * ( d - k ), size, sim ) < max_sim )
751 c_tab( bi + i, bj + j, bk + k ) =
true;
754 c_tab( bi + i, bj - j, bk + k ) =
true;
758 c_tab( bi - i, bj + j, bk + k ) =
true;
761 c_tab( bi - i, bj - j, bk + k ) =
true;
774 template<
typename Array_type,
typename Functor >
775 inline bool __search(
776 const Array_type &in,
777 const Array_type &ref,
783 const size_t &num_of_bins,
785 const double &b_scale,
786 const double &e_scale,
787 const double &scale_factor )
789 typedef array< double > histogram_type;
791 histogram_type i_histo( num_of_bins );
792 histogram_type r_histo( num_of_bins );
793 _make_histogram( ref, r_histo, 0, 0, 0, ref.width( ), ref.height( ), ref.depth( ), f );
794 array3< bool > culling_table( in.width( ), in.height( ), in.depth( ) );
799 similarity = ( similarity < 0.0 || 1.0 < similarity ) ? 0.0 : similarity;
802 size_t w, h, d, pi, pj, pk;
803 histogram_type histo1( num_of_bins ), histo2( num_of_bins );
804 bool is_found =
false;
806 while( ( scale_factor > 1.0 ) ? ( s <= e_scale ) : ( s >= e_scale ) )
808 w =
static_cast< size_t >( ref.width( ) * s );
809 h =
static_cast< size_t >( ref.height( ) * s );
810 d =
static_cast< size_t >( ref.depth( ) * s );
811 _make_histogram( in, histo2, 0, 0, 0, w, h, d, f );
812 culling_table.fill(
false );
814 for(
size_t k = 0 ; k < in.depth( ) - d + 1 ; k ++ )
816 _diff_histogram( in, histo2, 0, 0, k, 0, 0, pk, w, h, d, f );
820 for(
size_t j = 0 ; j < in.height( ) - h + 1 ; j ++ )
822 _diff_histogram( in, histo1, 0, j, k, 0, pj, pk, w, h, d, f );
826 for(
size_t i = 0 ; i < in.width( ) - w + 1 ; i ++ )
828 if( !culling_table( i, j, k ) )
831 _diff_histogram( in, i_histo, i, j, k, pi, pj, pk, w, h, d, f );
833 sim = _similarity( i_histo, r_histo );
834 if( sim > similarity )
837 x =
static_cast< unsigned int >( i );
838 y =
static_cast< unsigned int >( j );
839 z =
static_cast< unsigned int >( k );
843 _culling( culling_table, i, j, k, w, h, d, sim, similarity );
853 template<
typename Array_type,
typename Functor >
854 inline bool _search_memory(
855 const Array_type &in,
856 const Array_type &ref,
862 const size_t &num_of_bins,
864 const double &b_scale,
865 const double &e_scale,
866 const double &scale_factor )
869 return __search( in, ref, x, y, z, scale, similarity, num_of_bins, f, b_scale, e_scale, scale_factor );
872 template<
typename Array_type,
typename Functor >
873 inline bool _search_speed(
874 const Array_type &in2,
875 const Array_type &ref2,
881 const size_t &num_of_bins,
883 const double &b_scale,
884 const double &e_scale,
885 const double &scale_factor )
888 typedef typename Functor::result_type value_type;
889 array3< value_type > in( in2.width( ), in2.height( ), in2.depth( ) );
890 _quantize( in2, in, f );
891 array3< value_type > ref( ref2.width( ), ref2.height( ), ref2.depth( ) );
892 _quantize( ref2, ref, f );
893 return __search( in, ref, x, y, z, scale, similarity, num_of_bins, _functor< value_type, value_type >( ), b_scale, e_scale, scale_factor );
896 template<
typename Array_type,
typename Functor >
898 const Array_type &input,
899 const Array_type &reference,
907 const double &scale_factor,
908 const size_t &num_of_bins,
912 if( scale_factor <= 0.0 || scale_factor == 1.0 )
916 const double u_bound = _minimum( static_cast< double >( input.width( ) ) / reference.width( ), _minimum( static_cast< double >( input.height( ) ) / reference.height( ),
static_cast< double >( input.depth( ) ) / reference.depth( ) ) );
917 const double l_bound = 0.01;
918 min_scale = ( min_scale < l_bound ) ? l_bound : min_scale;
919 min_scale = ( min_scale > u_bound ) ? u_bound : min_scale;
920 max_scale = ( max_scale < l_bound ) ? l_bound : max_scale;
921 max_scale = ( max_scale > u_bound ) ? u_bound : max_scale;
922 if( min_scale > max_scale )
924 double tmp = min_scale;
925 min_scale = max_scale;
928 double begin_scale, end_scale;
929 if( scale_factor > 1.0 )
931 begin_scale = min_scale;
932 end_scale = max_scale;
936 begin_scale = max_scale;
937 end_scale = min_scale;
941 return _search_speed( input, reference, x, y, z, scale, similarity, num_of_bins, f, begin_scale, end_scale, scale_factor );
945 return _search_memory( input, reference, x, y, z, scale, similarity, num_of_bins, f, begin_scale, end_scale, scale_factor );
978 const array2< rgb< unsigned char > > &input,
979 const array2< rgb< unsigned char > > &reference,
984 const double &min_scale,
985 const double &max_scale,
986 const double &scale_factor,
987 size_t num_of_bins2 )
990 typedef _active_search_::_functor< rgb< unsigned char >,
unsigned int > functor;
991 num_of_bins2 = ( num_of_bins2 > 256 ) ? 256 : num_of_bins2;
992 const size_t num_of_bins = num_of_bins2 * num_of_bins2 * num_of_bins2;
993 return _active_search_::_search( input, reference, x, y, scale, similarity, min_scale, max_scale, scale_factor, num_of_bins, functor( num_of_bins2 ),
active_search_style::speed );
1015 const array2< rgb< unsigned char > > &input,
1016 const array2< rgb< unsigned char > > &reference,
1020 const double &scale,
1021 size_t num_of_bins2 )
1024 typedef _active_search_::_functor< rgb< unsigned char >,
unsigned int > functor;
1025 num_of_bins2 = ( num_of_bins2 > 256 ) ? 256 : num_of_bins2;
1026 const size_t num_of_bins = num_of_bins2 * num_of_bins2 * num_of_bins2;
1028 return _active_search_::_search( input, reference, x, y, tmp, similarity, scale, scale, 2.0, num_of_bins, functor( num_of_bins2 ),
active_search_style::speed );
1056 template <
typename Value_type,
typename Allocator >
1058 const array< Value_type, Allocator > &input,
1059 const array< Value_type, Allocator > &reference,
1063 const double &min_scale,
1064 const double &max_scale,
1065 const double &scale_factor,
1066 const size_t &num_of_bins )
1069 typedef typename _active_search_::_functor< Value_type, Value_type > functor;
1070 return _active_search_::_search( input, reference, x, scale, similarity, min_scale, max_scale, scale_factor, num_of_bins, functor( ),
active_search_style::memory );
1092 template <
typename Value_type,
typename Allocator >
1094 const array< Value_type, Allocator > &input,
1095 const array< Value_type, Allocator > &reference,
1098 const double &scale,
1099 const size_t &num_of_bins )
1102 typedef typename _active_search_::_functor< Value_type, Value_type > functor;
1104 return _active_search_::_search( input, reference, x, tmp, similarity, scale, scale, 2.0, num_of_bins, functor( ),
active_search_style::memory );
1133 template <
typename Value_type,
typename Allocator,
typename Functor >
1135 const array< Value_type, Allocator > &input,
1136 const array< Value_type, Allocator > &reference,
1140 const double &min_scale,
1141 const double &max_scale,
1142 const double &scale_factor,
1143 const size_t &num_of_bins,
1148 return _active_search_::_search( input, reference, x, scale, similarity, min_scale, max_scale, scale_factor, num_of_bins, f, style );
1174 template <
typename Value_type,
typename Allocator,
typename Functor >
1176 const array< Value_type, Allocator > &input,
1177 const array< Value_type, Allocator > &reference,
1180 const double &scale,
1181 const size_t &num_of_bins,
1187 return _active_search_::_search( input, reference, x, tmp, similarity, scale, scale, 2.0, num_of_bins, f, style );
1215 template <
typename Value_type,
typename Allocator >
1217 const array1< Value_type, Allocator > &input,
1218 const array1< Value_type, Allocator > &reference,
1222 const double &min_scale,
1223 const double &max_scale,
1224 const double &scale_factor,
1225 const size_t &num_of_bins )
1228 typedef typename _active_search_::_functor< Value_type, Value_type > functor;
1229 return _active_search_::_search( input, reference, x, scale, similarity, min_scale, max_scale, scale_factor, num_of_bins, functor( ),
active_search_style::memory );
1251 template <
typename Value_type,
typename Allocator >
1253 const array1< Value_type, Allocator > &input,
1254 const array1< Value_type, Allocator > &reference,
1257 const double &scale,
1258 const size_t &num_of_bins )
1261 typedef typename _active_search_::_functor< Value_type, Value_type > functor;
1263 return _active_search_::_search( input, reference, x, tmp, similarity, scale, scale, 2.0, num_of_bins, functor( ),
active_search_style::memory );
1292 template <
typename Value_type,
typename Allocator,
typename Functor >
1294 const array1< Value_type, Allocator > &input,
1295 const array1< Value_type, Allocator > &reference,
1299 const double &min_scale,
1300 const double &max_scale,
1301 const double &scale_factor,
1302 const size_t &num_of_bins,
1307 return _active_search_::_search( input, reference, x, scale, similarity, min_scale, max_scale, scale_factor, num_of_bins, f, style );
1333 template <
typename Value_type,
typename Allocator,
typename Functor >
1335 const array1< Value_type, Allocator > &input,
1336 const array1< Value_type, Allocator > &reference,
1339 const double &scale,
1340 const size_t &num_of_bins,
1346 return _active_search_::_search( input, reference, x, tmp, similarity, scale, scale, 2.0, num_of_bins, f, style );
1375 template <
typename Value_type,
typename Allocator >
1377 const array2< Value_type, Allocator > &input,
1378 const array2< Value_type, Allocator > &reference,
1383 const double &min_scale,
1384 const double &max_scale,
1385 const double &scale_factor,
1386 const size_t &num_of_bins )
1389 typedef typename _active_search_::_functor< Value_type, Value_type > functor;
1390 return _active_search_::_search( input, reference, x, y, scale, similarity, min_scale, max_scale, scale_factor, num_of_bins, functor( ),
active_search_style::memory );
1413 template <
typename Value_type,
typename Allocator >
1415 const array2< Value_type, Allocator > &input,
1416 const array2< Value_type, Allocator > &reference,
1420 const double &scale,
1421 const size_t &num_of_bins )
1424 typedef typename _active_search_::_functor< Value_type, Value_type > functor;
1426 return _active_search_::_search( input, reference, x, y, tmp, similarity, scale, scale, 2.0, num_of_bins, functor( ),
active_search_style::memory );
1456 template <
typename Value_type,
typename Allocator,
typename Functor >
1458 const array2< Value_type, Allocator > &input,
1459 const array2< Value_type, Allocator > &reference,
1464 const double &min_scale,
1465 const double &max_scale,
1466 const double &scale_factor,
1467 const size_t &num_of_bins,
1472 return _active_search_::_search( input, reference, x, y, scale, similarity, min_scale, max_scale, scale_factor, num_of_bins, f, style );
1499 template <
typename Value_type,
typename Allocator,
typename Functor >
1501 const array2< Value_type, Allocator > &input,
1502 const array2< Value_type, Allocator > &reference,
1506 const double &scale,
1507 const size_t &num_of_bins,
1513 return _active_search_::_search( input, reference, x, y, tmp, similarity, scale, scale, 2.0, num_of_bins, f, style );
1543 template <
typename Value_type,
typename Allocator >
1545 const array3< Value_type, Allocator > &input,
1546 const array3< Value_type, Allocator > &reference,
1552 const double &min_scale,
1553 const double &max_scale,
1554 const double &scale_factor,
1555 const size_t &num_of_bins )
1558 typedef typename _active_search_::_functor< Value_type, Value_type > functor;
1559 return _active_search_::_search( input, reference, x, y, z, scale, similarity, min_scale, max_scale, scale_factor, num_of_bins, functor( ),
active_search_style::memory );
1583 template <
typename Value_type,
typename Allocator >
1585 const array3< Value_type, Allocator > &input,
1586 const array3< Value_type, Allocator > &reference,
1591 const double &scale,
1592 const size_t &num_of_bins )
1595 typedef typename _active_search_::_functor< Value_type, Value_type > functor;
1597 return _active_search_::_search( input, reference, x, y, z, tmp, similarity, scale, scale, 2.0, num_of_bins, functor( ),
active_search_style::memory );
1628 template <
typename Value_type,
typename Allocator,
typename Functor >
1630 const array3< Value_type, Allocator > &input,
1631 const array3< Value_type, Allocator > &reference,
1637 const double &min_scale,
1638 const double &max_scale,
1639 const double &scale_factor,
1640 const size_t &num_of_bins,
1645 return _active_search_::_search( input, reference, x, y, z, scale, similarity, min_scale, max_scale, scale_factor, num_of_bins, f, style );
1673 template <
typename Value_type,
typename Allocator,
typename Functor >
1675 const array3< Value_type, Allocator > &input,
1676 const array3< Value_type, Allocator > &reference,
1681 const double &scale,
1682 const size_t &num_of_bins,
1688 return _active_search_::_search( input, reference, x, y, z, tmp, similarity, scale, scale, 2.0, num_of_bins, f, style );
1700 #endif // #ifdef __INCLUDE_ACTIVE_SEARCH_H__