gc_stream.cc
Go to the documentation of this file.
1 /*
2  * This file is part of the rc_genicam_api package.
3  *
4  * Copyright (c) 2017 Roboception GmbH
5  * All rights reserved
6  *
7  * Author: Heiko Hirschmueller
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of the copyright holder nor the names of its contributors
20  * may be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #include <rc_genicam_api/system.h>
38 #include <rc_genicam_api/device.h>
39 #include <rc_genicam_api/stream.h>
40 #include <rc_genicam_api/buffer.h>
41 #include <rc_genicam_api/image.h>
42 #include <rc_genicam_api/config.h>
43 
45 
46 #include <Base/GCException.h>
47 
48 #include <signal.h>
49 
50 #include <iostream>
51 #include <fstream>
52 #include <iomanip>
53 #include <algorithm>
54 #include <atomic>
55 #include <thread>
56 #include <chrono>
57 
58 #ifdef _WIN32
59 #undef min
60 #undef max
61 #endif
62 
63 namespace
64 {
65 
71 std::string ensureNewName(std::string name)
72 {
73  // check if given name is already used
74 
75  std::ifstream file(name);
76 
77  if (file.is_open())
78  {
79  file.close();
80 
81  // split name in prefix and suffix
82 
83  std::string suffix;
84 
85  size_t i=name.rfind('.');
86  if (i != name.npos && name.size()-i <= 4)
87  {
88  suffix=name.substr(i);
89  name=name.substr(0, i);
90  }
91 
92  // add number for finding name that is nor used
93 
94  int n=1;
95  while (n < 100)
96  {
98  s << name << "_" << n << suffix;
99 
100  file.open(s.str());
101  if (!file.is_open())
102  {
103  name=s.str();
104  break;
105  }
106 
107  file.close();
108  n++;
109  }
110  }
111 
112  return name;
113 }
114 
119 std::string storeBuffer(const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
120  const std::shared_ptr<GenApi::CChunkAdapter> &chunkadapter,
121  const std::string &component, const rcg::Buffer *buffer, uint32_t part)
122 {
123  // prepare file name
124 
125  std::ostringstream name;
126 
127  uint64_t t_sec = buffer->getTimestampNS()/1000000000;
128  uint64_t t_nsec = buffer->getTimestampNS()%1000000000;
129 
130  name << "image_" << t_sec << "." << std::setfill('0') << std::setw(9) << t_nsec;
131 
132  if (component.size() > 0)
133  {
134  name << '_' << component;
135  }
136 
137  if (chunkadapter)
138  {
139  // Append out1 and out2 status to file name: _<out1>_<out2>
140  std::int64_t line_status=rcg::getInteger(nodemap, "ChunkLineStatusAll");
141  bool out1 = line_status & 0x01;
142  bool out2 = line_status & 0x02;
143  name << "_" << std::noboolalpha << out1 << "_" << out2;
144  }
145 
146  // store image (see e.g. the sv tool of cvkit for show images)
147 
148  if (!buffer->getIsIncomplete() && buffer->getImagePresent(part))
149  {
150  size_t width=buffer->getWidth(part);
151  size_t height=buffer->getHeight(part);
152  const unsigned char *p=static_cast<const unsigned char *>(buffer->getBase(part));
153 
154  size_t px=buffer->getXPadding(part);
155 
156  uint64_t format=buffer->getPixelFormat(part);
157  switch (format)
158  {
159  case Mono8: // store 8 bit monochrome image
160  case Confidence8:
161  case Error8:
162  {
163  name << ".pgm";
164  std::ofstream out(ensureNewName(name.str()), std::ios::binary);
165 
166  out << "P5" << std::endl;
167  out << width << " " << height << std::endl;
168  out << 255 << "\n";
169 
170  std::streambuf *sb=out.rdbuf();
171 
172  for (size_t k=0; k<height && out.good(); k++)
173  {
174  for (size_t i=0; i<width; i++)
175  {
176  sb->sputc(static_cast<char>(*p++));
177  }
178 
179  p+=px;
180  }
181 
182  out.close();
183  }
184  break;
185 
186  case Coord3D_C16: // store 16 bit monochrome image
187  {
188  name << ".pgm";
189  std::ofstream out(ensureNewName(name.str()), std::ios::binary);
190 
191  out << "P5" << std::endl;
192  out << width << " " << height << std::endl;
193  out << 65535 << "\n";
194 
195  std::streambuf *sb=out.rdbuf();
196 
197  // copy image data, pgm is always big endian
198 
199  if (buffer->isBigEndian())
200  {
201  for (size_t k=0; k<height && out.good(); k++)
202  {
203  for (size_t i=0; i<width; i++)
204  {
205  sb->sputc(static_cast<char>(*p++));
206  sb->sputc(static_cast<char>(*p++));
207  }
208 
209  p+=px;
210  }
211  }
212  else
213  {
214  for (size_t k=0; k<height && out.good(); k++)
215  {
216  for (size_t i=0; i<width; i++)
217  {
218  sb->sputc(static_cast<char>(p[1]));
219  sb->sputc(static_cast<char>(p[0]));
220  p+=2;
221  }
222 
223  p+=px;
224  }
225  }
226 
227  out.close();
228  }
229  break;
230 
231  case YCbCr411_8: // convert and store as color image
232  {
233  name << ".ppm";
234  std::ofstream out(ensureNewName(name.str()), std::ios::binary);
235 
236  out << "P6" << std::endl;
237  out << width << " " << height << std::endl;
238  out << 255 << "\n";
239 
240  std::streambuf *sb=out.rdbuf();
241 
242  size_t pstep=(width>>2)*6+px;
243  for (size_t k=0; k<height && out.good(); k++)
244  {
245  for (size_t i=0; i<width; i+=4)
246  {
247  uint8_t rgb[12];
248  rcg::convYCbCr411toQuadRGB(rgb, p, static_cast<int>(i));
249 
250  for (int j=0; j<12; j++)
251  {
252  sb->sputc(static_cast<char>(rgb[j]));
253  }
254  }
255 
256  p+=pstep;
257  }
258 
259  out.close();
260  }
261  break;
262 
263  default:
264  std::cerr << "storeBuffer(): Unknown pixel format: "
265  << GetPixelFormatName(static_cast<PfncFormat>(buffer->getPixelFormat(part)))
266  << std::endl;
267  return std::string();
268  break;
269  }
270  }
271  else if (buffer->getIsIncomplete())
272  {
273  std::cerr << "storeBuffer(): Received incomplete buffer" << std::endl;
274  return std::string();
275  }
276  else if (!buffer->getImagePresent(part))
277  {
278  std::cerr << "storeBuffer(): Received buffer without image" << std::endl;
279  return std::string();
280  }
281 
282  return name.str();
283 }
284 
293 std::string storeBufferAsDisparity(const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
294  const std::shared_ptr<GenApi::CChunkAdapter> &chunkadapter,
295  const rcg::Buffer *buffer, uint32_t part)
296 {
297  std::string dispname;
298 
299  if (!buffer->getIsIncomplete() && buffer->getImagePresent(part) &&
300  buffer->getPixelFormat(part) == Coord3D_C16 && chunkadapter)
301  {
302  // get necessary information from ChunkScan3d parameters
303 
304  int inv=-1;
305 
306  rcg::setString(nodemap, "ChunkComponentSelector", "Disparity");
307 
308  if (rcg::getBoolean(nodemap, "ChunkScan3dInvalidDataFlag"))
309  {
310  inv=static_cast<int>(rcg::getFloat(nodemap, "ChunkScan3dInvalidDataValue"));
311  }
312 
313  double scale=rcg::getFloat(nodemap, "ChunkScan3dCoordinateScale");
314  double offset=rcg::getFloat(nodemap, "ChunkScan3dCoordinateOffset");
315  double f=rcg::getFloat(nodemap, "ChunkScan3dFocalLength");
316  double t=rcg::getFloat(nodemap, "ChunkScan3dBaseline");
317  double u=rcg::getFloat(nodemap, "ChunkScan3dPrincipalPointU");
318  double v=rcg::getFloat(nodemap, "ChunkScan3dPrincipalPointV");
319 
320  // proceed if required information is given
321 
322  if (scale > 0 && f > 0 && t > 0)
323  {
324  // prepare file name
325 
326  std::ostringstream name;
327 
328  uint64_t t_sec = buffer->getTimestampNS()/1000000000;
329  uint64_t t_nsec = buffer->getTimestampNS()%1000000000;
330 
331  name << "image_" << t_sec << "." << std::setfill('0') << std::setw(9) << t_nsec;
332 
333  // convert values and store disparity image
334 
335  size_t px=buffer->getXPadding(part);
336  size_t width=buffer->getWidth(part);
337  size_t height=buffer->getHeight(part);
338  const unsigned char *p=static_cast<const unsigned char *>(buffer->getBase(part))+
339  2*(width+px)*(height+1);
340 
341  name << "_Disparity";
342 
343  // Append out1 and out2 status to file name: _<out1>_<out2>
344  std::int64_t line_status=rcg::getInteger(nodemap, "ChunkLineStatusAll");
345  bool out1 = line_status & 0x01;
346  bool out2 = line_status & 0x02;
347  name << "_" << std::noboolalpha << out1 << "_" << out2;
348 
349  dispname=name.str()+".pfm";
350 
351  std::ofstream out(ensureNewName(dispname), std::ios::binary);
352 
353  out << "Pf" << std::endl;
354  out << width << " " << height << std::endl;
355  out << 1 << "\n";
356 
357  std::streambuf *sb=out.rdbuf();
358 
359  // get 16 bit data, scale and add offset and store as big endian
360 
361  bool msbfirst=true;
362 
363  {
364  int pp=1;
365  char *cc=reinterpret_cast<char *>(&pp);
366  msbfirst=(cc[0] != 1);
367  }
368 
369  for (size_t k=0; k<height && out.good(); k++)
370  {
371  p-=(width+px)<<2;
372  for (size_t i=0; i<width; i++)
373  {
374  int val;
375  if (buffer->isBigEndian())
376  {
377  val=(static_cast<int>(p[0])<<8)|p[1];
378  }
379  else
380  {
381  val=(static_cast<int>(p[1])<<8)|p[0];
382  }
383 
384  p+=2;
385 
386  float d=std::numeric_limits<float>::infinity();
387  if (val != inv)
388  {
389  d=static_cast<float>(val*scale+offset);
390  }
391 
392  char *c=reinterpret_cast<char *>(&d);
393 
394  if (msbfirst)
395  {
396  sb->sputc(c[0]);
397  sb->sputc(c[1]);
398  sb->sputc(c[2]);
399  sb->sputc(c[3]);
400  }
401  else
402  {
403  sb->sputc(c[3]);
404  sb->sputc(c[2]);
405  sb->sputc(c[1]);
406  sb->sputc(c[0]);
407  }
408 
409  p+=px;
410  }
411  }
412 
413  out.close();
414 
415  // store parameters that are necessary for 3D reconstruction in separate
416  // parameter file
417 
418  name << "_param.txt";
419 
420  out.open(ensureNewName(name.str()));
421 
422  out << "# Created by gc_stream" << std::endl;
423  out << std::fixed << std::setprecision(5);
424  out << "camera.A=[" << f << " 0 " << u << "; 0 " << f << " " << v << "; 0 0 1]" << std::endl;
425  out << "camera.height=" << height << std::endl;
426  out << "camera.width=" << width << std::endl;
427  out << "rho=" << f*t << std::endl;
428  out << "t=" << t << std::endl;
429 
430  out.close();
431  }
432  }
433 
434  return dispname;
435 }
436 
437 // simple mechanism to set the boolean flag when the user presses enter in the
438 // terminal
439 
440 std::atomic<bool> user_interrupt(false);
441 
442 void interruptHandler(int)
443 {
444  std::cout << "Stopping ..." << std::endl;
445 
446  user_interrupt=true;
447 }
448 
449 #ifdef _WIN32
450 
451 void checkUserInterrupt()
452 {
453  char a;
454  std::cin.get(a);
455 
456  std::cout << "Stopping ..." << std::endl;
457 
458  user_interrupt=true;
459 }
460 
461 #endif
462 
463 }
464 
465 int main(int argc, char *argv[])
466 {
467  int ret=0;
468 
469  signal(SIGINT, interruptHandler);
470 
471  try
472  {
473  bool store=true;
474  int i=1;
475 
476  if (i < argc)
477  {
478  if (std::string(argv[i]) == "-t")
479  {
480  store=false;
481  i++;
482  }
483  }
484 
485  if (i < argc && std::string(argv[i]) != "-h")
486  {
487  // find specific device accross all systems and interfaces and open it
488 
489  std::shared_ptr<rcg::Device> dev=rcg::getDevice(argv[i++]);
490 
491  if (dev)
492  {
493  dev->open(rcg::Device::CONTROL);
494  std::shared_ptr<GenApi::CNodeMapRef> nodemap=dev->getRemoteNodeMap();
495 
496  // get chunk adapter (this switches chunk mode on if possible and
497  // returns a null pointer if this is not possible)
498 
499  std::shared_ptr<GenApi::CChunkAdapter> chunkadapter=rcg::getChunkAdapter(nodemap, dev->getTLType());
500 
501  // set values as given on the command line
502 
503  int n=1;
504  while (i < argc)
505  {
506  // split argument in key and value
507 
508  std::string key=argv[i++];
509  std::string value;
510 
511  size_t k=key.find('=');
512  if (k != std::string::npos)
513  {
514  value=key.substr(k+1);
515  key=key.substr(0, k);
516  }
517 
518  if (key == "n") // set number of images
519  {
520  n=std::max(1, std::stoi(value));
521  }
522  else // set key=value pair through GenICam
523  {
524  if (value.size() > 0)
525  {
526  rcg::setString(nodemap, key.c_str(), value.c_str(), true);
527  }
528  else
529  {
530  rcg::callCommand(nodemap, key.c_str(), true);
531  }
532  }
533  }
534 
535  // print enabled streams
536 
537  {
538  std::vector<std::string> component;
539 
540  rcg::getEnum(nodemap, "ComponentSelector", component, false);
541 
542  if (component.size() > 0)
543  {
544  std::cout << std::endl;
545  std::cout << "Available components (1 means enabled, 0 means disabled):" << std::endl;
546  std::cout << std::endl;
547 
548  for (size_t k=0; k<component.size(); k++)
549  {
550  rcg::setEnum(nodemap, "ComponentSelector", component[k].c_str(), true);
551 
552  std::cout << component[k] << ": ";
553  std::cout << rcg::getBoolean(nodemap, "ComponentEnable", true, true);
554  std::cout << std::endl;
555  }
556 
557  std::cout << std::endl;
558  }
559  }
560 
561  // open stream and get n images
562 
563  std::vector<std::shared_ptr<rcg::Stream> > stream=dev->getStreams();
564 
565  if (stream.size() > 0)
566  {
567 #ifdef _WIN32
568  // start background thread for checking user input
569  std::thread thread_cui(checkUserInterrupt);
570  thread_cui.detach();
571 #endif
572 
573  // opening first stream
574 
575  stream[0]->open();
576  stream[0]->startStreaming();
577 
578  std::cout << "Package size: " << rcg::getString(nodemap, "GevSCPSPacketSize") << std::endl;
579 
580 #ifdef _WIN32
581  std::cout << "Press 'Enter' to abort grabbing." << std::endl;
582 #endif
583  std::cout << std::endl;
584 
585  int buffers_received=0;
586  int buffers_incomplete=0;
587  auto time_start=std::chrono::steady_clock::now();
588  double latency_ns=0;
589 
590  for (int k=0; k<n && !user_interrupt; k++)
591  {
592  // grab next image with timeout of 3 seconds
593 
594  int retry=5;
595  while (retry > 0 && !user_interrupt)
596  {
597  const rcg::Buffer *buffer=stream[0]->grab(3000);
598 
599  if (buffer != 0)
600  {
601  buffers_received++;
602 
603  if (!buffer->getIsIncomplete())
604  {
605  // attach buffer to nodemap for accessing chunk data if possible
606 
607  if (chunkadapter)
608  {
609  chunkadapter->AttachBuffer(
610  reinterpret_cast<std::uint8_t *>(buffer->getGlobalBase()),
611  static_cast<int64_t>(buffer->getSizeFilled()));
612  }
613 
614  // store images in all parts
615 
616  if (store)
617  {
618  uint32_t npart=buffer->getNumberOfParts();
619  for (uint32_t part=0; part<npart; part++)
620  {
621  if (buffer->getImagePresent(part))
622  {
623  std::string name;
624 
625  // get component name
626 
627  std::string component=rcg::getComponetOfPart(nodemap, buffer, part);
628 
629  // try storing disparity as float image with meta information
630 
631  if (component == "Disparity")
632  {
633  name=storeBufferAsDisparity(nodemap, chunkadapter, buffer, part);
634  }
635 
636  // otherwise, store as ordinary image
637 
638  if (name.size() == 0)
639  {
640  name=storeBuffer(nodemap, chunkadapter, component, buffer, part);
641  }
642 
643  // report success
644 
645  if (name.size() > 0)
646  {
647  std::cout << "Image '" << name << "' stored" << std::endl;
648  retry=0;
649  }
650  }
651  }
652  }
653  else
654  {
655  // just print timestamp of received buffer
656 
657  uint64_t t_sec = buffer->getTimestampNS()/1000000000;
658  uint64_t t_nsec = buffer->getTimestampNS()%1000000000;
659 
660  std::cout << "Received buffer with timestamp: " << t_sec << "."
661  << std::setfill('0') << std::setw(9) << t_nsec << std::endl;
662  retry=0;
663 
664  // accumulate mean latency
665 
666  auto current=std::chrono::system_clock::now();
667  latency_ns+=
668  static_cast<double>(std::chrono::duration_cast<std::chrono::nanoseconds>(current.time_since_epoch()).count())-
669  static_cast<double>(buffer->getTimestampNS());
670  }
671 
672  // detach buffer from nodemap
673 
674  if (chunkadapter) chunkadapter->DetachBuffer();
675  }
676  else
677  {
678  std::cerr << "Incomplete buffer received" << std::endl;
679  buffers_incomplete++;
680  }
681  }
682  else
683  {
684  std::cerr << "Cannot grab images" << std::endl;
685  break;
686  }
687 
688  retry--;
689  }
690  }
691 
692  stream[0]->stopStreaming();
693  stream[0]->close();
694 
695  // report received and incomplete buffers
696 
697  std::cout << std::endl;
698  std::cout << "Received buffers: " << buffers_received << std::endl;
699  std::cout << "Incomplete buffers: " << buffers_incomplete << std::endl;
700 
701  auto time_stop=std::chrono::steady_clock::now();
702  std::cout << "Buffers per second: " << std::setprecision(3)
703  << 1000.0*buffers_received/std::chrono::duration_cast<std::chrono::milliseconds>(time_stop-time_start).count()
704  << std::endl;
705 
706  if (!store)
707  {
708  if (buffers_received-buffers_incomplete > 0)
709  {
710  latency_ns/=buffers_received-buffers_incomplete;
711  }
712 
713  std::cout << "Mean latency: " << std::setprecision(5) << latency_ns/1.0e6
714  << " ms (only meaningful if camera is synchronized e.g. via PTP!)" << std::endl;
715  }
716 
717  // return error code if no images could be received
718 
719  if (buffers_incomplete == buffers_received)
720  {
721  ret=1;
722  }
723  }
724  else
725  {
726  std::cerr << "No streams available" << std::endl;
727  ret=1;
728  }
729 
730  dev->close();
731  }
732  else
733  {
734  std::cerr << "Device '" << argv[1] << "' not found!" << std::endl;
735  ret=1;
736  }
737  }
738  else
739  {
740  // show help
741 
742  std::cout << argv[0] << " -h | [-t] [<interface-id>:]<device-id> [n=<n>] [<key>=<value>] ..." << std::endl;
743  std::cout << std::endl;
744  std::cout << "Stores images from the specified device after applying the given optional GenICam parameters." << std::endl;
745  std::cout << std::endl;
746  std::cout << "Options:" << std::endl;
747  std::cout << "-h Prints help information and exits" << std::endl;
748  std::cout << "-t Testmode, which does not store images and provides extended statistics" << std::endl;
749  std::cout << std::endl;
750  std::cout << "Parameters:" << std::endl;
751  std::cout << "<interface-id> Optional GenICam ID of interface for connecting to the device" << std::endl;
752  std::cout << "<device-id> GenICam device ID, serial number or user defined name of device" << std::endl;
753  std::cout << "n=<n> Optional number of images to be received (default is 1)" << std::endl;
754  std::cout << "<key>=<value> Optional GenICam parameters to be changed in the given order" << std::endl;
755 #ifdef _WIN32
756  std::cout << std::endl;
757  std::cout << "Streaming can be aborted by hitting the 'Enter' key." << std::endl;
758 #endif
759  ret=1;
760  }
761  }
762  catch (const std::exception &ex)
763  {
764  std::cerr << "Exception: " << ex.what() << std::endl;
765  ret=2;
766  }
767  catch (const GENICAM_NAMESPACE::GenericException &ex)
768  {
769  std::cerr << "Exception: " << ex.what() << std::endl;
770  ret=2;
771  }
772  catch (...)
773  {
774  std::cerr << "Unknown exception!" << std::endl;
775  ret=2;
776  }
777 
779 
780  return ret;
781 }
bool getBoolean(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception, bool igncache)
Get the value of a boolean feature of the given nodemap.
Definition: config.cc:497
std::shared_ptr< Device > getDevice(const char *id)
Searches across all transport layers and interfaces for a device.
Definition: device.cc:469
Definition: PFNC.h:272
size_t getSizeFilled() const
Returns the number of bytes written into the buffer last time it has been filled. ...
Definition: buffer.cc:252
std::shared_ptr< GenApi::CChunkAdapter > getChunkAdapter(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const std::string &tltype)
Sets ChunkModeActive to 1, creates a chunk adapter for the specified transport layer and attaches it ...
Definition: config.cc:871
int main(int argc, char *argv[])
Definition: gc_stream.cc:465
size_t getXPadding(std::uint32_t part) const
Returns horizontal padding of the data in the buffer in bytes.
Definition: buffer.cc:323
__int64 int64_t
Definition: config-win32.h:21
int64_t getInteger(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, int64_t *vmin, int64_t *vmax, bool exception, bool igncache)
Get the value of an integer feature of the given nodemap.
Definition: config.cc:542
std::string str()
size_t getWidth(std::uint32_t part) const
Returns the width of the image in pixel.
Definition: buffer.cc:271
bool setEnum(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const char *value, bool exception)
Set the value of an enumeration of the given nodemap.
Definition: config.cc:294
static void clearSystems()
Clears the internal list of systems.
Definition: system.cc:213
void convYCbCr411toQuadRGB(uint8_t rgb[12], const uint8_t *row, int i)
Conversion of a group of four pixels from YCbCr411 format (6 bytes for four pixels) to RGB...
Definition: image.cc:112
The buffer class encapsulates a Genicam buffer that is provided by a stream.
Definition: buffer.h:115
void * getGlobalBase() const
Returns the global base address of the buffer memory.
Definition: buffer.cc:164
void * getBase(std::uint32_t part) const
Returns the base address of the specified part of the multi-part buffer.
Definition: buffer.cc:174
std::string getEnum(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Get the value of an enumeration of the given nodemap.
Definition: config.cc:644
uint64_t getPixelFormat(std::uint32_t part) const
Returns the pixel format of the specified part as defined in the PFNC.
Definition: buffer.cc:388
#define Error8
Definition: pixel_formats.h:46
bool setString(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const char *value, bool exception)
Set the value of a feature of the given nodemap.
Definition: config.cc:351
double getFloat(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, double *vmin, double *vmax, bool exception, bool igncache)
Get the value of a double feature of the given nodemap.
Definition: config.cc:593
uint64_t getTimestampNS() const
Returns the acquisition timestamp of the data in this buffer in ns.
Definition: buffer.cc:489
bool isBigEndian() const
Returns if the data is given as big or little endian.
Definition: buffer.cc:460
bool callCommand(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Calls the given command.
Definition: config.cc:53
bool getImagePresent(std::uint32_t part) const
Returns if a 2D, 3D or confidence image is present in the specified part.
Definition: buffer.cc:346
bool getIsIncomplete() const
Signals if the buffer is incomplete due to an error.
Definition: buffer.cc:242
GenICam&#39;s exception class.
Definition: GCException.h:62
size_t getHeight(std::uint32_t part) const
Returns the height of the image in pixel.
Definition: buffer.cc:284
std::string getString(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception, bool igncache)
Get the value of a feature of the given nodemap.
Definition: config.cc:753
std::string getComponetOfPart(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const rcg::Buffer *buffer, uint32_t ipart)
Definition: config.cc:895
virtual const char * what() const
Get error description (overwrite from std:exception)
std::uint32_t getNumberOfParts() const
Returns the number of parts, excluding chunk data.
Definition: buffer.cc:142


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 19:10:54