33 template<
typename Combine>
37 template<
typename Combine>
39 : m_flag_image(flag_image), m_flag_instance(flag_instance) {
43 template<
typename Combine>
50 if (m_flag_image->getWidth() != detection_frame_info.getWidth() ||
51 m_flag_image->getHeight() != detection_frame_info.getHeight()) {
53 <<
"The flag image size does not match the detection image size: " 54 << m_flag_image->getWidth() <<
"x" << m_flag_image->getHeight() <<
" != " 55 << detection_frame_info.getWidth() <<
"x" << detection_frame_info.getHeight();
60 pixel_flags.
push_back(m_flag_image->getValue(coords.m_x, coords.m_y));
69 namespace ExternalFlagCombineTypes {
75 for (
auto pix_flag : pixel_flags) {
89 for (
auto pix_flag : pixel_flags) {
100 for (
auto pix_flag : pixel_flags) {
101 if (pix_flag < flag) {
104 }
else if (pix_flag == flag) {
111 return {flag,
count};
119 for (
auto pix_flag : pixel_flags) {
120 if (pix_flag > flag) {
123 }
else if (pix_flag == flag) {
130 return {flag,
count};
137 for (
auto pix_flag : pixel_flags) {
138 counters[pix_flag] += 1;
142 for (
auto&
pair : counters) {
148 return {flag,
count};
154 template class ExternalFlagTask<ExternalFlagCombineTypes::Or>;
155 template class ExternalFlagTask<ExternalFlagCombineTypes::And>;
156 template class ExternalFlagTask<ExternalFlagCombineTypes::Min>;
157 template class ExternalFlagTask<ExternalFlagCombineTypes::Max>;
158 template class ExternalFlagTask<ExternalFlagCombineTypes::Most>;
static std::pair< std::int64_t, int > combine(const std::vector< FlagImage::PixelType > &pixel_flags)