From: <st...@us...> - 2009-08-20 12:09:15
|
Revision: 4251 http://hugin.svn.sourceforge.net/hugin/?rev=4251&view=rev Author: stativ Date: 2009-08-20 12:09:08 +0000 (Thu, 20 Aug 2009) Log Message: ----------- hugin_hdrmerge now writes output. But it contains artifacts. This commit is only because I want to have some fallback before making more changes. Modified Paths: -------------- hugin/branches/gsoc2009_deghosting/src/tools/hugin_hdrmerge.cpp Modified: hugin/branches/gsoc2009_deghosting/src/tools/hugin_hdrmerge.cpp =================================================================== --- hugin/branches/gsoc2009_deghosting/src/tools/hugin_hdrmerge.cpp 2009-08-20 07:33:33 UTC (rev 4250) +++ hugin/branches/gsoc2009_deghosting/src/tools/hugin_hdrmerge.cpp 2009-08-20 12:09:08 UTC (rev 4251) @@ -135,16 +135,15 @@ /** compute output image when given source images */ bool weightedAverageOfImageFiles(const vector<string> &inputFiles, const vector<FImagePtr> &weights, - FRGBImage *output, - BImage *mask) + FRGBImage &output) { if(g_verbose > 0) { cout << "Merging input images" << endl; } + int width = (weights[0])->width(); + int height = (weights[0])->height(); assert(inputFiles.size() == weights.size()); - output->resize((weights[0])->width(), (weights[0])->height()); - mask->resize((weights[0])->width(), (weights[0])->height()); for(unsigned i = 0; i < inputFiles.size(); i++) { ImageImportInfo inputInfo(inputFiles[i].c_str()); @@ -158,13 +157,12 @@ combineTwoImages(srcImageRange(img), srcImage(*(weights.at(i))), destImage(img), Arg1() * Arg2()); + + output.resize(width, height); //combine with output img - combineTwoImages(srcImageRange(*output), srcImage(img), - destImage(*output), + combineTwoImages(srcImageRange(output), srcImage(img), + destImage(output), Arg1() + Arg2()); - //combine masks - combineTwoImages(srcImageRange(*mask), srcImage(tmpMask), - destImage(*mask), max(Arg2() + Arg1(), Param(255))); } return true; } @@ -293,12 +291,14 @@ deghoster = &khanDeghoster; vector<FImagePtr> weights = deghoster->createWeightMasks(); - BImage mask; + weightedAverageOfImageFiles(inputFiles, weights, output); if (g_verbose > 0) { std::cout << "Writing " << outputFile << std::endl; } - weightedAverageOfImageFiles(inputFiles, weights, &output, &mask); ImageExportInfo exinfo(outputFile.c_str()); + exinfo.setPixelType("FLOAT"); + BImage alpha(output.width(), output.height(), 255); + exportImageAlpha(srcImageRange(output), srcImage(alpha), exinfo); } else { std::cerr << "Unknown merge mode, see help for a list of possible modes" << std::endl; return 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |