projects
/
trackerpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
separate pytwrpper from predictorWrappery
[trackerpp.git]
/
src
/
VideoReader.cpp
diff --git
a/src/VideoReader.cpp
b/src/VideoReader.cpp
index
17d5518
..
cfba733
100644
(file)
--- a/
src/VideoReader.cpp
+++ b/
src/VideoReader.cpp
@@
-8,26
+8,21
@@
const static std::string TAG = "VideoReader";
VideoReaderPtr VideoReaderFactory::createVideoReader(VideoSrcType type, const std::string& url)
{
VideoReaderPtr VideoReaderFactory::createVideoReader(VideoSrcType type, const std::string& url)
{
+ VideoReaderPtr v;
switch(type){
case VideoSrcType::URL:
switch(type){
case VideoSrcType::URL:
- {
- VideoReaderPtr v (new UrlReader(type, url));
- return v;
- }
+ v = std::make_shared<UrlReader>(type, url);
+ break;
case VideoSrcType::File:
case VideoSrcType::File:
- {
- VideoReaderPtr v (new FileReader(type, url));
- return v;
- }
+ v = std::make_shared<FileReader>(type, url);
+ break;
case VideoSrcType::USB:
case VideoSrcType::USB:
- {
- VideoReaderPtr v (new UsbReader(type, url));
- return v;
- }
+ v = std::make_shared<UsbReader>(type, url);
+ break;
default:
break;
}
default:
break;
}
- return
nullptr
;
+ return
v
;
}
VideoReader::~VideoReader()
}
VideoReader::~VideoReader()
@@
-52,6
+47,13
@@
UrlReader::~UrlReader()
vcap.release();
}
vcap.release();
}
+static long count = 0;
+
+static void printImg(const cv::Mat& mat)
+{
+ std::cout << mat.at<int>(0,0) << std::endl;
+}
+
bool UrlReader::read(cv::Mat& mat)
{
bool ret = vcap.read(mat);
bool UrlReader::read(cv::Mat& mat)
{
bool ret = vcap.read(mat);
@@
-59,18
+61,10
@@
bool UrlReader::read(cv::Mat& mat)
LOG_ERROR(TAG, "blank frame grabbed");
return false;
}
LOG_ERROR(TAG, "blank frame grabbed");
return false;
}
+ count++;
+ std::string name = "./temp/image_" + std::to_string(count) + ".png";
+ if ((count % 50 == 0)){
+ imwrite(name.c_str(), mat);
+ }
return ret;
}
return ret;
}
-
-//
-//void UrlReader::read()
-//{
-//}
-//
-//void FileReader::read()
-//{
-//}
-//
-//void UsbReader::read()
-//{
-//}