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

Linux Cross Reference
Tina4/src/tools/stereo/left_view.c

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

  1 /**@(#)
  2 **/
  3 #include <stdio.h>
  4 #include <tina/sys.h>
  5 #include <tina/sysfuncs.h>
  6 #include <tina/math.h>
  7 #include <tina/vision.h>
  8 #include <tina/improcfuncs.h>
  9 #include <tina/tv.h>
 10 #include <tina/tvfuncs.h>
 11 #include <tina/toolsfuncs.h>
 12 #include <tina/draw.h>
 13 #include <tina/drawfuncs.h>
 14 
 15 Tv     *tv_create();
 16 
 17 static Bool image_on = true;
 18 static Bool edges_on;
 19 static Bool corners_on;
 20 static Bool strings_on;
 21 static Bool poly_on;
 22 
 23 void    left_image_on(Bool on)
 24 {
 25     image_on = on;
 26 }
 27 
 28 void    left_edges_on(Bool on)
 29 {
 30     edges_on = on;
 31 }
 32 
 33 void    left_corners_on(Bool on)
 34 {
 35     corners_on = on;
 36 }
 37 
 38 void    left_strings_on(Bool on)
 39 {
 40     strings_on = on;
 41 }
 42 
 43 void    left_poly_on(Bool on)
 44 {
 45     poly_on = on;
 46 }
 47 
 48 void    left_backdraw(Tv * tv)
 49 {
 50     Imrect *im = left_image();
 51 
 52     if (image_on && (im != NULL))
 53     {
 54         im = imf_scale(im, 0.0, 255.0);
 55         tv_imrect2(tv, im);
 56         im_free(im);
 57     }
 58 }
 59 
 60 void    left_fulldraw(Tv * tv)
 61 {
 62     Imrect *er = left_edges_get();
 63     Imrect *cnr = left_corners_get();
 64     List   *poly = left_geom_get();
 65 
 66     if (edges_on && (er != NULL))
 67         tv_edges_conn(tv, er);
 68     if (strings_on && (er != NULL))
 69         tv_strings(tv, er);
 70     if (corners_on && (cnr != NULL))
 71         tv_edges_conn(tv, cnr);
 72     if (poly_on && poly != NULL)
 73         reclist_list_draw(tv, poly, (int)NULL, geom_col_draw, NULL);
 74 }
 75 
 76 void    left_init(Tv * tv)
 77 {
 78     Imrect *im = left_image();
 79     Imrect *er = left_edges();
 80 
 81     if (im != NULL)
 82         tv_camera2_image(tv, im->width, im->height);
 83     else if (er != NULL)
 84         tv_camera2_image(tv, er->width, er->height);
 85 }
 86 
 87 void    left_skeldraw(Tv * tv)
 88 {
 89     Imrect *im = left_image();
 90     Imrect *er = left_edges();
 91     List   *poly = left_geom_get();
 92 
 93     if (image_on && (im != NULL))
 94         tv_imrect_skel(tv, im);
 95     else if ((edges_on || strings_on) && (er != NULL))
 96         tv_imrect_skel(tv, er);
 97     if (poly_on && poly != NULL)
 98         reclist_list_draw(tv, poly, (int)NULL, geom_draw, NULL);
 99 }
100 
101 Tv     *left_tv_make(void)
102 {
103     Tv     *tvleft = NULL;
104 
105     tvleft = tv_create("left");
106     (void) tv_set_backdraw(tvleft, left_backdraw);
107     (void) tv_set_fulldraw(tvleft, left_fulldraw);
108     (void) tv_set_skeldraw(tvleft, left_skeldraw);
109     tv_set_init(tvleft, left_init);
110     (void) tv_set_zoomlevel(tvleft, IMZOOM);
111     return (tvleft);
112 }
113 
114 void    left_grey(Tv * tv, Ipos pos)
115 {
116     Vec2    v = {Vec2_id};
117     Vec2    tv_backproj2();
118     Imrect *im = left_image();
119     int     x, y, val;
120 
121     v = tv_backproj2(tv, pos);
122     x = vec2_x(v);
123     y = vec2_y(v);
124     val = im_get_pix(im, y, x);
125 
126     format("pos %10d %10d:     grey level = %10d\n", x, y, val);
127 }
128 
129 Tv_mouse left_grey_mouse(void)
130 {
131     return (mouse_define(MOUSE_NAME, "grey mouse",
132                          LEFT_NAME, "grey",
133                          LEFT_DOWN, left_grey, NULL));
134 }
135 

~ [ 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.