| 544 | } |
| 545 | |
| 546 | std::shared_ptr<Image> Image::Create(const Size2D &size, nvcv::ImageFormat fmt, int rowAlign) |
| 547 | { |
| 548 | std::vector<std::shared_ptr<CacheItem>> vcont = Cache::Instance().fetch(Key{size, fmt}); |
| 549 | |
| 550 | // None found? |
| 551 | if (vcont.empty()) |
| 552 | { |
| 553 | std::shared_ptr<Image> img(new Image(size, fmt, rowAlign)); |
| 554 | Cache::Instance().add(*img); |
| 555 | return img; |
| 556 | } |
| 557 | else |
| 558 | { |
| 559 | // Get the first one |
| 560 | return std::static_pointer_cast<Image>(vcont[0]); |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | std::shared_ptr<Image> Image::Zeros(const Size2D &size, nvcv::ImageFormat fmt, int rowAlign) |
| 565 | { |