Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

109 lines (88 sloc) 3.264 kB
// __BEGIN_LICENSE__
//
// Copyright (C) 2008 United States Government as represented by the
// Administrator of the National Aeronautics and Space Administration
// (NASA). All Rights Reserved.
//
// Copyright 2008 Carnegie Mellon University. All rights reserved.
//
// This software is distributed under the NASA Open Source Agreement
// (NOSA), version 1.3. The NOSA has been approved by the Open Source
// Initiative. See the file COPYING at the top of the distribution
// directory tree for the complete NOSA document.
//
// THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY
// KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT
// LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO
// SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT
// THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT
// DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE.
//
// __END_LICENSE__
/// \file nurbs.cc
///
#ifdef _MSC_VER
#pragma warning(disable:4244)
#pragma warning(disable:4267)
#pragma warning(disable:4996)
#endif
#include <boost/program_options.hpp>
namespace po = boost::program_options;
#include <vw/vw.h>
using namespace vw;
#include "SurfaceNURBS.h"
using namespace vw;
int main( int argc, char *argv[] ) {
std::string input_file_name, output_file_name;
unsigned int num_iterations;
po::options_description desc("Options");
desc.add_options()
("help", "Display this help message")
("input-file", po::value<std::string>(&input_file_name), "Explicitly specify the input file")
("output-file,o", po::value<std::string>(&output_file_name)->default_value("output.png"), "Specify the output file")
("iterations,i", po::value<unsigned int>(&num_iterations), "The number of iterations to perform")
("holes-only,h", "Only fill areas with no pixels (zero alpha) with interpolated data.")
("normalize", "Normalize the output image")
("verbose", "Verbose output");
po::positional_options_description p;
p.add("input-file", 1);
po::variables_map vm;
po::store( po::command_line_parser( argc, argv ).options(desc).positional(p).run(), vm );
po::notify( vm );
if( vm.count("help") ) {
std::cout << desc << std::endl;
return 1;
}
if( vm.count("input-file") != 1 ) {
std::cout << "Error: Must specify exactly one input file!" << std::endl;
std::cout << desc << std::endl;
return 1;
}
if( vm.count("verbose") ) {
set_debug_level(VerboseDebugMessage);
}
try {
ImageView<PixelGrayA<float> > image;
read_image( image, input_file_name );
ImageView<PixelGrayA<float> > output;
output = MBASurfaceNURBS(image, num_iterations);
if (vm.count("holes-only") ) {
for (int j = 0; j < image.rows(); ++j) {
for (int i = 0; i < image.cols(); ++i) {
if (image(i,j).a() != 0) {
output(i,j) = image(i,j);
}
}
}
}
if( vm.count("normalize") ) {
output = normalize(output);
}
write_image( output_file_name, output );
}
catch( Exception& e ) {
std::cerr << "Error: " << e.what() << std::endl;
}
return 0;
}
Jump to Line
Something went wrong with that request. Please try again.