From: <bl...@us...> - 2008-09-15 00:05:31
|
Revision: 3427 http://hugin.svn.sourceforge.net/hugin/?rev=3427&view=rev Author: blimbo Date: 2008-09-15 00:05:28 +0000 (Mon, 15 Sep 2008) Log Message: ----------- Now includes celeste standalone Modified Paths: -------------- hugin/branches/gsoc2008_sky_identification/src/celeste/CMakeLists.txt hugin/branches/gsoc2008_sky_identification/src/celeste/Celeste.cpp hugin/branches/gsoc2008_sky_identification/src/celeste/CelesteGlobals.cpp hugin/branches/gsoc2008_sky_identification/src/celeste/CelesteGlobals.h hugin/branches/gsoc2008_sky_identification/src/celeste/Makefile hugin/branches/gsoc2008_sky_identification/src/celeste/cmake_install.cmake hugin/branches/gsoc2008_sky_identification/src/foreign/tinysvm/CMakeLists.txt Added Paths: ----------- hugin/branches/gsoc2008_sky_identification/src/celeste/Features.cpp hugin/branches/gsoc2008_sky_identification/src/celeste/Features.h hugin/branches/gsoc2008_sky_identification/src/celeste/Main.cpp Modified: hugin/branches/gsoc2008_sky_identification/src/celeste/CMakeLists.txt =================================================================== --- hugin/branches/gsoc2008_sky_identification/src/celeste/CMakeLists.txt 2008-09-14 22:58:10 UTC (rev 3426) +++ hugin/branches/gsoc2008_sky_identification/src/celeste/CMakeLists.txt 2008-09-15 00:05:28 UTC (rev 3427) @@ -14,17 +14,28 @@ Utilities.cpp ) +SET(CELESTE_STANDALONE_SRC +CelesteGlobals.cpp +ContrastFilter.cpp +Features.cpp +Gabor.cpp +GaborFilter.cpp +GaborJet.cpp +ImageFile.cpp +LogPolar.cpp +Main.cpp +PGMImage.cpp +Utilities.cpp +../hugin_config.h +) + SET (CELESTE_MODEL data/celeste.model ) -#IF (${HUGIN_SHARED_LIBS}) -# add_library(celeste SHARED ${CELESTE_SRC}) -# set_target_properties(celeste PROPERTIES VERSION ${HUGIN_LIB_VERSION}) -# install(TARGETS celeste DESTINATION ${LIBDIR}) -#ELSE (${HUGIN_SHARED_LIBS}) -# add_library(celeste STATIC ${CELESTE_SRC}) -#ENDIF (${HUGIN_SHARED_LIBS}) - add_library(celeste STATIC ${CELESTE_SRC}) INSTALL(FILES ${CELESTE_MODEL} DESTINATION ${HUGINDATADIR}/xrc/data) + +ADD_EXECUTABLE(celeste_standalone ${CELESTE_STANDALONE_SRC} ) +TARGET_LINK_LIBRARIES(celeste_standalone tinysvm ${image_libs} vigraimpex) +INSTALL(TARGETS celeste_standalone DESTINATION ${BINDIR}) Modified: hugin/branches/gsoc2008_sky_identification/src/celeste/Celeste.cpp =================================================================== --- hugin/branches/gsoc2008_sky_identification/src/celeste/Celeste.cpp 2008-09-14 22:58:10 UTC (rev 3426) +++ hugin/branches/gsoc2008_sky_identification/src/celeste/Celeste.cpp 2008-09-15 00:05:28 UTC (rev 3427) @@ -88,7 +88,6 @@ importImage(info, destImage(in)); // Max dimension - const int resize_dimension = 820; double sizefactor = 1; int nw = 0, nh = 0; Modified: hugin/branches/gsoc2008_sky_identification/src/celeste/CelesteGlobals.cpp =================================================================== --- hugin/branches/gsoc2008_sky_identification/src/celeste/CelesteGlobals.cpp 2008-09-14 22:58:10 UTC (rev 3426) +++ hugin/branches/gsoc2008_sky_identification/src/celeste/CelesteGlobals.cpp 2008-09-15 00:05:28 UTC (rev 3427) @@ -34,3 +34,5 @@ // Spacing between fiducial points int spacing = (gRadius * 2) + 1; + +int resize_dimension = 820; Modified: hugin/branches/gsoc2008_sky_identification/src/celeste/CelesteGlobals.h =================================================================== --- hugin/branches/gsoc2008_sky_identification/src/celeste/CelesteGlobals.h 2008-09-14 22:58:10 UTC (rev 3426) +++ hugin/branches/gsoc2008_sky_identification/src/celeste/CelesteGlobals.h 2008-09-15 00:05:28 UTC (rev 3427) @@ -12,6 +12,7 @@ extern int gNumLocs; extern int **gLocations; extern int spacing; +extern int resize_dimension; #endif Added: hugin/branches/gsoc2008_sky_identification/src/celeste/Features.cpp =================================================================== --- hugin/branches/gsoc2008_sky_identification/src/celeste/Features.cpp (rev 0) +++ hugin/branches/gsoc2008_sky_identification/src/celeste/Features.cpp 2008-09-15 00:05:28 UTC (rev 3427) @@ -0,0 +1,563 @@ +/*************************************************************************** + * Copyright (C) 2008 by Tim Nugent * + * tim...@gm... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <iostream> +#include "vigra/stdimage.hxx" +#include "vigra/resizeimage.hxx" +#include "vigra/impex.hxx" +#include "vigra/colorconversions.hxx" +#include <sys/types.h> +#include <sys/stat.h> +#include <stdlib.h> +#include "Gabor.h" +#include "Utilities.h" +#include "CelesteGlobals.h" +#include <tinysvm.h> + +using namespace vigra; +using namespace std; + +typedef vigra::BRGBImage::PixelType RGB; + +string add_feature(string& feature_string,int feature_number,float feature_value){ + + // Convert int and float values to string + string f; + stringstream out_feature; + out_feature << feature_number; + f = out_feature.str(); + + feature_string.append(f); + feature_string.append(":"); + + stringstream out_value; + out_value << feature_value; + f = out_value.str(); + + feature_string.append(f); + feature_string.append(" "); + + //cout << feature_string << endl; + + return(feature_string); + +} + +void get_gabor_response(string& imagefile,vector<string>& gabor_responses, unsigned int& mask, TinySVM::Model& m,float& +threshold,string& mask_format,vector<unsigned int>& ignore_cp){ + + try{ + + cout << "Generating feature vector by Gabor filtering..." << endl; + cout << "Opening image file:\t" << imagefile << endl; + + // Read image given as first argument + // File type is determined automatically + vigra::ImageImportInfo info(imagefile.c_str()); + + // Create RGB images of appropriate size + vigra::FRGBImage in(info.width(), info.height()); + + // Import the image + importImage(info, destImage(in)); + + // Max dimension + double sizefactor = 1; + int nw = info.width(), nh = info.height(); + + // In case we want to save filters + // Create this directory and change option in Globals.cpp + char basename[] = "gabor_filters/celeste"; + + if (info.width() >= info.height()){ + if (resize_dimension >= info.width() ){ + resize_dimension = info.width(); + } + }else{ + if (resize_dimension >= info.height()){ + resize_dimension = info.height(); + } + } + //cout << "Re-size dimenstion:\t" << resize_dimension << endl; + + cout << "Image dimensions:\t" << info.width() << " x " << info.height() << endl; + + // Re-size to max dimension + if (info.width() > resize_dimension || info.height() > resize_dimension){ + + if (info.width() >= info.height()){ + + + sizefactor = (double)resize_dimension/info.width(); + + // calculate new image size + nw = resize_dimension; + nh = static_cast<int>(0.5 + (sizefactor*info.height())); + + }else{ + sizefactor = (double)resize_dimension/info.height(); + + + // calculate new image size + nw = static_cast<int>(0.5 + (sizefactor*info.width())); + nh = resize_dimension; + + } + + cout << "Scaling by:\t\t" << sizefactor << endl; + cout << "New dimensions:\t\t" << nw << " x " << nh << endl; + + // create a RGB image of appropriate size + vigra::FRGBImage out(nw, nh); + + // resize the image, using a bi-cubic spline algorithm + resizeImageNoInterpolation(srcImageRange(in),destImageRange(out)); + + in = out; + + }else{ + //cout << "Image dimensions:\t" << info.width() << " x " << info.height() << endl; + } + + //cout << "Total pixels:\t\t" << in.width()*in.height() << endl; + + // Convert to LUV colour space + //cout << "Converting to LUV colourspace..." << endl; + + FRGBImage luv(in.width(),in.height()); + transformImage(srcImageRange(in), destImage(luv), RGBPrime2LuvFunctor<double>() ); + + //cout << "Total fiducial points: " << gNumLocs << endl; + + // Prepare Gabor API array + float *frameBuf = new float[in.width()*in.height()]; + float *u_values = new float[in.width()*in.height()]; + float *v_values = new float[in.width()*in.height()]; + float** pixels = CreateMatrix( (float)0, in.height(), in.width() ); + + // Do something with each pixel... + unsigned int counter = 0; + vigra::FRGBImage::iterator img_iter(luv.begin()),end(luv.end()); + for(; img_iter != end; ++img_iter) { + + // [0] is L, [1] is U, [2] is V + // We only want L for Gabor filtering + frameBuf[counter] = (*img_iter)[0]; + + u_values[counter] = (*img_iter)[1]; + v_values[counter] = (*img_iter)[2]; + + //cout << "Pixel " << counter << " - L: " << (*img_iter)[0] << endl; + //cout << "Pixel " << counter << " - U: " << (*img_iter)[1] << endl; + //cout << "Pixel " << counter << " - V: " << (*img_iter)[2] << endl; + counter++; + } + + // Prepare framebuf for Gabor API + unsigned int k = 0; + for (int i = 0; i < in.height(); i++ ){ + for (int j = 0; j < in.width(); j++ ){ + pixels[i][j] = frameBuf[k]; + //cout << i << " " << j << " = " << k << " - " << frameBuf[k] << endl; + k++; + } + } + + if (gNumLocs){ + + float *response = NULL; + int len = 0; + + // Scale control points by sizefactor + for (int j = 0; j < gNumLocs; j++){ + + //cout << sizefactor << ": " << gLocations[j][0] << "," << gLocations[j][1] << " ---> "; + gLocations[j][0] = int(gLocations[j][0] * sizefactor); + gLocations[j][1] = int(gLocations[j][1] * sizefactor); + //cout << gLocations[j][0] << "," << gLocations[j][1] << endl; + + // Ignore control points that are too close to the border + if ((gLocations[j][0] >= gRadius + 1)&&(gLocations[j][1] >= gRadius + 1)&&(gLocations[j][0] <= nw - gRadius - 1)&&(gLocations[j][1] <= nh - gRadius - 1)){ + + ignore_cp.push_back(0); + + }else{ + + //cout << "Bad CP " << gLocations[j][0] << "," << gLocations[j][1] << endl; + ignore_cp.push_back(1); + gLocations[j][0] = gRadius + 1; + gLocations[j][1] = gRadius + 1; + } + + + // Check CPs are ok - add them to reduced image in red + //in(gLocations[j][0],gLocations[j][1]) = vigra::FRGBImage::PixelType(255,0,0); + + } + + // Do Gabor filtering + response = ProcessChannel( pixels, in.height(), in.width(), response, &len, basename ); + + // Turn the response into SVM vector, and add colour features + + int vector_length = (int)len/gNumLocs; + + for (int j = 0; j < gNumLocs; j++){ + + int pixel_number = gLocations[j][0] + (in.width() * (gLocations[j][1] - 1)) - 1; + + // Apply label + + // SVM light style + string feature_vector = ("0 "); + // Tiny SVM style + //string feature_vector = (""); + + unsigned int feature = 1; + + for ( int v = (j * vector_length); v < ((j + 1) * vector_length); v++){ + + feature_vector = add_feature(feature_vector,feature,response[v]); + feature++; + } + + + // Work out average colour - U + V channels + + float u_sum = 0, v_sum = 0; + unsigned int pixels_in_region = (gRadius * 2)*(gRadius * 2); + + for (int t = 1 - gRadius; t <= gRadius; t++){ + + unsigned int this_y_pixel = pixel_number + (t * in.width()); + + for (int r = 1 - gRadius; r <= gRadius; r++){ + + unsigned int this_x_pixel = this_y_pixel + r; + + //if (this_x_pixel == pixel_number){ + // cout << "*" << this_x_pixel << "* "; + //}else{ + // cout << this_x_pixel << " "; + //} + + u_sum += u_values[this_x_pixel]; + v_sum += v_values[this_x_pixel]; + + //cout << "u = " << u_values[this_x_pixel] << "(" << u_sum << ")" << endl; + //cout << "v = " << v_values[this_x_pixel] << "(" << v_sum << ")" << endl; + + } + //cout << endl; + } + //cout << endl; + + float u_ave = (float)u_sum/pixels_in_region; + float v_ave = (float)v_sum/pixels_in_region; + + // Now work out standard deviation for U and V channels + u_sum = 0, v_sum = 0; + + for (int t = 1 - gRadius; t <= gRadius; t++){ + + unsigned int this_y_pixel = pixel_number + (t * in.width()); + + for (int r = 1 - gRadius; r <= gRadius; r++){ + + unsigned int this_x_pixel = this_y_pixel + r; + + u_sum += pow(u_values[this_x_pixel]-u_ave,2); + v_sum += pow(v_values[this_x_pixel]-v_ave,2); + + } + } + + + float std_u = sqrt(u_sum/(pixels_in_region-1)); + float std_v = sqrt(v_sum/(pixels_in_region-1)); + + //cout << "U sum = " << u_sum << " U ave = " << u_ave << " U std = " << std_u << endl; + //cout << "V sum = " << v_sum << " V ave = " << v_ave << " V std = " << std_v << endl << endl; + + // Add these colour features to feature vector string + + + feature_vector = add_feature(feature_vector,feature,u_ave); + feature++; + feature_vector = add_feature(feature_vector,feature,std_u); + feature++; + feature_vector = add_feature(feature_vector,feature,v_ave); + feature++; + feature_vector = add_feature(feature_vector,feature,std_v); + feature++; + feature_vector = add_feature(feature_vector,feature,u_values[pixel_number]); + feature++; + feature_vector = add_feature(feature_vector,feature,v_values[pixel_number]); + + gabor_responses.push_back(feature_vector); + + //cout << feature_vector << endl; + + } + + delete[] response; + response = NULL; + + } + + // Create mask + if (mask){ + + // Create mask file name + string mask_name = (""); + if (imagefile.substr(imagefile.length()-4,1) == (".")){ + + mask_name.append(imagefile.substr(0,imagefile.length()-4)); + + }else{ + + mask_name.append(imagefile.substr(0,imagefile.length()-4)); + } + mask_name.append("_mask."); + mask_name.append(mask_format); + + cout << "Generating mask:\t" << mask_name << endl; + // Create mask of same dimensions + vigra::BRGBImage mask_out(nw, nh); + + // Set mask to white + vigra::initImage(srcIterRange(mask_out.upperLeft(), + mask_out.upperLeft() + vigra::Diff2D(nw,nh)), + RGB(255,255,255) ); + + float *mask_response = NULL; + gLocations = NULL; + gNumLocs = 0; + + // Create grid of fiducial points + for (int i = gRadius; i < in.height() - gRadius; i += spacing ){ + for (int j = gRadius; j < in.width() - gRadius; j += spacing ){ + gNumLocs++; + } + // Add extra FP at the end of each row in case nw % gRadius + gNumLocs++; + } + + // Add extra FP at the end of each row in case nh % gRadius + for (int j = gRadius; j < in.width() - gRadius; j += spacing ){ + gNumLocs++; + } + + // Create the storage matrix + gLocations = CreateMatrix( (int)0, gNumLocs, 2); + gNumLocs = 0; + for (int i = gRadius; i < in.height() - gRadius; i += spacing ){ + for (int j = gRadius; j < in.width() - gRadius; j += spacing ){ + + gLocations[gNumLocs][0] = j; + gLocations[gNumLocs][1] = i; + //cout << "fPoint " << gNumLocs << ":\t" << i << " " << j << endl; + gNumLocs++; + } + + // Add extra FP at the end of each row in case nw % spacing + if (nw % spacing){ + + gLocations[gNumLocs][0] = nw - gRadius - 1; + gLocations[gNumLocs][1] = i; + //cout << "efPoint " << gNumLocs << ":\t" << i << " " << nw - gRadius - 1 << endl; + gNumLocs++; + } + + } + + // Add extra FP at the end of each row in case nh % spacing + if (nh % spacing){ + + for (int j = gRadius; j < in.width() - gRadius; j += spacing ){ + + gLocations[gNumLocs][0] = j; + gLocations[gNumLocs][1] = nh - gRadius - 1; + //cout << "efPoint " << gNumLocs << ":\t" << nh - gRadius - 1 << " " << j << endl; + gNumLocs++; + + } + } + + //cout << "Total FPs:\t" << gNumLocs << endl; + + int len = 0; + //cout << "Pre-response " << in.height() << ","<< in.width() << endl; + mask_response = ProcessChannel( pixels, in.height(), in.width(), mask_response, &len, basename ); + //cout << "Post-response" << endl; + + // Turn the response into SVM vector, and add colour features + + int vector_length = (int)len/gNumLocs; + + for ( int j = 0; j < gNumLocs; j++ ){ + + //cout << j << ":"<<endl; + + unsigned int pixel_number = gLocations[j][0] + (in.width() * (gLocations[j][1] - 1)) - 1; + + // Apply label + // SVM light style + string feature_vector = ("0 "); + // Tiny SVM style + //string feature_vector = (""); + + unsigned int feature = 1; + + for ( int v = (j * vector_length); v < ((j + 1) * vector_length); v++){ + + feature_vector = add_feature(feature_vector,feature,mask_response[v]); + feature++; + } + + // Work out average colour - U + V channels + + float u_sum = 0, v_sum = 0; + int pixels_in_region = (gRadius * 2)*(gRadius * 2); + + for (int t = 1 - gRadius; t <= gRadius; t++){ + + unsigned int this_y_pixel = pixel_number + (t * in.width()); + + for (int r = 1 - gRadius; r <= gRadius; r++){ + + unsigned int this_x_pixel = this_y_pixel + r; + + u_sum += u_values[this_x_pixel]; + v_sum += v_values[this_x_pixel]; + + } + } + + float u_ave = (float)u_sum/pixels_in_region; + float v_ave = (float)v_sum/pixels_in_region; + + // Now work out standard deviation for U and V channels + u_sum = 0, v_sum = 0; + + for (int t = 1 - gRadius; t <= gRadius; t++){ + + unsigned int this_y_pixel = pixel_number + (t * in.width()); + + for (int r = 1 - gRadius; r <= gRadius; r++){ + + unsigned int this_x_pixel = this_y_pixel + r; + + u_sum += pow(u_values[this_x_pixel]-u_ave,2); + v_sum += pow(v_values[this_x_pixel]-v_ave,2); + + } + } + + float std_u = sqrt(u_sum/(pixels_in_region-1)); + float std_v = sqrt(v_sum/(pixels_in_region-1)); + + // Add these colour features to feature vector string + + feature_vector = add_feature(feature_vector,feature,u_ave); + feature++; + feature_vector = add_feature(feature_vector,feature,std_u); + feature++; + feature_vector = add_feature(feature_vector,feature,v_ave); + feature++; + feature_vector = add_feature(feature_vector,feature,std_v); + feature++; + feature_vector = add_feature(feature_vector,feature,u_values[pixel_number]); + feature++; + feature_vector = add_feature(feature_vector,feature,v_values[pixel_number]); + + //cout << "Pixel " << gLocations[j][0] << "," << gLocations[j][1] << ":\t"; + + if (m.classify(feature_vector.c_str()) > threshold){ + + //cout << "Cloud\t\t(score " << m.classify(feature_vector.c_str()) << " > " << threshold << ")" << endl; + + unsigned int sub_x0 = gLocations[j][0] - gRadius; + unsigned int sub_y0 = gLocations[j][1] - gRadius; + unsigned int sub_x1 = gLocations[j][0] + gRadius + 1; + unsigned int sub_y1 = gLocations[j][1] + gRadius + 1; + + //cout << sub_x0 << ","<< sub_y0 << " - " << sub_x1 << "," << sub_y1 << endl; + + // Set region to black + vigra::initImage(srcIterRange(mask_out.upperLeft() + vigra::Diff2D(sub_x0, sub_y0), + mask_out.upperLeft() + vigra::Diff2D(sub_x1, sub_y1)), + RGB(0,0,0) ); + + + }else{ + + //cout << "Non-cloud\t(score " << m.classify(feature_vector.c_str()) << " <= " << threshold << ")" << endl; + + } + + //cout << feature_vector << endl; + + } + + delete [] mask_response; + mask_response = NULL; + + // Re-size mask to match original image + vigra::BRGBImage mask_resize(info.width(),info.height()); + + resizeImageNoInterpolation(srcImageRange(mask_out),destImageRange(mask_resize)); + + exportImage(srcImageRange(mask_resize), ImageExportInfo(mask_name.c_str())); + + } + + //cout << "Deleting... " << endl; + + delete[] frameBuf; + frameBuf = NULL; + + //cout << "Deleting... " << endl; + + delete [] u_values; + u_values = NULL; + + //cout << "Deleting... " << endl; + + delete [] v_values; + v_values = NULL; + + //cout << "Deleting... " << endl; + + gNumLocs = 0; + + cout << endl; + + }catch (vigra::StdException & e){ + + // catch any errors that might have occured and print their reason + cout << "Unable to open file:\t" << imagefile << endl << endl; + cout << e.what() << endl; + exit(1); + + } + +} + Added: hugin/branches/gsoc2008_sky_identification/src/celeste/Features.h =================================================================== --- hugin/branches/gsoc2008_sky_identification/src/celeste/Features.h (rev 0) +++ hugin/branches/gsoc2008_sky_identification/src/celeste/Features.h 2008-09-15 00:05:28 UTC (rev 3427) @@ -0,0 +1,12 @@ +#ifndef __FEAUTRES__ +#define __FEATURES__ + +#include <tinysvm.h> + +string add_feature(string&, int, float); + +void get_gabor_response(string&,vector<string>&,unsigned int&, TinySVM::Model&, float&, +string&,vector<unsigned int>&); + +#endif + Added: hugin/branches/gsoc2008_sky_identification/src/celeste/Main.cpp =================================================================== --- hugin/branches/gsoc2008_sky_identification/src/celeste/Main.cpp (rev 0) +++ hugin/branches/gsoc2008_sky_identification/src/celeste/Main.cpp 2008-09-15 00:05:28 UTC (rev 3427) @@ -0,0 +1,592 @@ +/*************************************************************************** + * Copyright (C) 2008 by Tim Nugent * + * tim...@gm... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <stdio.h> +#include <fstream> +#include <iostream> +#include <sstream> +#include <vector> +#include <cctype> +#include "CelesteGlobals.h" +#include "Utilities.h" +#include "Features.h" +#include <tinysvm.h> +#include <sys/stat.h> +#include "hugin_config.h" + +using namespace std; + +bool fileexists(string strFilename) { + + struct stat stFileInfo; + bool blnReturn; + int intStat; + + // Attempt to get the file attributes + intStat = stat(strFilename.c_str(),&stFileInfo); + if(intStat == 0) { + + blnReturn = true; + }else{ + + blnReturn = false; + } + + return(blnReturn); +} + +static void tokenize(const string& str, vector<string>& tokens, const string& delimiters = " "){ + + // Skip delimiters at beginning + string::size_type lastPos = str.find_first_not_of(delimiters, 0); + + // Find first non-delimiter + string::size_type pos = str.find_first_of(delimiters, lastPos); + + while (string::npos != pos || string::npos != lastPos){ + + // Found a token, add it to the vector + tokens.push_back(str.substr(lastPos, pos - lastPos)); + + // Skip delimiters. Note the not_of + lastPos = str.find_first_not_of(delimiters, pos); + + // Find next non-delimiter + pos = str.find_first_of(delimiters, lastPos); + } + +} + +static void parse_pto(string& f,vector<string>& images,vector<string>& pto_file_top,vector<string>& +pto_file_cps,vector<string>& pto_file_end,vector<string>& gabor_responses, unsigned int& mask, TinySVM::Model& m,float +threshold,string& mask_format,vector<unsigned int>& ignore_cp){ + + // Create some vectors to store image and control point data + vector<unsigned int> xcps; + vector<unsigned int> ycps; + + // Open the .pto file and make sure it's good to go + ifstream is(f.c_str()); + + if(!is.good()){ + cout << "Couldn't open Hugin project file " << f << endl << endl; + exit(1); + } + + // Get line from stream + string line; + unsigned int current = 0, counter = 0, at_cps = 0, done_cps = 0; + + while(getline(is,line)){ + + string start = line.substr(0, 1); + string autopano_start = line.substr(0, 9); + + if (at_cps == 0){ + pto_file_top.push_back(line); + } + + if (start == ("i") || autopano_start == ("#-imgfile")){ + + // Parse images from lines beginning 'i' + + //vector<string> tokens; + //tokenize(line, tokens); + //string imagename = tokens.back().substr(2, tokens.back().length()-3); + + size_t found; + string imagename = (""); + + // Hugin files + if (start == ("i")){ + + found = line.find("\""); + imagename = line.substr(found + 1, line.length() - found - 2); + //cout << imagename << endl; + + // (Old?) Autopano Pro files + }else{ + + found = line.find("\""); + imagename = line.substr(found + 1, line.length() - found - 2); + + } + + if (fileexists(imagename)){ + + // Put filenames into a vector + images.push_back(imagename); + + // Seach for the image if we can't find it, using path of PTO file + }else{ + + //cout << imagename << " doesn't exist." << endl; + + vector<string> tokens; + imagename = (""); + + // *nix file paths + if (f.find("/") < f.length() || f.substr(0, 1) == ("/")){ + + if (f.substr(0, 1) == ("/")){ + imagename += ("/"); + } + + tokenize(f, tokens, "/"); + for (unsigned int p = 0; p < tokens.size() - 1; p++){ + imagename += tokens[p]; + imagename += "/"; + } + imagename += line.substr(found + 1, line.length() - found - 2); + + // Windows file paths... experimental! + }else{ + + tokenize(f, tokens, "\\"); + for (unsigned int p = 0; p < tokens.size() - 1; p++){ + imagename += tokens[p]; + imagename += "\\"; + } + imagename += line.substr(found + 1, line.length() - found - 2); + + } + + //cout << "New search path " << imagename << endl; + + if (fileexists(imagename)){ + + // Put filenames into a vector + images.push_back(imagename); + + }else{ + + cout << "Couldn't open image " << line.substr(found + 2, line.length() - found - + 3) << endl; + + cout << "Also tried " << imagename << endl << endl; + exit(1); + } + } + + //cout << imagename << endl; + + + }else if (start == ("c")){ + + pto_file_cps.push_back(line); + //cout << line << endl; + + // Marker - we're at CPs + at_cps = 1; + + vector<string> tokens; + tokenize(line, tokens); + + // Image number for accessing images vector + unsigned int image_no = atoi( tokens[1].substr(1, tokens[1].length()-1).c_str() ); + + if (image_no != current){ + + // Create the storage matrix + gNumLocs = xcps.size(); + gLocations = CreateMatrix( (int)0, gNumLocs, 2); + + //cout << images[current] << " " << image_no << " (" << xcps.size() << "):" << endl; + + for (int cp = 0; cp < gNumLocs; cp++){ + + //cout << "CP " << cp << ": " << xcps[cp] << "," << ycps[cp] << endl; + + gLocations[cp][0] = xcps[cp]; + gLocations[cp][1] = ycps[cp]; + + } + + // Get response + get_gabor_response(images[current],gabor_responses,mask,m,threshold,mask_format,ignore_cp); + + gLocations = NULL; + + xcps.clear(); + ycps.clear(); + current = image_no; + + // First CP of next image + + // Control point x + unsigned int xcp = atoi( tokens[3].substr(1, tokens[3].length()-1).c_str() ); + xcps.push_back(xcp); + + // Control point y + unsigned int ycp = atoi( tokens[4].substr(1, tokens[4].length()-1).c_str() ); + ycps.push_back(ycp); + + counter = 1; + + }else{ + + // Control point x + unsigned int xcp = atoi( tokens[3].substr(1, tokens[3].length()-1).c_str() ); + xcps.push_back(xcp); + + // Control point y + unsigned int ycp = atoi( tokens[4].substr(1, tokens[4].length()-1).c_str() ); + ycps.push_back(ycp); + + counter++; + + //cout << images[image_no] << " : " << xcp << "," << ycp << endl; + } + + }else if (at_cps && start != ("c") && start != ("#") && done_cps == 0){ + + // Create the storage matrix + gNumLocs = xcps.size(); + gLocations = CreateMatrix( (int)0, gNumLocs, 2); + + //cout << images[current] << " " << current << " (" << xcps.size() << "):" << endl; + + for (unsigned int cp = 0; cp < counter; cp++){ + + //cout << "CP " << cp << ": " << xcps[cp] << "," << ycps[cp] << endl; + + gLocations[cp][0] = xcps[cp]; + gLocations[cp][1] = ycps[cp]; + + } + + // Get response + get_gabor_response(images[current],gabor_responses,mask,m,threshold,mask_format,ignore_cp); + + gLocations = NULL; + + xcps.clear(); + ycps.clear(); + + done_cps = 1; + + } + + if (at_cps && start != ("c")){ + + pto_file_end.push_back(line); + + } + + } + + // Process last image + if (images.size() > 1){ + + gNumLocs = 0; + get_gabor_response(images.back(),gabor_responses,mask,m,threshold,mask_format,ignore_cp); + + } + + // Close stream + is.close(); + +} + +static void tiny_svm_classify(string& model_file,vector<string>& gabor_responses,vector<double>& svm_responses, TinySVM::Model& m){ + + // Put the responses in a vector + for (unsigned int s = 0; s < gabor_responses.size(); s++){ + + svm_responses.push_back(m.classify(gabor_responses[s].c_str())); + + //cout << m.classify(gabor_responses[s].c_str()) << endl; + //cout << gabor_responses[s] << endl; + } + +} + +static void write_pto(float& threshold,vector<string>& images,string& output_pto,vector<string>& +pto_file_top,vector<string>& pto_file_cps,vector<string>& pto_file_end,vector<double> svm_responses,vector<unsigned int>& ignore_cp){ + + // File to write to + ofstream out; + out.open (output_pto.c_str()); + + if(!out.good()){ + cout << "Couldn't write to Hugin project file " << output_pto << endl << endl; + exit(1); + } + + // Print the top of the file + for (unsigned int l = 0; l < pto_file_top.size() - 1; l++){ + + out << pto_file_top[l] << endl; + + } + + unsigned int current = 0; + + cout << images[current] << ":" << endl; + + // Print control points + for (unsigned int l = 0; l < pto_file_cps.size(); l++){ + + //cout << l << ": " << pto_file_cps[l] << endl; + + vector<string> tokens; + tokenize(pto_file_cps[l], tokens); + unsigned int image_no = atoi( tokens[1].substr(1, tokens[1].length()-1).c_str() ); + if (image_no != current){ + cout << endl << images[image_no] << ":" << endl; + } + current = image_no; + + cout << "CP "; + unsigned int len = 0; + for (unsigned int t = 1; t < 7; t++){ + len += tokens[t].length(); + cout << tokens[t] << " "; + } + + //cout << pto_file_cps[l] << "\t"; + + for (unsigned int s = 0; s < 60 - len; s++){ + cout << " "; + } + + if (ignore_cp[l]){ + + // CP is too close to border so ignored + cout << "OK (score N/A)" << endl; + + out << pto_file_cps[l] << endl; + + }else{ + + if (svm_responses[l] > threshold){ + cout << "Removed (score " << svm_responses[l] << " > " << threshold << ")" << endl; + }else{ + cout << "OK (score " << svm_responses[l] << " <= " << threshold << ")" << endl; + + // Write to file + out << pto_file_cps[l] << endl; + + } + } + } + + // Print bottom of file + for (unsigned int l = 0; l < pto_file_end.size(); l++){ + + out << pto_file_end[l] << endl; + + } + + out.close(); + +} + +static void usage(){ + + // Print usage and exit + cout << endl << "Celeste: Removes cloud-like control points from Hugin project files and creates image masks" << endl; + cout << "using Support Vector Machines." << endl; + cout << endl << "Version 1.0.1" << endl; + cout << endl << "Usage: celeste [options] image1 image2 [..]" << endl << endl; + cout << "Options:" << endl << endl; + cout << " -i <filename> Input Hugin PTO file. Control points over SVM threshold will" << endl; + cout << " be removed before being written to the output file. If -m is" << endl; + cout << " set to 1, images in the file will be also be masked." << endl; + cout << " -o <filename> Output Hugin PTO file. Default: '<filename>_celeste.pto'" << endl; + cout << " -d <filename> SVM model file. Default: 'data/celeste.model'" << endl; + cout << " -s <int> Maximum dimension for re-sized image prior to processing. A" << endl; + cout << " higher value will increase the resolution of the mask but is" << endl; + cout << " significantly slower. Default: 800" << endl; + cout << " -t <float> SVM threshold. Raise this value to remove fewer control points," << endl; + cout << " lower it to remove more. Try the range -1 to +1. Default: 0" << endl; + cout << " -m <1|0> Create masks when processing Hugin PTO file. Default: 0" << endl; + cout << " -f <string> Mask file format. Options are PNG, JPEG, BMP, GIF and TIFF." << endl; + cout << " Default: PNG" << endl; + cout << " -r <1|0> Filter radius. 0 = large (more accurate), 1 = small (higher" << endl; + cout << " resolution mask, slower, less accurate). Default: 0" << endl; + cout << " -h Print usage." << endl; + cout << " image1 image2.. Image files to be masked." << endl << endl; + exit(1); + +} + +int main(unsigned int argc, const char* argv[]){ + + // Exit with usage unless filename given as argument + if (argc < 2){ + usage(); + } + + unsigned int i = 1, mask = 0; + float threshold = 0; + vector<string> images_to_mask; + string pto_file = (""),output_pto = (""); + string mask_format = ("PNG"); + string model_file = ("data/celeste.model"); + int course_fine = 0; + + // Deal with arguments + while(i < argc){ + + if( argv[i][0] == '-'){ + + if (argc == 2){ + usage(); + } + + i++; + switch(argv[i-1][1]){ + + // Put some more argument options in here later + case 'h' : {usage();} + case 'i' : {pto_file += argv[i]; break;} + case 'o' : {output_pto += argv[i]; break;} + case 't' : {threshold = atof(argv[i]); break;} + case 'm' : {mask = atoi(argv[i]); break;} + case 'f' : {mask_format = argv[i]; break;} + case 'd' : {model_file = argv[i]; break;} + case 'r' : {course_fine = atoi(argv[i]); break;} + case 's' : {resize_dimension = atoi(argv[i]); break;} + } + + + }else{ + images_to_mask.push_back(argv[i]); + //pto_file = argv[i]; + } + + i++; + } + + // Check model file + if (!fileexists(model_file)){ + + string install_path_model = (INSTALL_XRC_DIR); + install_path_model.append(model_file); + + if (!fileexists(install_path_model)){ + + cout << endl << "Couldn't open SVM model file " << model_file << endl; + cout << "Also tried " << install_path_model << endl << endl; + exit(1); + + }else{ + + model_file = install_path_model; + + } + } + + // Open SVM model file + TinySVM::Model m; + + if (! m.read(model_file.c_str())) throw; + + // Set output .pto filename if not given + if (output_pto == ("") && pto_file != ("")){ + output_pto = pto_file.substr(0,pto_file.length()-4).append("_celeste.pto"); + //("celeste_output.pto"); + } + + // Convert mask format to upper case + transform(mask_format.begin(), mask_format.end(), mask_format.begin(),(int(*)(int)) toupper); + if (mask_format == ("JPG")){ + mask_format = ("JPEG"); + } + if (mask_format != ("PNG") &&mask_format != ("BMP") && mask_format != ("GIF") && mask_format != ("JPEG") && mask_format != ("TIFF")){ + mask_format = ("TIFF"); + } + + // Print some stuff out + cout << endl << "Celeste: Removes cloud-like control points from Hugin project files and creates image masks" << endl; + cout << "using Support Vector Machines." << endl; + cout << endl << "Version 1.0.1" << endl << endl; + cout << "Arguments:" << endl; + cout << "Input Hugin file:\t" << pto_file << endl; + cout << "Output Hugin file:\t" << output_pto << endl; + cout << "SVM model file:\t\t" << model_file << endl; + cout << "Max dimension:\t\t" << resize_dimension << endl; + cout << "SVM threshold:\t\t" << threshold << endl; + cout << "Create PTO masks:\t"; + if (mask){ + cout << "Yes" << endl; + }else{ + cout << "No" << endl; + } + cout << "Mask format:\t\t" << mask_format << endl; + cout << "Filter radius:\t\t"; + + // Mask resolution + if (course_fine){ + + gRadius = 10; + spacing = (gRadius * 2) + 1; + cout << "Small" << endl << endl; + + }else{ + cout << "Large" << endl << endl; + } + // Convert mask format to lower case + transform(mask_format.begin(), mask_format.end(), mask_format.begin(),(int(*)(int)) tolower); + + // Vectors to store Gabor and SVM responses etc + vector<string> images,gabor_responses,pto_file_top,pto_file_cps,pto_file_end; + vector<double> svm_responses; + vector<unsigned int> ignore_cp; + + // Mask images + if (images_to_mask.size()){ + + cout << "Masking images..." << endl << endl; + + unsigned int n = 1; + for (unsigned int l = 0; l < images_to_mask.size(); l++){ + + get_gabor_response(images_to_mask[l],gabor_responses,n,m,threshold,mask_format,ignore_cp); + gNumLocs = 0; + + } + ignore_cp.clear(); + } + + // Process PTO file + if (pto_file != ("")){ + + cout << "Parsing Hugin project file " << pto_file << endl << endl; + + // Parse pto file + parse_pto(pto_file,images,pto_file_top,pto_file_cps,pto_file_end,gabor_responses,mask,m,threshold,mask_format,ignore_cp); + + cout << "Classifying control points using SVM..." << endl << endl; + + // Classify using SVM + tiny_svm_classify(model_file,gabor_responses,svm_responses,m); + + // Prune CPs and write new pto file + write_pto(threshold,images,output_pto,pto_file_top,pto_file_cps,pto_file_end,svm_responses,ignore_cp); + + cout << endl << "Writen file " << output_pto << endl << endl; + + } + + return(1); + +} Modified: hugin/branches/gsoc2008_sky_identification/src/celeste/Makefile =================================================================== --- hugin/branches/gsoc2008_sky_identification/src/celeste/Makefile 2008-09-14 22:58:10 UTC (rev 3426) +++ hugin/branches/gsoc2008_sky_identification/src/celeste/Makefile 2008-09-15 00:05:28 UTC (rev 3427) @@ -173,6 +173,20 @@ cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/build .PHONY : celeste/fast +# Convenience name for target. +src/celeste/CMakeFiles/celeste_standalone.dir/rule: + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f CMakeFiles/Makefile2 src/celeste/CMakeFiles/celeste_standalone.dir/rule +.PHONY : src/celeste/CMakeFiles/celeste_standalone.dir/rule + +# Convenience name for target. +celeste_standalone: src/celeste/CMakeFiles/celeste_standalone.dir/rule +.PHONY : celeste_standalone + +# fast build rule for target. +celeste_standalone/fast: + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/build +.PHONY : celeste_standalone/fast + # target to build an object file Celeste.o: cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Celeste.o @@ -190,137 +204,194 @@ # target to build an object file CelesteGlobals.o: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/CelesteGlobals.o + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/CelesteGlobals.o + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/CelesteGlobals.o .PHONY : CelesteGlobals.o # target to preprocess a source file CelesteGlobals.i: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/CelesteGlobals.i + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/CelesteGlobals.i + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/CelesteGlobals.i .PHONY : CelesteGlobals.i # target to generate assembly for a file CelesteGlobals.s: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/CelesteGlobals.s + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/CelesteGlobals.s + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/CelesteGlobals.s .PHONY : CelesteGlobals.s # target to build an object file ContrastFilter.o: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ContrastFilter.o + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ContrastFilter.o + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/ContrastFilter.o .PHONY : ContrastFilter.o # target to preprocess a source file ContrastFilter.i: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ContrastFilter.i + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ContrastFilter.i + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/ContrastFilter.i .PHONY : ContrastFilter.i # target to generate assembly for a file ContrastFilter.s: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ContrastFilter.s + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ContrastFilter.s + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/ContrastFilter.s .PHONY : ContrastFilter.s # target to build an object file +Features.o: + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Features.o +.PHONY : Features.o + +# target to preprocess a source file +Features.i: + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Features.i +.PHONY : Features.i + +# target to generate assembly for a file +Features.s: + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Features.s +.PHONY : Features.s + +# target to build an object file Gabor.o: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Gabor.o + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Gabor.o + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Gabor.o .PHONY : Gabor.o # target to preprocess a source file Gabor.i: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Gabor.i + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Gabor.i + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Gabor.i .PHONY : Gabor.i # target to generate assembly for a file Gabor.s: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Gabor.s + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Gabor.s + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Gabor.s .PHONY : Gabor.s # target to build an object file GaborFilter.o: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborFilter.o + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborFilter.o + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/GaborFilter.o .PHONY : GaborFilter.o # target to preprocess a source file GaborFilter.i: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborFilter.i + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborFilter.i + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/GaborFilter.i .PHONY : GaborFilter.i # target to generate assembly for a file GaborFilter.s: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborFilter.s + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborFilter.s + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/GaborFilter.s .PHONY : GaborFilter.s # target to build an object file GaborJet.o: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborJet.o + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborJet.o + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/GaborJet.o .PHONY : GaborJet.o # target to preprocess a source file GaborJet.i: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborJet.i + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborJet.i + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/GaborJet.i .PHONY : GaborJet.i # target to generate assembly for a file GaborJet.s: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborJet.s + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/GaborJet.s + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/GaborJet.s .PHONY : GaborJet.s # target to build an object file ImageFile.o: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ImageFile.o + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ImageFile.o + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/ImageFile.o .PHONY : ImageFile.o # target to preprocess a source file ImageFile.i: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ImageFile.i + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ImageFile.i + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/ImageFile.i .PHONY : ImageFile.i # target to generate assembly for a file ImageFile.s: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ImageFile.s + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/ImageFile.s + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/ImageFile.s .PHONY : ImageFile.s # target to build an object file LogPolar.o: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/LogPolar.o + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/LogPolar.o + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/LogPolar.o .PHONY : LogPolar.o # target to preprocess a source file LogPolar.i: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/LogPolar.i + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/LogPolar.i + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/LogPolar.i .PHONY : LogPolar.i # target to generate assembly for a file LogPolar.s: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/LogPolar.s + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/LogPolar.s + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/LogPolar.s .PHONY : LogPolar.s # target to build an object file +Main.o: + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Main.o +.PHONY : Main.o + +# target to preprocess a source file +Main.i: + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Main.i +.PHONY : Main.i + +# target to generate assembly for a file +Main.s: + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Main.s +.PHONY : Main.s + +# target to build an object file PGMImage.o: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/PGMImage.o + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/PGMImage.o + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/PGMImage.o .PHONY : PGMImage.o # target to preprocess a source file PGMImage.i: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/PGMImage.i + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/PGMImage.i + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/PGMImage.i .PHONY : PGMImage.i # target to generate assembly for a file PGMImage.s: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/PGMImage.s + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/PGMImage.s + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/PGMImage.s .PHONY : PGMImage.s # target to build an object file Utilities.o: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Utilities.o + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Utilities.o + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Utilities.o .PHONY : Utilities.o # target to preprocess a source file Utilities.i: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Utilities.i + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Utilities.i + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Utilities.i .PHONY : Utilities.i # target to generate assembly for a file Utilities.s: - cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Utilities.s + cd /home/tnugent/celeste_gsoc_svn && cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste.dir/build.make src/celeste/CMakeFiles/celeste.dir/Utilities.s + cd /home/tnugent/celeste_gsoc_svn && $(MAKE) -f src/celeste/CMakeFiles/celeste_standalone.dir/build.make src/celeste/CMakeFiles/celeste_standalone.dir/Utilities.s .PHONY : Utilities.s # Help Target @@ -330,6 +401,7 @@ @echo "... clean" @echo "... depend" @echo "... celeste" + @echo "... celeste_standalone" @echo "... edit_cache" @echo "... install" @echo "... install/local" @@ -347,6 +419,9 @@ @echo "... ContrastFilter.o" @echo "... ContrastFilter.i" @echo "... ContrastFilter.s" + @echo "... Features.o" + @echo "... Features.i" + @echo "... Features.s" @echo "... Gabor.o" @echo "... Gabor.i" @echo "... Gabor.s" @@ -362,6 +437,9 @@ @echo "... LogPolar.o" @echo "... LogPolar.i" @echo "... LogPolar.s" + @echo "... Main.o" + @echo "... Main.i" + @echo "... Main.s" @echo "... PGMImage.o" @echo "... PGMImage.i" @echo "... PGMImage.s" Modified: hugin/branches/gsoc2008_sky_identification/src/celeste/cmake_install.cmake =================================================================== --- hugin/branches/gsoc2008_sky_identification/src/celeste/cmake_install.cmake 2008-09-14 22:58:10 UTC (rev 3426) +++ hugin/branches/gsoc2008_sky_identification/src/celeste/cmake_install.cmake 2008-09-15 00:05:28 UTC (rev 3427) @@ -36,3 +36,21 @@ FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/share/hugin/xrc/data" TYPE FILE FILES "/home/tnugent/celeste_gsoc_svn/src/celeste/data/celeste.model") ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" MATCHES "^(Unspecified)$") +IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" MATCHES "^(Unspecified)$") + IF("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$") + IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/celeste_standalone") + FILE(RPATH_CHECK + FILE "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/celeste_standalone" + RPATH "") + ENDIF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/celeste_standalone") + FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/home/tnugent/celeste_gsoc_svn/src/celeste/cel... [truncated message content] |