Permalink
Browse files

Re-enabled the ISIS stereo code and integrated it with the normal ste…

…reo.cc file. Tweaked calls to the interest point API to match the new KDTree-enabled matcher.
  • Loading branch information...
1 parent 82416df commit e89f1e9a272c9efd93ed37a25dd7d2a1918ae539 @broxtronix broxtronix committed Feb 1, 2008
View
@@ -780,3 +780,7 @@ AC_DEFUN([AX_APP],
AM_CONDITIONAL([MAKE_APP_$1], [test "$MAKE_APP_$1" = "yes"])
])
+
+# Include Autotroll for building QT components w/out using qmake as
+# the primary build tool.
+m4_include([config/autotroll.m4])
View
@@ -216,6 +216,9 @@ AX_PROG_AR
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
+# Qt with AutoTroll.
+#AT_WITH_QT
+
if test "yes" = "$ENABLE_VERBOSE"; then
AC_MSG_NOTICE([using PKG_PATHS=$PKG_PATHS])
fi
@@ -242,21 +245,25 @@ AX_PKG(VW_INTEREST_POINT, [], [-lvwInterestPoint])
AX_PKG(OPENSCENEGRAPH, [], [-losg -losgDB -lOpenThreads], [osg/ref_ptr])
AX_PKG(MBA, [], [-lMBA_1.0_gpl_nopt], [MBA.h])
AX_PKG(SPICE, [], [-lcspice -lcsupport], [SpiceUsr.h SpiceZfc.h])
-#AX_PKG(QT, [], [], [QTCore.h])
-#AX_PKG(ISIS, [], [-lisis3])
-#AX_PKG(ISIS3RDPARTY, [], [-lgeos -lxerces-c -lgsl -lgslcblas -liconv -lqwt])
+
+AX_PKG(QT_CORE, [], [], [QVector], [QtCore])
+AX_PKG(QT_GUI, [], [], [QLabel], [QtGui])
+AX_PKG(ISIS3RDPARTY, [], [-lgeos -lxerces-c -lgsl -lgslcblas -liconv -lqwt])
+AX_PKG(ISIS, [], [-lisis3])
##################################################
# module definitions
##################################################
-AX_APP(STEREO, [src], yes, [BOOST BOOST_PROGRAM_OPTIONS BOOST_FILESYSTEM VW VW_CAMERA VW_CARTOGRAPHY VW_STEREO VW_INTEREST_POINT LAPACK MBA SPICE])
-#AX_APP(ISISSTEREO, [src], yes, [BOOST BOOST_PROGRAM_OPTIONS BOOST_FILESYSTEM VW VW_CAMERA VW_CARTOGRAPHY VW_STEREO VW_INTEREST_POINT LAPACK MBA SPICE QT ISIS ISIS3RDPARTY])
+AX_APP(STEREO, [src], yes, [BOOST BOOST_PROGRAM_OPTIONS BOOST_FILESYSTEM VW VW_CAMERA VW_CARTOGRAPHY VW_STEREO VW_INTEREST_POINT LAPACK MBA SPICE], [ISIS ISIS3RDPARTY QT_CORE QT_GUI])
+AX_APP(ISISSTEREO, [src], yes, [BOOST BOOST_PROGRAM_OPTIONS BOOST_FILESYSTEM VW VW_CAMERA VW_CARTOGRAPHY VW_STEREO VW_INTEREST_POINT LAPACK MBA SPICE ISIS ISIS3RDPARTY])
AX_APP(DISPARITYDEBUG, [src], yes, [BOOST BOOST_PROGRAM_OPTIONS VW VW_STEREO])
AX_APP(POINT2MESH, [src], yes, [BOOST BOOST_PROGRAM_OPTIONS VW OPENSCENEGRAPH])
AX_APP(POINT2DEM, [src], yes, [BOOST BOOST_PROGRAM_OPTIONS VW VW_CARTOGRAPHY])
-AX_APP(NURBS, [src], yes, [BOOST BOOST_PROGRAM_OPTIONS VW MBA])
+AX_APP(NURBS, [src], no, [BOOST BOOST_PROGRAM_OPTIONS VW MBA])
AX_APP(CTXIMAGE, [src], no, [BOOST BOOST_PROGRAM_OPTIONS VW VW_CARTOGRAPHY])
+AX_APP(RMAX2CAHVOR, [src], no, [BOOST VW VW_CAMERA])
+AX_APP(RMAXADJUST, [src], no, [BOOST BOOST_PROGRAM_OPTIONS VW VW_CAMERA VW_STEREO LAPACK])
##################################################
# final processing
File renamed without changes.
@@ -33,40 +33,51 @@ using namespace vw;
using namespace vw::camera;
IsisCameraModel::IsisCameraModel(std::string cube_filename) {
- Isis::Cube cube;
- cube.Open(cube_filename);
+ std::cout << "Opening camera model for image: " << cube_filename << "\n";
- if ( !(cube.IsOpen()) )
+ Isis::Cube* cube_ptr = new Isis::Cube;
+ m_isis_cube = cube_ptr;
+
+ cube_ptr->Open(cube_filename);
+
+ if ( !(cube_ptr->IsOpen()) )
vw_throw(IOErr() << "IsisCameraModel: Could not open cube file: \"" << cube_filename << "\".");
try {
- m_isis_camera_ptr = cube.Camera();
+ std::cout << "Accessing camera model\n";
+ m_isis_camera_ptr = cube_ptr->Camera();
} catch (Isis::iException &e) {
m_isis_camera_ptr = 0;
vw_throw(IOErr() << "IsisCameraModel: failed to instantiate a camera model from " << cube_filename << ". " << e.what());
- }
-
- cube.Close();
+ }
+}
+
+IsisCameraModel::~IsisCameraModel() {
+ std::cout << "Closing cube file...\n";
+ if (m_isis_cube) {
+ static_cast<Isis::Cube*>(m_isis_cube)->Close();
+ delete static_cast<Isis::Cube*>(m_isis_cube);
+ }
}
Vector2 IsisCameraModel::point_to_pixel(Vector3 const& point) const {
Isis::Camera* cam = static_cast<Isis::Camera*>(m_isis_camera_ptr);
-// // Convert into "Universal Ground" coordinates
-// Vector3 lon_lat_radius = cartography::xyz_to_lon_lat_radius(point);
+ // Convert into "Universal Ground" coordinates
+ Vector3 lon_lat_radius = cartography::xyz_to_lon_lat_radius(point);
-// // Set the current "active" pixel for the upcoming computation
-// cam->SetUniversalGround(lon_lat_radius[1], lon_lat_radius[0], lon_lat_radius[2]);
+ // Set the current "active" pixel for the upcoming computation
+ cam->SetUniversalGround(lon_lat_radius[1], lon_lat_radius[0]);
-// return Vector2(cam->Sample(), cam->Line());
+// std::cout << "LON LAT RAD: " << lon_lat_radius << " ---> ";
+// std::cout << cam->Line() << " " << cam->Sample() << "\n";
- vw_throw (NoImplErr() << "IsisCameraModel::point_to_pixel() is not yet implemented.\n");
- return Vector2(); // Never reached
+ return Vector2(cam->Sample(), cam->Line());
}
Vector3 IsisCameraModel::pixel_to_vector (Vector2 const& pix) const {
Isis::Camera* cam = static_cast<Isis::Camera*>(m_isis_camera_ptr);
-
+
// Set the current "active" pixel for the upcoming computations
cam->SetImage(pix[0],pix[1]);
@@ -84,15 +95,22 @@ Vector3 IsisCameraModel::pixel_to_vector (Vector2 const& pix) const {
Vector3 IsisCameraModel::camera_center(Vector2 const& pix ) const {
Isis::Camera* cam = static_cast<Isis::Camera*>(m_isis_camera_ptr);
+ // Set the current "active" pixel for the upcoming computations
+ cam->SetImage(pix[0],pix[1]);
+
double pos[3];
cam->InstrumentPosition(pos);
- return Vector3(pos[0],pos[1],pos[2]);
+ return Vector3(pos[0]*1000,pos[1]*1000,pos[2]*1000);
}
Quaternion<double> IsisCameraModel::camera_pose(Vector2 const& pix ) const {
Isis::Camera* cam = static_cast<Isis::Camera*>(m_isis_camera_ptr);
+ // Set the current "active" pixel for the upcoming computations
+ cam->SetImage(pix[0],pix[1]);
+
vw_throw(NoImplErr() << "IsisCameraModel::camera_pose() is not yet implemented.\n");
+ return Quaternion<double>();
}
@@ -41,14 +41,15 @@ namespace camera {
// A void pointer which is cast to Isis::Camera* in the
// implentation of the methods below.
void* m_isis_camera_ptr;
+ void* m_isis_cube;
public:
//------------------------------------------------------------------
// Constructors / Destructors
//------------------------------------------------------------------
IsisCameraModel(std::string cube_filename);
- virtual ~IsisCameraModel() {}
+ virtual ~IsisCameraModel();
//------------------------------------------------------------------
// Methods
View
@@ -5,7 +5,7 @@
#include <vw/Math/Vector.h>
#include <vw/Math/Quaternion.h>
#include <vw/Camera/OrbitingPushbroomModel.h>
-#include "Spice.h"
+#include "SpiceUtilities.h"
#include "stereo.h"
#include <iostream>
View
@@ -22,7 +22,10 @@
########################################################################
# sources
########################################################################
-#isis_sources = Isis/DiskImageResourceIsis.cc Isis/IsisCameraModel.cc
+#include $(top_srcdir)/config/autotroll.mak
+
+isis_sources = Isis/DiskImageResourceIsis.cc Isis/IsisCameraModel.cc \
+ Isis/StereoSessionIsis.cc
ctx_sources = MRO/StereoSessionCTX.cc MRO/DiskImageResourceDDD.cc \
MRO/CTXEphemeris.cc MRO/CTXMetadata.cc
@@ -34,19 +37,20 @@ apollo_sources = apollo/StereoSessionApolloMetric.cc
moc_sources = MOC/StereoSessionMOC.cc MOC/Ephemeris.cc MOLAReader.cc \
MOC/Metadata.cc MOC/MOLA.cc
+
clementine_sources = clementine/StereoSessionClementine.cc
generic_stereo_sources = file_lib.cc StereoSession.cc \
StereoSessionKeypoint.cc \
StereoSessionPinhole.cc \
TabulatedDataReader.cc KML.cc
-
bin_PROGRAMS =
if MAKE_APP_STEREO
bin_PROGRAMS += stereo
stereo_SOURCES = $(moc_sources) $(ctx_sources) $(hrsc_sources) \
$(apollo_sources) $(clementine_sources) \
- $(generic_stereo_sources) Spice.cc stereo.cc
+ $(generic_stereo_sources) $(isis_sources) \
+ SpiceUtilities.cc stereo.cc
stereo_LDFLAGS = $(APP_STEREO_LIBS)
endif
@@ -57,6 +61,13 @@ endif
# isis_stereo_LDFLAGS = $(APP_ISISSTEREO_LIBS)
# endif
+#if MAKE_APP_ASPGUI
+# bin_PROGRAMS += aspgui
+# aspgui_SOURCES = aspgui.cc gui/GlWidget.cc
+# aspgui_CXXFLAGS = $(QT_CXXFLAGS) $(QT_INCPATH)
+# aspgui_LDFLAGS = $(QT_LDFLAGS) $(QT_LIBS) $(APP_ASPGUI_LIBS)
+#endif
+
if MAKE_APP_DISPARITYDEBUG
bin_PROGRAMS += disparitydebug
disparitydebug_SOURCES = disparitydebug.cc
@@ -88,6 +99,18 @@ if MAKE_APP_CTXIMAGE
ctximage_LDFLAGS = $(APP_CTXIMAGE_LIBS)
endif
+if MAKE_APP_RMAX2CAHVOR
+ bin_PROGRAMS += rmax2cahvor
+ rmax2cahvor_SOURCES = rmax2cahvor.cc
+ rmax2cahvor_LDFLAGS = $(APP_RMAX2CAHVOR_LIBS)
+endif
+
+if MAKE_APP_RMAXADJUST
+ bin_PROGRAMS += rmax_adjust
+ rmax_adjust_SOURCES = rmax_adjust.cc
+ rmax_adjust_LDFLAGS = $(APP_RMAXADJUST_LIBS)
+endif
+
# ctx2kml_SOURCES = ctx2kml.cc MRO/DiskImageResourceDDD.cc
# orbitviz_SOURCES = orbitviz.cc Spice.cc
# orthoproject_SOURCES = orthoproject.cc $(generic_stereo_sources)
View
@@ -41,9 +41,9 @@ namespace cartography {
TerminalProgressCallback progress_callback;
progress_callback.report_progress(0);
- for (unsigned int j = 0; j < m_point_image.rows(); j++) {
+ for (int32 j = 0; j < m_point_image.rows(); j++) {
progress_callback.report_progress(float(j)/m_point_image.rows());
- for (unsigned int i= 0; i < m_point_image.cols(); i++)
+ for (int32 i= 0; i < m_point_image.cols(); i++)
if (m_point_image(i,j) != Vector3())
m_bbox.grow(m_point_image(i,j));
}
@@ -114,8 +114,8 @@ namespace cartography {
renderer.Clear(vw::stereo::eColorBufferBit);
}
- for (unsigned int row = *m_row_start; row < m_point_image.rows(); ++row) {
- for (unsigned int col = 0; col < m_point_image.cols(); ++col) {
+ for (int32 row = *m_row_start; row < m_point_image.rows(); ++row) {
+ for (int32 col = 0; col < m_point_image.cols(); ++col) {
if (local_bbox.contains(m_point_image(col,row)) ) {
float vertices[12], intensities[6];
int triangle_count;
View
@@ -22,7 +22,7 @@ void read_image_info( std::string const& filename, ImageInfo& info ) {
vw_out(DebugMessage) << "Reading image info from " << filename << std::endl;;
DiskImageResourcePNG png( filename );
info.filename = filename;
- for( int i=0; i<png.num_comments(); ++i ) {
+ for( unsigned i=0; i<png.num_comments(); ++i ) {
std::string const& key = png.get_comment(i).key;
std::istringstream value( png.get_comment(i).text );
if( key == "easting" ) value >> info.easting;
@@ -1,4 +1,4 @@
-#include "Spice.h"
+#include "SpiceUtilities.h"
#include "SpiceUsr.h"
#include "SpiceZfc.h"
File renamed without changes.
@@ -86,10 +86,11 @@ StereoSessionKeypoint::determine_image_alignment(std::string const& input_file1,
ScaledInterestPointDetector<LogInterestOperator> detector;
InterestPointList ip1 = detect_interest_points(channels_to_planes(left_disk_image), detector);
InterestPointList ip2 = detect_interest_points(channels_to_planes(right_disk_image), detector);
+ vw_out(InfoMessage) << "Left image: " << ip1.size() << " points. Right image: " << ip2.size() << "\n";
// Generate descriptors for interest points.
// TODO: Switch to a more sophisticated descriptor
- vw_out(InfoMessage) << "\tGenerating descriptors... ";
+ vw_out(InfoMessage) << "\tGenerating descriptors... " << std::flush;
PatchDescriptorGenerator descriptor;
descriptor(left_disk_image, ip1);
descriptor(right_disk_image, ip2);
@@ -99,17 +100,32 @@ StereoSessionKeypoint::determine_image_alignment(std::string const& input_file1,
// constraints on the matched interest points.
vw_out(InfoMessage) << "\nInterest Point Matching:\n";
double matcher_threshold = 0.8;
+
+ // RANSAC needs the matches as a vector, and so does the matcher.
+ // this is messy, but for now we simply make a copy.
+ std::vector<InterestPoint> ip1_copy(ip1.size()), ip2_copy(ip2.size());
+ std::copy(ip1.begin(), ip1.end(), ip1_copy.begin());
+ std::copy(ip2.begin(), ip2.end(), ip2_copy.begin());
+
InterestPointMatcher<L2NormMetric,NullConstraint> matcher(matcher_threshold);
std::vector<InterestPoint> matched_ip1, matched_ip2;
- matcher.match(ip1, ip2, matched_ip1, matched_ip2);
+ matcher(ip1_copy, ip2_copy, matched_ip1, matched_ip2, false, TerminalProgressCallback());
vw_out(InfoMessage) << "Found " << matched_ip1.size() << " putative matches.\n";
- // RANSAC is used to fit a similarity transform between the
- // matched sets of points
+ std::vector<Vector2> ransac_ip1(matched_ip1.size());
+ std::vector<Vector2> ransac_ip2(matched_ip2.size());
+ for (unsigned i = 0; i < matched_ip1.size();++i ) {
+ ransac_ip1[i] = Vector2(matched_ip1[i].x, matched_ip1[i].y);
+ ransac_ip2[i] = Vector2(matched_ip2[i].x, matched_ip2[i].y);
+ }
- Matrix<double> align_matrix = ransac(matched_ip2, matched_ip1,
+ // RANSAC is used to fit a similarity transform between the
+ // matched sets of points
+ vw_out(InfoMessage) << "\nRunning RANSAC:\n";
+ Matrix<double> align_matrix = ransac(ransac_ip2, ransac_ip1,
vw::math::SimilarityFittingFunctor(),
InterestPointErrorMetric());
+ vw_out(InfoMessage) << "Done.\n";
if (m_sub_sampling > 1)
scale_align_matrix(align_matrix);
Oops, something went wrong.

0 comments on commit e89f1e9

Please sign in to comment.