NVIDIA DeepStream SDK API Reference

6.4 Release
Image.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 
11 #ifndef CVCORE_IMAGE_H
12 #define CVCORE_IMAGE_H
13 
14 #include <cassert>
15 #include <functional>
16 #include <tuple>
17 #include <type_traits>
18 
19 #include "Memory.h"
20 #include "Tensor.h"
21 
22 namespace cvcore {
23 
29 {
30  Y_U8,
32  Y_S8,
60  NV12,
61  NV24,
62 };
63 
68 {
70  float pixelMean[3];
71  float normalization[3];
72  float stdDev[3];
73 };
74 
75 template<ImageType T>
76 struct IsCompositeImage : std::integral_constant<bool, T == NV12 || T == NV24>
77 {
78 };
79 
80 template<ImageType T>
82  : std::integral_constant<bool, T == PLANAR_RGB_U8 || T == PLANAR_RGB_U16 || T == PLANAR_RGB_F16 ||
83  T == PLANAR_RGB_F32 || T == PLANAR_BGR_U8 || T == PLANAR_BGR_U16 ||
84  T == PLANAR_BGR_F16 || T == PLANAR_BGR_F32 || T == PLANAR_RGBA_U8 ||
85  T == PLANAR_RGBA_U16 || T == PLANAR_RGBA_F16 || T == PLANAR_RGBA_F32>
86 {
87 };
88 
89 template<ImageType T>
90 struct IsInterleavedImage : std::integral_constant<bool, !IsCompositeImage<T>::value && !IsPlanarImage<T>::value>
91 {
92 };
93 
97 template<ImageType T, size_t N>
98 struct ImageTraits;
99 
100 template<>
101 struct ImageTraits<Y_U8, 3>
102 {
103  static constexpr TensorLayout TL = TensorLayout::HWC;
104  static constexpr ChannelCount CC = ChannelCount::C1;
105  static constexpr ChannelType CT = ChannelType::U8;
106 };
107 
108 template<>
109 struct ImageTraits<Y_U8, 4>
110 {
111  static constexpr TensorLayout TL = TensorLayout::NHWC;
112  static constexpr ChannelCount CC = ChannelCount::C1;
113  static constexpr ChannelType CT = ChannelType::U8;
114 };
115 
116 template<>
117 struct ImageTraits<Y_U16, 3>
118 {
119  static constexpr TensorLayout TL = TensorLayout::HWC;
120  static constexpr ChannelCount CC = ChannelCount::C1;
121  static constexpr ChannelType CT = ChannelType::U16;
122 };
123 
124 template<>
125 struct ImageTraits<Y_U16, 4>
126 {
127  static constexpr TensorLayout TL = TensorLayout::NHWC;
128  static constexpr ChannelCount CC = ChannelCount::C1;
129  static constexpr ChannelType CT = ChannelType::U16;
130 };
131 
132 template<>
133 struct ImageTraits<Y_S8, 3>
134 {
135  static constexpr TensorLayout TL = TensorLayout::HWC;
136  static constexpr ChannelCount CC = ChannelCount::C1;
137  static constexpr ChannelType CT = ChannelType::S8;
138 };
139 
140 template<>
141 struct ImageTraits<Y_S8, 4>
142 {
143  static constexpr TensorLayout TL = TensorLayout::NHWC;
144  static constexpr ChannelCount CC = ChannelCount::C1;
145  static constexpr ChannelType CT = ChannelType::S8;
146 };
147 
148 template<>
149 struct ImageTraits<Y_S16, 3>
150 {
151  static constexpr TensorLayout TL = TensorLayout::HWC;
152  static constexpr ChannelCount CC = ChannelCount::C1;
153  static constexpr ChannelType CT = ChannelType::S16;
154 };
155 
156 template<>
157 struct ImageTraits<Y_S16, 4>
158 {
159  static constexpr TensorLayout TL = TensorLayout::NHWC;
160  static constexpr ChannelCount CC = ChannelCount::C1;
161  static constexpr ChannelType CT = ChannelType::S16;
162 };
163 
164 template<>
165 struct ImageTraits<Y_F32, 3>
166 {
167  static constexpr TensorLayout TL = TensorLayout::HWC;
168  static constexpr ChannelCount CC = ChannelCount::C1;
169  static constexpr ChannelType CT = ChannelType::F32;
170 };
171 
172 template<>
173 struct ImageTraits<Y_F32, 4>
174 {
175  static constexpr TensorLayout TL = TensorLayout::NHWC;
176  static constexpr ChannelCount CC = ChannelCount::C1;
177  static constexpr ChannelType CT = ChannelType::F32;
178 };
179 
180 template<>
181 struct ImageTraits<RGB_U8, 3>
182 {
183  static constexpr TensorLayout TL = TensorLayout::HWC;
184  static constexpr ChannelCount CC = ChannelCount::C3;
185  static constexpr ChannelType CT = ChannelType::U8;
186 };
187 
188 template<>
189 struct ImageTraits<RGB_U8, 4>
190 {
191  static constexpr TensorLayout TL = TensorLayout::NHWC;
192  static constexpr ChannelCount CC = ChannelCount::C3;
193  static constexpr ChannelType CT = ChannelType::U8;
194 };
195 
196 template<>
198 {
199  static constexpr TensorLayout TL = TensorLayout::HWC;
200  static constexpr ChannelCount CC = ChannelCount::C3;
201  static constexpr ChannelType CT = ChannelType::U16;
202 };
203 
204 template<>
206 {
207  static constexpr TensorLayout TL = TensorLayout::NHWC;
208  static constexpr ChannelCount CC = ChannelCount::C3;
209  static constexpr ChannelType CT = ChannelType::U16;
210 };
211 
212 template<>
214 {
215  static constexpr TensorLayout TL = TensorLayout::HWC;
216  static constexpr ChannelCount CC = ChannelCount::C3;
217  static constexpr ChannelType CT = ChannelType::F32;
218 };
219 
220 template<>
222 {
223  static constexpr TensorLayout TL = TensorLayout::NHWC;
224  static constexpr ChannelCount CC = ChannelCount::C3;
225  static constexpr ChannelType CT = ChannelType::F32;
226 };
227 
228 template<>
229 struct ImageTraits<BGR_U8, 3>
230 {
231  static constexpr TensorLayout TL = TensorLayout::HWC;
232  static constexpr ChannelCount CC = ChannelCount::C3;
233  static constexpr ChannelType CT = ChannelType::U8;
234 };
235 
236 template<>
237 struct ImageTraits<BGR_U8, 4>
238 {
239  static constexpr TensorLayout TL = TensorLayout::NHWC;
240  static constexpr ChannelCount CC = ChannelCount::C3;
241  static constexpr ChannelType CT = ChannelType::U8;
242 };
243 
244 template<>
246 {
247  static constexpr TensorLayout TL = TensorLayout::HWC;
248  static constexpr ChannelCount CC = ChannelCount::C3;
249  static constexpr ChannelType CT = ChannelType::U16;
250 };
251 
252 template<>
254 {
255  static constexpr TensorLayout TL = TensorLayout::NHWC;
256  static constexpr ChannelCount CC = ChannelCount::C3;
257  static constexpr ChannelType CT = ChannelType::U16;
258 };
259 
260 template<>
262 {
263  static constexpr TensorLayout TL = TensorLayout::HWC;
264  static constexpr ChannelCount CC = ChannelCount::C3;
265  static constexpr ChannelType CT = ChannelType::F32;
266 };
267 
268 template<>
270 {
271  static constexpr TensorLayout TL = TensorLayout::NHWC;
272  static constexpr ChannelCount CC = ChannelCount::C3;
273  static constexpr ChannelType CT = ChannelType::F32;
274 };
275 
276 template<>
278 {
279  static constexpr TensorLayout TL = TensorLayout::CHW;
280  static constexpr ChannelCount CC = ChannelCount::C3;
281  static constexpr ChannelType CT = ChannelType::U8;
282 };
283 
284 template<>
286 {
287  static constexpr TensorLayout TL = TensorLayout::NCHW;
288  static constexpr ChannelCount CC = ChannelCount::C3;
289  static constexpr ChannelType CT = ChannelType::U8;
290 };
291 
292 template<>
294 {
295  static constexpr TensorLayout TL = TensorLayout::CHW;
296  static constexpr ChannelCount CC = ChannelCount::C3;
297  static constexpr ChannelType CT = ChannelType::U16;
298 };
299 
300 template<>
302 {
303  static constexpr TensorLayout TL = TensorLayout::NCHW;
304  static constexpr ChannelCount CC = ChannelCount::C3;
305  static constexpr ChannelType CT = ChannelType::U16;
306 };
307 
308 template<>
310 {
311  static constexpr TensorLayout TL = TensorLayout::CHW;
312  static constexpr ChannelCount CC = ChannelCount::C3;
313  static constexpr ChannelType CT = ChannelType::F32;
314 };
315 
316 template<>
318 {
319  static constexpr TensorLayout TL = TensorLayout::NCHW;
320  static constexpr ChannelCount CC = ChannelCount::C3;
321  static constexpr ChannelType CT = ChannelType::F32;
322 };
323 
324 template<>
326 {
327  static constexpr TensorLayout TL = TensorLayout::CHW;
328  static constexpr ChannelCount CC = ChannelCount::C3;
329  static constexpr ChannelType CT = ChannelType::U8;
330 };
331 
332 template<>
334 {
335  static constexpr TensorLayout TL = TensorLayout::NCHW;
336  static constexpr ChannelCount CC = ChannelCount::C3;
337  static constexpr ChannelType CT = ChannelType::U8;
338 };
339 
340 template<>
342 {
343  static constexpr TensorLayout TL = TensorLayout::CHW;
344  static constexpr ChannelCount CC = ChannelCount::C3;
345  static constexpr ChannelType CT = ChannelType::U16;
346 };
347 
348 template<>
350 {
351  static constexpr TensorLayout TL = TensorLayout::NCHW;
352  static constexpr ChannelCount CC = ChannelCount::C3;
353  static constexpr ChannelType CT = ChannelType::U16;
354 };
355 
356 template<>
358 {
359  static constexpr TensorLayout TL = TensorLayout::CHW;
360  static constexpr ChannelCount CC = ChannelCount::C3;
361  static constexpr ChannelType CT = ChannelType::F32;
362 };
363 
364 template<>
366 {
367  static constexpr TensorLayout TL = TensorLayout::NCHW;
368  static constexpr ChannelCount CC = ChannelCount::C3;
369  static constexpr ChannelType CT = ChannelType::F32;
370 };
371 
375 inline size_t GetImageElementSize(const ImageType type)
376 {
377  size_t imageElementSize;
378 
379  switch (type)
380  {
381  case ImageType::Y_U8:
382  case ImageType::Y_S8:
383  case ImageType::RGB_U8:
384  case ImageType::BGR_U8:
385  case ImageType::RGBA_U8:
389  {
390  imageElementSize = 1;
391  break;
392  }
393  case ImageType::Y_U16:
394  case ImageType::Y_S16:
395  case ImageType::RGB_U16:
396  case ImageType::BGR_U16:
397  case ImageType::RGBA_U16:
401  case ImageType::Y_F16:
402  case ImageType::RGB_F16:
403  case ImageType::BGR_F16:
404  case ImageType::RGBA_F16:
408  {
409  imageElementSize = 2;
410  break;
411  }
412  case ImageType::Y_F32:
413  case ImageType::RGB_F32:
414  case ImageType::BGR_F32:
415  case ImageType::RGBA_F32:
419  {
420  imageElementSize = 4;
421  break;
422  }
423  default:
424  {
425  imageElementSize = 0;
426  }
427  }
428 
429  return imageElementSize;
430 }
431 
435 inline size_t GetImageChannelCount(const ImageType type)
436 {
437  size_t imageChannelCount;
438 
439  switch (type)
440  {
441  case ImageType::Y_U8:
442  case ImageType::Y_U16:
443  case ImageType::Y_S8:
444  case ImageType::Y_S16:
445  case ImageType::Y_F16:
446  case ImageType::Y_F32:
447  {
448  imageChannelCount = 1;
449  break;
450  }
451  case ImageType::RGB_U8:
452  case ImageType::RGB_U16:
453  case ImageType::RGB_F16:
454  case ImageType::RGB_F32:
455  case ImageType::BGR_U8:
456  case ImageType::BGR_U16:
457  case ImageType::BGR_F16:
458  case ImageType::BGR_F32:
467  {
468  imageChannelCount = 3;
469  break;
470  }
471  case ImageType::RGBA_U8:
472  case ImageType::RGBA_U16:
473  case ImageType::RGBA_F16:
474  case ImageType::RGBA_F32:
479  {
480  imageChannelCount = 4;
481  break;
482  }
483  default:
484  {
485  imageChannelCount = 0;
486  }
487  }
488 
489  return imageChannelCount;
490 };
491 
492 template<ImageType T>
493 class Image
494 {
495 };
496 
497 template<>
498 class Image<ImageType::Y_U8> : public Tensor<HWC, C1, U8>
499 {
501 };
502 
503 template<>
504 class Image<ImageType::Y_U16> : public Tensor<HWC, C1, U16>
505 {
507 };
508 
509 template<>
510 class Image<ImageType::Y_S8> : public Tensor<HWC, C1, S8>
511 {
513 };
514 
515 template<>
516 class Image<ImageType::Y_S16> : public Tensor<HWC, C1, S16>
517 {
519 };
520 
521 template<>
522 class Image<ImageType::Y_F16> : public Tensor<HWC, C1, F16>
523 {
525 };
526 
527 template<>
528 class Image<ImageType::Y_F32> : public Tensor<HWC, C1, F32>
529 {
531 };
532 
533 template<>
534 class Image<ImageType::RGB_U8> : public Tensor<HWC, C3, U8>
535 {
537 };
538 
539 template<>
540 class Image<ImageType::RGB_U16> : public Tensor<HWC, C3, U16>
541 {
543 };
544 
545 template<>
546 class Image<ImageType::RGB_F16> : public Tensor<HWC, C3, F16>
547 {
549 };
550 
551 template<>
552 class Image<ImageType::RGB_F32> : public Tensor<HWC, C3, F32>
553 {
555 };
556 
557 template<>
558 class Image<ImageType::BGR_U8> : public Tensor<HWC, C3, U8>
559 {
561 };
562 
563 template<>
564 class Image<ImageType::BGR_U16> : public Tensor<HWC, C3, U16>
565 {
567 };
568 
569 template<>
570 class Image<ImageType::BGR_F16> : public Tensor<HWC, C3, F16>
571 {
573 };
574 
575 template<>
576 class Image<ImageType::BGR_F32> : public Tensor<HWC, C3, F32>
577 {
579 };
580 
581 template<>
582 class Image<ImageType::RGBA_U8> : public Tensor<HWC, C4, U8>
583 {
585 };
586 
587 template<>
588 class Image<ImageType::RGBA_U16> : public Tensor<HWC, C4, U16>
589 {
591 };
592 
593 template<>
594 class Image<ImageType::RGBA_F16> : public Tensor<HWC, C4, F16>
595 {
597 };
598 
599 template<>
600 class Image<ImageType::RGBA_F32> : public Tensor<HWC, C4, F32>
601 {
603 };
604 
605 template<>
606 class Image<ImageType::PLANAR_RGB_U8> : public Tensor<CHW, C3, U8>
607 {
609 };
610 
611 template<>
612 class Image<ImageType::PLANAR_RGB_U16> : public Tensor<CHW, C3, U16>
613 {
615 };
616 
617 template<>
618 class Image<ImageType::PLANAR_RGB_F16> : public Tensor<CHW, C3, F16>
619 {
621 };
622 
623 template<>
624 class Image<ImageType::PLANAR_RGB_F32> : public Tensor<CHW, C3, F32>
625 {
627 };
628 
629 template<>
630 class Image<ImageType::PLANAR_BGR_U8> : public Tensor<CHW, C3, U8>
631 {
633 };
634 
635 template<>
636 class Image<ImageType::PLANAR_BGR_U16> : public Tensor<CHW, C3, U16>
637 {
639 };
640 
641 template<>
642 class Image<ImageType::PLANAR_BGR_F16> : public Tensor<CHW, C3, F16>
643 {
645 };
646 
647 template<>
648 class Image<ImageType::PLANAR_BGR_F32> : public Tensor<CHW, C3, F32>
649 {
651 };
652 
653 template<>
654 class Image<ImageType::PLANAR_RGBA_U8> : public Tensor<CHW, C4, U8>
655 {
657 };
658 
659 template<>
660 class Image<ImageType::PLANAR_RGBA_U16> : public Tensor<CHW, C4, U16>
661 {
663 };
664 
665 template<>
666 class Image<ImageType::PLANAR_RGBA_F16> : public Tensor<CHW, C4, F16>
667 {
669 };
670 
671 template<>
672 class Image<ImageType::PLANAR_RGBA_F32> : public Tensor<CHW, C4, F32>
673 {
675 };
676 
677 template<>
679 {
680 public:
681  Image(std::size_t width, std::size_t height, bool isCPU = true)
682  : m_data(std::make_tuple(Y(width, height, isCPU), UV(width / 2, height / 2, isCPU)))
683  {
684  assert(width % 2 == 0 && height % 2 == 0);
685  }
686 
687  Image(std::size_t width, std::size_t height, std::uint8_t *dataPtrLuma, std::uint8_t *dataPtrChroma,
688  bool isCPU = true)
689  : m_data(std::make_tuple(Y(width, height, dataPtrLuma, isCPU), UV(width / 2, height / 2, dataPtrChroma, isCPU)))
690  {
691  assert(width % 2 == 0 && height % 2 == 0);
692  }
693 
694  Image(std::size_t width, std::size_t height, std::size_t rowPitchLuma, std::size_t rowPitchChroma,
695  std::uint8_t *dataPtrLuma, std::uint8_t *dataPtrChroma, bool isCPU = true)
696  : m_data(std::make_tuple(Y(width, height, rowPitchLuma, dataPtrLuma, isCPU),
697  UV(width / 2, height / 2, rowPitchChroma, dataPtrChroma, isCPU)))
698  {
699  assert(width % 2 == 0 && height % 2 == 0);
700  }
701 
702  std::size_t getLumaWidth() const
703  {
704  return std::get<0>(m_data).getWidth();
705  }
706 
707  std::size_t getLumaHeight() const
708  {
709  return std::get<0>(m_data).getHeight();
710  }
711 
712  std::size_t getChromaWidth() const
713  {
714  return std::get<1>(m_data).getWidth();
715  }
716 
717  std::size_t getChromaHeight() const
718  {
719  return std::get<1>(m_data).getHeight();
720  }
721 
722  std::size_t getLumaStride(TensorDimension dim) const
723  {
724  return std::get<0>(m_data).getStride(dim);
725  }
726 
727  std::size_t getChromaStride(TensorDimension dim) const
728  {
729  return std::get<1>(m_data).getStride(dim);
730  }
731 
732  std::uint8_t *getLumaData()
733  {
734  return std::get<0>(m_data).getData();
735  }
736 
737  std::uint8_t *getChromaData()
738  {
739  return std::get<1>(m_data).getData();
740  }
741 
742  const std::uint8_t *getLumaData() const
743  {
744  return std::get<0>(m_data).getData();
745  }
746 
747  std::size_t getLumaDataSize() const
748  {
749  return std::get<0>(m_data).getDataSize();
750  }
751 
752  const std::uint8_t *getChromaData() const
753  {
754  return std::get<1>(m_data).getData();
755  }
756 
757  std::size_t getChromaDataSize() const
758  {
759  return std::get<1>(m_data).getDataSize();
760  }
761 
762  bool isCPU() const
763  {
764  return std::get<0>(m_data).isCPU();
765  }
766 
767  friend void Copy(Image<NV12> &dst, const Image<NV12> &src, cudaStream_t stream);
768 
769 private:
770  using Y = Tensor<HWC, C1, U8>;
771  using UV = Tensor<HWC, C2, U8>;
772 
773  std::tuple<Y, UV> m_data;
774 };
775 
776 template<>
778 {
779 public:
780  Image(std::size_t width, std::size_t height, bool isCPU = true)
781  : m_data(std::make_tuple(Y(width, height, isCPU), UV(width, height, isCPU)))
782  {
783  }
784 
785  Image(std::size_t width, std::size_t height, std::uint8_t *dataPtrLuma, std::uint8_t *dataPtrChroma,
786  bool isCPU = true)
787  : m_data(std::make_tuple(Y(width, height, dataPtrLuma, isCPU), UV(width, height, dataPtrChroma, isCPU)))
788  {
789  }
790 
791  Image(std::size_t width, std::size_t height, std::size_t rowPitchLuma, std::size_t rowPitchChroma,
792  std::uint8_t *dataPtrLuma, std::uint8_t *dataPtrChroma, bool isCPU = true)
793  : m_data(std::make_tuple(Y(width, height, rowPitchLuma, dataPtrLuma, isCPU),
794  UV(width, height, rowPitchChroma, dataPtrChroma, isCPU)))
795  {
796  }
797 
798  std::size_t getLumaWidth() const
799  {
800  return std::get<0>(m_data).getWidth();
801  }
802 
803  std::size_t getLumaHeight() const
804  {
805  return std::get<0>(m_data).getHeight();
806  }
807 
808  std::size_t getChromaWidth() const
809  {
810  return std::get<1>(m_data).getWidth();
811  }
812 
813  std::size_t getChromaHeight() const
814  {
815  return std::get<1>(m_data).getHeight();
816  }
817 
818  std::size_t getLumaStride(TensorDimension dim) const
819  {
820  return std::get<0>(m_data).getStride(dim);
821  }
822 
823  std::size_t getChromaStride(TensorDimension dim) const
824  {
825  return std::get<1>(m_data).getStride(dim);
826  }
827 
828  std::uint8_t *getLumaData()
829  {
830  return std::get<0>(m_data).getData();
831  }
832 
833  const std::uint8_t *getLumaData() const
834  {
835  return std::get<0>(m_data).getData();
836  }
837 
838  std::size_t getLumaDataSize() const
839  {
840  return std::get<0>(m_data).getDataSize();
841  }
842 
843  std::uint8_t *getChromaData()
844  {
845  return std::get<1>(m_data).getData();
846  }
847 
848  const std::uint8_t *getChromaData() const
849  {
850  return std::get<1>(m_data).getData();
851  }
852 
853  std::size_t getChromaDataSize() const
854  {
855  return std::get<1>(m_data).getDataSize();
856  }
857 
858  bool isCPU() const
859  {
860  return std::get<0>(m_data).isCPU();
861  }
862 
863  friend void Copy(Image<NV24> &dst, const Image<NV24> &src, cudaStream_t stream);
864 
865 private:
866  using Y = Tensor<HWC, C1, U8>;
867  using UV = Tensor<HWC, C2, U8>;
868 
869  std::tuple<Y, UV> m_data;
870 };
871 
872 void inline Copy(Image<NV12> &dst, const Image<NV12> &src, cudaStream_t stream = 0)
873 {
874  Copy(std::get<0>(dst.m_data), std::get<0>(src.m_data), stream);
875  Copy(std::get<1>(dst.m_data), std::get<1>(src.m_data), stream);
876 }
877 
878 void inline Copy(Image<NV24> &dst, const Image<NV24> &src, cudaStream_t stream = 0)
879 {
880  Copy(std::get<0>(dst.m_data), std::get<0>(src.m_data), stream);
881  Copy(std::get<1>(dst.m_data), std::get<1>(src.m_data), stream);
882 }
883 
884 } // namespace cvcore
885 
886 #endif // CVCORE_IMAGE_H
cvcore::Image
Definition: Image.h:493
cvcore::Y_S8
@ Y_S8
8-bit signed gray.
Definition: Image.h:32
cvcore::Image< ImageType::NV24 >::Image
Image(std::size_t width, std::size_t height, std::uint8_t *dataPtrLuma, std::uint8_t *dataPtrChroma, bool isCPU=true)
Definition: Image.h:785
cvcore::NV24
@ NV24
8-bit planar Y + interleaved UV.
Definition: Image.h:61
cvcore::PLANAR_RGB_U8
@ PLANAR_RGB_U8
8-bit planar RGB.
Definition: Image.h:48
cvcore::CHW
@ CHW
channel, height, width (channel planar).
Definition: Tensor.h:33
cvcore::S8
@ S8
int8_t.
Definition: Tensor.h:62
cvcore::Image< ImageType::NV24 >::getLumaHeight
std::size_t getLumaHeight() const
Definition: Image.h:803
cvcore::Image< ImageType::NV12 >::Image
Image(std::size_t width, std::size_t height, bool isCPU=true)
Definition: Image.h:681
cvcore::IsInterleavedImage
Definition: Image.h:90
cvcore
Definition: PnP.h:20
cvcore::Y_S16
@ Y_S16
16-bit signed gray.
Definition: Image.h:33
cvcore::Image< ImageType::NV24 >::getLumaStride
std::size_t getLumaStride(TensorDimension dim) const
Definition: Image.h:818
cvcore::Image< ImageType::NV12 >::getLumaStride
std::size_t getLumaStride(TensorDimension dim) const
Definition: Image.h:722
cvcore::Image< ImageType::NV24 >::getChromaStride
std::size_t getChromaStride(TensorDimension dim) const
Definition: Image.h:823
cvcore::PLANAR_RGBA_U16
@ PLANAR_RGBA_U16
16-bit planar RGBA.
Definition: Image.h:57
cvcore::RGB_F16
@ RGB_F16
half RGB.
Definition: Image.h:38
cvcore::BGR_F16
@ BGR_F16
half BGR.
Definition: Image.h:42
cvcore::Copy
void Copy(Image< NV12 > &dst, const Image< NV12 > &src, cudaStream_t stream=0)
Definition: Image.h:872
cvcore::BGR_F32
@ BGR_F32
float BGR.
Definition: Image.h:43
cvcore::Image< ImageType::NV24 >::getChromaData
const std::uint8_t * getChromaData() const
Definition: Image.h:848
cvcore::Image< ImageType::NV12 >::Image
Image(std::size_t width, std::size_t height, std::size_t rowPitchLuma, std::size_t rowPitchChroma, std::uint8_t *dataPtrLuma, std::uint8_t *dataPtrChroma, bool isCPU=true)
Definition: Image.h:694
cvcore::Image< ImageType::NV24 >::isCPU
bool isCPU() const
Definition: Image.h:858
cvcore::RGB_U8
@ RGB_U8
8-bit RGB.
Definition: Image.h:36
cvcore::PLANAR_BGR_U8
@ PLANAR_BGR_U8
8-bit planar BGR.
Definition: Image.h:52
cvcore::Image< ImageType::NV24 >::getLumaData
const std::uint8_t * getLumaData() const
Definition: Image.h:833
cvcore::C1
@ C1
1 channels.
Definition: Tensor.h:47
cvcore::Image< ImageType::NV24 >::getLumaWidth
std::size_t getLumaWidth() const
Definition: Image.h:798
cvcore::PLANAR_BGR_U16
@ PLANAR_BGR_U16
16-bit planar BGR.
Definition: Image.h:53
cvcore::PLANAR_RGBA_F16
@ PLANAR_RGBA_F16
half planar RGBA.
Definition: Image.h:58
cvcore::Image< ImageType::NV12 >::getLumaHeight
std::size_t getLumaHeight() const
Definition: Image.h:707
cvcore::Image< ImageType::NV12 >::isCPU
bool isCPU() const
Definition: Image.h:762
cvcore::Image< ImageType::NV12 >::getChromaHeight
std::size_t getChromaHeight() const
Definition: Image.h:717
cvcore::Image< ImageType::NV12 >::getChromaStride
std::size_t getChromaStride(TensorDimension dim) const
Definition: Image.h:727
cvcore::Image< ImageType::NV12 >::getLumaData
const std::uint8_t * getLumaData() const
Definition: Image.h:742
cvcore::Image< ImageType::NV24 >::Image
Image(std::size_t width, std::size_t height, bool isCPU=true)
Definition: Image.h:780
cvcore::ImagePreProcessingParams::normalization
float normalization[3]
Scale or normalization values for R,G,B channels.
Definition: Image.h:71
cvcore::Y_U8
@ Y_U8
8-bit unsigned gray.
Definition: Image.h:30
cvcore::Image< ImageType::NV24 >::getChromaDataSize
std::size_t getChromaDataSize() const
Definition: Image.h:853
cvcore::Image< ImageType::NV12 >::getLumaWidth
std::size_t getLumaWidth() const
Definition: Image.h:702
cvcore::IsPlanarImage
Definition: Image.h:81
cvcore::RGB_F32
@ RGB_F32
float RGB.
Definition: Image.h:39
cvcore::C3
@ C3
3 channels.
Definition: Tensor.h:49
cvcore::PLANAR_BGR_F32
@ PLANAR_BGR_F32
float planar BGR.
Definition: Image.h:55
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: nvbufsurftransform.h:29
cvcore::Tensor
Definition: Tensor.h:704
cvcore::U8
@ U8
uint8_t.
Definition: Tensor.h:60
cvcore::BGR_U16
@ BGR_U16
16-bit BGR.
Definition: Image.h:41
cvcore::BGR_U8
@ BGR_U8
8-bit BGR.
Definition: Image.h:40
cvcore::U16
@ U16
uint16_t.
Definition: Tensor.h:61
cvcore::RGBA_U8
@ RGBA_U8
8-bit RGBA.
Definition: Image.h:44
cvcore::PLANAR_RGBA_F32
@ PLANAR_RGBA_F32
float planar RGBA.
Definition: Image.h:59
cvcore::RGBA_U16
@ RGBA_U16
16-bit RGBA.
Definition: Image.h:45
cvcore::S16
@ S16
int16_t.
Definition: Tensor.h:63
cvcore::NCHW
@ NCHW
alias for DCHW.
Definition: Tensor.h:37
cvcore::ImagePreProcessingParams::stdDev
float stdDev[3]
Standard deviation values for R,G,B channels.
Definition: Image.h:72
cvcore::ImagePreProcessingParams::pixelMean
float pixelMean[3]
Image Mean value offset for R,G,B channels.
Definition: Image.h:70
cvcore::NHWC
@ NHWC
alias for DHWC.
Definition: Tensor.h:35
cvcore::PLANAR_RGB_U16
@ PLANAR_RGB_U16
16-bit planar RGB.
Definition: Image.h:49
cvcore::PLANAR_BGR_F16
@ PLANAR_BGR_F16
half planar BGR.
Definition: Image.h:54
cvcore::RGBA_F16
@ RGBA_F16
half RGBA.
Definition: Image.h:46
cvcore::Image< ImageType::NV12 >::getChromaWidth
std::size_t getChromaWidth() const
Definition: Image.h:712
cvcore::F32
@ F32
float.
Definition: Tensor.h:65
cvcore::Image< ImageType::NV24 >::getChromaHeight
std::size_t getChromaHeight() const
Definition: Image.h:813
cvcore::Image< ImageType::NV12 >::getChromaDataSize
std::size_t getChromaDataSize() const
Definition: Image.h:757
cvcore::ImagePreProcessingParams
Struct type for image preprocessing params.
Definition: Image.h:67
cvcore::Y_F32
@ Y_F32
float normalized gray.
Definition: Image.h:35
cvcore::ImageType
ImageType
An enum.
Definition: Image.h:28
Memory.h
cvcore::ImageTraits
Image traits that map ImageType to TensorLayout, ChannelCount and ChannelType.
Definition: Image.h:98
cvcore::RGBA_F32
@ RGBA_F32
float RGBA.
Definition: Image.h:47
cvcore::Image< ImageType::NV12 >::getChromaData
const std::uint8_t * getChromaData() const
Definition: Image.h:752
cvcore::ImagePreProcessingParams::imgType
ImageType imgType
Input Image Type.
Definition: Image.h:69
cvcore::NV12
@ NV12
8-bit planar Y + interleaved and subsampled (1/4 Y samples) UV.
Definition: Image.h:60
cvcore::RGB_U16
@ RGB_U16
16-bit RGB.
Definition: Image.h:37
Tensor.h
cvcore::TensorDimension
TensorDimension
An enum.
Definition: Tensor.h:73
cvcore::Image< ImageType::NV24 >::getLumaData
std::uint8_t * getLumaData()
Definition: Image.h:828
cvcore::PLANAR_RGB_F32
@ PLANAR_RGB_F32
float planar RGB.
Definition: Image.h:51
cvcore::HWC
@ HWC
height, width, channel (channel interleaved).
Definition: Tensor.h:32
cvcore::Image< ImageType::NV12 >::Image
Image(std::size_t width, std::size_t height, std::uint8_t *dataPtrLuma, std::uint8_t *dataPtrChroma, bool isCPU=true)
Definition: Image.h:687
cvcore::ChannelType
ChannelType
An enum.
Definition: Tensor.h:58
cvcore::TensorLayout
TensorLayout
An enum.
Definition: Tensor.h:28
cvcore::PLANAR_RGBA_U8
@ PLANAR_RGBA_U8
8-bit planar RGBA.
Definition: Image.h:56
cvcore::Y_U16
@ Y_U16
16-bit unsigned gray.
Definition: Image.h:31
cvcore::GetImageChannelCount
size_t GetImageChannelCount(const ImageType type)
Get the number of channels for a specific ImageType.
Definition: Image.h:435
cvcore::Image< ImageType::NV24 >::Image
Image(std::size_t width, std::size_t height, std::size_t rowPitchLuma, std::size_t rowPitchChroma, std::uint8_t *dataPtrLuma, std::uint8_t *dataPtrChroma, bool isCPU=true)
Definition: Image.h:791
cvcore::PLANAR_RGB_F16
@ PLANAR_RGB_F16
half planar RGB.
Definition: Image.h:50
cvcore::IsCompositeImage
Definition: Image.h:76
cvcore::ChannelCount
ChannelCount
An enum.
Definition: Tensor.h:45
cvcore::Image< ImageType::NV24 >::getLumaDataSize
std::size_t getLumaDataSize() const
Definition: Image.h:838
cvcore::Image< ImageType::NV12 >::getLumaData
std::uint8_t * getLumaData()
Definition: Image.h:732
cvcore::Image< ImageType::NV24 >::getChromaWidth
std::size_t getChromaWidth() const
Definition: Image.h:808
cvcore::Image< ImageType::NV12 >::getLumaDataSize
std::size_t getLumaDataSize() const
Definition: Image.h:747
cvcore::GetImageElementSize
size_t GetImageElementSize(const ImageType type)
Get the bytes of each element for a specific ImageType.
Definition: Image.h:375
cvcore::Image< ImageType::NV12 >::getChromaData
std::uint8_t * getChromaData()
Definition: Image.h:737
cvcore::Image< ImageType::NV24 >::getChromaData
std::uint8_t * getChromaData()
Definition: Image.h:843
cvcore::Y_F16
@ Y_F16
half normalized gray.
Definition: Image.h:34