return 0;
}
- static diff_stat_t _align_element(ale_pos perturb, ale_pos local_lower,
- scale_cluster *scale_clusters, diff_stat_t here,
- ale_pos adj_p, ale_pos adj_o, ale_pos adj_b,
- ale_pos *current_bd, ale_pos *modified_bd,
- astate_t *astate, int lod, scale_cluster si) {
-
- /*
- * Run initial tests to get perturbation multipliers and error
- * centroids.
- */
-
- std::vector<d2::trans_single> t_set;
-
- here.get_perturb_set(&t_set, adj_p, adj_o, adj_b, current_bd, modified_bd);
-
- int stable_count = 0;
-
- while (perturb >= local_lower) {
-
- ui::get()->alignment_dims(scale_clusters[lod].accum->height(), scale_clusters[lod].accum->width(),
- scale_clusters[lod].input->height(), scale_clusters[lod].input->width());
-
- /*
- * Orientational adjustment value in degrees.
- *
- * Since rotational perturbation is now specified as an
- * arclength, we have to convert.
- */
-
- ale_pos adj_o = 2 * (double) perturb
- / sqrt(pow(scale_clusters[0].input->height(), 2)
- + pow(scale_clusters[0].input->width(), 2))
- * 180
- / M_PI;
-
- /*
- * Barrel distortion adjustment value
- */
-
- ale_pos adj_b = perturb * bda_mult;
-
- trans_single old_offset = here.get_offset();
-
- here.perturb_test(perturb, adj_p, adj_o, adj_b, current_bd, modified_bd,
- stable_count);
-
- if (here.get_offset() == old_offset)
- stable_count++;
- else
- stable_count = 0;
-
- if (stable_count == 3) {
-
- stable_count = 0;
-
- perturb *= 0.5;
-
- if (lod > 0
- && lod > lrint(log(perturb) / log(2)) - lod_preferred) {
-
- /*
- * Work with images twice as large
- */
-
- lod--;
- si = scale_clusters[lod];
-
- /*
- * Rescale the transforms.
- */
-
- ale_pos rescale_factor = (double) scale_factor
- / (double) pow(2, lod)
- / (double) here.get_offset().scale();
-
- here.rescale(rescale_factor, si);
-
- } else {
- adj_p = perturb / pow(2, lod);
- }
-
- /*
- * Announce changes
- */
-
- ui::get()->alignment_perturbation_level(perturb, lod);
- }
-
- ui::get()->set_match(here.get_error());
- ui::get()->set_offset(here.get_offset());
- }
-
- if (lod > 0) {
- ale_pos rescale_factor = (double) scale_factor
- / (double) here.get_offset().scale();
-
- here.rescale(rescale_factor, scale_clusters[0]);
- }
-
- return here;
- }
-
/*
* Check for satisfaction of the certainty threshold.
*/