23 #ifdef HAVE_BUMBLEBEE2_CAM
24 # include <fvcams/bumblebee2.h>
26 #include <fvutils/rectification/rectfile.h>
27 #include <fvutils/rectification/rectinfo_block.h>
28 #include <fvutils/rectification/rectinfo_lut_block.h>
29 #include <fvutils/system/camargp.h>
30 #include <utils/system/argparser.h>
32 #ifdef HAVE_TRICLOPS_SDK
33 # include <fvstereo/triclops.h>
43 using namespace firevision;
48 printf(
"Usage: %s <-r|-v|-i> file.rectlut\n", argp->
program_name());
49 printf(
"You have to give at least one of -r/-v/-i and a file name\n"
50 " -r retrieve rectification lut from live camera,\n"
51 " uses first found Bumblebee2 camera\n"
52 " -v verify rectification lut, compares the identification\n"
53 " info stored in the file with the first currently\n"
55 " -d deep verifiction of rectification LUT, compares the identification\n"
56 " info stored in the file with the first currently attached camera. It\n"
57 " also verifies each single mapping on equality.\n"
58 " -i print info about rectification LUT file\n\n");
65 #ifdef HAVE_BUMBLEBEE2_CAM
66 # ifdef HAVE_TRICLOPS_SDK
67 const char *lut_file = argp->
items()[0];
69 if (access(lut_file, F_OK) == 0) {
70 fprintf(stderr,
"File with name %s exists, delete manually and retry. Aborting.\n", lut_file);
73 if (access(lut_file, W_OK) != 0) {
75 if (errno != ENOENT) {
76 fprintf(stderr,
"Cannot write to file %s, permission problem?\n", lut_file);
94 printf(
"Retrieving the rectification LUT from a camera is not supported,\n"
95 "because the Triclops SDK was not available at compile time.\n");
98 printf(
"Retrieving the rectification LUT from a camera is not supported,\n"
99 "because the Bumblebee2 support was not available at compile time.\n");
110 #ifdef HAVE_BUMBLEBEE2_CAM
115 for (
unsigned int i = 0; i < argp->
num_items(); ++i) {
116 const char *lut_file = argp->
items()[i];
118 if (access(lut_file, F_OK) != 0) {
119 fprintf(stderr,
"File with name %s does not exist. Ignoring.\n", lut_file);
122 if (access(lut_file, R_OK) != 0) {
123 fprintf(stderr,
"Cannot read file %s, permission problem? Ingoring.\n", lut_file);
132 printf(
"Success. The rectification info file has been created for the "
133 "connected camera\n");
135 printf(
"Failure. The rectification info file has *not* been created "
136 "for the connected camera\n");
140 fprintf(stderr,
"Failed to read lut file %s\n", lut_file);
153 printf(
"Verifying the rectification LUT from a camera is not supported,\n"
154 "because the Bumblebee2 support was not available at compile time.\n");
163 #ifdef HAVE_BUMBLEBEE2_CAM
164 # ifdef HAVE_TRICLOPS_SDK
173 for (
unsigned int i = 0; i < argp->
num_items(); ++i) {
174 const char *lut_file = argp->
items()[i];
176 if (access(lut_file, F_OK) != 0) {
177 fprintf(stderr,
"File with name %s does not exist. Ignoring.\n", lut_file);
180 if (access(lut_file, R_OK) != 0) {
181 fprintf(stderr,
"Cannot read file %s, permission problem? Ingoring.\n", lut_file);
186 printf(
"Success. LUT file %s contains matching configuration data.\n", lut_file);
188 printf(
"Failure. LUT file %s does not contain matching configuration data.\n", lut_file);
200 printf(
"Deep verification of the rectification LUT from a camera is not supported,\n"
201 "because the Triclops SDK was not available at compile time.\n");
205 printf(
"Deep verification of the rectification LUT from a camera is not supported,\n"
206 "because the Bumblebee2 support was not available at compile time.\n");
214 for (
unsigned int i = 0; i < argp->
num_items(); ++i) {
215 const char *lut_file = argp->
items()[i];
217 if (access(lut_file, F_OK) != 0) {
218 fprintf(stderr,
"File with name %s does not exist. Ignoring.\n", lut_file);
221 if (access(lut_file, R_OK) != 0) {
222 fprintf(stderr,
"Cannot read file %s, permission problem? Ingoring.\n", lut_file);
234 "Num Blocks: %zu/%zu (header/read)\n"
240 "Camera Model: %s\n",
247 (
long unsigned int)rif->
guid(),
249 (
long long unsigned int)rif->
guid(),
254 RectificationInfoFile::RectInfoBlockVector::const_iterator b;
255 for (b = blocks->begin(); b != blocks->end(); ++b) {
258 printf(
"\nRectInfo Block No. %u\n"
263 rectinfo_type_strings[rib->
type()],
264 rectinfo_camera_strings[rib->
camera()],
267 switch (rib->
type()) {
268 case FIREVISION_RECTINFO_TYPE_LUT_16x16: {
271 printf(
"** Failure to access LUT_16x16\n");
273 printf(
"LUT width: %hu\n"
279 default: printf(
"** No additional information available for this info type\n");
break;
285 fprintf(stderr,
"Failed to read lut file %s\n", lut_file);
294 main(
int argc,
char **argv)
303 return retrieve(&argp);
304 }
else if (argp.
has_arg(
"v")) {
305 return verify(&argp);
306 }
else if (argp.
has_arg(
"d")) {
307 return deep_verify(&argp);
308 }
else if (argp.
has_arg(
"i")) {
Parse command line arguments.
const char * program_name() const
Get name of program.
const std::vector< const char * > & items() const
Get non-option items.
std::vector< const char * >::size_type num_items() const
Get number of non-option items.
bool has_arg(const char *argn)
Check if argument has been supplied.
Base class for exceptions in Fawkes.
void print_trace() noexcept
Prints trace to stderr.
virtual void close()
Close camera.
virtual void open()
Open the camera.
virtual bool verify_guid(uint64_t ver_guid) const
Verify GUID validity.
unsigned int type() const
Get block type.
size_t block_size() const
Size of blocks.
unsigned int version()
Get the version of the file.
size_t num_blocks()
Get the number of available info blocks.
bool is_little_endian()
Check if data is encoded as little endian.
Rectification info block.
uint8_t camera() const
Get block camera identifier.
Vector that is used for maintaining the rectification info blocks.
virtual void read(const char *filename)
Read file.
RectInfoBlockVector * rectinfo_blocks()
Get all rectification info blocks.
const char * model()
Get the model of the camera.
uint64_t guid()
Get the GUID of camera.
Recitification Lookup Table Block.
uint16_t pixel_height()
Get height the LUT.
uint16_t pixel_width()
Get width of the LUT.
Stereo processing using PGR Triclops SDK.
void generate_rectification_lut(const char *lut_file)
Generate rectification LUT.
bool verify_rectification_lut(const char *lut_file)
Verify rectification LUT.
Fawkes library namespace.