Image Utilities (IU)
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
iuio.h
1 #pragma once
2 
3 #include <string>
4 #include "iudefs.h"
5 #include "iuio/iuioapi.h"
6 #include <opencv2/core/core.hpp>
7 
8 namespace iu {
9 
28 IUIO_DLLAPI iu::ImageCpu_8u_C1* imread_8u_C1(const std::string& filename);
29 IUIO_DLLAPI iu::ImageCpu_8u_C3* imread_8u_C3(const std::string& filename);
30 IUIO_DLLAPI iu::ImageCpu_8u_C4* imread_8u_C4(const std::string& filename);
31 IUIO_DLLAPI iu::ImageCpu_32f_C1* imread_32f_C1(const std::string& filename);
32 IUIO_DLLAPI iu::ImageCpu_32f_C3* imread_32f_C3(const std::string& filename);
33 IUIO_DLLAPI iu::ImageCpu_32f_C4* imread_32f_C4(const std::string& filename);
34 
39 IUIO_DLLAPI iu::ImageGpu_8u_C1* imread_cu8u_C1(const std::string& filename);
40 IUIO_DLLAPI iu::ImageGpu_8u_C4* imread_cu8u_C4(const std::string& filename);
41 IUIO_DLLAPI iu::ImageGpu_32f_C1* imread_cu32f_C1(const std::string& filename);
42 IUIO_DLLAPI iu::ImageGpu_32f_C4* imread_cu32f_C4(const std::string& filename);
43 
49 IUIO_DLLAPI bool imsave(iu::ImageCpu_8u_C1* image, const std::string& filename, const bool& normalize=false);
50 IUIO_DLLAPI bool imsave(iu::ImageCpu_8u_C3* image, const std::string& filename, const bool& normalize=false);
51 IUIO_DLLAPI bool imsave(iu::ImageCpu_8u_C4* image, const std::string& filename, const bool& normalize=false);
52 IUIO_DLLAPI bool imsave(iu::ImageCpu_32f_C1* image, const std::string& filename, const bool& normalize=false);
53 IUIO_DLLAPI bool imsave(iu::ImageCpu_32f_C3* image, const std::string& filename, const bool& normalize=false);
54 IUIO_DLLAPI bool imsave(iu::ImageCpu_32f_C4* image, const std::string& filename, const bool& normalize=false);
55 
61 IUIO_DLLAPI bool imsave(iu::ImageGpu_8u_C1* image, const std::string& filename, const bool& normalize=false);
62 IUIO_DLLAPI bool imsave(iu::ImageGpu_8u_C4* image, const std::string& filename, const bool& normalize=false);
63 IUIO_DLLAPI bool imsave(iu::ImageGpu_32f_C1* image, const std::string& filename, const bool& normalize=false);
64 IUIO_DLLAPI bool imsave(iu::ImageGpu_32f_C4* image, const std::string& filename, const bool& normalize=false);
65 
70 IUIO_DLLAPI void imshow(iu::ImageCpu_8u_C1* image, const std::string& winname, const bool& normalize=false);
71 IUIO_DLLAPI void imshow(iu::ImageCpu_8u_C3* image, const std::string& winname, const bool& normalize=false);
72 IUIO_DLLAPI void imshow(iu::ImageCpu_8u_C4* image, const std::string& winname, const bool& normalize=false);
73 IUIO_DLLAPI void imshow(iu::ImageCpu_32f_C1* image, const std::string& winname, const bool& normalize=false);
74 IUIO_DLLAPI void imshow(iu::ImageCpu_32f_C3* image, const std::string& winname, const bool& normalize=false);
75 IUIO_DLLAPI void imshow(iu::ImageCpu_32f_C4* image, const std::string& winname, const bool& normalize=false);
76 
81 IUIO_DLLAPI void imshow(iu::ImageGpu_8u_C1* image, const std::string& winname, const bool& normalize=false);
82 IUIO_DLLAPI void imshow(iu::ImageGpu_8u_C4* image, const std::string& winname, const bool& normalize=false);
83 IUIO_DLLAPI void imshow(iu::ImageGpu_32f_C1* image, const std::string& winname, const bool& normalize=false);
84 IUIO_DLLAPI void imshow(iu::ImageGpu_32f_C4* image, const std::string& winname, const bool& normalize=false);
85 
86  // end of ImagIO
88 
90 // * The ImageCpu is NOT a deep copy, it just uses the data pointer from the Mat, i.e.
91 // * it wraps the memory from the Mat in an ImageCpu.
92 // */
93 //template<typename PixelType, class Allocator >
94 //IUIO_DLLAPI void imageCpu_from_Mat(cv::Mat& mat, iu::ImageCpu<PixelType, Allocator> &img)
95 //{
96 // iu::Size<2> mat_sz(mat.cols, mat.rows);
97 
98 // if (img.data())
99 // throw IuException("Conversion from cv::Mat to iu::ImageCpu: expected empty ImageCpu", __FILE__, __FUNCTION__, __LINE__);
100 
103 
143 
144 // // The assignment operator will involve a temporary copy and destruction of img, but we don't care since we made
145 // // sure that the img is empty -> img destructor will not free any data
146 // img = iu::ImageCpu<PixelType, Allocator>((PixelType*)mat.data, mat_sz.width, mat_sz.height, mat.step, true);
147 //}
148  // end of IO
150 
151 } // namespace iu
152 
153 
154 
IUIO_DLLAPI bool imsave(iu::ImageCpu_8u_C1 *image, const std::string &filename, const bool &normalize=false)
IUIO_DLLAPI iu::ImageCpu_8u_C1 * imread_8u_C1(const std::string &filename)
IUIO_DLLAPI void imshow(iu::ImageCpu_8u_C1 *image, const std::string &winname, const bool &normalize=false)
IUIO_DLLAPI iu::ImageGpu_8u_C1 * imread_cu8u_C1(const std::string &filename)
Device 2D image class (pitched memory).
Definition: image_gpu.h:34
Host 2D image class (pitched memory).
Definition: image_cpu.h:27