-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkImageCamera.h
executable file
·112 lines (83 loc) · 3.46 KB
/
vtkImageCamera.h
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
// .NAME vtkImageCamera - Texture map an image onto a quad based on extrinsic
// camera parameters.
// .SECTION Description
// vtkImageCamera computes the frustum of a camera from its extrinsic parameters.
// A quad is computed by finding 4 points along the frustum edges that are equidistant
// from the camera center. An image is then texture mapped onto this quad.
//
//(+x, +y) (-x, +y)
//________
//| |
//| |
//| |
//|________|
//(+x, -y) (-x, -y)
// Must negate x coordinate of pixel (in center = (0,0), +x is right, +y is up coordinate system) before requesting the ray through that pixel!
#ifndef __vtkImageCamera_h
#define __vtkImageCamera_h
#include "vtkPhysicalCamera.h"
#include "vtkCommand.h"
#include "vtkSmartPointer.h"
#include <vtkstd/string>
class vtkInformation;
class vtkInformationVector;
class vtkActor;
class vtkImageData;
class vtkPoints;
class vtkRenderer;
class vtkImageCamera : public vtkPhysicalCamera
{
public:
vtkTypeRevisionMacro(vtkImageCamera,vtkPhysicalCamera);
void PrintSelf(ostream& os, vtkIndent indent);
static vtkImageCamera *New();
void CopyImageCamera(vtkImageCamera*);
void CopyPhysicalCamera(vtkPhysicalCamera*);
void SetDistanceFromCamera(const double d);
vtkGetMacro(DistanceFromCamera, double);
void ReadTexture();
//void InitializeCamera();
vtkActor* GetImageActor();
vtkActor* GetReprojectedImageActor();
vtkActor* GetReprojectionRaysActor();
void SetRenderer(vtkRenderer* renderer);
unsigned int GetNumberOfRows();
unsigned int GetNumberOfColumns();
unsigned int GetHeight();
unsigned int GetWidth();
void OutputCorners();
void OutputRays();
void UpdateImageActor();
void CreateViewingDirectionActor();
void CreateReprojectedImage(vtkPoints* points);
//void CreateReprojectionRays(vtkPoints* points);
void SetTextureImage(vtkImageData* image);
void SetTextureFileName(vtkstd::string filename);
protected:
vtkImageCamera();
~vtkImageCamera(){}
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
private:
vtkImageCamera(const vtkImageCamera&); // Not implemented.
void operator=(const vtkImageCamera&); // Not implemented.
vtkSmartPointer<vtkImageData> TextureImage; //The image to texture map onto the quad.
//vtkSmartPointer<vtkImageData> ReprojectedImage; //The image resulting when 3D points are projected into the image.
vtkSmartPointer<vtkActor> ImageActor; //The quad + texture.
//vtkSmartPointer<vtkActor> ReprojectedImageActor;
//vtkActor* tlCornerActor;
//vtkActor* trCornerActor;
//vtkActor* CornerActor;
vtkSmartPointer<vtkActor> CornerActor;
//vtkSmartPointer<vtkActor> ViewingDirectionActor;
//vtkSmartPointer<vtkActor> ReprojectionRaysActor;
vtkSmartPointer<vtkRenderer> Renderer;
//Convenience functions to get the pixel coordinates of useful pixels.
virtual void GetTopLeftPixel(double* p);
virtual void GetTopRightPixel(double* p);
virtual void GetBottomLeftPixel(double* p);
virtual void GetBottomRightPixel(double* p);
//void CreateCornerActors(double tl[3], double tr[3]);
vtkstd::string TextureFileName;
double DistanceFromCamera; //Controls which slice through the camera frustum the image is displayed on. The smaller this value is, the closer to the camera center the image is displayed.
};
#endif