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

Linux Cross Reference
Tina6/tina-tools/tinatool/tlbase/tlbaseSter_roi.c

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

  1 /**********
  2  * 
  3  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  4  * University of Manchester, UK.  All rights reserved.
  5  * 
  6  * Redistribution and use in source and binary forms, with or without modification, 
  7  * are permitted provided that the following conditions are met:
  8  * 
  9  *   . Redistributions of source code must retain the above copyright notice, 
 10  *     this list of conditions and the following disclaimer.
 11  *    
 12  *   . Redistributions in binary form must reproduce the above copyright notice,
 13  *     this list of conditions and the following disclaimer in the documentation 
 14  *     and/or other materials provided with the distribution.
 15  * 
 16  *   . Neither the name of the University of Manchester nor the names of its
 17  *     contributors may be used to endorse or promote products derived from this 
 18  *     software without specific prior written permission.
 19  * 
 20  * 
 21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 31  * POSSIBILITY OF SUCH DAMAGE.
 32  *
 33  **********
 34  * 
 35  * Program :    TINA
 36  * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/tlbase/tlbaseSter_roi.c,v $
 37  * Date    :  $Date: 2005/02/07 23:29:19 $
 38  * Version :  $Revision: 1.3 $
 39  * CVS Id  :  $Id: tlbaseSter_roi.c,v 1.3 2005/02/07 23:29:19 paul Exp $
 40  *
 41  * Author  :  Legacy TINA
 42  *
 43  * Notes : reading and writing of stereo ROI files
 44  *
 45  *********
 46 */
 47 
 48 #include "tlbaseSter_roi.h"
 49 
 50 #if HAVE_CONFIG_H
 51 #include <config.h>
 52 #endif
 53 
 54 #include <stdio.h>
 55 #include <sys/param.h>
 56 #include <string.h>
 57 #include <tina/sys/sysDef.h>
 58 #include <tina/sys/sysPro.h>
 59 #include <tina/image/imgDef.h>
 60 #include <tina/image/imgPro.h>
 61 #include <tinatool/draw/drawPro.h>
 62 #include <tinatool/tlbase/tlbase_InfrPro.h>
 63 #include <tinatool/tlbase/tlbaseSter_left.h>
 64 #include <tinatool/tlbase/tlbaseSter_right.h>
 65 
 66  
 67 void read_stereo_roi(char *fname)
 68 {
 69   FILE *fp = NULL;
 70   int lxl, lxr, uxl, uxr, lyl, lyr, uyl, uyr;
 71 
 72   if (fname == NULL)
 73     {
 74       error("read_stereo_roi : invalid filename", warning);
 75       return;
 76     }
 77 
 78   if ((fp = fopen(fname, "r")) == NULL)
 79     {
 80       error("read_stereo_roi : cannot open file", warning);
 81       return;
 82     }
 83 
 84   fscanf(fp, "%d %d %d %d ", &lxl, &lyl, &uxl, &uyl);
 85   fscanf(fp, "%d %d %d %d ", &lxr, &lyr, &uxr, &uyr);
 86   fclose(fp);
 87 
 88   tv_set_roi(left_tv_get(), roi_alloc(lxl, lyl, uxl, uyl));
 89   tv_set_roi(right_tv_get(), roi_alloc(lxr, lyr, uxr, uyr));
 90 }
 91 
 92 void write_stereo_roi(char *fname)
 93 {
 94   FILE *fp = NULL;
 95   Imregion *roil = NULL, *roir = NULL;
 96   
 97   if (fname == NULL)
 98     {
 99       error("write_stereo_roi : invalid filename", warning);
100       return;
101     }
102 
103   if ((fp = fopen(fname, "w")) == NULL)
104     {
105       error("write_stereo_roi : cannot open file", warning);
106       return;
107     }
108 
109   roil = tv_get_im_roi(left_tv_get());
110   roir = tv_get_im_roi(right_tv_get());
111 
112   if ((roil == NULL) || (roir == NULL))
113     {
114       error("write_stereo_roi : no left or right roi data", warning);
115       fclose(fp);
116       return;
117     }
118 
119   fprintf(fp, "%d %d %d %d ", roil->lx, roil->ly, roil->ux, roil->uy);
120   fprintf(fp, "%d %d %d %d ", roir->lx, roir->ly, roir->ux, roir->uy);
121   fclose(fp);
122 
123   rfree(roil);
124   rfree(roir);
125 }
126 
127 
128 

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