void objDetection::utilities::setupBackgroundImage(config& conf) { if(!conf.back) { if(conf.camera) { getImageFromFile("bg.jpg",conf.background); if(conf.background) { std::cout<<"background loaded"<<std::endl; } else { std::cout<<"Setup for Background image"<<std::endl; conf.background = getImageFromCamera(conf); } } else if(conf.image_file) { getImageFromFile(getNextImageFileName(conf).c_str(),conf.background); } conf.back=true; cropFrame(conf,conf.background); } }
/* public callable function to apply image effects set the getters on this class */ cv::Mat VideoProcessing::process(cv::Mat &frame) { // save reference to the current frame, do NOT copy it into the memory this->frame = frame; if (picGreyscale == true) { convertFrame2Grey(); } if (picInvert == true) { invertFrame(); } if (picFlip == true) { flipFrame(); } if (picRotateAngle != 0) { rotateFrame(); } if (picEqualize == true) { equalizeFrame(); } if (picSharpen == true) { sharpenFrame(); } if (picCrop == true) { cropFrame(); } return this->frame; }
bool objDetection::utilities::getNextFrame(config& conf) { if(conf.camera) { conf.current_frame=getImageFromCamera(conf); if(conf.current_frame==NULL) return false; } else if(conf.image_file) { std::string add=getNextImageFileName(conf); if(strcmp(add.c_str(),"")!=0) getImageFromFile(add.c_str(),conf.current_frame); else return false; } if(conf.current_frame==NULL) { return false; } cropFrame(conf,conf.current_frame); return true; }