41 lines
659 B
C++
41 lines
659 B
C++
#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);
|
|
}
|