00001
00011 #pragma once
00012
00013 #include "../common/standard.h"
00014 #include "VoxelCube.h"
00015 #include "Viewpoint.h"
00016 #include <time.h>
00017
00018
00020 class Scanner
00021 {
00022 public:
00023
00025 Scanner() { progressReportCB = NULL; lastTime = time(NULL); updateInterval = 0; thresholdSquared = 50*50;}
00026
00028 void getVoxelParamsFromScnFile(const char *filename, Vertex ¢er, int &voxelsPerSide, double &voxelCubeSize);
00029
00031 void loadImages (const char *filename, int defaultVoxelsPerSide, float defaultVoxelCubeSize);
00032
00034 void carveVoxels (double threshold, bool bUseSilhouettes);
00035
00037 void setProgressCallback (void (*updateCB)(char *str, float pctDone, void *data), int intervalInSeconds, void *data);
00038
00040 void drawWithAngle(bool bSmooth, double latitude, double longitude);
00041
00042
00045 void takeSnapshots(const char *directoryName);
00046
00048 bool hasSilhouettes() const;
00049
00050 Vertex guessVoxelcubeCenter ();
00051
00052 VoxelCube voxelCube;
00053
00055 QEM::ProgMesh mesh;
00056
00057 private:
00058 void drawFromImagePerspective (bool bSmooth, int imgIndex);
00059
00061 ViewpointList images;
00062
00064 RgbDouble averageColor (std::vector< RgbByte > &colors) const;
00065
00067 RgbDouble weightedAverageColor (std::vector< RgbByte > &colors, std::vector< int > &numPixelsSeen) const;
00068
00070 bool colorsAgree (std::vector< RgbByte > &colors, std::vector< int > numPixelsSeen) const;
00071
00073 void drawItemBufferForImage (Viewpoint &image);
00074
00075 void drawModel(bool bSmooth, bool bDrawWireFrame);
00076
00077 void doProgressUpdate(bool bForce, float pctDone, const char *format, ...);
00078 void *progressUpdateData;
00079 bool getColorsForVoxel (SurfaceVoxelList::iterator &svl_iter, std::vector< RgbByte > &colorsToAgreeOn, std::vector< int > &numPixelsFound, bool bUseSilhouettes) const;
00080 bool isConsistent (SurfaceVoxelList::iterator &svl_iter, bool bUseSilhouettes) const;
00081 void (*progressReportCB)(char *updateString, float pctDone, void *data);
00082 size_t lastTime;
00083 int updateInterval;
00084 double thresholdSquared;
00085 };
00086