00001 /* 00002 * @common Simple test program for experimental vips_hdrmerge (not available 00003 * publicly), obseleted by the hugin_hdrmerge tool. 00004 * 00005 * @author Pablo d'Angelo <pablo.dangelo@web.de> 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This software is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public 00018 * License along with this software; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 */ 00022 00023 /* compile with 00024 00025 g++ -g -Wall blend.cc `pkg-config vipsCC-7.11 --cflags --libs` 00026 00027 */ 00028 00029 #include <vips/vips> 00030 00031 #include <unistd.h> 00032 00033 using namespace vips; 00034 00035 int 00036 main (int argc, char **argv) 00037 { 00038 try 00039 { 00040 // 1 is the output image, the other args are input 00041 if (argc < 2) 00042 throw VError ("usage: out in1, in2 ...\n"); 00043 00044 std::vector<VImage> ins; 00045 int nin = argc - 2; 00046 int w=0, h=0; 00047 for (int i = 0; i < nin; i++) { 00048 VImage in (argv[i+2]); 00049 int nw = in.Xoffset() + in.Xsize(); 00050 int nh = in.Yoffset() + in.Ysize(); 00051 if (w < nw) w = nw; 00052 if (h < nh) h = nh; 00053 ins.push_back( in ); 00054 } 00055 00056 // embed in the output image 00057 for (int i = 0; i < nin; i++) { 00058 ins[i] = ins[i].embed (0, 00059 ins[i].Xoffset(), 00060 ins[i].Yoffset(), 00061 w, h); 00062 } 00063 00064 // perform the actual merge operations 00065 VImage out = VImage::hdrmerge(ins); 00066 out.write (argv[1]); 00067 } 00068 catch (VError err) 00069 { 00070 err.perror (argv[0]); 00071 } 00072 00073 return (0); 00074 }
1.3.9.1