1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
/****************************************************************************
* *
* PrimeSense Sensor 5.x Alpha *
* Copyright (C) 2011 PrimeSense Ltd. *
* *
* This file is part of PrimeSense Sensor. *
* *
* PrimeSense Sensor is free software: you can redistribute it and/or modify*
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* PrimeSense Sensor is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
* *
****************************************************************************/
#ifndef _XNV_GENERAL_STATIC_MAP_H_
#define _XNV_GENERAL_STATIC_MAP_H_
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include "XnVDepthMap.h"
#include "XnVDevice.h"
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
/**
* This is a general StaticMap base class.
* It implements the Save/Load functionality, as well as the Clean,
* which applies the internal XnVDepthMap instance to the input XnVDepthMap.
* It also implements some basic Reset and AddMap capabilities, as a framework
* for the specific sub classes, which will implement the specific AddMap and Reset
* relevant to the specific StaticMap implementation.
*/
class XN_EE_FW_API XnVGeneralStaticMap
{
public:
XnVGeneralStaticMap(const XnChar* strINIFile = NULL);
virtual ~XnVGeneralStaticMap();
/**
* Load a static map from file. The file name is given in the INI file supplied to the ctor.
* Static maps are saved in QVGA/VGA resolutions, and therefore can only be loaded in these resolutions.
*
* @param [in] nResolution The resolution.
*/
virtual XnStatus Load(XnUInt32 nResolution);
virtual XnStatus Load(XnResolutions nResolution);
virtual XnStatus Load(const XnChar* strFileName);
/**
* Save the current static map to 2 files: 1 for VGA and 1 for QVGA.
* The file names are given in the INI file supplied to the ctor.
* Saving in other resolutions will result in failure.
*/
virtual XnStatus Save();
virtual XnStatus Save(const XnChar* strFileName);
/**
* Discard the current static map.
*/
XnStatus Reset();
/**
* Each specific type of static map will have different things to do when adding a new map. This is the place for it.
*
* @param [in] dmMap A depth map to add to the static.
*/
virtual XnStatus AddMap(const XnVDepthMap& dmMap) = 0;
/**
* Clean the current depth map according to the static map.
* If resolutions don't match, the function will fail.
*
* @param [in,out] dmMap A depth map on which to apply the static map.
*
* @return XN_STATUS_OK on success, XNV_STATUS_RESOLUTION_MISMATCH if resolution doesn't match learned static.
*/
virtual XnStatus Clean(XnVDepthMap& dmMap);
/**
* Get the internal depth map. See the learned values per pixel in the static map.
*/
XnVDepthMap* GetDepthMap() const;
protected:
/**
* Each specific type of static map will have different things to do when resetting. This is the place for it.
*/
virtual XnStatus DoReset() = 0;
/**
* Do all general things needed before adding a new map. This includes checking resolutions match (and resetting if not)
* Specific AddMap functions should call this at the beginning.
*
* @param [in] dmMap A depth map to add to the static.
*/
XnStatus PreAddMap(const XnVDepthMap& dmMap);
virtual XnStatus Init(XnUInt32 nNewSize) = 0;
XnVDepthMap* m_pdmStaticMap;
XnBool m_bInit;
XnVDevice m_Device;
XnChar m_strVGAFile[80];
XnChar m_strQVGAFile[80];
XnBool m_bVGAExists, m_bQVGAExists;
};
#endif //_XNV_GENERAL_STATIC_MAP_H_
|