stereo_processor.cpp

00001
00002 /***************************************************************************
00003  *  stereo_processor.cpp - Stereo processor interface
00004  *
00005  *  Created: Fri May 18 16:02:08 2007
00006  *  Copyright  2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023
00024 #include <stereo/stereo_processor.h>
00025 
00026 /** @class StereoProcessor <stereo/stereo_processor.h>
00027  * Stereo processor interface.
00028  * This interface provides access to different stereo processing
00029  * implementations.
00030  *
00031  * @author Tim Niemueller
00032  *
00033  * @fn virtual void StereoProcessor::get_xyz(unsigned int px, unsigned int py, float *x, float *y, float *z) = 0
00034  * Get coordinates for pixel in camera coordinate system.
00035  * This retrieves coordinates in the coordinate system of the stereo camera.
00036  * Retrieving new positions may fail if no valid disparity information could
00037  * be calculated for the given point. This is indicated with the return value.
00038  * @param px x position of pixel in image
00039  * @param py y position of pixel in image
00040  * @param x upon successful return contains the x coordinate of the point in the camera coordinate sytem
00041  * @param y upon successful return contains the y coordinate of the point in the camera coordinate sytem
00042  * @param z upon successful return contains the z coordinate of the point in the camera coordinate sytem
00043  * @return true, if valid information could be retrieved and was written to (x,y,z), false otherwise
00044  *
00045  * @fn virtual void StereoProcessor::get_world_xyz(unsigned int px, unsigned int py, float *x, float *y, float *z) = 0
00046  * Get coordinates for pixel in robot coordinate system.
00047  * This retrieves coordinates in the coordinate system of the robot holding
00048  * the stereo camera. The robot coordinate system is a right-handed cardanic
00049  * coordinate system with the X axis pointing forward, the Y axis pointing
00050  * right and the Z axis pointing downwards.
00051  * Retrieving new positions may fail if no valid disparity information could
00052  * be calculated for the given point. This is indicated with the return value.
00053  * @param px x position of pixel in image
00054  * @param py y position of pixel in image
00055  * @param x upon successful return contains the x coordinate of the point in the robot coordinate sytem
00056  * @param y upon successful return contains the y coordinate of the point in the robot coordinate sytem
00057  * @param z upon successful return contains the z coordinate of the point in the robot coordinate sytem
00058  * @return true, if valid information could be retrieved and was written to (x,y,z), false otherwise
00059  *
00060  * @fn virtual void StereoProcessor::preprocess_stereo() = 0
00061  * Do any pre-processing needed.
00062  * Do all the preprocessing needed to calculate the disparity or the YUV images.
00063  * This has been split out to be able to do only one thing.
00064  *
00065  * @fn virtual void StereoProcessor::calculate_disparity(ROI *roi = 0) = 0
00066  * Caculate disparity images.
00067  * Depending on the data the specific stereo processor needs the disparity image
00068  * is calculated.
00069  * If a region of interest (ROI) is supplied then only this region is processed.
00070  * @param roi region of interest to process
00071  *
00072  * @fn virtual void StereoProcessor::calculate_yuv(bool both = false) = 0
00073  * Caculate yuv images.
00074  * This will calculate YUV images of the cameras. By default only the reference
00075  * image is converted to YUV, as this is sufficient in most cases. If you need both
00076  * images specify so as argument. A call to this method is valid only after calling
00077  * calculate_disparity() as this may rely on data produced there.
00078  * @param both if true, both YUV images are calculated for the left and right camera,
00079  * if false only the YUV image of the reference camera is calculated (dependant on
00080  * camera)
00081  *
00082  * @fn virtual unsigned char *  StereoProcessor::disparity_buffer() = 0
00083  * Get the disparity image buffer.
00084  * This returns a buffer containing the disparity image. The buffer is not copied
00085  * so do not change anything in the buffer or subsequent calls to get_xyz() and
00086  * get_world_xyz() will return invalid results.
00087  *
00088  * @fn virtual size_t           StereoProcessor::disparity_buffer_size() const = 0
00089  * Get disparity buffer size.
00090  * @return size in bytes of the disparity image buffer
00091  *
00092  * @fn virtual unsigned char *  StereoProcessor::yuv_buffer() = 0
00093  * Get YUV-formatted buffer of reference camera.
00094  * This will return the YUV buffer of the reference image. This is only available
00095  * after calling calculate_yuv().
00096  * @return YUV buffer of the reference image
00097  * 
00098  * @fn virtual unsigned char *  StereoProcessor::auxiliary_yuv_buffer() = 0
00099  * Get YUV-formatted buffer of auxiliary camera.
00100  * This will return the YUV buffer of the auxiliary image. This is only available
00101  * after calling calculate_yuv().
00102  * @return YUV buffer of the auxiliary image
00103  *
00104  */
00105 
00106 /** Virtual empty destructor. */
00107 StereoProcessor::~StereoProcessor()
00108 {
00109 }