PlottWare/PlottWareControl/imageViewer.cpp

41 lines
659 B
C++
Raw Permalink Normal View History

2019-08-08 14:02:07 +00:00
#include "imageViewer.h"
ImageViewer::ImageViewer(){
name="";
}
ImageViewer::ImageViewer(cv::Mat* _img, std::string _name){
img=_img;
name=_name;
}
ImageViewer::ImageViewer(cv::Mat _cimg, std::string _name){
cimg=_cimg;
name=_name;
img=&cimg;
}
ImageViewer::~ImageViewer(){
show(false);
img->release();
}
void ImageViewer::assignImage(cv::Mat* _img){
img=_img;
}
void ImageViewer::show(bool show){
if(show){
cv::namedWindow(name, CV_WINDOW_AUTOSIZE);
cv::imshow(name, *img);
}
else{
cv::destroyWindow(name);
}
}
void ImageViewer::refresh(){
show(false);
show(true);
}