1 #ifndef CVD_LOAD_AND_SAVE_H 2 #define CVD_LOAD_AND_SAVE_H 4 #include <cvd/colourspace_convert.h> 5 #include <cvd/convert_image.h> 6 #include <cvd/exceptions.h> 7 #include <cvd/internal/convert_pixel_types.h> 8 #include <cvd/internal/io/parameter.h> 9 #include <cvd/internal/name_CVD_rgb_types.h> 29 using CVD::Exceptions::All::All;
93 ReadTypeMismatch(
const std::string& available,
const std::string& requested);
121 OpenError(
const std::string&,
const std::string&,
int);
129 template <
class C,
int i>
132 static const bool use_16bit = 1;
162 template <
class A,
class B>
174 template <
class PixelType,
class DiskPixelType,
class ImageLoader>
181 for(
int row = 0; row < r.size().y; row++)
183 r.get_raw_pixel_line(rowbuf.
data());
186 if(r.top_row_first())
189 rowptr = im[im.
size().y - row - 1];
196 template <
class PixelType,
class ImageLoader>
201 for(
int row = 0; row < r.size().y; row++)
202 if(r.top_row_first())
203 r.get_raw_pixel_line(im[row]);
205 r.get_raw_pixel_line(im[im.
size().y - row - 1]);
209 template <
class PixelType,
class DiskPixelType,
class ImageLoader>
225 template <
class PixelType,
class ImageLoader,
class List>
245 template <
class PixelType,
class ImageLoader>
259 template <
class T,
class ImageLoader>
265 template <
class T,
class ImageLoader>
268 ImageLoader loader(in);
270 if(im.
size() != size)
273 readImage(im, loader);
276 template <
class T,
class ImageLoader>
277 void readImage(
Image<T>& im, std::istream& in)
279 ImageLoader loader(in);
281 readImage(im, loader);
304 template <
class Pixel,
class ImageWriter,
class OutgoingPixel>
313 for(
int r = 0; r < im.
size().y; r++)
316 w.write_raw_pixel_line(row.data());
319 for(
int r = im.
size().y - 1; r >= 0; r--)
322 w.write_raw_pixel_line(row.data());
327 template <
class Pixel,
class ImageWriter>
335 for(
int r = 0; r < im.
size().y; r++)
336 w.write_raw_pixel_line(im[r]);
338 for(
int r = im.
size().y - 1; r >= 0; r--)
339 w.write_raw_pixel_line(im[r]);
343 template <
class Pixel,
class Writer>
The ifstream which the file is being read from is not open.
Definition: load_and_save.h:55
Can two types be converted with CVD::convert_image?
Definition: convert_image.h:170
Definition: load_and_save.h:142
Definition: load_and_save.h:226
All classes and functions are within the CVD namespace.
Definition: argb.h:6
ImageRef size() const
What is the size of this image?
Definition: image.h:557
Cannot seek in this stream.
Definition: load_and_save.h:83
Definition: load_and_save.h:163
Definition: load_and_save.h:130
void resize(const ImageRef &size)
Resize the image (destroying the data).
Definition: image.h:731
Error in opening file.
Definition: load_and_save.h:119
This image type is not supported.
Definition: load_and_save.h:41
Definition: load_and_save.h:159
This image subtype is not supported.
Definition: load_and_save.h:112
The file ended before the image.
Definition: load_and_save.h:48
Error writing the image.
Definition: load_and_save.h:76
ConstPointerType data() const
Returns the raw image data.
Definition: image.h:535
Definition: load_and_save.h:175
Base class for all CVD exceptions.
Definition: exceptions.h:15
This image type is not supported.
Definition: load_and_save.h:34
Definition: image_ref.h:29
A generic image class to manage a block of arbitrarily padded data as an image.
Definition: image.h:273
void convert_image(const BasicImage< bayer_bggr > &from, BasicImage< byte > &to)
Convert Bayer pattern of various forms to greyscale data.
The loaded image is not the right size.
Definition: load_and_save.h:69
Definition: load_and_save.h:305
Definition: load_and_save.h:210
Definition: name_builtin_types.h:11
Definition: convert_pixel_types.h:441
A full image which manages its own data.
Definition: image.h:623
Type mismatch reading the image (image data is either 8- or 16-bit, and it must be the same in the fi...
Definition: load_and_save.h:90
Class for holding parameters for image savers, with type erasure.
Definition: parameter.h:18
Can individual pixels of two types be converted with ConvertPixels::convert()? E.g.
Definition: convert_image.h:179
Base class for all Image_IO exceptions.
Definition: load_and_save.h:27
Definition: pixel_traits.h:16
An error occurred in one of the helper libraries.
Definition: load_and_save.h:105
Type mismatch reading the image (image data is either 8- or 16-bit, and it must be the same in the fi...
Definition: load_and_save.h:98