32 template<
typename Combine>
36 template<
typename Combine>
38 unsigned int flag_instance)
40 m_flag_instance(flag_instance) {
44 template<
typename Combine>
49 if (m_flag_image->getWidth() != detection_frame_info.getWidth() ||
50 m_flag_image->getHeight() != detection_frame_info.getHeight()) {
52 <<
"The flag image size does not match the detection image size: "
53 << m_flag_image->getWidth() <<
"x" << m_flag_image->getHeight() <<
" != "
54 << detection_frame_info.getWidth() <<
"x" << detection_frame_info.getHeight();
59 pixel_flags.
push_back(m_flag_image->getValue(coords.m_x, coords.m_y));
68 namespace ExternalFlagCombineTypes {
74 for (
auto pix_flag : pixel_flags) {
88 for (
auto pix_flag : pixel_flags) {
99 for (
auto pix_flag : pixel_flags) {
100 if (pix_flag < flag) {
103 }
else if (pix_flag == flag) {
110 return {flag,
count};
118 for (
auto pix_flag : pixel_flags) {
119 if (pix_flag > flag) {
122 }
else if (pix_flag == flag) {
129 return {flag,
count};
136 for (
auto pix_flag : pixel_flags) {
137 counters[pix_flag] += 1;
141 for (
auto&
pair : counters) {
147 return {flag,
count};
153 template class ExternalFlagTask<ExternalFlagCombineTypes::Or>;
154 template class ExternalFlagTask<ExternalFlagCombineTypes::And>;
155 template class ExternalFlagTask<ExternalFlagCombineTypes::Min>;
156 template class ExternalFlagTask<ExternalFlagCombineTypes::Max>;
157 template class ExternalFlagTask<ExternalFlagCombineTypes::Most>;
static std::pair< std::int64_t, int > combine(const std::vector< FlagImage::PixelType > &pixel_flags)