2 #ifndef vpgl_local_rational_camera_hxx_ 3 #define vpgl_local_rational_camera_hxx_ 10 # include <vcl_msvc_warnings.h> 41 lvcs_(
vpgl_lvcs(latitude, longitude, elevation,
60 vpgl_lvcs& non_const_lvcs = const_cast<vpgl_lvcs&>(lvcs_);
71 this->
project(world_point[0], world_point[1], world_point[2],
72 image_point[0], image_point[1]);
81 this->project(world_point.
x(), world_point.
y(), world_point.
z(), u,
v);
91 <<
"------------------------------------------------\n\n";
97 std::ofstream file_out;
98 file_out.open(cam_path.c_str());
99 if (!file_out.good()) {
100 std::cerr <<
"error: bad filename: " << cam_path << std::endl;
103 file_out.precision(12);
127 file_out <<
"satId = \"????\";\n" 128 <<
"bandId = \"RGB\";\n" 129 <<
"SpecId = \"RPC00B\";\n" 130 <<
"BEGIN_GROUP = IMAGE\n" 143 file_out <<
" lineNumCoef = (";
144 for (
int i=0; i<20; i++) {
149 file_out <<
");\n lineDenCoef = (";
150 for (
int i=0; i<20; i++) {
155 file_out <<
");\n sampNumCoef = (";
156 for (
int i=0; i<20; i++) {
161 file_out <<
");\n sampDenCoef = (";
162 for (
int i=0; i<20; i++) {
168 <<
"END_GROUP = IMAGE\n" 172 double longitude, latitude, elevation;
173 lvcs_.get_origin(latitude, longitude, elevation);
174 file_out << longitude <<
'\n' 176 << elevation <<
'\n';
184 std::ifstream file_inp;
185 file_inp.open(cam_path.c_str());
186 if (!file_inp.good()) {
187 std::cout <<
"error: bad filename: " << cam_path << std::endl;
190 return read_local_rational_camera<T>(file_inp);
202 while (!istr.eof()&&!good) {
206 double longitude, latitude, elevation;
207 istr >> longitude >> latitude >> elevation;
208 lvcs =
vpgl_lvcs(latitude, longitude, elevation,
226 std::cout <<
"Failed to read rational camera part of " << cam_path <<
'\n';
229 std::ifstream file_inp;
230 file_inp.open(cam_path.c_str());
231 if (!file_inp.good()) {
232 std::cout <<
"error: bad filename: " << cam_path << std::endl;
238 while (!file_inp.eof()&&!good) {
242 double longitude, latitude, elevation;
243 file_inp >> longitude >> latitude >> elevation;
244 lvcs =
vpgl_lvcs(latitude, longitude, elevation,
267 #undef vpgl_LOCAL_RATIONAL_CAMERA_INSTANTIATE 268 #define vpgl_LOCAL_RATIONAL_CAMERA_INSTANTIATE(T) \ 269 template class vpgl_local_rational_camera<T >; \ 270 template std::ostream& operator<<(std::ostream&, const vpgl_local_rational_camera<T >&); \ 271 template vpgl_local_rational_camera<T >* read_local_rational_camera(std::string); \ 272 template vpgl_local_rational_camera<T >* read_local_rational_camera_from_txt(std::string); \ 273 template vpgl_local_rational_camera<T >* read_local_rational_camera(std::istream&) 275 #endif // vpgl_local_rational_camera_hxx_ void project(const T x, const T y, const T z, T &u, T &v) const override
The generic camera interface. u represents image column, v image row.
void local_to_global(const double lx, const double ly, const double lz, cs_names cs_name, double &lon, double &lat, double &gz, AngUnits output_ang_unit=DEG, LenUnits output_len_unit=METERS)
Converts pointin, given in local vertical coord system, to pointout in the global coord system given ...
vpgl_local_rational_camera< T > * clone(void) const override
Clone ‘this’: creation of a new object and initialization.
void print(std::ostream &s=std::cout) const override
print the camera parameters.
vpgl_local_rational_camera< T > * read_local_rational_camera(std::string cam_path)
Creates a local rational camera from a file.
vnl_vector_fixed< T, 2 > project(vnl_vector_fixed< T, 3 > const &world_point) const override
Project a world point onto the image.
std::ostream & operator<<(std::ostream &s, const vpgl_local_rational_camera< T > &p)
Write to stream.
A local rational camera model.
T scale(const coor_index coor_index) const
get a specific scale value.
vpgl_local_rational_camera()
default constructor.
virtual void print(std::ostream &s=std::cout) const
print the camera parameters.
T offset(const coor_index coor_index) const
get a specific offset value.
vpgl_local_rational_camera< T > * read_local_rational_camera_from_txt(std::string cam_path)
read camera from txt file (small sat format).
void project(const T x, const T y, const T z, T &u, T &v) const override
The generic camera interface. u represents image column, v image row.
bool save(std::string cam_path) override
save to file (the lvcs is after the global rational camera parameters).