AI Watch A1
Multi-person 3D skeleton detection using Intel RealSense and OpenPose with Kafka support.
Public Member Functions | Private Member Functions | List of all members
ImageManager Class Reference

ImageManager class is a general-purpose class useful for operations on images such as loading, saving, showing and releasing attached memory. More...

#include <ImageManager.hpp>

Public Member Functions

void loadImage (std::string imagePath, int loadType, cv::Mat &inputImage)
 Loads a single image. More...
 
void saveImages (const std::initializer_list< cv::Mat > &images, const std::initializer_list< std::string > &imagePaths)
 Saves multiple images. More...
 
void showImages (const std::initializer_list< cv::Mat > &images, const std::initializer_list< std::string > &windowNames)
 Shows multiple images. More...
 
void releaseImages (const std::initializer_list< cv::Mat > &images)
 Releases multiple images. More...
 

Private Member Functions

void saveImage (std::string imageSavePath, const cv::Mat &imageToSave)
 Saves a single image. More...
 

Detailed Description

ImageManager class is a general-purpose class useful for operations on images such as loading, saving, showing and releasing attached memory.

Definition at line 29 of file ImageManager.hpp.

Member Function Documentation

◆ loadImage()

void ImageManager::loadImage ( std::string  imagePath,
int  loadType,
cv::Mat &  inputImage 
)

Loads a single image.

Parameters
imagePathThe path where the image has been saved on disk.
loadTypeHow to load the image.
inputImageA reference to a cv::Mat object.

Definition at line 21 of file ImageManager.cpp.

21 {
22 inputImage = cv::imread(imagePath, loadType);
23 if (inputImage.empty()) {
24 std::cout << "IMAGE NOT FOUND: " << imagePath << "\n";
26 }
27}
static const char * LOAD_IMAGE_SCOPE
Definition: constants.hpp:21
static const short int LOAD_IMAGE_ERROR
Definition: constants.hpp:20

References LOAD_IMAGE_ERROR, and LOAD_IMAGE_SCOPE.

Referenced by OpenCV_Manager::showSkeletonsCV().

◆ releaseImages()

void ImageManager::releaseImages ( const std::initializer_list< cv::Mat > &  images)

Releases multiple images.

Parameters
imagesThe images to release.

Definition at line 50 of file ImageManager.cpp.

50 {
51 for (auto singleImage : images) singleImage.release();
52}

Referenced by OpenCV_Manager::getVideoFramesCV(), and OpenCV_Manager::showSkeletonsCV().

◆ saveImage()

void ImageManager::saveImage ( std::string  imageSavePath,
const cv::Mat &  imageToSave 
)
private

Saves a single image.

Parameters
imageSavePathThe path where to save the image.
imageToSaveThe image to save.

Definition at line 15 of file ImageManager.cpp.

15 {
16 if (!(cv::imwrite(imageSavePath, imageToSave))) CV_Error(SAVE_IMAGE_ERROR, SAVE_IMAGE_SCOPE);
17}
static const short int SAVE_IMAGE_ERROR
Definition: constants.hpp:23
static const char * SAVE_IMAGE_SCOPE
Definition: constants.hpp:24

References SAVE_IMAGE_ERROR, and SAVE_IMAGE_SCOPE.

Referenced by saveImages().

◆ saveImages()

void ImageManager::saveImages ( const std::initializer_list< cv::Mat > &  images,
const std::initializer_list< std::string > &  imagePaths 
)

Saves multiple images.

Parameters
imagesThe images to save.
imagePathsThe paths where to save the images.

Definition at line 29 of file ImageManager.cpp.

29 {
30 auto imagesIterator = images.begin();
31 auto imagePathsIterator = imagePaths.begin();
32 for (unsigned char i = 0; i < images.size(); i++) {
33 saveImage(* imagePathsIterator, * imagesIterator);
34 imagePathsIterator++;
35 imagesIterator++;
36 }
37}
void saveImage(std::string imageSavePath, const cv::Mat &imageToSave)
Saves a single image.

References saveImage().

Referenced by OpenCV_Manager::getVideoFramesCV(), and OpenCV_Manager::showSkeletonsCV().

◆ showImages()

void ImageManager::showImages ( const std::initializer_list< cv::Mat > &  images,
const std::initializer_list< std::string > &  windowNames 
)

Shows multiple images.

Parameters
imagesThe images to show.
windowNamesThe window names in which images will be shown.

Definition at line 39 of file ImageManager.cpp.

39 {
40 auto imagesIterator = images.begin();
41 auto windowNamesIterator = windowNames.begin();
42 for (unsigned char i = 0; i < images.size(); i++) {
43 cv::imshow(* windowNamesIterator, * imagesIterator);
44 windowNamesIterator++;
45 imagesIterator++;
46 }
47 cv::waitKey(1);
48}

Referenced by OpenCV_Manager::showSkeletonsCV().


The documentation for this class was generated from the following files: