Commit 1a0cfbcde9d07b87103b531db481349371d10368

Authored by Jordi Inglada
1 parent bc9957b6
Exists in master

COMP: changes so that gcc 4.7 compiles

Showing 1 changed file with 20 additions and 18 deletions   Show diff stats
code/src/algo/BaatzAlgorithm.txx
... ... @@ -165,24 +165,26 @@ BaatzAlgorithm<TInputImage>::Segmentation()
165 165 RegionPointerType bestneigh = nullptr;
166 166 bool prev_merged = true;
167 167  
168   - m_ComputeCostFunction = [&](RegionPointerType r1, RegionPointerType r2)->double
169   - {
170   - double spectral_h;
171   - double spatial_h;
172   - double cost = 0;
173   -
174   - spectral_h = ColorComponentCostFusion(r1, r2);
175   - cost += m_Parameters.m_ColorWeight * spectral_h;
176   -
177   - if(cost < m_Parameters.m_Scale)
178   - {
179   - spatial_h = CompactnessComponentCostFusion(r1, r2);
180   - cost += (1-m_Parameters.m_ColorWeight)*spatial_h;
181   - return cost;
182   - }
183   - else
184   - return cost;
185   - };
  168 + auto cw = m_Parameters.m_ColorWeight;
  169 + auto sc = m_Parameters.m_Scale;
  170 + m_ComputeCostFunction = [&](RegionPointerType r1, RegionPointerType r2)->double
  171 + {
  172 + double spectral_h;
  173 + double spatial_h;
  174 + double cost = 0;
  175 +
  176 + spectral_h = ColorComponentCostFusion(r1, r2);
  177 + cost += cw * spectral_h;
  178 +
  179 + if(cost < sc)
  180 + {
  181 + spatial_h = CompactnessComponentCostFusion(r1, r2);
  182 + cost += (1-cw)*spatial_h;
  183 + return cost;
  184 + }
  185 + else
  186 + return cost;
  187 + };
186 188  
187 189 while(curr_step < max_iter && prev_merged)
188 190 {
... ...