26 #include <fvutils/rectification/rectfile.h> 27 #include <fvutils/rectification/rectinfo_lut_block.h> 41 main(
int argc,
char **argv)
45 const char *s =
"qatest.rif";
53 FIREVISION_RECTINFO_CAMERA_MAIN);
56 FIREVISION_RECTINFO_CAMERA_LEFT);
71 for (
int i = 0; i < 10; ++i ) {
72 uint16_t x = i, y = i, to_x = i * 2, to_y = i * 2;
73 printf(
"Mapping (%u, %u) to (%u, %u)\n", x, y, to_x, to_y);
77 for (
int i = 10; i < 20; ++i ) {
78 uint16_t x = i, y = i, to_x = i * 2, to_y = i * 2;
79 printf(
"Mapping2 (%u, %u) to (%u, %u)\n", x, y, to_x, to_y);
88 for (RectificationInfoFile::RectInfoBlockVector::iterator i = blocks->begin(); i != blocks->end(); ++i) {
91 printf(
"Got rectification info block of unknown type");
95 printf(
"LUT: type: %u camera: %u size: %zu\n",
98 cout <<
"Looking for non-zero mappings" << endl;
99 uint16_t x, y, to_x, to_y;
100 for ( y = 0; y < HEIGHT; ++y) {
101 for ( x = 0; x < WIDTH; ++x) {
103 rlib->
mapping(x, y, &to_x, &to_y);
104 if ( (to_x != 0) || (to_y != 0) ) {
105 printf(
"(%u, %u) maps to (%u, %u)\n", x, y, to_x, to_y);
113 cout <<
"Writing to " << s << endl;
118 cout <<
"Reading from " << s << endl;
123 for (RectificationInfoFile::RectInfoBlockVector::iterator i = blocks->begin(); i != blocks->end(); ++i) {
125 if ( rlib == NULL ) {
126 printf(
"Got rectification info block of unknown type");
131 printf(
"LUT: type: %u camera: %u size: %zu\n",
134 cout <<
"Looking for non-zero mappings" << endl;
135 uint16_t x, y, to_x, to_y;
136 for ( y = 0; y < HEIGHT; ++y) {
137 for ( x = 0; x < WIDTH; ++x) {
139 rlib->
mapping(x, y, &to_x, &to_y);
140 if ( (to_x != 0) || (to_y != 0) ) {
141 printf(
"(%u, %u) maps to (%u, %u)\n", x, y, to_x, to_y);
unsigned int type() const
Get block type.
Recitification Lookup Table Block.
void add_rectinfo_block(RectificationInfoBlock *block)
Add a rectification info block.
Vector that is used for maintaining the rectification info blocks.
virtual void write(const char *file_name)
Write file.
virtual void mapping(uint16_t x, uint16_t y, uint16_t *to_x, uint16_t *to_y)
Get mapping (to_x, to_y) for (x, y).
virtual void read(const char *filename)
Read file.
void set_mapping(uint16_t x, uint16_t y, uint16_t to_x, uint16_t to_y)
Set mapping.
size_t block_size() const
Size of blocks.
virtual void clear()
Clear internal storage.
uint8_t camera() const
Get block camera identifier.
RectInfoBlockVector * rectinfo_blocks()
Get all rectification info blocks.