www.pudn.com > Estereo.rar > reconst3D.cpp
/***************************************************************************
*
* Copyright 2004 by the Massachusetts Institute of Technology. All
* rights reserved.
*
* Developed by David Demirdjian
* at the Computer Sciences and Artificial Intelligence Laboratory,
* MIT, Cambridge, Massachusetts.
*
* Permission to use, copy, or modify this software and its documentation
* for educational and research purposes only and without fee is hereby
* granted, provided that this copyright notice and the original authors's
* names appear on all copies and supporting documentation. If individual
* files are separated from this distribution directory structure, this
* copyright notice must be included. For any other uses of this software,
* in original or modified form, including but not limited to distribution
* in whole or in part, specific prior permission must be obtained from
* MIT. These programs shall not be used, rewritten, or adapted as the
* basis of a commercial software or hardware product without first
* obtaining appropriate licenses from MIT. MIT. makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
**************************************************************************/
#include "stereoMatching.h"
#include "processingMMX.h"
#define _DDMIN(X,Y) ((X<=Y)?(X):(Y))
#define _DDMAX(X,Y) ((X>=Y)?(X):(Y))
void StereoMatching::setCameraParameters(float f, float b, float u, float v)
{
focal = f;
baseline = b;
u0 = u;
v0 = v;
}
void StereoMatching::getCameraParameters(float& f, float& b, float& u, float& v) const
{
f = focal;
b = baseline;
u = u0;
v = v0;
}
// 3D reconstruction
// idx is passed to give (x,y) location
void StereoMatching::doReconstruction(const int* idx, const float* subpixel_depth_list, int nbPoints,
float* X_list, float* Y_list, float* Z_list)
{
float disp;
if (nbPoints > 0)
{
int i;
short x,y;
for (i=0; i 0)
{
for (int i=0; i