~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/vision/stereo/choose.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 /* choose.c
  4  * 
  5  * Generic stereo functions for choosing best matches.
  6  * 
  7  * They only change the type field in the support structure assiociated
  8  * with each match.
  9  * 
 10  * Functions that also delete alternative matches and select the chosen
 11  * one can be found in select.c */
 12 
 13 #include <tina/sys.h>
 14 #include <tina/sysfuncs.h>
 15 #include <tina/math.h>
 16 #include <tina/mathfuncs.h>
 17 #include <tina/vision.h>
 18 #include <tina/visionfuncs.h>
 19 
 20 /* Chose the best match of an epipolar edge string. Based upon the
 21  * matching strength field of the support structure. Sets the support
 22  * type of the best match to GOOD_MATCH. Sets the support type for
 23  * contradictory matches to BAD_MATCH. */
 24 static void choose_best_match(Tstring * es)
 25 {
 26     List   *list;
 27     List   *ptr;
 28     Support *bestsup = NULL;
 29     float   max_strength = (float) 0.0;
 30 
 31     if (es == NULL)
 32         return;
 33 
 34     list = (List *) prop_get(es->props, MLIST);
 35 
 36     for (ptr = list; ptr != NULL; ptr = ptr->next)
 37     {
 38         Match  *match = (Match *) ptr->to;
 39         Support *sup;
 40 
 41         sup = (Support *) prop_get(match->props, MATCH_SUPPORT);
 42 
 43         if (sup->type <= BAD_MATCH)
 44             continue;
 45 
 46         sup->type = BAD_MATCH;
 47         if (bestsup == NULL || sup->matching_strength > max_strength)
 48         {
 49             bestsup = sup;
 50             max_strength = sup->matching_strength;
 51         }
 52     }
 53     if (bestsup != NULL)
 54         bestsup->type = GOOD_MATCH;
 55 }
 56 
 57 /* Choose the best match for all the epipolar edge strings that
 58  * constitute the global edge string. */
 59 void    es_choose_best_matches(Tstring * es)
 60 {
 61     es_apply_to_sindex_strings(es, choose_best_match, NULL);
 62 }
 63 
 64 /* Choose all matches in the match list. Set the support type of each
 65  * to GOOD_MATCH. Set the support type of contradictory matches to
 66  * BAD_MATCH. */
 67 void    choose_these_matches(List * mlist)
 68 {
 69     List   *clist;
 70     List   *mptr;
 71     List   *cptr;
 72 
 73     if (mlist == NULL)
 74         return;
 75 
 76     for (mptr = mlist; mptr != NULL; mptr = mptr->next)
 77     {
 78         Match  *match;
 79         Support *bestsup;
 80         Tstring *es;
 81 
 82         match = (Match *) mptr->to;
 83         es = (Tstring *) match->to1;
 84         bestsup = (Support *) prop_get(match->props, MATCH_SUPPORT);
 85         if (bestsup->type <= BAD_MATCH) /* already rejected */
 86             continue;
 87 
 88         clist = (List *) prop_get(es->props, MLIST);
 89 
 90         for (cptr = clist; cptr != NULL; cptr = cptr->next)
 91         {
 92             Match  *match = (Match *) cptr->to;
 93             Support *sup;
 94 
 95             sup = (Support *) prop_get(match->props, MATCH_SUPPORT);
 96             sup->type = BAD_MATCH;
 97         }
 98         bestsup->type = GOOD_MATCH;
 99     }
100 }
101 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.