Main MRPT website > C++ reference for MRPT 1.5.9
CImage_JPEG_streams.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #include "base-precomp.h" // Precompiled headers
11 
12 #include <mrpt/utils/CImage.h>
13 #include <mrpt/utils/CStream.h>
14 
15 // Universal include for all versions of OpenCV
16 #include <mrpt/otherlibs/do_opencv_includes.h>
17 
18 using namespace mrpt;
19 using namespace mrpt::utils;
20 
21 // ---------------------------------------------------------------------------------------
22 // START OF JPEG FUNCTIONS PART
23 // ---------------------------------------------------------------------------------------
24 /* Expanded data destination object for stdio output */
25 
26 //#undef INT32
27 #undef FAR
28 #define XMD_H
29 
30 #include <stdio.h>
31 
32 // In Windows, we HAVE TO (YES dear...) include our custom jpeglib
33 // The problem is that, without .so/.dlls, all the libs have their
34 // own jpeglib and runtime checks of expected type-sizes fail
35 // causing asserts.... (fix: JLBC 20/OCT/2008)
36 #if MRPT_HAS_JPEG_SYSTEM
37  // Normal: System libraries (typ. unix)
38  #include <jpeglib.h>
39 
40  // Convert mrpt-names to normal ones:
41  #define mrpt_jpeg_source_mgr jpeg_source_mgr
42 
43 #elif MRPT_HAS_JPEG // Built-in version
44  #include "jpeglib/mrpt_jpeglib.h"
45  #define mrpt_jpeg_source_mgr jpeg_source_mgr
46 #endif
47 
48 typedef struct
49 {
50  struct jpeg_destination_mgr pub; /* public fields */
51 
52  CStream * out; /* target stream */
53  JOCTET * buffer; /* start of buffer */
55 
57 
58 #define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
59 
60 /*
61  * Initialize destination --- called by jpeg_start_compress
62  * before any data is actually written.
63  */
64 
65 METHODDEF(void)
67 {
68 mrpt_dest_ptr dest = (mrpt_dest_ptr) cinfo->dest;
69 
70  /* Allocate the output buffer --- it will be released when done with image */
71  dest->buffer = (JOCTET *)
72  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
73  OUTPUT_BUF_SIZE * sizeof(JOCTET));
74 
75  dest->pub.next_output_byte = dest->buffer;
77 }
78 
79 
80 /*
81  * Empty the output buffer --- called whenever buffer fills up.
82  *
83  * In typical applications, this should write the entire output buffer
84  * (ignoring the current state of next_output_byte & free_in_buffer),
85  * reset the pointer & count to the start of the buffer, and return TRUE
86  * indicating that the buffer has been dumped.
87  *
88  * In applications that need to be able to suspend compression due to output
89  * overrun, a FALSE return indicates that the buffer cannot be emptied now.
90  * In this situation, the compressor will return to its caller (possibly with
91  * an indication that it has not accepted all the supplied scanlines). The
92  * application should resume compression after it has made more room in the
93  * output buffer. Note that there are substantial restrictions on the use of
94  * suspension --- see the documentation.
95  *
96  * When suspending, the compressor will back up to a convenient restart point
97  * (typically the start of the current MCU). next_output_byte & free_in_buffer
98  * indicate where the restart point will be if the current call returns FALSE.
99  * Data beyond this point will be regenerated after resumption, so do not
100  * write it out when emptying the buffer externally.
101  */
102 
103 METHODDEF(boolean)
105 {
106  mrpt_dest_ptr dest = (mrpt_dest_ptr) cinfo->dest;
107 
108  dest->out->WriteBuffer( dest->buffer, OUTPUT_BUF_SIZE);
109 
110  dest->pub.next_output_byte = dest->buffer;
112 
113  return TRUE;
114 }
115 
116 
117 /*
118  * Terminate destination --- called by jpeg_finish_compress
119  * after all data has been written. Usually needs to flush buffer.
120  *
121  * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
122  * application must deal with any cleanup that should happen even
123  * for error exit.
124  */
125 
126 METHODDEF(void)
128 {
129  mrpt_dest_ptr dest = (mrpt_dest_ptr) cinfo->dest;
130  size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;
131 
132  /* Write any data remaining in the buffer */
133  if (datacount > 0)
134  dest->out->WriteBuffer( dest->buffer, (int)datacount);
135 
136 }
137 
138 GLOBAL(void)
140 {
141  mrpt_dest_ptr dest;
142 
143  /* The destination object is made permanent so that multiple JPEG images
144  * can be written to the same file without re-executing jpeg_stdio_dest.
145  * This makes it dangerous to use this manager and a different destination
146  * manager serially with the same JPEG object, because their private object
147  * sizes may be different. Caveat programmer.
148  */
149  if (cinfo->dest == NULL) { /* first time for this JPEG object? */
150  cinfo->dest = (jpeg_destination_mgr *)
151  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
152  sizeof(mrpt_destination_mgr));
153  }
154 
155  dest = (mrpt_dest_ptr) cinfo->dest;
156  dest->pub.init_destination = init_destination;
157  dest->pub.empty_output_buffer = empty_output_buffer;
158  dest->pub.term_destination = term_destination;
159  dest->out = out;
160 }
161 
162 // -------------------------------------------------------------
163 
164 /* Expanded data source object for stdio input */
165 
166 typedef struct
167 {
168  mrpt_jpeg_source_mgr pub; /* public fields */
169  CStream * in; /* source stream */
170  JOCTET * buffer; /* start of buffer */
171  boolean start_of_file; /* have we gotten any data yet? */
172 } my_source_mgr;
173 
175 
176 #define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */
177 
178 /*
179  * Initialize source --- called by jpeg_read_header
180  * before any data is actually read.
181  */
182 
183 METHODDEF(void)
185 {
186  my_src_ptr src = (my_src_ptr) cinfo->src;
187 
188  /* We reset the empty-input-file flag for each image,
189  * but we don't clear the input buffer.
190  * This is correct behavior for reading a series of images from one source.
191  */
193 }
194 
195 
196 /*
197  * Fill the input buffer --- called whenever buffer is emptied.
198  *
199  * In typical applications, this should read fresh data into the buffer
200  * (ignoring the current state of next_input_byte & bytes_in_buffer),
201  * reset the pointer & count to the start of the buffer, and return TRUE
202  * indicating that the buffer has been reloaded. It is not necessary to
203  * fill the buffer entirely, only to obtain at least one more byte.
204  *
205  * There is no such thing as an EOF return. If the end of the file has been
206  * reached, the routine has a choice of ERREXIT() or inserting fake data into
207  * the buffer. In most cases, generating a warning message and inserting a
208  * fake EOI marker is the best course of action --- this will allow the
209  * decompressor to output however much of the image is there. However,
210  * the resulting error message is misleading if the real problem is an empty
211  * input file, so we handle that case specially.
212  *
213  * In applications that need to be able to suspend compression due to input
214  * not being available yet, a FALSE return indicates that no more data can be
215  * obtained right now, but more may be forthcoming later. In this situation,
216  * the decompressor will return to its caller (with an indication of the
217  * number of scanlines it has read, if any). The application should resume
218  * decompression after it has loaded more data into the input buffer. Note
219  * that there are substantial restrictions on the use of suspension --- see
220  * the documentation.
221  *
222  * When suspending, the decompressor will back up to a convenient restart point
223  * (typically the start of the current MCU). next_input_byte & bytes_in_buffer
224  * indicate where the restart point will be if the current call returns FALSE.
225  * Data beyond this point must be rescanned after resumption, so move it to
226  * the front of the buffer rather than discarding it.
227  */
228 
229 METHODDEF(boolean)
231 {
232  my_src_ptr src = (my_src_ptr) cinfo->src;
233  size_t nbytes;
234 
235  nbytes = src->in->ReadBuffer( src->buffer, INPUT_BUF_SIZE);
236 
237  if (nbytes <= 0)
238  {
239  if (src->start_of_file) /* Treat empty input file as fatal error */
240  {
241  THROW_EXCEPTION("Error looking for JPEG start data!")
242  }
243 
244  /* Insert a fake EOI marker */
245  src->buffer[0] = (JOCTET) 0xFF;
246  src->buffer[1] = (JOCTET) JPEG_EOI;
247  nbytes = 2;
248  }
249 
250  src->pub.next_input_byte = src->buffer;
251  src->pub.bytes_in_buffer = nbytes;
252  src->start_of_file = FALSE;
253 
254  return TRUE;
255 }
256 
257 
258 /*
259  * Skip data --- used to skip over a potentially large amount of
260  * uninteresting data (such as an APPn marker).
261  *
262  * Writers of suspendable-input applications must note that skip_input_data
263  * is not granted the right to give a suspension return. If the skip extends
264  * beyond the data currently in the buffer, the buffer can be marked empty so
265  * that the next read will cause a fill_input_buffer call that can suspend.
266  * Arranging for additional bytes to be discarded before reloading the input
267  * buffer is the application writer's problem.
268  */
269 
270 METHODDEF(void)
271 skip_input_data (j_decompress_ptr cinfo, long num_bytes)
272 {
273  my_src_ptr src = (my_src_ptr) cinfo->src;
274 
275  /* Just a dumb implementation for now. Could use fseek() except
276  * it doesn't work on pipes. Not clear that being smart is worth
277  * any trouble anyway --- large skips are infrequent.
278  */
279  if (num_bytes > 0) {
280  while (num_bytes > (long) src->pub.bytes_in_buffer) {
281  num_bytes -= (long) src->pub.bytes_in_buffer;
282  (void) fill_input_buffer(cinfo);
283  /* note we assume that fill_input_buffer will never return FALSE,
284  * so suspension need not be handled.
285  */
286  }
287  src->pub.next_input_byte += (size_t) num_bytes;
288  src->pub.bytes_in_buffer -= (size_t) num_bytes;
289  }
290 }
291 
292 
293 /*
294  * An additional method that can be provided by data source modules is the
295  * resync_to_restart method for error recovery in the presence of RST markers.
296  * For the moment, this source module just uses the default resync method
297  * provided by the JPEG library. That method assumes that no backtracking
298  * is possible.
299  */
300 
301 
302 /*
303  * Terminate source --- called by jpeg_finish_decompress
304  * after all data has been read. Often a no-op.
305  *
306  * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
307  * application must deal with any cleanup that should happen even
308  * for error exit.
309  */
310 
311 METHODDEF(void)
313 {
314  MRPT_UNUSED_PARAM(cinfo);
315  /* no work necessary here */
316 }
317 
318 
319 /*
320  * Prepare for input from a stdio stream.
321  * The caller must have already opened the stream, and is responsible
322  * for closing it after finishing decompression.
323  */
324 
325 GLOBAL(void)
327 {
328  my_src_ptr src;
329 
330  /* The source object and input buffer are made permanent so that a series
331  * of JPEG images can be read from the same file by calling jpeg_stdio_src
332  * only before the first one. (If we discarded the buffer at the end of
333  * one image, we'd likely lose the start of the next one.)
334  * This makes it unsafe to use this manager and a different source
335  * manager serially with the same JPEG object. Caveat programmer.
336  */
337  if (cinfo->src == NULL)
338  { /* first time for this JPEG object? */
339  cinfo->src = (mrpt_jpeg_source_mgr *)
340  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
341  sizeof(my_source_mgr));
342  src = (my_src_ptr) cinfo->src;
343  src->buffer = (JOCTET *)
344  (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
345  INPUT_BUF_SIZE * sizeof(JOCTET));
346  }
347 
348  src = (my_src_ptr) cinfo->src;
349  src->pub.init_source = init_source;
350  src->pub.fill_input_buffer = fill_input_buffer;
351  src->pub.skip_input_data = skip_input_data;
352  src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
353  src->pub.term_source = term_source;
354  src->in = in;
355  src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
356  src->pub.next_input_byte = NULL; /* until buffer loaded */
357 }
358 
359 // ---------------------------------------------------------------------------------------
360 // END OF JPEG FUNCTIONS PART
361 // ---------------------------------------------------------------------------------------
362 
363 
364 
365 /*---------------------------------------------------------------
366  saveToStreamAsJPEG
367  ---------------------------------------------------------------*/
368 void CImage::saveToStreamAsJPEG( CStream &out, const int jpeg_quality ) const
369 {
370 #if MRPT_HAS_OPENCV
371  MRPT_START
372 
373  makeSureImageIsLoaded(); // For delayed loaded images stored externally
374 
375  struct jpeg_compress_struct cinfo;
376  struct jpeg_error_mgr jerr;
377 
378  const IplImage *ipl = static_cast<const IplImage*>(img);
379 
380  const unsigned int nCols = ipl->width;
381  const unsigned int nRows = ipl->height;
382  const bool is_color = (ipl->nChannels==3);
383 
384 
385  // Some previous verification:
386  ASSERT_(nCols>=1 && nRows>=1)
387  ASSERT_(ipl)
388  ASSERT_(ipl->nChannels == 1 || ipl->nChannels == 3)
389 
390  // 1) Initialization of the JPEG compresion object:
391  // --------------------------------------------------
392  cinfo.err = jpeg_std_error(&jerr);
393  jpeg_create_compress(&cinfo);
394 
395  // 2) Set the destination of jpeg data:
396  // --------------------------------------------------
397  jpeg_stdio_dest( &cinfo, &out );
398 
399  // 3) Set parameters for compression:
400  // --------------------------------------------------
401  cinfo.image_width = nCols;
402  cinfo.image_height = nRows;
403  cinfo.input_components = is_color ? 3:1;
404  cinfo.in_color_space = is_color ? JCS_RGB : JCS_GRAYSCALE;
405 
406  jpeg_set_defaults(&cinfo);
407  /* Make optional parameter settings here */
408  /* Now you can set any non-default parameters you wish to.
409  * Here we just illustrate the use of quality (quantization table) scaling:
410  */
411  jpeg_set_quality(&cinfo, jpeg_quality /* quality per cent */, TRUE /* limit to baseline-JPEG values */);
412 
413  // 4) Start:
414  // --------------------------------------------------
415  jpeg_start_compress(&cinfo, TRUE);
416 
417  // 5) Write scan lines:
418  // --------------------------------------------------
419  if (is_color)
420  {
421  JSAMPROW row_pointer[1]; /* pointer to a single row */
422  row_pointer[0] = (JSAMPROW)new char[ ipl->widthStep ];
423 
424  for (unsigned int row = 0; row<nRows;row++)
425  {
426  // Flip RGB bytes order!
427  char *src;
428  if (ipl->origin == 0)
429  src = &ipl->imageData[ row * ipl->widthStep ];
430  else src = &ipl->imageData[ (nRows-1-row) * ipl->widthStep ];
431  char *target = (char *)row_pointer[0];
432  for (unsigned int col=0;col<nCols;col++)
433  {
434  target[0] = src[2];
435  target[1] = src[1];
436  target[2] = src[0];
437 
438  target+=3;
439  src+=3;
440  }
441 
442  if (1!= jpeg_write_scanlines(&cinfo, row_pointer, 1))
443  {
444  THROW_EXCEPTION("jpeg_write_scanlines: didn't work!!");
445  }
446  }
447 
448  delete[] row_pointer[0];
449  } // end "color"
450  else
451  { // Is grayscale:
452  JSAMPROW row_pointer[1]; /* pointer to a single row */
453 
454  for (unsigned int row = 0; row<nRows;row++)
455  {
456  if (ipl->origin == 0)
457  row_pointer[0] = (JSAMPROW) &ipl->imageData[ row * ipl->widthStep ];
458  else row_pointer[0] = (JSAMPROW) &ipl->imageData[ (nRows-1-row) * ipl->widthStep ];
459 
460  // Gray scale:
461  if (1!= jpeg_write_scanlines(&cinfo, row_pointer, 1))
462  {
463  THROW_EXCEPTION("jpeg_write_scanlines: didn't work!!");
464  }
465  }
466  }
467 
468  // 6) Compress and finish:
469  // --------------------------------------------------
470  jpeg_finish_compress(&cinfo);
471  jpeg_destroy_compress(&cinfo);
472 
473  // DONE!
474  MRPT_END
475 #endif
476 }
477 
478 
479 /*---------------------------------------------------------------
480  saveToStreamAsJPEG
481  ---------------------------------------------------------------*/
483 {
484 #if MRPT_HAS_OPENCV
485  MRPT_START
486 
487  struct jpeg_decompress_struct cinfo;
488  struct jpeg_error_mgr jerr;
489 
490  /* Step 1: allocate and initialize JPEG decompression object */
491 
492  /* We set up the normal JPEG error routines, then override error_exit. */
493  cinfo.err = jpeg_std_error(&jerr);
494 
495  /* Now we can initialize the JPEG decompression object. */
496  jpeg_create_decompress(&cinfo);
497 
498  /* Step 2: specify data source (eg, a file) */
499  jpeg_stdio_src(&cinfo, &in);
500 
501  /* Step 3: read file parameters with jpeg_read_header() */
502  jpeg_read_header(&cinfo, TRUE);
503 
504  /* Step 4: set parameters for decompression */
505 
506  /* Step 5: Start decompressor */
507  jpeg_start_decompress(&cinfo);
508 
509  /* We may need to do some setup of our own at this point before reading
510  * the data. After jpeg_start_decompress() we have the correct scaled
511  * output image dimensions available, as well as the output colormap
512  * if we asked for color quantization.
513  * In this example, we need to make an output work buffer of the right size.
514  */
515  /* JSAMPLEs per row in output buffer */
516  /* physical row width in output buffer */
517  const int row_stride = cinfo.output_width * cinfo.output_components;
518  /* Make a one-row-high sample array that will go away when done with image */
519  /* Output row buffer */
520  JSAMPARRAY buffer = (*cinfo.mem->alloc_sarray)
521  ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
522 
523 
524  // Resize the CImage now:
525  this->changeSize( cinfo.output_width, cinfo.output_height, cinfo.out_color_components, true );
526  IplImage *ipl = static_cast<IplImage*>(img);
527 
528  /* Step 6: while (scan lines remain to be read) */
529  /* jpeg_read_scanlines(...); */
530 
531  /* Here we use the library's state variable cinfo.output_scanline as the
532  * loop counter, so that we don't have to keep track ourselves.
533  */
534  const unsigned int nCols = cinfo.output_width;
535  const unsigned int nRows = cinfo.output_height;
536 
537  for (unsigned int row = 0; row<nRows;row++)
538  {
539  /* jpeg_read_scanlines expects an array of pointers to scanlines.
540  * Here the array is only one element long, but you could ask for
541  * more than one scanline at a time if that's more convenient.
542  */
543  jpeg_read_scanlines(&cinfo, buffer, 1);
544 
545  /* Copy into the CImage object */
546  if (isColor())
547  {
548  // Flip RGB bytes order!
549  char *target = &ipl->imageData[ row * ipl->widthStep ];
550  const char *src = (char *)buffer[0];
551  for (unsigned int col=0;col<nCols;col++)
552  {
553  target[0] = src[2];
554  target[1] = src[1];
555  target[2] = src[0];
556 
557  target+=3;
558  src+=3;
559  }
560  }
561  else
562  {
563  // Gray scale:
564  memcpy( &ipl->imageData[ row * ipl->widthStep ],
565  buffer[0],
566  row_stride );
567  }
568 
569  }
570 
571  /* Step 7: Finish decompression */
572 
573  jpeg_finish_decompress(&cinfo);
574  /* We can ignore the return value since suspension is not possible
575  * with the stdio data source.
576  */
577 
578  /* Step 8: Release JPEG decompression object */
579 
580  /* This is an important step since it will release a good deal of memory. */
581  jpeg_destroy_decompress(&cinfo);
582 
583  // DONE!
584  MRPT_END
585 #endif
586 }
587 
void BASE_IMPEXP memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) MRPT_NO_THROWS
An OS and compiler independent version of "memcpy".
Definition: os.cpp:358
jpeg_set_quality(j_compress_ptr cinfo, int quality, boolean force_baseline)
Definition: jcparam.cpp:129
size_t ReadBuffer(void *Buffer, size_t Count)
Reads a block of bytes from the stream into Buffer.
Definition: CStream.cpp:45
init_destination(j_compress_ptr cinfo)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
GLuint buffer
Definition: glext.h:3775
#define JPOOL_PERMANENT
Definition: mrpt_jpeglib.h:745
mrpt_destination_mgr * mrpt_dest_ptr
jpeg_set_defaults(j_compress_ptr cinfo)
Definition: jcparam.cpp:265
#define THROW_EXCEPTION(msg)
struct jpeg_common_struct * j_common_ptr
Definition: mrpt_jpeglib.h:258
jpeg_finish_decompress(j_decompress_ptr cinfo)
Definition: jdapimin.cpp:360
JDIMENSION image_height
Definition: mrpt_jpeglib.h:277
void WriteBuffer(const void *Buffer, size_t Count)
Writes a block of bytes to the stream from Buffer.
Definition: CStream.cpp:67
jpeg_start_decompress(j_decompress_ptr cinfo)
Definition: jdapistd.cpp:31
JSAMPLE FAR * JSAMPROW
Definition: mrpt_jpeglib.h:63
my_source_mgr * my_src_ptr
GLuint src
Definition: glext.h:6303
init_source(j_decompress_ptr cinfo)
jpeg_write_scanlines(j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines)
Definition: jcapistd.cpp:70
fill_input_buffer(j_decompress_ptr cinfo)
mrpt_jpeg_source_mgr pub
J_COLOR_SPACE in_color_space
Definition: mrpt_jpeglib.h:279
#define OUTPUT_BUF_SIZE
jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired)
Definition: jdmarker.cpp:1187
jpeg_finish_compress(j_compress_ptr cinfo)
Definition: jcapimin.cpp:138
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
jpeg_destroy_decompress(j_decompress_ptr cinfo)
Definition: jdapimin.cpp:82
jpeg_stdio_src(j_decompress_ptr cinfo, CStream *in)
jpeg_read_scanlines(j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines)
Definition: jdapistd.cpp:145
#define MRPT_END
term_source(j_decompress_ptr cinfo)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
#define FALSE
Definition: jmorecfg.h:227
struct jpeg_destination_mgr pub
#define JPOOL_IMAGE
Definition: mrpt_jpeglib.h:746
JSAMPROW * JSAMPARRAY
Definition: mrpt_jpeglib.h:64
term_destination(j_compress_ptr cinfo)
void saveToStreamAsJPEG(mrpt::utils::CStream &out, const int jpeg_quality=95) const
Save image to binary stream as a JPEG (.jpg) compressed format.
#define JPEG_EOI
void changeSize(unsigned int width, unsigned int height, TImageChannels nChannels, bool originTopLeft)
Resize the buffers in "img" to accomodate a new image size and/or format.
Definition: CImage.cpp:228
jpeg_read_header(j_decompress_ptr cinfo, boolean require_image)
Definition: jdapimin.cpp:232
jpeg_destroy_compress(j_compress_ptr cinfo)
Definition: jcapimin.cpp:79
#define jpeg_create_decompress(cinfo)
Definition: mrpt_jpeglib.h:894
#define TRUE
Definition: jmorecfg.h:230
jpeg_stdio_dest(j_compress_ptr cinfo, CStream *out)
#define MRPT_START
void makeSureImageIsLoaded() const
Checks if the image is of type "external storage", and if so and not loaded yet, load it...
Definition: CImage.cpp:1935
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define GLOBAL(type)
Definition: jmorecfg.h:185
GLenum GLenum GLvoid * row
Definition: glext.h:3533
#define METHODDEF(type)
Definition: jmorecfg.h:181
GLuint in
Definition: glext.h:6301
jpeg_std_error(struct jpeg_error_mgr *err)
Definition: jerror.cpp:221
#define INPUT_BUF_SIZE
#define ASSERT_(f)
bool isColor() const
Returns true if the image is RGB, false if it is grayscale.
Definition: CImage.cpp:898
char JOCTET
Definition: jmorecfg.h:112
void * img
The internal IplImage pointer to the actual image content.
Definition: CImage.h:912
#define jpeg_create_compress(cinfo)
Definition: mrpt_jpeglib.h:891
empty_output_buffer(j_compress_ptr cinfo)
skip_input_data(j_decompress_ptr cinfo, long num_bytes)
void loadFromStreamAsJPEG(CStream &in)
Reads the image from a binary stream containing a binary jpeg file.
JDIMENSION image_width
Definition: mrpt_jpeglib.h:276
jpeg_start_compress(j_compress_ptr cinfo, boolean write_all_tables)
Definition: jcapistd.cpp:31



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020