32 namespace SourceXtractor {
34 template<
typename Combine>
38 template<
typename Combine>
40 unsigned int flag_instance)
41 : m_flag_images(flag_images),
42 m_flag_instance(flag_instance) {
46 template<
typename Combine>
53 if (flag_image_acc.
getWidth() != detection_frame_info.getWidth() ||
54 flag_image_acc.
getHeight() != detection_frame_info.getHeight()) {
56 <<
"The flag image size does not match the detection image size: "
58 << detection_frame_info.getWidth() <<
"x" << detection_frame_info.getHeight();
63 pixel_flags.
push_back(flag_image_acc.getValue(coords.m_x, coords.m_y));
67 std::tie(flag, count) = Combine::combine(pixel_flags);
72 namespace ExternalFlagCombineTypes {
78 for (
auto pix_flag : pixel_flags) {
92 for (
auto pix_flag : pixel_flags) {
103 for (
auto pix_flag : pixel_flags) {
104 if (pix_flag < flag) {
107 }
else if (pix_flag == flag) {
114 return {flag, count};
122 for (
auto pix_flag : pixel_flags) {
123 if (pix_flag > flag) {
126 }
else if (pix_flag == flag) {
133 return {flag, count};
140 for (
auto pix_flag : pixel_flags) {
141 counters[pix_flag] += 1;
145 for (
auto&
pair : counters) {
146 if (
pair.second > count) {
151 return {flag, count};
157 template class ExternalFlagTask<ExternalFlagCombineTypes::Or>;
158 template class ExternalFlagTask<ExternalFlagCombineTypes::And>;
159 template class ExternalFlagTask<ExternalFlagCombineTypes::Min>;
160 template class ExternalFlagTask<ExternalFlagCombineTypes::Max>;
161 template class ExternalFlagTask<ExternalFlagCombineTypes::Most>;
static std::pair< std::int64_t, int > combine(const std::vector< FlagImage::PixelType > &pixel_flags)