本文整理汇总了C++中FilterManager::applyFilterChain方法的典型用法代码示例。如果您正苦于以下问题:C++ FilterManager::applyFilterChain方法的具体用法?C++ FilterManager::applyFilterChain怎么用?C++ FilterManager::applyFilterChain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilterManager
的用法示例。
在下文中一共展示了FilterManager::applyFilterChain方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: T_applyFilterChain
int FilterManagerTEST::T_applyFilterChain() {
int fail = 0;
logger->trace("==============================");
logger->trace("Testing applyFilterChain():");
logger->trace(" Creating FM under normal mode...");
FilterManager* fm = new FilterManager("fm");
logger->trace(" Using factory, making 4 random filters...");
Filter* f1,*f2,*f3,*f4;
f1 = FilterFactory::createFilter();
f2 = FilterFactory::createNullImgFilter();
f3 = FilterFactory::createNullFPGAFilter();
f4 = FilterFactory::createFilter();
logger->trace(" Inserting f1 as \"task 3\" to FRONT...");
fm->insertFilter("task 3",f1,"FRONT");
logger->trace(" Inserting f2 as \"task 1\"...");
fm->insertFilter("task 1",f2,"task 3");
logger->trace(" Inserting f3 as \"task 2\" between f1,f2...");
fm->insertFilter("task 2",f3,"task 3");
logger->trace(" Inserting f4 as \"task 4\" to REAR...");
fm->insertFilter("task 4",f4);
logger->trace(" Making img objs...");
cv::Mat img = cv::Mat::zeros(2,2,CV_8UC1);
ImgData* data = new ImgData("input",img);
logger->trace(" Applying all filters...");
int res = fm->applyFilterChain(data);
logger->trace(" Checking data ID...");
logger->trace(" "+data->getID());
if (data->getID() == "fm")
logger->trace(" ok");
else {
logger->warn(" NOT ok, ID not set!");
fail++;
}
logger->trace(" "+data->getTrack()+"error code "+std::to_string(res));
if (data->getTrack() == "task 1; task 2-1; task 3; task 4; ")
if (res == 1)
logger->trace(" ok");
else {
logger->warn(" NOT ok, error code incorrect");
}
else {
logger->warn(" NOT ok, track record not expected");
}
img.release();
delete data;
delete fm;
logger->trace("Testing complete.");
if (fail > 0)
logger->warn(" TEST FAILED: applyFilterChain");
logger->trace("==============================");
return fail;
}
示例2: T_filter
int RGBFilterTEST::T_filter() {
int fail = 0;
logger->trace("==============================");
logger->trace("Testing filter():");
// logger->trace(" Using imread...");
// cv::Mat img = cv::imread("rgb_mode_0.jpg",CV_LOAD_IMAGE_COLOR);
// if (! img.data)
// logger->warn(" OH NO, img not read");
logger->trace(" Using camCap...");
ImgDataTEST* imgTest = new ImgDataTEST();
cv::Mat img = imgTest->camCap();
cvDestroyWindow("camCap");
logger->trace(" Loading test image into a ImgData wrapper...");
ImgData* testImg = new ImgData("raw",img);
logger->trace(" Copying ImgData to second wrapper...");
ImgData* testImg2 = new ImgData(*testImg);
logger->trace(" Showing one copy of test image (should be named \"raw\")...");
testImg->showImg();
logger->trace(" Filtering first data w/ full luminosity specturm, aka mode 0...");
logger->trace(" Init int arr[3]...");
int arr[] = {25,-15,-20};
logger->trace(" Using filter factory, create mode 0 filter...");
RGBFilter* rgbFilter = new RGBFilter(arr);//(RGBFilter*)FilterFactory::createRGBFilter(arr);
logger->trace(" Creating filter manager w/ id \"RGBFilter MODE 0\"...");
FilterManager* fm = new FilterManager("RGBFilter MODE 0");
logger->trace(" Inserting filter as \"rgb mode 0\"...");
fm->insertFilter("rgb mode 0",rgbFilter);
logger->trace(" Attempt filtering using filter manager...");
fm->applyFilterChain(testImg);
logger->trace(" Showing filtered test image...");
testImg->showImg();
logger->trace(" Expect 2 windows, \"raw\" and \"RGBFilter MODE 0\", the latter should be red shifted");
logger->trace(" If true, hit space, else hit esc");
char key;
while (1) {
key = cvWaitKey(0);
if (char(key) == 32) {
logger->trace(" ok");
break;
}
else if (char(key) == 27) {
logger->warn(" NOT ok, details of output under mode 0 not correct");
fail++;
break;
}
}
logger->trace(" Filtering data 2 w/ 3 zones of luminosity separately, aka mode 1...");
logger->trace(" Init int high[3],mid[3],shad[3]...");
int high[] = {255,255,255};
int mid[] = {50,-30,-30};
int shad[] = {-255,-255,-255};
logger->trace(" Using filter factory, create mode 1 filter...");
RGBFilter* rgbFilter2 = new RGBFilter(high,mid,shad);//(RGBFilter*)FilterFactory::createRGBFilter(high,mid,shad);
logger->trace(" Creating filter manager w/ id \"RGBFilter MODE 1\"...");
FilterManager* fm2 = new FilterManager("RGBFilter MODE 1");
logger->trace(" Inserting filter as \"rgb mode 1\"...");
fm2->insertFilter("rgb mode 1",rgbFilter2);
logger->trace(" Attempt filtering using filter manager...");
fm2->applyFilterChain(testImg2);
logger->trace(" Showing filtered test image...");
testImg2->showImg();
logger->trace(" Expect 3 windows in total, \"raw\" and \"RGBFilter MODE 0\" and \"RGBFilter MODE 1\", the latter should be red shifted, but a bit differently");
logger->trace(" If true, hit space, else hit esc");
while (1) {
key = cvWaitKey(0);
if (char(key) == 32) {
logger->trace(" ok");
break;
}
else if (char(key) == 27) {
logger->warn(" NOT ok, details of output under mode 1 not correct");
fail++;
break;
}
}
delete fm;
delete fm2;
cvDestroyWindow("raw");
testImg->closeImg();
testImg2->closeImg();
delete testImg;
delete testImg2;
img.release();
if (fail > 0)
logger->warn(" TEST FAILED: filter()");
logger->trace("==============================");
return fail;
}