23 #ifdef HAVE_BUMBLEBEE2_CAM 24 #include <fvcams/bumblebee2.h> 26 #include <fvutils/system/camargp.h> 27 #include <utils/system/argparser.h> 28 #include <fvutils/rectification/rectfile.h> 29 #include <fvutils/rectification/rectinfo_block.h> 30 #include <fvutils/rectification/rectinfo_lut_block.h> 32 #ifdef HAVE_TRICLOPS_SDK 33 #include <fvstereo/triclops.h> 47 printf(
"Usage: %s <-r|-v|-i> file.rectlut\n", argp->
program_name());
48 printf(
"You have to give at least one of -r/-v/-i and a file name\n" 49 " -r retrieve rectification lut from live camera,\n" 50 " uses first found Bumblebee2 camera\n" 51 " -v verify rectification lut, compares the identification\n" 52 " info stored in the file with the first currently\n" 54 " -d deep verifiction of rectification LUT, compares the identification\n" 55 " info stored in the file with the first currently attached camera. It\n" 56 " also verifies each single mapping on equality.\n" 57 " -i print info about rectification LUT file\n\n" 66 #ifdef HAVE_BUMBLEBEE2_CAM 67 #ifdef HAVE_TRICLOPS_SDK 68 const char *lut_file = argp->
items()[0];
70 if ( access(lut_file, F_OK) == 0) {
71 fprintf(stderr,
"File with name %s exists, delete manually and retry. Aborting.\n", lut_file);
74 if ( access(lut_file, W_OK) != 0) {
76 if ( errno != ENOENT ) {
77 fprintf(stderr,
"Cannot write to file %s, permission problem?\n", lut_file);
95 printf(
"Retrieving the rectification LUT from a camera is not supported,\n" 96 "because the Triclops SDK was not available at compile time.\n");
99 printf(
"Retrieving the rectification LUT from a camera is not supported,\n" 100 "because the Bumblebee2 support was not available at compile time.\n");
112 #ifdef HAVE_BUMBLEBEE2_CAM 117 for (
unsigned int i = 0; i < argp->
num_items(); ++i) {
119 const char *lut_file = argp->
items()[i];
121 if ( access(lut_file, F_OK) != 0) {
122 fprintf(stderr,
"File with name %s does not exist. Ignoring.\n", lut_file);
125 if ( access(lut_file, R_OK) != 0) {
126 fprintf(stderr,
"Cannot read file %s, permission problem? Ingoring.\n", lut_file);
135 printf(
"Success. The rectification info file has been created for the " 136 "connected camera\n");
138 printf(
"Failure. The rectification info file has *not* been created " 139 "for the connected camera\n");
143 fprintf(stderr,
"Failed to read lut file %s\n", lut_file);
157 printf(
"Verifying the rectification LUT from a camera is not supported,\n" 158 "because the Bumblebee2 support was not available at compile time.\n");
168 #ifdef HAVE_BUMBLEBEE2_CAM 169 #ifdef HAVE_TRICLOPS_SDK 178 for (
unsigned int i = 0; i < argp->
num_items(); ++i) {
180 const char *lut_file = argp->
items()[i];
182 if ( access(lut_file, F_OK) != 0) {
183 fprintf(stderr,
"File with name %s does not exist. Ignoring.\n", lut_file);
186 if ( access(lut_file, R_OK) != 0) {
187 fprintf(stderr,
"Cannot read file %s, permission problem? Ingoring.\n", lut_file);
192 printf(
"Success. LUT file %s contains matching configuration data.\n", lut_file);
194 printf(
"Failure. LUT file %s does not contain matching configuration data.\n", lut_file);
207 printf(
"Deep verification of the rectification LUT from a camera is not supported,\n" 208 "because the Triclops SDK was not available at compile time.\n");
212 printf(
"Deep verification of the rectification LUT from a camera is not supported,\n" 213 "because the Bumblebee2 support was not available at compile time.\n");
222 for (
unsigned int i = 0; i < argp->
num_items(); ++i) {
224 const char *lut_file = argp->
items()[i];
226 if ( access(lut_file, F_OK) != 0) {
227 fprintf(stderr,
"File with name %s does not exist. Ignoring.\n", lut_file);
230 if ( access(lut_file, R_OK) != 0) {
231 fprintf(stderr,
"Cannot read file %s, permission problem? Ingoring.\n", lut_file);
243 "Num Blocks: %zu/%zu (header/read)\n" 249 "Camera Model: %s\n",
254 (
long unsigned int)rif->
guid(),
256 (
long long unsigned int)rif->
guid(),
261 RectificationInfoFile::RectInfoBlockVector::const_iterator b;
262 for (b = blocks->begin(); b != blocks->end(); ++b) {
265 printf(
"\nRectInfo Block No. %u\n" 270 rectinfo_type_strings[rib->
type()],
271 rectinfo_camera_strings[rib->
camera()],
274 switch (rib->
type()) {
275 case FIREVISION_RECTINFO_TYPE_LUT_16x16:
278 if ( rlib == NULL ) {
279 printf(
"** Failure to access LUT_16x16\n");
281 printf(
"LUT width: %hu\n" 288 printf(
"** No additional information available for this info type\n");
295 fprintf(stderr,
"Failed to read lut file %s\n", lut_file);
306 main(
int argc,
char **argv)
316 return retrieve(&argp);
317 }
else if ( argp.
has_arg(
"v") ) {
318 return verify(&argp);
319 }
else if ( argp.
has_arg(
"d") ) {
320 return deep_verify(&argp);
321 }
else if ( argp.
has_arg(
"i") ) {
const char * program_name() const
Get name of program.
size_t num_blocks()
Get the number of available info blocks.
virtual void open()
Open the camera.
unsigned int type() const
Get block type.
uint16_t pixel_width()
Get width of the LUT.
const char * model()
Get the model of the camera.
const std::vector< const char *> & items() const
Get non-option items.
bool verify_rectification_lut(const char *lut_file)
Verify rectification LUT.
Fawkes library namespace.
Recitification Lookup Table Block.
void generate_rectification_lut(const char *lut_file)
Generate rectification LUT.
Parse command line arguments.
Vector that is used for maintaining the rectification info blocks.
bool is_little_endian()
Check if data is encoded as little endian.
uint64_t guid()
Get the GUID of camera.
std::vector< const char *>::size_type num_items() const
Get number of non-option items.
unsigned int version()
Get the version of the file.
Base class for exceptions in Fawkes.
virtual void close()
Close camera.
uint16_t pixel_height()
Get height the LUT.
virtual void read(const char *filename)
Read file.
Rectification info block.
Stereo processing using PGR Triclops SDK.
void print_trace()
Prints trace to stderr.
size_t block_size() const
Size of blocks.
bool has_arg(const char *argn)
Check if argument has been supplied.
virtual bool verify_guid(uint64_t ver_guid) const
Verify GUID validity.
uint8_t camera() const
Get block camera identifier.
RectInfoBlockVector * rectinfo_blocks()
Get all rectification info blocks.