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

Linux Cross Reference
Tina4/src/tools/sequence/seq_view.c

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

  1 /*
  2   seq_view.c
  3 
  4   Functions that setup and perform seqoral logical tv thingies
  5 
  6   author: a.lacey
  7   date  : 9-2-93;  version 1.0
  8           4.12.95; version 2.0
  9 */
 10 
 11 #include <stdio.h>
 12 #include <tina/sys.h>
 13 #include <tina/math.h>
 14 #include <tina/mathfuncs.h>
 15 #include <tina/tv.h>
 16 #include <tina/tvfuncs.h>
 17 #include <tina/vision.h>
 18 #include <tina/visionfuncs.h>
 19 #include <tina/image.h>
 20 #include <tina/draw.h>
 21 #include <tina/drawfuncs.h>
 22 #include <tina/seqdefs.h>
 23 #include <tina/seqoral.h>
 24 #include <tina/seqpro.h>
 25 
 26 #define TRFEATURE_C     yellow
 27 #define TRCP_C          red
 28 #define TRCV_C          green
 29 #define TRCA_C          blue
 30 #define TRMOD_C         violet
 31 
 32 
 33 static Bool      image_on;
 34 static Bool      edges_on;
 35 static Bool      corners_on;
 36 static Bool      text_on;
 37 static Bool      bmroi_on;
 38 static Bool      kalm_on;
 39 
 40 static int       cpos[4][2] = { {-24, 17}, {-24, -5}, {7, -5}, {7, 17} };
 41 
 42 
 43 void    seq_image_on(Bool on)
 44 {
 45   image_on = on;
 46 }
 47  
 48 
 49 void    seq_edges_on(Bool on)
 50 {
 51   edges_on = on;
 52 }
 53 
 54 
 55 void    seq_corners_on(Bool on)
 56 {
 57   corners_on = on;
 58 }
 59 
 60 
 61 void    seq_text_on(Bool on)
 62 {
 63   text_on = on;
 64 }
 65 
 66 
 67 void      label_to_text(int a, int b, char *st)
 68 {
 69   if (b < 0)
 70     sprintf(st, "%d", a);
 71   else
 72     sprintf(st, "%d:%d", a, b);
 73 }
 74 
 75 
 76 void      seq_show_text(Tv *tv)
 77 {
 78   Imrect   *im = (Imrect *)seq_image_get();
 79   char      mssg[512];
 80   Ipos      pos;
 81 
 82   if (im == NULL)
 83     return;
 84 
 85   pos = ipos(10, 10);
 86   tv_set_color(tv, red);
 87 
 88   sprintf(mssg, "Frame: %d", get_frame_no(im));
 89   tv_text(tv, mssg, pos);
 90 }
 91 
 92 
 93 
 94 void      seq_show_corners(Tv *tv)
 95 {
 96   Imrect        *im = (Imrect *)seq_image_get();
 97   Imrect        *imc = NULL;
 98 
 99   if (im == NULL)
100     return;
101 
102   if ((imc = (Imrect *)prop_get(im->props, TMPCNR_TYPE)) == NULL)
103     {
104       seq_corners_set(NULL);
105       return;
106     }
107 
108   seq_corners_set(imc);
109 
110 }
111 
112 
113 void     seq_show_edges(Tv *tv)
114 {
115   Imrect        *im = (Imrect *)seq_image_get();
116   Imrect        *ime = NULL;
117 
118   if (im == NULL)
119     return;
120 
121   if ((ime = (Imrect *)prop_get(im->props, TMPEDG_TYPE)) == NULL)
122     {
123           seq_edges_set(NULL);
124           return;
125     }
126 
127   seq_edges_set(ime);
128 
129 }
130 
131 
132 
133 void         seq_show_bits()
134 {
135   Tv    *tv = (Tv *)seq_tv_get();
136 
137   if (tv == NULL)
138     return;
139 
140   if (text_on)
141     seq_show_text(tv);
142 
143   if (corners_on)
144     seq_show_corners(tv);
145 
146   if (edges_on)
147     seq_show_edges(tv);
148 
149 }
150 
151 
152 
153 void        seq_backdraw(Tv *tv)
154 {
155   Imrect    *im = (Imrect *)seq_image_get();
156  
157   if (image_on && (im != NULL))
158   {
159      im = imf_scale(im, 0.0, 255.0);
160      tv_imrect2(tv, im);
161      im_free(im);
162   }
163 
164 }
165 
166  
167 void         seq_fulldraw(Tv *tv)
168 {
169   Imrect     *er = (Imrect *)seq_edges_get();
170   Imrect     *cnr = (Imrect *)seq_corners_get();
171  
172   if (edges_on && (er != NULL))
173     tv_edges_conn(tv, er);
174   if (corners_on && (cnr != NULL))
175     tv_edges_conn(tv, cnr);
176 }
177 
178 
179 
180 void          seq_skeldraw(Tv *tv)
181 {
182   Imrect     *im = (Imrect *)seq_image_get();
183   Imrect     *er = (Imrect *)seq_edges();
184  
185   tv_set_overlay(tv);
186   if (image_on && (im != NULL))
187     tv_imrect_skel(tv, im);
188   else if ((edges_on) && (er != NULL))
189     tv_imrect_skel(tv, er);
190   tv_reset_draw(tv);
191 }
192 
193 
194 void           seq_init(Tv *tv)
195 {
196   Imrect      *im = (Imrect *)seq_image_get();
197   Imrect      *er = (Imrect *)seq_edges();
198  
199   if (im != NULL)
200     tv_camera2_image(tv, im->width, im->height);
201   else if (er != NULL)
202     tv_camera2_image(tv, er->width, er->height);
203   seq_show_bits();
204 }
205 
206 
207 
208 Tv            *seq_tv_make(void)
209 {
210   Tv    *tvseq = NULL;
211 
212   tvseq = tv_create("sequence");
213   tv_set_backdraw(tvseq, seq_backdraw);
214   tv_set_fulldraw(tvseq, seq_fulldraw);
215   tv_set_skeldraw(tvseq, seq_skeldraw);
216   tv_set_zoomlevel(tvseq, IMZOOM);
217   tv_set_init(tvseq, seq_init);
218 
219   return (tvseq);
220 }
221 

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