Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpImageIoPortable.cpp
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Backend for portable image format I/O operations.
32 */
33
39#include "vpImageIoBackend.h"
40#include <visp3/core/vpImageConvert.h>
41#include <visp3/core/vpIoTools.h>
42#include <visp3/core/vpEndian.h>
43
44#ifndef DOXYGEN_SHOULD_SKIP_THIS
54void vp_decodeHeaderPNM(const std::string &filename, std::ifstream &fd, const std::string &magic, unsigned int &w,
55 unsigned int &h, unsigned int &maxval)
56{
57 std::string line;
58 unsigned int nb_elt = 4, cpt_elt = 0;
59 while (cpt_elt != nb_elt) {
60 // Skip empty lines or lines starting with # (comment)
61 while (std::getline(fd, line) && (line.compare(0, 1, "#") == 0 || line.size() == 0)) {
62 }
63
64 if (fd.eof()) {
65 fd.close();
66 throw(vpImageException(vpImageException::ioError, "Cannot read header of file \"%s\"", filename.c_str()));
67 }
68
69 std::vector<std::string> header = vpIoTools::splitChain(line, std::string(" "));
70
71 if (header.size() == 0) {
72 fd.close();
73 throw(vpImageException(vpImageException::ioError, "Cannot read header of file \"%s\"", filename.c_str()));
74 }
75
76 if (cpt_elt == 0) { // decode magic
77 if (header[0].compare(0, magic.size(), magic) != 0) {
78 fd.close();
79 throw(vpImageException(vpImageException::ioError, "\"%s\" is not a PNM file with magic number %s",
80 filename.c_str(), magic.c_str()));
81 }
82 cpt_elt++;
83 header.erase(header.begin(),
84 header.begin() + 1); // erase first element that is processed
85 }
86 while (header.size()) {
87 if (cpt_elt == 1) { // decode width
88 std::istringstream ss(header[0]);
89 ss >> w;
90 cpt_elt++;
91 header.erase(header.begin(),
92 header.begin() + 1); // erase first element that is processed
93 } else if (cpt_elt == 2) { // decode height
94 std::istringstream ss(header[0]);
95 ss >> h;
96 cpt_elt++;
97 header.erase(header.begin(),
98 header.begin() + 1); // erase first element that is processed
99 } else if (cpt_elt == 3) { // decode maxval
100 std::istringstream ss(header[0]);
101 ss >> maxval;
102 cpt_elt++;
103 header.erase(header.begin(),
104 header.begin() + 1); // erase first element that is processed
105 }
106 }
107 }
108}
109
110void vp_decodeHeaderPFM(const std::string &filename, std::ifstream &fd, std::string &magic, unsigned int &w,
111 unsigned int &h, double &scale, bool &littleEndian)
112{
113 std::string line;
114 const unsigned int nb_elt = 4;
115 unsigned int cpt_elt = 0;
116 while (cpt_elt != nb_elt) {
117 // Skip empty lines or lines starting with # (comment)
118 while (std::getline(fd, line) && (line.compare(0, 1, "#") == 0 || line.size() == 0)) {
119 }
120
121 if (fd.eof()) {
122 fd.close();
123 throw(vpImageException(vpImageException::ioError, "Cannot read header of file \"%s\"", filename.c_str()));
124 }
125
126 std::vector<std::string> header = vpIoTools::splitChain(line, std::string(" "));
127
128 if (header.empty()) {
129 fd.close();
130 throw(vpImageException(vpImageException::ioError, "Cannot read header of file \"%s\"", filename.c_str()));
131 }
132
133 if (cpt_elt == 0) { // decode magic
134 magic = header[0];
135 if (magic != "PF" && magic != "Pf") {
136 fd.close();
138 "\"%s\" is not a PFM file with PF (RGB) or Pf (gray) magic number", filename.c_str()));
139 }
140 cpt_elt++;
141 header.erase(header.begin(),
142 header.begin() + 1); // erase first element that is processed
143 }
144 while (header.size()) {
145 if (cpt_elt == 1) { // decode width
146 std::istringstream ss(header[0]);
147 ss >> w;
148 cpt_elt++;
149 header.erase(header.begin(),
150 header.begin() + 1); // erase first element that is processed
151 } else if (cpt_elt == 2) { // decode height
152 std::istringstream ss(header[0]);
153 ss >> h;
154 cpt_elt++;
155 header.erase(header.begin(),
156 header.begin() + 1); // erase first element that is processed
157 } else if (cpt_elt == 3) { // decode byte order
158 std::istringstream ss(header[0]);
159 ss >> scale;
160 littleEndian = scale < 0;
161 cpt_elt++;
162 header.erase(header.begin(),
163 header.begin() + 1); // erase first element that is processed
164 }
165 }
166 }
167}
168#endif
169
170//--------------------------------------------------------------------------
171// PFM
172//--------------------------------------------------------------------------
173
182void vp_writePFM(const vpImage<float> &I, const std::string &filename)
183{
184 FILE *fd;
185
186 // Test the filename
187 if (filename.empty()) {
188 throw(vpImageException(vpImageException::ioError, "Cannot write PFM image: filename empty"));
189 }
190
191 fd = fopen(filename.c_str(), "wb");
192
193 if (fd == NULL) {
194 throw(vpImageException(vpImageException::ioError, "Cannot create PFM file \"%s\"", filename.c_str()));
195 }
196
197 // Write the head
198 fprintf(fd, "P8\n"); // Magic number
199 fprintf(fd, "%u %u\n", I.getWidth(), I.getHeight()); // Image size
200 fprintf(fd, "255\n"); // Max level
201
202 // Write the bitmap
203 size_t ierr;
204 size_t nbyte = I.getWidth() * I.getHeight();
205
206 ierr = fwrite(I.bitmap, sizeof(float), nbyte, fd);
207 if (ierr != nbyte) {
208 fclose(fd);
209 throw(vpImageException(vpImageException::ioError, "Cannot save PFM file \"%s\": only %d bytes over %d saved ",
210 filename.c_str(), ierr, nbyte));
211 }
212
213 fflush(fd);
214 fclose(fd);
215}
216
217void vp_writePFM_HDR(const vpImage<float> &I, const std::string &filename)
218{
219 // Test the filename
220 if (filename.empty()) {
221 throw(vpImageException(vpImageException::ioError, "Cannot write PFM image: filename empty"));
222 }
223
224 FILE *fd = fopen(filename.c_str(), "wb");
225 if (fd == NULL) {
226 throw(vpImageException(vpImageException::ioError, "Cannot create PFM file \"%s\"", filename.c_str()));
227 }
228
229 // Write the head
230 fprintf(fd, "Pf\n"); // Magic number
231 fprintf(fd, "%u %u\n", I.getWidth(), I.getHeight()); // Image size
232#ifdef VISP_LITTLE_ENDIAN
233 fprintf(fd, "%f\n", -1.0f); // Byte order
234#else
235 fprintf(fd, "%f\n", 1.0f); // Byte order
236#endif
237
238 // Write the bitmap
239 size_t nbyte = I.getWidth();
240 for (int i = static_cast<int>(I.getHeight()) - 1; i >= 0; i--) {
241 size_t ierr = fwrite(I[i], sizeof(float), nbyte, fd);
242 if (ierr != nbyte) {
243 fclose(fd);
244 throw(vpImageException(vpImageException::ioError, "Cannot save PFM file \"%s\": only %d bytes over %d saved ",
245 filename.c_str(), ierr, nbyte));
246 }
247 }
248
249 fflush(fd);
250 fclose(fd);
251}
252
253void vp_writePFM_HDR(const vpImage<vpRGBf> &I, const std::string &filename)
254{
255 // Test the filename
256 if (filename.empty()) {
257 throw(vpImageException(vpImageException::ioError, "Cannot write PFM image: filename empty"));
258 }
259
260 FILE *fd = fopen(filename.c_str(), "wb");
261 if (fd == NULL) {
262 throw(vpImageException(vpImageException::ioError, "Cannot create PFM file \"%s\"", filename.c_str()));
263 }
264
265 // Write the head
266 fprintf(fd, "PF\n"); // Magic number
267 fprintf(fd, "%u %u\n", I.getWidth(), I.getHeight()); // Image size
268#ifdef VISP_LITTLE_ENDIAN
269 fprintf(fd, "%f\n", -1.0f); // Byte order
270#else
271 fprintf(fd, "%f\n", 1.0f); // Byte order
272#endif
273
274 // Write the bitmap
275 size_t nbyte = I.getWidth() * 3;
276 for (int i = static_cast<int>(I.getHeight()) - 1; i >= 0; i--) {
277 size_t ierr = fwrite(I[i], sizeof(float), nbyte, fd);
278 if (ierr != nbyte) {
279 fclose(fd);
280 throw(vpImageException(vpImageException::ioError, "Cannot save PFM file \"%s\": only %d bytes over %d saved ",
281 filename.c_str(), ierr, nbyte));
282 }
283 }
284
285 fflush(fd);
286 fclose(fd);
287}
288
289//--------------------------------------------------------------------------
290// PGM
291//--------------------------------------------------------------------------
292
300void vp_writePGM(const vpImage<unsigned char> &I, const std::string &filename)
301{
302 FILE *fd;
303
304 // Test the filename
305 if (filename.empty()) {
306 throw(vpImageException(vpImageException::ioError, "Cannot create PGM file: filename empty"));
307 }
308
309 fd = fopen(filename.c_str(), "wb");
310
311 if (fd == NULL) {
312 throw(vpImageException(vpImageException::ioError, "Cannot create PGM file \"%s\"", filename.c_str()));
313 }
314
315 // Write the head
316 fprintf(fd, "P5\n"); // Magic number
317 fprintf(fd, "%u %u\n", I.getWidth(), I.getHeight()); // Image size
318 fprintf(fd, "255\n"); // Max level
319
320 // Write the bitmap
321 size_t ierr;
322 size_t nbyte = I.getWidth() * I.getHeight();
323
324 ierr = fwrite(I.bitmap, sizeof(unsigned char), nbyte, fd);
325 if (ierr != nbyte) {
326 fclose(fd);
327 throw(vpImageException(vpImageException::ioError, "Cannot save PGM file \"%s\": only %d over %d bytes saved",
328 filename.c_str(), ierr, nbyte));
329 }
330
331 fflush(fd);
332 fclose(fd);
333}
334
342void vp_writePGM(const vpImage<short> &I, const std::string &filename)
343{
345 unsigned int nrows = I.getHeight();
346 unsigned int ncols = I.getWidth();
347
348 Iuc.resize(nrows, ncols);
349
350 for (unsigned int i = 0; i < nrows * ncols; i++)
351 Iuc.bitmap[i] = (unsigned char)I.bitmap[i];
352
353 vp_writePGM(Iuc, filename);
354}
355
364void vp_writePGM(const vpImage<vpRGBa> &I, const std::string &filename)
365{
366
367 FILE *fd;
368
369 // Test the filename
370 if (filename.empty()) {
371 throw(vpImageException(vpImageException::ioError, "Cannot create PGM file: filename empty"));
372 }
373
374 fd = fopen(filename.c_str(), "wb");
375
376 if (fd == NULL) {
377 throw(vpImageException(vpImageException::ioError, "Cannot create PGM file \"%s\"", filename.c_str()));
378 }
379
380 // Write the head
381 fprintf(fd, "P5\n"); // Magic number
382 fprintf(fd, "%u %u\n", I.getWidth(), I.getHeight()); // Image size
383 fprintf(fd, "255\n"); // Max level
384
385 // Write the bitmap
386 size_t ierr;
387 size_t nbyte = I.getWidth() * I.getHeight();
388
391
392 ierr = fwrite(Itmp.bitmap, sizeof(unsigned char), nbyte, fd);
393 if (ierr != nbyte) {
394 fclose(fd);
395 throw(vpImageException(vpImageException::ioError, "Cannot save PGM file \"%s\": only %d over %d bytes saved",
396 filename.c_str(), ierr, nbyte));
397 }
398
399 fflush(fd);
400 fclose(fd);
401}
402
417void vp_readPFM(vpImage<float> &I, const std::string &filename)
418{
419 unsigned int w = 0, h = 0, maxval = 0;
420 const unsigned int w_max = 100000, h_max = 100000, maxval_max = 255;
421 const std::string magic("P8");
422
423 std::ifstream fd(filename.c_str(), std::ios::binary);
424
425 // Open the filename
426 if (!fd.is_open()) {
427 throw(vpImageException(vpImageException::ioError, "Cannot open file \"%s\"", filename.c_str()));
428 }
429
430 vp_decodeHeaderPNM(filename, fd, magic, w, h, maxval);
431
432 if (w > w_max || h > h_max) {
433 fd.close();
434 throw(vpException(vpException::badValue, "Bad image size in \"%s\"", filename.c_str()));
435 }
436 if (maxval > maxval_max) {
437 fd.close();
438 throw(vpImageException(vpImageException::ioError, "Bad maxval in \"%s\"", filename.c_str()));
439 }
440
441 if ((h != I.getHeight()) || (w != I.getWidth())) {
442 I.resize(h, w);
443 }
444
445 unsigned int nbyte = I.getHeight() * I.getWidth();
446 fd.read((char *)I.bitmap, sizeof(float) * nbyte);
447 if (!fd) {
448 fd.close();
449 throw(vpImageException(vpImageException::ioError, "Read only %d of %d bytes in file \"%s\"", fd.gcount(), nbyte,
450 filename.c_str()));
451 }
452
453 fd.close();
454}
455
471void vp_readPFM_HDR(vpImage<float> &I, const std::string &filename)
472{
473 std::ifstream fd(filename.c_str(), std::ios::binary);
474
475 // Open the filename
476 if (!fd.is_open()) {
477 throw(vpImageException(vpImageException::ioError, "Cannot open file \"%s\"", filename.c_str()));
478 }
479
480 const unsigned int w_max = 100000, h_max = 100000;
481 const std::string magicRGB("PF"), magicGray("Pf");
482 std::string magic;
483 unsigned int w = 0, h = 0;
484 double scale = 1;
485 bool littleEndian = true;
486 vp_decodeHeaderPFM(filename, fd, magic, w, h, scale, littleEndian);
487
488 if (w > w_max || h > h_max) {
489 fd.close();
490 throw(vpException(vpException::badValue, "Bad image size in \"%s\"", filename.c_str()));
491 }
492
493 unsigned int channels = (magic == magicRGB) ? 3 : 1;
494 if (h != I.getHeight() || channels * w != I.getWidth()) {
495 I.resize(h, channels * w);
496 }
497
498#ifdef VISP_LITTLE_ENDIAN
499 bool swapEndianness = !littleEndian;
500#else
501 bool swapEndianness = littleEndian;
502#endif
503 for (int i = I.getHeight() - 1; i >= 0; i--) {
504 fd.read((char *)I[i], sizeof(float) * w * channels);
505 if (swapEndianness) {
506 for (unsigned int j = 0; j < w * channels; j++) {
507 I[i][j] = vpEndian::swapFloat(I[i][j]);
508 }
509 }
510 }
511
512 if (!fd) {
513 fd.close();
514 throw(vpImageException(vpImageException::ioError, "Read only %d bytes in file \"%s\"", fd.gcount(),
515 filename.c_str()));
516 }
517 fd.close();
518
519 if (std::fabs(scale) > 0.0f) {
520 for (unsigned int i = 0; i < I.getHeight(); i++) {
521 for (unsigned int j = 0; j < I.getWidth(); j++) {
522 I[i][j] *= 1.0f / static_cast<float>(std::fabs(scale));
523 }
524 }
525 }
526}
527
543void vp_readPFM_HDR(vpImage<vpRGBf> &I, const std::string &filename)
544{
545 std::ifstream fd(filename.c_str(), std::ios::binary);
546
547 // Open the filename
548 if (!fd.is_open()) {
549 throw(vpImageException(vpImageException::ioError, "Cannot open file \"%s\"", filename.c_str()));
550 }
551
552 const unsigned int w_max = 100000, h_max = 100000;
553 const std::string magicRGB("PF"), magicGray("Pf");
554 std::string magic;
555 unsigned int w = 0, h = 0;
556 double scale = 1;
557 bool littleEndian = true;
558 vp_decodeHeaderPFM(filename, fd, magic, w, h, scale, littleEndian);
559
560 if (w > w_max || h > h_max) {
561 fd.close();
562 throw(vpException(vpException::badValue, "Bad image size in \"%s\"", filename.c_str()));
563 }
564
565 unsigned int channels = (magic == magicRGB) ? 3 : 1;
566 if (magic != magicRGB) {
567 throw(vpImageException(vpImageException::ioError, "Image \"%s\" is not an RGB image!", filename.c_str()));
568 }
569 if (h != I.getHeight() || w != I.getWidth()) {
570 I.resize(h, w);
571 }
572
573#ifdef VISP_LITTLE_ENDIAN
574 bool swapEndianness = !littleEndian;
575#else
576 bool swapEndianness = littleEndian;
577#endif
578 for (int i = I.getHeight() - 1; i >= 0; i--) {
579 fd.read((char *)I[i], sizeof(float) * w * channels);
580 if (swapEndianness) {
581 for (unsigned int j = 0; j < w; j++) {
582 I[i][j].R = vpEndian::swapFloat(I[i][j].R);
583 I[i][j].G = vpEndian::swapFloat(I[i][j].G);
584 I[i][j].B = vpEndian::swapFloat(I[i][j].B);
585 }
586 }
587 }
588
589 if (!fd) {
590 fd.close();
591 throw(vpImageException(vpImageException::ioError, "Read only %d bytes in file \"%s\"", fd.gcount(),
592 filename.c_str()));
593 }
594 fd.close();
595
596 if (std::fabs(scale) > 0.0f) {
597 for (unsigned int i = 0; i < I.getHeight(); i++) {
598 for (unsigned int j = 0; j < I.getWidth(); j++) {
599 I[i][j].R *= 1.0f / static_cast<float>(std::fabs(scale));
600 I[i][j].G *= 1.0f / static_cast<float>(std::fabs(scale));
601 I[i][j].B *= 1.0f / static_cast<float>(std::fabs(scale));
602 }
603 }
604 }
605}
606
621void vp_readPGM(vpImage<unsigned char> &I, const std::string &filename)
622{
623 unsigned int w = 0, h = 0, maxval = 0;
624 unsigned int w_max = 100000, h_max = 100000, maxval_max = 255;
625 std::string magic("P5");
626
627 std::ifstream fd(filename.c_str(), std::ios::binary);
628
629 // Open the filename
630 if (!fd.is_open()) {
631 throw(vpImageException(vpImageException::ioError, "Cannot open file \"%s\"", filename.c_str()));
632 }
633
634 vp_decodeHeaderPNM(filename, fd, magic, w, h, maxval);
635
636 if (w > w_max || h > h_max) {
637 fd.close();
638 throw(vpException(vpException::badValue, "Bad image size in \"%s\"", filename.c_str()));
639 }
640 if (maxval > maxval_max) {
641 fd.close();
642 throw(vpImageException(vpImageException::ioError, "Bad maxval in \"%s\"", filename.c_str()));
643 }
644
645 if ((h != I.getHeight()) || (w != I.getWidth())) {
646 I.resize(h, w);
647 }
648
649 unsigned int nbyte = I.getHeight() * I.getWidth();
650 fd.read((char *)I.bitmap, nbyte);
651 if (!fd) {
652 fd.close();
653 throw(vpImageException(vpImageException::ioError, "Read only %d of %d bytes in file \"%s\"", fd.gcount(), nbyte,
654 filename.c_str()));
655 }
656
657 fd.close();
658}
659
677void vp_readPGM(vpImage<vpRGBa> &I, const std::string &filename)
678{
680
681 vp_readPGM(Itmp, filename);
682
684}
685
686//--------------------------------------------------------------------------
687// PPM
688//--------------------------------------------------------------------------
689
705void vp_readPPM(vpImage<unsigned char> &I, const std::string &filename)
706{
707 vpImage<vpRGBa> Itmp;
708
709 vp_readPPM(Itmp, filename);
710
712}
713
725void vp_readPPM(vpImage<vpRGBa> &I, const std::string &filename)
726{
727 unsigned int w = 0, h = 0, maxval = 0;
728 unsigned int w_max = 100000, h_max = 100000, maxval_max = 255;
729 std::string magic("P6");
730
731 std::ifstream fd(filename.c_str(), std::ios::binary);
732
733 // Open the filename
734 if (!fd.is_open()) {
735 throw(vpImageException(vpImageException::ioError, "Cannot open file \"%s\"", filename.c_str()));
736 }
737
738 vp_decodeHeaderPNM(filename, fd, magic, w, h, maxval);
739
740 if (w > w_max || h > h_max) {
741 fd.close();
742 throw(vpException(vpException::badValue, "Bad image size in \"%s\"", filename.c_str()));
743 }
744 if (maxval > maxval_max) {
745 fd.close();
746 throw(vpImageException(vpImageException::ioError, "Bad maxval in \"%s\"", filename.c_str()));
747 }
748
749 if ((h != I.getHeight()) || (w != I.getWidth())) {
750 I.resize(h, w);
751 }
752
753 for (unsigned int i = 0; i < I.getHeight(); i++) {
754 for (unsigned int j = 0; j < I.getWidth(); j++) {
755 unsigned char rgb[3];
756 fd.read((char *)&rgb, 3);
757
758 if (!fd) {
759 fd.close();
760 throw(vpImageException(vpImageException::ioError, "Read only %d of %d bytes in file \"%s\"",
761 (i * I.getWidth() + j) * 3 + fd.gcount(), I.getSize() * 3, filename.c_str()));
762 }
763
764 I[i][j].R = rgb[0];
765 I[i][j].G = rgb[1];
766 I[i][j].B = rgb[2];
767 I[i][j].A = vpRGBa::alpha_default;
768 }
769 }
770
771 fd.close();
772}
773
782void vp_writePPM(const vpImage<unsigned char> &I, const std::string &filename)
783{
784 vpImage<vpRGBa> Itmp;
785
787
788 vp_writePPM(Itmp, filename);
789}
790
798void vp_writePPM(const vpImage<vpRGBa> &I, const std::string &filename)
799{
800 FILE *f;
801
802 // Test the filename
803 if (filename.empty()) {
804 throw(vpImageException(vpImageException::ioError, "Cannot create PPM file: filename empty"));
805 }
806
807 f = fopen(filename.c_str(), "wb");
808
809 if (f == NULL) {
810 throw(vpImageException(vpImageException::ioError, "Cannot create PPM file \"%s\"", filename.c_str()));
811 }
812
813 fprintf(f, "P6\n"); // Magic number
814 fprintf(f, "%u %u\n", I.getWidth(), I.getHeight()); // Image size
815 fprintf(f, "%d\n", 255); // Max level
816
817 for (unsigned int i = 0; i < I.getHeight(); i++) {
818 for (unsigned int j = 0; j < I.getWidth(); j++) {
819 vpRGBa v = I[i][j];
820 unsigned char rgb[3];
821 rgb[0] = v.R;
822 rgb[1] = v.G;
823 rgb[2] = v.B;
824
825 size_t res = fwrite(&rgb, 1, 3, f);
826 if (res != 3) {
827 fclose(f);
828 throw(vpImageException(vpImageException::ioError, "cannot write file \"%s\"", filename.c_str()));
829 }
830 }
831 }
832
833 fflush(f);
834 fclose(f);
835}
error that can be emitted by ViSP classes.
Definition vpException.h:59
@ badValue
Used to indicate that a value is not in the allowed range.
Definition vpException.h:85
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
Error that can be emitted by the vpImage class and its derivatives.
@ ioError
Image io error.
Definition of the vpImage class member functions.
Definition vpImage.h:135
unsigned int getWidth() const
Definition vpImage.h:242
void resize(unsigned int h, unsigned int w)
resize the image : Image initialization
Definition vpImage.h:795
unsigned int getSize() const
Definition vpImage.h:223
Type * bitmap
points toward the bitmap
Definition vpImage.h:139
unsigned int getHeight() const
Definition vpImage.h:184
static std::vector< std::string > splitChain(const std::string &chain, const std::string &sep)
unsigned char B
Blue component.
Definition vpRGBa.h:140
unsigned char R
Red component.
Definition vpRGBa.h:138
unsigned char G
Green component.
Definition vpRGBa.h:139
@ alpha_default
Definition vpRGBa.h:63
VISP_EXPORT float swapFloat(float f)
Definition vpEndian.cpp:65