75 #ifndef SLIP_CORRELATION_HPP
76 #define SLIP_CORRELATION_HPP
178 template<
typename T,
typename InputIterator1,
typename InputIterator2>
181 InputIterator2 first2)
219 typename InputIterator1,
220 typename InputIterator2,
221 typename MaskIterator>
224 InputIterator1 last1,
225 MaskIterator mask_first,
226 InputIterator2 first2,
227 typename std::iterator_traits<MaskIterator>::value_type value=
typename
228 std::iterator_traits<MaskIterator>::value_type(1))
230 assert(first1 != last1);
232 for (; first1 != last1; ++first1,++first2,++mask_first)
234 if(*mask_first == value)
236 init +=(*first1)*(*first2);
274 typename InputIterator1,
275 typename InputIterator2,
279 InputIterator1 last1,
280 InputIterator2 first2,
283 assert(first1 != last1);
285 for (; first1 != last1; ++first1, ++first2)
289 init +=(*first1)*(*first2);
337 template<
typename T,
typename InputIterator1,
typename InputIterator2>
339 T
cc(InputIterator1 first, InputIterator1 last,
340 InputIterator2 first2)
342 return slip::std_crosscorrelation<T>(first,last,first2);
378 typename InputIterator1,
379 typename InputIterator2,
380 typename MaskIterator>
383 InputIterator1 last1,
384 MaskIterator mask_first,
385 InputIterator2 first2,
387 typename std::iterator_traits<MaskIterator>::value_type value=
typename
388 std::iterator_traits<MaskIterator>::value_type(1))
390 return slip::std_crosscorrelation_mask<T>(first1,last1,mask_first,first2,value);
425 typename InputIterator1,
426 typename InputIterator2,
430 InputIterator1 last1,
431 InputIterator2 first2,
434 return slip::std_crosscorrelation_if<T>(first1,last1,first2,pred);
486 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
489 InputIterator2 first2,
490 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
491 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
494 Real __init1 = Real();
496 for (; first != last; ++first, ++first2)
498 __init1 = __init1 + (*first - mean1) * (*first2 - mean2);
537 template<
typename Real,
538 typename InputIterator1,
539 typename InputIterator2,
540 typename MaskIterator>
543 MaskIterator mask_first,
544 InputIterator2 first2,
546 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
547 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type(),
548 typename std::iterator_traits<MaskIterator>::value_type value=
typename
549 std::iterator_traits<MaskIterator>::value_type(1))
551 Real __init1 = Real();
552 for (; first1 != last1; ++first1, ++first2,++mask_first)
554 if(*mask_first == value)
556 __init1 = __init1 + (*first1 - mean1) * (*first2 - mean2);
596 template<
typename Real,
597 typename InputIterator1,
598 typename InputIterator2,
602 InputIterator2 first2,
604 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
605 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
609 Real __init1 = Real();
610 for (; first1 != last1; ++first1, ++first2)
614 __init1 = __init1 + (*first1 - mean1) * (*first2 - mean2);
665 template<
typename Real,
666 typename InputIterator1,
667 typename InputIterator2>
669 Real
ccc(InputIterator1 first, InputIterator1 last,
670 InputIterator2 first2,
671 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
672 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
674 return slip::centered_crosscorrelation<Real>(first,last,first2,mean1,mean2);
710 template<
typename Real,
711 typename InputIterator1,
712 typename InputIterator2,
713 typename MaskIterator>
715 Real
ccc_mask(InputIterator1 first1,InputIterator1 last1,
716 MaskIterator mask_first,
717 InputIterator2 first2,
719 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
720 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type(),
721 typename std::iterator_traits<MaskIterator>::value_type value=
typename
722 std::iterator_traits<MaskIterator>::value_type(1))
725 return slip::centered_crosscorrelation_mask<Real>(first1,last1,mask_first,first2,mean1,mean2,value);
763 template<
typename Real,
764 typename InputIterator1,
765 typename InputIterator2,
768 Real
ccc_if(InputIterator1 first1,InputIterator1 last1,
769 InputIterator2 first2,Predicate pred,
770 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
771 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
773 return slip::centered_crosscorrelation_if<Real>(first1,last1,first2,pred,mean1,mean2);
824 template<
typename Real,
825 typename InputIterator1,
826 typename InputIterator2>
829 InputIterator2 first2,
830 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
831 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
834 Real __init1 = Real();
835 Real __init2 = Real();
837 for (; first != last; ++first, ++first2)
839 __init1 = __init1 + (*first - mean1) * (*first - mean1);
840 __init2 = __init2 + (*first2 - mean2) * (*first2 - mean2);
841 __cc = __cc + *first * *first2;
844 return __cc /
std::sqrt(__init1 * __init2);
881 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator >
884 InputIterator1 last1,
885 MaskIterator mask_first,
886 InputIterator2 first2,
887 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
888 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type(),
typename std::iterator_traits<MaskIterator>::value_type value=
typename
889 std::iterator_traits<MaskIterator>::value_type(1))
891 Real __init1 = Real();
892 Real __init2 = Real();
894 for (; first1 != last1; ++first1, ++first2,++mask_first)
896 if(*mask_first == value)
899 Real __diff1 = (*first1 - mean1);
900 Real __diff2 = (*first2 - mean2);
901 __init1 = __init1 + (__diff1 * __diff1);
902 __init2 = __init2 + (__diff2 * __diff2);
903 __cc = __cc + (*first1 * *first2);
906 return __cc /
std::sqrt(__init1 * __init2);
945 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename Predicate>
948 InputIterator2 first2,Predicate pred,
949 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
950 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
954 Real __init1 = Real();
955 Real __init2 = Real();
958 for (; first1 != last1; ++first1, ++first2)
962 Real __diff1 = (*first1 - mean1);
963 Real __diff2 = (*first2 - mean2);
964 __init1 = __init1 + (__diff1 * __diff1);
965 __init2 = __init2 + (__diff2 * __diff2);
966 __cc = __cc + (*first1 * *first2);
969 return __cc /
std::sqrt(__init1 * __init2);
1020 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
1022 Real
pncc(InputIterator1 first, InputIterator1 last,
1023 InputIterator2 first2,
1024 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
1025 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
1028 return slip::pseudo_normalized_crosscorrelation<Real>(first,last,first2,mean1,mean2);
1064 template<
typename Real,
1065 typename InputIterator1,
1066 typename InputIterator2,
1067 typename MaskIterator >
1070 InputIterator1 last1,
1071 MaskIterator mask_first,
1072 InputIterator2 first2,
1073 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
1074 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type(),
typename std::iterator_traits<MaskIterator>::value_type value=
typename
1075 std::iterator_traits<MaskIterator>::value_type(1))
1077 return slip::pseudo_normalized_crosscorrelation_mask<Real>(first1,last1,mask_first,first2,mean1,mean2,value);
1115 template<
typename Real,
1116 typename InputIterator1,
1117 typename InputIterator2,
1120 Real
pncc_if(InputIterator1 first1,InputIterator1 last1,
1121 InputIterator2 first2,Predicate pred,
1122 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
1123 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
1126 return slip::pseudo_normalized_crosscorrelation_if<Real>(first1,last1,first2,pred,mean1,mean2);
1175 template<
typename Real,
1176 typename InputIterator1,
1177 typename InputIterator2>
1180 InputIterator1 last,
1181 InputIterator2 first2,
1182 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
1183 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
1187 Real __init0 = Real();
1188 Real __init1 = Real();
1189 Real __init2 = Real();
1191 for (; first != last; ++first, ++first2)
1193 Real __diff1 = (*first - mean1);
1194 Real __diff2 = (*first2 - mean2);
1195 __init0 = __init0 + __diff1 * __diff2;
1196 __init1 = __init1 + __diff1 * __diff1;
1197 __init2 = __init2 + __diff2 * __diff2;
1200 return __init0 /
std::sqrt(__init1 * __init2);
1236 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator >
1239 InputIterator1 last1,
1240 MaskIterator mask_first,
1241 InputIterator2 first2,
1243 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
1244 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type(),
typename std::iterator_traits<MaskIterator>::value_type value=
typename
1245 std::iterator_traits<MaskIterator>::value_type(1))
1249 Real __init0 = Real();
1250 Real __init1 = Real();
1251 Real __init2 = Real();
1253 for (; first1 != last1; ++first1, ++first2,++mask_first)
1255 if(*mask_first == value)
1257 Real __diff1 = (*first1 - mean1);
1258 Real __diff2 = (*first2 - mean2);
1259 __init0 = __init0 + __diff1 * __diff2;
1260 __init1 = __init1 + __diff1 * __diff1;
1261 __init2 = __init2 + __diff2 * __diff2;
1264 return __init0 /
std::sqrt(__init1 * __init2);
1300 template<
typename Real,
1301 typename InputIterator1,
1302 typename InputIterator2,
1306 InputIterator2 first2,Predicate pred,
1307 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
1308 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
1313 Real __init0 = Real();
1314 Real __init1 = Real();
1315 Real __init2 = Real();
1317 for (; first1 != last1; ++first1, ++first2)
1321 Real __diff1 = (*first1 - mean1);
1322 Real __diff2 = (*first2 - mean2);
1323 __init0 = __init0 + __diff1 * __diff2;
1324 __init1 = __init1 + __diff1 * __diff1;
1325 __init2 = __init2 + __diff2 * __diff2;
1328 return __init0 /
std::sqrt(__init1 * __init2);
1376 template<
typename Real,
typename InputIterator1,
typename InputIterator2>
1378 Real
ncc(InputIterator1 first,
1379 InputIterator1 last,
1380 InputIterator2 first2,
1381 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
1382 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
1384 return slip::normalized_crosscorrelation<Real>(first,last,first2,mean1,mean2);
1424 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename MaskIterator >
1427 InputIterator1 last1,
1428 MaskIterator mask_first,
1429 InputIterator2 first2,
1431 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
1432 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type(),
typename std::iterator_traits<MaskIterator>::value_type value=
typename
1433 std::iterator_traits<MaskIterator>::value_type(1))
1436 return slip::normalized_crosscorrelation_mask<Real>(first1,last1,mask_first,first2,mean1,mean2,value);
1471 template<
typename Real,
typename InputIterator1,
typename InputIterator2,
typename Predicate>
1473 Real
ncc_if(InputIterator1 first1,InputIterator1 last1,
1474 InputIterator2 first2,Predicate pred,
1475 typename std::iterator_traits<InputIterator1>::value_type mean1 =
typename std::iterator_traits<InputIterator1>::value_type(),
1476 typename std::iterator_traits<InputIterator1>::value_type mean2 =
typename std::iterator_traits<InputIterator2>::value_type())
1479 return slip::centered_crosscorrelation_if<Real>(first1,last1,first2,pred,mean1,mean2);
1516 template<
typename RandomAccessIterator1,
typename RandomAccessIterator2>
1519 RandomAccessIterator1 last,
1520 RandomAccessIterator2 auto_first,
1521 RandomAccessIterator2 auto_last)
1526 typedef typename std::iterator_traits<RandomAccessIterator2>::value_type value_type;
1527 typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type _Difference;
1529 assert(last - first > 0);
1530 assert((auto_last - auto_first) == (last-first)*2 - 1);
1531 _Difference med = _Difference(last - first) - 1;
1532 for(_Difference i = 0; i <= med; ++i)
1534 value_type __init0 = value_type();
1535 RandomAccessIterator1 first_tmp = first;
1536 RandomAccessIterator2 first_tmp2 = first + i;
1537 for (; first_tmp2 != last; ++first_tmp, ++first_tmp2)
1540 value_type __diff2 = *first_tmp2;
1541 __init0 = __init0 + __diff1 * __diff2;
1543 value_type val = __init0;
1545 *(auto_first + med + i) = val;
1546 *(auto_first + med - i) = val;
1579 template<
typename RandomAccessIterator1,
typename RandomAccessIterator2>
1582 RandomAccessIterator1 last,
1583 RandomAccessIterator2 auto_first,
1584 RandomAccessIterator2 auto_last)
1588 typedef typename std::iterator_traits<RandomAccessIterator2>::value_type value_type;
1589 typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type _Difference;
1591 assert(last - first > 0);
1592 assert((auto_last - auto_first) == (last-first));
1593 _Difference med = _Difference(last - first);
1594 for(_Difference i = 0; i < med; ++i)
1596 value_type __init0 = value_type();
1597 RandomAccessIterator1 first_tmp = first;
1598 RandomAccessIterator2 first_tmp2 = first + i;
1599 for (; first_tmp2 != last; ++first_tmp, ++first_tmp2)
1602 value_type __diff2 = *first_tmp2;
1603 __init0 = __init0 + __diff1 * __diff2;
1605 value_type val = __init0;
1607 *(auto_first + i) = val;
1640 template<
typename RandomAccessIterator1,
typename RandomAccessIterator2>
1643 RandomAccessIterator1 last,
1644 RandomAccessIterator2 auto_first,
1645 RandomAccessIterator2 auto_last)
1648 typedef typename std::iterator_traits<RandomAccessIterator2>::value_type value_type;
1649 typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type _Difference;
1652 _Difference N = (auto_last - auto_first);
1653 value_type one_over_N = value_type(1)/value_type(N);
1654 std::transform(auto_first,auto_last,auto_first,std::bind2nd(std::multiplies<value_type>(),one_over_N));
1687 template<
typename RandomAccessIterator1,
typename RandomAccessIterator2>
1690 RandomAccessIterator1 last,
1691 RandomAccessIterator2 auto_first,
1692 RandomAccessIterator2 auto_last)
1696 typedef typename std::iterator_traits<RandomAccessIterator2>::value_type value_type;
1697 typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type _Difference;
1699 assert(last - first > 0);
1700 assert((auto_last - auto_first) == (last-first));
1701 _Difference med = _Difference(last - first);
1702 for(_Difference i = 0; i < med; ++i)
1704 value_type __init0 = value_type();
1705 RandomAccessIterator1 first_tmp = first;
1706 RandomAccessIterator2 first_tmp2 = first + i;
1707 for (; first_tmp2 != last; ++first_tmp, ++first_tmp2)
1710 value_type __diff2 = *first_tmp2;
1711 __init0 = __init0 + __diff1 * __diff2;
1713 value_type val = __init0;
1715 *(auto_first + i) = val / value_type(med-i);
1748 template<
typename RandomAccessIterator1,
typename RandomAccessIterator2>
1751 RandomAccessIterator1 last,
1752 RandomAccessIterator2 auto_first,
1753 RandomAccessIterator2 auto_last)
1757 typedef typename std::iterator_traits<RandomAccessIterator2>::value_type value_type;
1758 typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type _Difference;
1760 assert(last - first > 0);
1761 assert((auto_last - auto_first) == (last-first));
1763 value_type
mean = slip::mean<value_type>(first,last);
1764 _Difference med = _Difference(last - first);
1765 for(_Difference i = 0; i < med; ++i)
1767 value_type __init0 = value_type();
1768 RandomAccessIterator1 first_tmp = first;
1769 RandomAccessIterator2 first_tmp2 = first + i;
1770 for (; first_tmp2 != last; ++first_tmp, ++first_tmp2)
1773 value_type __diff2 = (*first_tmp2 -
mean);
1774 __init0 = __init0 + __diff1 * __diff2;
1776 value_type val = __init0;
1778 *(auto_first + i) = val;
1811 template<
typename RandomAccessIterator1,
typename RandomAccessIterator2>
1814 RandomAccessIterator1 last,
1815 RandomAccessIterator2 auto_first,
1816 RandomAccessIterator2 auto_last)
1819 typedef typename std::iterator_traits<RandomAccessIterator2>::value_type value_type;
1820 typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type _Difference;
1823 _Difference N = (auto_last - auto_first);
1824 value_type one_over_N = value_type(1)/value_type(N);
1825 std::transform(auto_first,auto_last,auto_first,std::bind2nd(std::multiplies<value_type>(),one_over_N));
1826 typedef typename std::iterator_traits<RandomAccessIterator2>::value_type value_type;
1858 template<
typename RandomAccessIterator1,
typename RandomAccessIterator2>
1861 RandomAccessIterator1 last,
1862 RandomAccessIterator2 auto_first,
1863 RandomAccessIterator2 auto_last)
1866 typedef typename std::iterator_traits<RandomAccessIterator2>::value_type value_type;
1867 typedef typename std::iterator_traits<RandomAccessIterator2>::difference_type _Difference;
1869 assert(last - first > 0);
1870 assert((auto_last - auto_first) == (last-first));
1872 value_type
mean = slip::mean<value_type>(first,last);
1873 _Difference med = _Difference(last - first);
1874 for(_Difference i = 0; i < med; ++i)
1876 value_type __init0 = value_type();
1877 RandomAccessIterator1 first_tmp = first;
1878 RandomAccessIterator2 first_tmp2 = first + i;
1879 for (; first_tmp2 != last; ++first_tmp, ++first_tmp2)
1882 value_type __diff2 = (*first_tmp2 -
mean);
1883 __init0 = __init0 + __diff1 * __diff2;
1885 value_type val = __init0;
1887 *(auto_first + i) = val / value_type(med-i);
1912 template <
typename RandomAccessIterator,
typename Matrix>
1915 RandomAccessIterator last,
1918 typedef typename std::iterator_traits<RandomAccessIterator>::value_type value_type;
1921 assert(
int(last -first) ==
int(A.
rows()));
1924 Auto.begin(),Auto.end());
1951 template <
typename RandomAccessIterator,
typename Matrix>
1954 RandomAccessIterator last,
1957 typedef typename std::iterator_traits<RandomAccessIterator>::value_type value_type;
1961 assert(
int(last -first) ==
int(A.
rows()));
1964 Auto.begin(),Auto.end());
2010 template<
typename Real,
typename InputIterator2d1,
typename InputIterator2d2,
typename OutputIterator2d>
2013 InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right,
2014 OutputIterator2d out_upper_left, OutputIterator2d out_bottom_right,
2017 typename InputIterator2d1::difference_type size2din1 = in1_bottom_right - in1_upper_left;
2018 typename InputIterator2d2::difference_type size2din2 = in2_bottom_right - in2_upper_left;
2019 typename OutputIterator2d::difference_type size2dout = out_bottom_right - out_upper_left;
2020 assert(size2din1 == size2dout);
2021 typename OutputIterator2d::difference_type size2d(size2din1[0] + size2din2[0] - 1, size2din1[1] + size2din2[1] - 1);
2024 slip::Box2d<int> box1(size2din2[0]/2,size2din2[1]/2,size2din2[0]/2 + size2din1[0]-1,size2din2[1]/2 + size2din1[1]-1);
2030 typename InputIterator2d2::value_type mean2 = slip::mean<typename InputIterator2d2::value_type>(in2_upper_left,in2_bottom_right);
2031 for(
size_t i=0; i<(size_t)size2dout[0]; i++)
2032 for(
size_t j=0; j<(size_t)size2dout[1]; j++)
2034 box2.
set_coord(i,j,size2din2[0]-1+i,size2din2[1]-1+j);
2035 typename InputIterator2d1::value_type mean1 = slip::mean<typename InputIterator2d1::value_type>(I.
upper_left(box2),I.
bottom_right(box2));
2037 *(out_upper_left + d) = normalized_crosscorrelation<Real>(in2_upper_left,in2_bottom_right,I.
upper_left(box2),mean2,mean1);
2044 typename InputIterator2d2::value_type mean2 = slip::mean<typename InputIterator2d2::value_type>(in2_upper_left,in2_bottom_right);
2045 for(
size_t i=0; i<(size_t)size2dout[0]; i++)
2046 for(
size_t j=0; j<(size_t)size2dout[1]; j++)
2048 box2.
set_coord(i,j,size2din2[0]-1+i,size2din2[1]-1+j);
2049 typename InputIterator2d1::value_type mean1 = slip::mean<typename InputIterator2d1::value_type>(I.
upper_left(box2),I.
bottom_right(box2));
2051 *(out_upper_left + d) = pseudo_normalized_crosscorrelation<Real>(in2_upper_left,in2_bottom_right,I.
upper_left(box2),mean2,mean1);
2058 typename InputIterator2d2::value_type mean2 = slip::mean<typename InputIterator2d2::value_type>(in2_upper_left,in2_bottom_right);
2059 for(
size_t i=0; i<(size_t)size2dout[0]; i++)
2060 for(
size_t j=0; j<(size_t)size2dout[1]; j++)
2062 box2.
set_coord(i,j,size2din2[0]-1+i,size2din2[1]-1+j);
2063 typename InputIterator2d1::value_type mean1 = slip::mean<typename InputIterator2d1::value_type>(I.
upper_left(box2),I.
bottom_right(box2));
2065 *(out_upper_left + d) = ccc<Real>(in2_upper_left,in2_bottom_right,I.
upper_left(box2),mean2,mean1);
2072 for(
size_t i=0; i<(size_t)size2dout[0]; i++)
2073 for(
size_t j=0; j<(size_t)size2dout[1]; j++)
2075 box2.
set_coord(i,j,size2din2[0]-1+i,size2din2[1]-1+j);
2077 *(out_upper_left + d) = cc<Real>(in2_upper_left,in2_bottom_right,I.
upper_left(box2));
2085 for(
size_t i=0; i<(size_t)size2dout[0]; i++)
2086 for(
size_t j=0; j<(size_t)size2dout[1]; j++)
2088 box2.
set_coord(i,j,size2din2[0]-1+i,size2din2[1]-1+j);
2090 *(out_upper_left + d) = cc<Real>(in2_upper_left,in2_bottom_right,I.
upper_left(box2));
2115 template<
typename Real,
typename InputIterator2d1,
typename InputIterator2d2,
typename OutputIterator2d>
2118 InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right,
2119 OutputIterator2d out_upper_left,
2120 OutputIterator2d out_bottom_right)
2122 slip::crosscorrelation2d<Real>(in1_upper_left,in1_bottom_right,in2_upper_left,in2_bottom_right,out_upper_left,out_bottom_right,
CC);
2145 template<
typename Real,
typename InputIterator2d1,
typename InputIterator2d2,
typename OutputIterator2d>
2148 InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right,
2149 OutputIterator2d out_upper_left,
2150 OutputIterator2d out_bottom_right)
2152 slip::crosscorrelation2d<Real>(in1_upper_left,in1_bottom_right,in2_upper_left,in2_bottom_right,out_upper_left,out_bottom_right,
CCC);
2176 template<
typename Real,
typename InputIterator2d1,
typename InputIterator2d2,
typename OutputIterator2d>
2179 InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right,
2180 OutputIterator2d out_upper_left,
2181 OutputIterator2d out_bottom_right)
2183 slip::crosscorrelation2d<Real>(in1_upper_left,in1_bottom_right,in2_upper_left,in2_bottom_right,out_upper_left,out_bottom_right,
PNCC);
2205 template<
typename Real,
typename InputIterator2d1,
typename InputIterator2d2,
typename OutputIterator2d>
2208 InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right,
2209 OutputIterator2d out_upper_left,
2210 OutputIterator2d out_bottom_right)
2212 slip::crosscorrelation2d<Real>(in1_upper_left,in1_bottom_right,in2_upper_left,in2_bottom_right,out_upper_left,out_bottom_right,
NCC);
2246 template<
typename InputIterator1,
2247 typename InputIterator2,
2248 typename OutputIterator>
2251 InputIterator2 first2,InputIterator2 last2,
2252 OutputIterator result_first,
2253 OutputIterator result_last)
2255 assert((last - first) != 0);
2256 assert((last2 - first2) != 0);
2257 assert((result_last-result_first) >= (last - first) + (last2 - first2) -1);
2259 std::size_t size=
static_cast<std::size_t
>((last-first) +(last2-first2)-1);
2261 typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
2274 for (std::size_t i = 0; i < size; ++i)
2276 fft1[i] *= std::conj(fft2[i]);
2280 std::transform(fft2.
begin(),fft2.
end(),result_first,
2318 template<
typename InputIterator1,
2319 typename InputIterator2,
2320 typename OutputIterator>
2323 InputIterator2 first2,InputIterator2 last2,
2324 OutputIterator result_first,
2325 OutputIterator result_last)
2327 assert((last - first) == (last2 - first2));
2328 assert((last - first) == (result_last - result_first));
2329 assert((last - first) == (last2 - first2));
2331 std::size_t size=
static_cast<std::size_t
>((last-first) +(last2-first2)-1);
2333 typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
2346 for (std::size_t i = 0; i < size; ++i)
2348 fft1[i] *= std::conj(fft2[i]);
2352 std::transform(fft2.
begin()+((last2-first2)/2),
2353 fft2.
begin()+((last2-first2)/2) + (last-first),result_first,
2393 template<
typename RandomAccessIterator1,
2394 typename RandomAccessIterator2,
2395 typename RandomAccessIterator3>
2398 RandomAccessIterator2 first2, RandomAccessIterator2 last2,
2399 RandomAccessIterator3 result_first, RandomAccessIterator3 result_last )
2429 std::reverse_iterator<RandomAccessIterator2>(last2),
2430 std::reverse_iterator<RandomAccessIterator2>(first2),
2431 result_first,result_last);
2469 template<
typename InputIterator1,
2470 typename InputIterator2,
2471 typename OutputIterator>
2474 InputIterator2 first2,InputIterator2 last2,
2475 OutputIterator result_first,
2476 OutputIterator result_last)
2478 assert((last - first) != 0);
2479 assert((last2 - first2) != 0);
2480 assert((result_last-result_first) >= (last - first) + (last2 - first2) -1);
2483 std::size_t size=
static_cast<std::size_t
>((last-first) +(last2-first2)-1);
2485 typedef typename std::iterator_traits<InputIterator1>::value_type value_type;
2498 for (std::size_t i = 0; i < size; ++i)
2500 fft1[i] *= std::conj(fft2[i]);
2546 template<
typename InputIterator2d1,
typename InputIterator2d2,
typename OutputIterator2d>
2549 InputIterator2d1 in1_bottom_right,
2550 InputIterator2d2 in2_upper_left,
2551 InputIterator2d2 in2_bottom_right,
2552 OutputIterator2d out_upper_left,
2553 OutputIterator2d out_bottom_right)
2556 assert((in1_bottom_right - in1_upper_left) == (out_bottom_right - out_upper_left));
2558 assert((in2_bottom_right - in2_upper_left) == (out_bottom_right - out_upper_left));
2559 typename InputIterator2d1::difference_type size2din1 = in1_bottom_right - in1_upper_left;
2560 typename InputIterator2d2::difference_type size2din2 = in2_bottom_right - in2_upper_left;
2561 typename OutputIterator2d::difference_type size2dout = out_bottom_right - out_upper_left;
2568 typedef std::reverse_iterator<InputIterator2d2> reverse_iterator;
2570 reverse_iterator(in2_upper_left),
2625 template<
typename InputIterator2d1,
typename InputIterator2d2,
typename OutputIterator2d>
2628 InputIterator2d1 in1_bottom_right,
2629 InputIterator2d2 in2_upper_left,
2630 InputIterator2d2 in2_bottom_right,
2631 OutputIterator2d out_upper_left,
2632 OutputIterator2d out_bottom_right)
2634 assert(((in1_bottom_right - in1_upper_left)[0]+(in2_bottom_right - in2_upper_left)[0] - 1) == (out_bottom_right - out_upper_left)[0]);
2635 assert(((in1_bottom_right - in1_upper_left)[1]+(in2_bottom_right - in2_upper_left)[1] - 1) == (out_bottom_right - out_upper_left)[1]);
2637 typename InputIterator2d1::difference_type size2din1 = in1_bottom_right - in1_upper_left;
2638 typename InputIterator2d2::difference_type size2din2 = in2_bottom_right - in2_upper_left;
2639 typename OutputIterator2d::difference_type size2dout = out_bottom_right - out_upper_left;
2641 typedef typename std::iterator_traits<InputIterator2d1>::value_type value_type;
2644 std::size_t rows = size2din1[0] + size2din2[0] - 1;
2645 std::size_t cols = size2din1[1] + size2din2[1] - 1;
2650 static_cast<int>(size2din1[0]-1),
2651 static_cast<int>(size2din1[1]-1));
2653 static_cast<int>(size2din2[0]-1),
2654 static_cast<int>(size2din2[1]-1));
2657 typedef std::reverse_iterator<InputIterator2d2> reverse_iterator;
2659 reverse_iterator(in2_upper_left),
2714 template<
typename InputIterator2d1,
2715 typename InputIterator2d2,
2716 typename OutputIterator2d>
2719 InputIterator2d1 in1_bottom_right,
2720 InputIterator2d2 in2_upper_left,
2721 InputIterator2d2 in2_bottom_right,
2722 OutputIterator2d out_upper_left,
2723 OutputIterator2d out_bottom_right)
2725 assert((in1_bottom_right - in1_upper_left)[0] == (out_bottom_right - out_upper_left)[0]);
2726 assert((in1_bottom_right - in1_upper_left)[1] == (out_bottom_right - out_upper_left)[1]);
2728 typename InputIterator2d1::difference_type size2din1 = in1_bottom_right - in1_upper_left;
2729 typename InputIterator2d2::difference_type size2din2 = in2_bottom_right - in2_upper_left;
2730 typename OutputIterator2d::difference_type size2dout = out_bottom_right - out_upper_left;
2732 typedef typename std::iterator_traits<InputIterator2d1>::value_type value_type;
2735 std::size_t rows = size2din1[0] + size2din2[0] - 1;
2736 std::size_t cols = size2din1[1] + size2din2[1] - 1;
2741 static_cast<int>(size2din1[0]-1),
2742 static_cast<int>(size2din1[1]-1));
2744 static_cast<int>(size2din2[0]-1),
2745 static_cast<int>(size2din2[1]-1));
2748 typedef std::reverse_iterator<InputIterator2d2> reverse_iterator;
2750 reverse_iterator(in2_upper_left),
2767 static_cast<int>(size2din2[0]/2 + size2din1[0] - 1),
2768 static_cast<int>(size2din2[1]/2 + size2din1[1] - 1));
2809 template<
typename InputIterator3d1,
2810 typename InputIterator3d2,
2811 typename OutputIterator3d>
2814 InputIterator3d1 in1_back_bottom_right,
2815 InputIterator3d2 in2_front_upper_left,
2816 InputIterator3d2 in2_back_bottom_right,
2817 OutputIterator3d out_front_upper_left,
2818 OutputIterator3d out_back_bottom_right)
2820 assert((in1_back_bottom_right - in1_front_upper_left) == (out_back_bottom_right - out_front_upper_left));
2821 assert((in2_back_bottom_right - in2_front_upper_left) == (out_back_bottom_right - out_front_upper_left));
2823 typename InputIterator3d1::difference_type size3din1 = in1_back_bottom_right - in1_front_upper_left;
2824 typename InputIterator3d2::difference_type size3din2 = in2_back_bottom_right - in2_front_upper_left;
2825 typename OutputIterator3d::difference_type size3dout = out_back_bottom_right - out_front_upper_left;
2834 for (std::size_t k=0;k<(size_t)size3din1[0];k++)
2835 for (std::size_t i=0;i<(size_t)size3din1[1];i++)
2836 for (std::size_t j=0;j<(size_t)size3din1[2];j++)
2838 fft1[k][i][j] *= std::conj(fft2[k][i][j]);
2883 template<
typename InputIterator3d1,
typename InputIterator3d2,
typename OutputIterator3d>
2887 InputIterator3d1 in1_back_bottom_right,
2888 InputIterator3d2 in2_front_upper_left,
2889 InputIterator3d2 in2_back_bottom_right,
2890 OutputIterator3d out_front_upper_left,
2891 OutputIterator3d out_back_bottom_right)
2893 assert(((in1_back_bottom_right - in1_front_upper_left)[0]+(in2_back_bottom_right - in2_front_upper_left)[0] - 1) == (out_back_bottom_right - out_front_upper_left)[0]);
2894 assert(((in1_back_bottom_right - in1_front_upper_left)[1]+(in2_back_bottom_right - in2_front_upper_left)[1] - 1) == (out_back_bottom_right - out_front_upper_left)[1]);
2895 assert(((in1_back_bottom_right - in1_front_upper_left)[2]+(in2_back_bottom_right - in2_front_upper_left)[2] - 1) == (out_back_bottom_right - out_front_upper_left)[2]);
2897 typename InputIterator3d1::difference_type size3din1 = in1_back_bottom_right - in1_front_upper_left;
2898 typename InputIterator3d2::difference_type size3din2 = in2_back_bottom_right - in2_front_upper_left;
2899 typename OutputIterator3d::difference_type size3dout = out_back_bottom_right - out_front_upper_left;
2903 std::size_t slices = size3din1[0] + size3din2[0] - 1;
2904 std::size_t rows = size3din1[1] + size3din2[1] - 1;
2905 std::size_t cols = size3din1[2] + size3din2[2] - 1;
2911 static_cast<int>(size3din1[0]-1),
2912 static_cast<int>(size3din1[1]-1),
2913 static_cast<int>(size3din1[2]-1));
2915 static_cast<int>(size3din2[0]-1),
2916 static_cast<int>(size3din2[1]-1),
2917 static_cast<int>(size3din2[2]-1));
2919 in1_back_bottom_right,
2922 typedef std::reverse_iterator<InputIterator3d2> reverse_iterator;
2924 reverse_iterator(in2_front_upper_left),
2933 fft1.front_upper_left());
2941 slip::ifft3d(fft1.front_upper_left(), fft1.back_bottom_right(),
2947 out_front_upper_left,
2988 template<
typename InputIterator3d1,
2989 typename InputIterator3d2,
2990 typename OutputIterator3d>
2994 InputIterator3d1 in1_back_bottom_right,
2995 InputIterator3d2 in2_front_upper_left,
2996 InputIterator3d2 in2_back_bottom_right,
2997 OutputIterator3d out_front_upper_left,
2998 OutputIterator3d out_back_bottom_right)
3000 assert( (in1_back_bottom_right - in1_front_upper_left)
3001 == (out_back_bottom_right - out_front_upper_left));
3003 typename InputIterator3d1::difference_type size3din1 = in1_back_bottom_right - in1_front_upper_left;
3004 typename InputIterator3d2::difference_type size3din2 = in2_back_bottom_right - in2_front_upper_left;
3005 typename OutputIterator3d::difference_type size3dout = out_back_bottom_right - out_front_upper_left;
3009 std::size_t slices = size3din1[0] + size3din2[0] - 1;
3010 std::size_t rows = size3din1[1] + size3din2[1] - 1;
3011 std::size_t cols = size3din1[2] + size3din2[2] - 1;
3017 static_cast<int>(size3din1[0]-1),
3018 static_cast<int>(size3din1[1]-1),
3019 static_cast<int>(size3din1[2]-1));
3021 static_cast<int>(size3din2[0]-1),
3022 static_cast<int>(size3din2[1]-1),
3023 static_cast<int>(size3din2[2]-1));
3025 in1_back_bottom_right,
3028 typedef std::reverse_iterator<InputIterator3d2> reverse_iterator;
3030 reverse_iterator(in2_front_upper_left),
3039 fft1.front_upper_left());
3048 slip::ifft3d(fft1.front_upper_left(), fft1.back_bottom_right(),
3054 static_cast<int>(size3din2[0]/2 + size3din1[0] - 1),
3055 static_cast<int>(size3din2[1]/2 + size3din1[1] - 1),
3056 static_cast<int>(size3din2[2]/2 + size3din1[2] - 1));
3068 #endif //SLIP_CORRELATION_HPP
void pseudo_normalized_crosscorrelation2d(InputIterator2d1 in1_upper_left, InputIterator2d1 in1_bottom_right, InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right, OutputIterator2d out_upper_left, OutputIterator2d out_bottom_right)
Computes the pseudo normalized crosscorrelation between two Images.
T cc_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the standard crosscorrelation between two sequences according to a mask sequence ...
void set_coord(const CoordType &x11, const CoordType &x12, const CoordType &x21, const CoordType &x22)
Mutator of the coordinates of the Box2d.
void fft_circular_crosscorrelation2d(InputIterator2d1 in1_upper_left, InputIterator2d1 in1_bottom_right, InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right, OutputIterator2d out_upper_left, OutputIterator2d out_bottom_right)
Computes the circular crosscorrelation between two 2D sequences using fft2d.
iterator2d upper_left()
Returns a read/write iterator2d that points to the first element of the Array2d. It points to the upp...
void fft_circular_crosscorrelation3d(InputIterator3d1 in1_front_upper_left, InputIterator3d1 in1_back_bottom_right, InputIterator3d2 in2_front_upper_left, InputIterator3d2 in2_back_bottom_right, OutputIterator3d out_front_upper_left, OutputIterator3d out_back_bottom_right)
Computes the standard crosscorrelation between two 3D sequences using fft3d.
void complex_fft_crosscorrelation(InputIterator1 first, InputIterator1 last, InputIterator2 first2, InputIterator2 last2, OutputIterator result_first, OutputIterator result_last)
Computes the standard complex crosscorrelation between two sequences using fft.
void fftshift(ForwardIterator first, ForwardIterator last)
Performs a shift of a container, for use with the fft and ifft functions, in order to move the freque...
void fftshift2d(ForwardIterator2D upper_left, ForwardIterator2D bottom_right)
Performs a shift of a 2d container, for use with the fft2d and ifft2d functions, in order to move the...
iterator3d front_upper_left()
Returns a read/write iterator3d that points to the first element of the Array3d. It points to the fro...
T cc_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the standard crosscorrelation between two sequences according to a Predicate. .
void fft_circular_convolution(RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 first2, RandomAccessIterator2 last2, RandomAccessIterator3 conv_first, RandomAccessIterator3 conv_last)
Computes the FFT circular convolution.
Real pseudo_normalized_crosscorrelation(InputIterator1 first, InputIterator1 last, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the pseudo normalized crosscorrelation between two sequences: .
void fft_circular_crosscorrelation(RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 first2, RandomAccessIterator2 last2, RandomAccessIterator3 result_first, RandomAccessIterator3 result_last)
Computes the FFT circular crosscorrelation.
Real ncc_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the standard normalized crosscorrelation between two sequences according to a Predicate: ...
Difference of Point3D class, specialization of DPoint<CoordType,DIM> with DIM = 3.
T std_crosscorrelation_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred)
Computes the standard crosscorrelation between two sequences according to a Predicate. .
void autocorrelation_full(RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 auto_first, RandomAccessIterator2 auto_last)
Computes the autocorrelations from lag -(last-first) to (last-first) of a range [first,last).
void centered_crosscorrelation2d(InputIterator2d1 in1_upper_left, InputIterator2d1 in1_bottom_right, InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right, OutputIterator2d out_upper_left, OutputIterator2d out_bottom_right)
Computes the centered crosscorrelation between two Images.
This is a three-dimensional dynamic and generic container. This container statisfies the Bidirectionn...
Real centered_crosscorrelation(InputIterator1 first, InputIterator1 last, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the centered crosscorrelation between two sequences: .
const_iterator begin() const
Returns a read-only (constant) iterator that points to the first element in the Array3d. Iteration is done in ordinary element order.
void biased_autocorrelation(RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 auto_first, RandomAccessIterator2 auto_last)
Computes the biased autocorrelations from lag -(last-first) to (last-first) of a range [first...
void fft_crosscorrelation2d(InputIterator2d1 in1_upper_left, InputIterator2d1 in1_bottom_right, InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right, OutputIterator2d out_upper_left, OutputIterator2d out_bottom_right)
Computes the standard crosscorrelation between two 2D sequences using fft2d.
iterator begin()
Returns a read/write iterator that points to the first element in the Array. Iteration is done in ord...
iterator2d bottom_right()
Returns a read/write iterator2d that points to the past the end element of the Array2d. It points to past the end element of the bottom right element of the Array2d.
size_type cols() const
Returns the number of columns (second dimension size) in the Matrix.
T cc(InputIterator1 first, InputIterator1 last, InputIterator2 first2)
Computes the standard crosscorrelation between two sequences: . Multiplies successive elements from t...
Real functor. Return the real part of x.
void biased_autocovariance(RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 auto_first, RandomAccessIterator2 auto_last)
Computes the biased autocovariance from lag -(last-first) to 0 of a range [first,last).
Real ccc_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type(), typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the centered crosscorrelation between two sequences according to a mask sequence ...
Real pseudo_normalized_crosscorrelation_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the standard pseudo normalized crosscorrelation between two sequences according to a Predica...
void autocorrelation(RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 auto_first, RandomAccessIterator2 auto_last)
Computes the autocorrelations from lag -(last-first) to (last-first) of a range [first,last).
void real_fft2d(InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
Computes the real fft2d of a container with 2d iterators.
Real ncc(InputIterator1 first, InputIterator1 last, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the standard normalized crosscorrelation between two sequences: .
Provides common linear algebra algorithms.
Real ccc_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the standard crosscorrelation between two sequences according to a Predicate: ...
void unbiased_autocovariance(RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 auto_first, RandomAccessIterator2 auto_last)
Computes the unbiased autocovariance from lag -(last-first) to 0 of a range [first,last).
T std_crosscorrelation_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the standard crosscorrelation between two sequences according to a mask sequence ...
void fft_crosscorrelation3d_same(InputIterator3d1 in1_front_upper_left, InputIterator3d1 in1_back_bottom_right, InputIterator3d2 in2_front_upper_left, InputIterator3d2 in2_back_bottom_right, OutputIterator3d out_front_upper_left, OutputIterator3d out_back_bottom_right)
Computes the standard crosscorrelation between two 3D sequences using fft3d.
Provides a class to manipulate 1d dynamic and generic arrays.
void ifft3d(InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
Computes the ifft3d of a container with 3d iterators.
T std_crosscorrelation(InputIterator1 first, InputIterator1 last, InputIterator2 first2)
Computes the standard crosscorrelation between two sequences: . Multiplies successive elements from t...
void biased_autocovariance_matrix(RandomAccessIterator first, RandomAccessIterator last, Matrix &A)
Constructs the biased autocorrelation matrix from given a range.
Real normalized_crosscorrelation(InputIterator1 first, InputIterator1 last, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the standard normalized crosscorrelation between two sequences: .
void ifft(InputIter in_begin, InputIter in_end, OutputIter out_begin)
Computes the inverse fft of a container.
void fft_crosscorrelation_same(InputIterator1 first, InputIterator1 last, InputIterator2 first2, InputIterator2 last2, OutputIterator result_first, OutputIterator result_last)
Computes the FFT central part of the crosscorrelation.
Real ccc(InputIterator1 first, InputIterator1 last, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the centered crosscorrelation between two sequences: .
void autocovariance(RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 auto_first, RandomAccessIterator2 auto_last)
Computes the autocovariance from lag -(last-first) to 0 of a range [first,last).
Real pncc_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type(), typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the pseudo normalized crosscorrelation between two sequences according to a mask sequence : ...
iterator end()
Returns a read/write iterator that points one past the last element in the Array. Iteration is done i...
Provides some statistics algorithms.
void unbiased_autocorrelation(RandomAccessIterator1 first, RandomAccessIterator1 last, RandomAccessIterator2 auto_first, RandomAccessIterator2 auto_last)
Computes the unbiased autocorrelations from lag -(last-first) to (last-first) of a range [first...
Real centered_crosscorrelation_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type(), typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the centered crosscorrelation between two sequences according to a mask sequence ...
void multiplies(InputIterator1 __first1, InputIterator1 __last1, InputIterator2 __first2, OutputIterator __result)
Computes the pointwise product of two ranges.
void copy(_II first, _II last, _OI output_first)
Copy algorithm optimized for slip iterators.
Difference of Point2D class, specialization of DPoint<CoordType,DIM> with DIM = 2.
Provides some macros which are used for using complex as real.
Value_T mean(InputIterator first, InputIterator last)
Computes the mean value of a range .
Real pseudo_normalized_crosscorrelation_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type(), typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the pseudo normalized crosscorrelation between two sequences according to a mask sequence : ...
Real normalized_crosscorrelation_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type(), typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the standard normalized crosscorrelation between two sequences according to a mask sequence ...
void set_coord(const CoordType &dx1, const CoordType &dx2)
Accessor/Mutator of the coordinates of DPoint2d.
iterator end()
Returns a read/write iterator that points one past the last element in the Array2d. Iteration is done in ordinary element order.
HyperVolume< T > sqrt(const HyperVolume< T > &M)
void complex_fft(InputIter in_begin, InputIter in_end, OutputIter out_begin)
Computes the complex fft of a container.
Provides some FFT algorithms.
Numerical matrix class. This container statisfies the BidirectionnalContainer concepts of the STL...
Provides some algorithms to computes arithmetical operations on ranges.
Provides SLIP error messages.
void fft_crosscorrelation3d(InputIterator3d1 in1_front_upper_left, InputIterator3d1 in1_back_bottom_right, InputIterator3d2 in2_front_upper_left, InputIterator3d2 in2_back_bottom_right, OutputIterator3d out_front_upper_left, OutputIterator3d out_back_bottom_right)
Computes the standard crosscorrelation between two 3D sequences using fft3d.
iterator3d back_bottom_right()
Returns a read/write iterator3d that points to the past the end element of the Array3d. It points to past the end element of the back bottom right element of the Array3d.
size_type rows() const
Returns the number of rows (first dimension size) in the Matrix.
Real pncc(InputIterator1 first, InputIterator1 last, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the pseudo normalized crosscorrelation between two sequences: .
std::iterator_traits< RandomAccessIterator1 >::value_type inner_product(RandomAccessIterator1 first1, RandomAccessIterator1 last1, RandomAccessIterator2 first2, typename std::iterator_traits< RandomAccessIterator1 >::value_type init=typename std::iterator_traits< RandomAccessIterator1 >::value_type())
Computes the inner_product of two ranges X and Y: .
Provides some convolution algorithms.
Real pncc_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the standard pseudo normalized crosscorrelation between two sequences according to a Predica...
void ifft2d(InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
Computes the ifft2d of a container with 2d iterators.
void fftshift3d(ForwardIterator3D front_upper_left, ForwardIterator3D back_bottom_right)
Performs a shift of a 2d container, for use with the fft2d and ifft2d functions, in order to move the...
Provides a class to manipulate 3d dynamic and generic arrays.
void normalized_crosscorrelation2d(InputIterator2d1 in1_upper_left, InputIterator2d1 in1_bottom_right, InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right, OutputIterator2d out_upper_left, OutputIterator2d out_bottom_right)
Computes the normalized crosscorrelation between two Images.
void real_fft(InputIter in_begin, InputIter in_end, OutputIter out_begin)
Computes the real fft of a container.
void std_crosscorrelation2d(InputIterator2d1 in1_upper_left, InputIterator2d1 in1_bottom_right, InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right, OutputIterator2d out_upper_left, OutputIterator2d out_bottom_right)
Computes the standard crosscorrelation between two Images.
void fft_crosscorrelation2d_same(InputIterator2d1 in1_upper_left, InputIterator2d1 in1_bottom_right, InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right, OutputIterator2d out_upper_left, OutputIterator2d out_bottom_right)
Computes the standard crosscorrelation between two 2D sequences using fft2d.
void biased_autocorrelation_matrix(RandomAccessIterator first, RandomAccessIterator last, Matrix &A)
Constructs the biased autocorrelation matrix from given a range.
Real centered_crosscorrelation_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the standard crosscorrelation between two sequences according to a Predicate: ...
Real normalized_crosscorrelation_if(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, Predicate pred, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type())
Computes the standard normalized crosscorrelation between two sequences according to a Predicate: ** ...
iterator begin()
Returns a read/write iterator that points to the first element in the Array2d. Iteration is done in o...
void crosscorrelation2d(InputIterator2d1 in1_upper_left, InputIterator2d1 in1_bottom_right, InputIterator2d2 in2_upper_left, InputIterator2d2 in2_bottom_right, OutputIterator2d out_upper_left, OutputIterator2d out_bottom_right, CROSSCORRELATION_TYPE t)
Computes the crosscorrelation between two Images.
This is a linear (one-dimensional) dynamic template container. This container statisfies the RandomAc...
const std::string CROSSCORRELATION_BAD_ALGO
void real_fft3d(InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
Computes the real fft3d of a container with 3d iterators.
CROSSCORRELATION_TYPE
Choose between different types of crosscorrelation.
Real ncc_mask(InputIterator1 first1, InputIterator1 last1, MaskIterator mask_first, InputIterator2 first2, typename std::iterator_traits< InputIterator1 >::value_type mean1=typename std::iterator_traits< InputIterator1 >::value_type(), typename std::iterator_traits< InputIterator1 >::value_type mean2=typename std::iterator_traits< InputIterator2 >::value_type(), typename std::iterator_traits< MaskIterator >::value_type value=typename std::iterator_traits< MaskIterator >::value_type(1))
Computes the standard normalized crosscorrelation between two sequences according to a mask sequence ...
void fft_crosscorrelation(InputIterator1 first, InputIterator1 last, InputIterator2 first2, InputIterator2 last2, OutputIterator result_first, OutputIterator result_last)
Computes the standard crosscorrelation between two sequences using fft.
void toeplitz(RandomAccessIterator first, RandomAccessIterator last, Matrix &A)
Constructs the Toeplitz matrix from given a range.
This is a two-dimensional dynamic and generic container. This container statisfies the Bidirectionnal...