-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Applications] Show detected markers in video and live mode #33
Conversation
'l' and 'd' for debug mode (ie it wait for a key to be pressed at each frame)
@@ -116,7 +116,7 @@ void CmdLine::usage( const char* const argv0 ) | |||
" [--use-cuda]\n" | |||
" [--parallel <n>]\n" | |||
"\n" | |||
" <imgpath> - path to an image (JPG, PNG) or video\n" | |||
" <imgpath> - path to an image (JPG, PNG) or video(avi, mov) or camera index for live capture (0, 1...)\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing space video(avi, mov)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
cv::cvtColor(imgGray, frame, cv::COLOR_GRAY2BGRA); | ||
|
||
drawMarkers(markers, frame); | ||
cv::imshow(windowName, frame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a UI should be an option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? :-)
*/ | ||
bool isInteger(std::string s) | ||
{ | ||
std::regex e("^-?\\d+"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sadly crashes at runtime with gcc4.8 (ubuntu 14.04.05) as regex apparently are not fully supported in that version. I'll find a workaround...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not going to have 10 cameras anytime soon so replace it with s.size()==1 && std::isdigit(s[0])
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah maybe your right, it was a bit overkilling it... ;-)
*/ | ||
void drawMarkers(const boost::ptr_list<CCTag> &markers, cv::Mat &image) | ||
{ | ||
BOOST_FOREACH(const cctag::CCTag & marker, markers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In C++11 there's no reason whatsoever to use BOOST_FOREACH
. Use for (const auto& marker : markers) { ... }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
#endif // WITH_CUDA | ||
|
||
bfs::path myPath( cmdline._filename ); | ||
bfs::path myPath(bfs::absolute(cmdline._filename)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bfs
?! Be consistent, either use bfs
or boost::filesystem
everywhere, but don't mix them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
frames.push_back( imgGray ); | ||
} | ||
std::cerr << "Done. Now processing." << std::endl; | ||
boost::timer t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the timer be inside the for
-loop if the meaning is to measure per-frame time? You should also instantiate it just before calling detection
. Could also upgrade to use the new timer implementation: http://www.boost.org/doc/libs/1_49_0/libs/timer/doc/cpu_timers.html
In any case, it seems to be unused, so just remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i just forgot to remove it from the previous version, there is already a timer inside detection
Modified the
detection.cpp
example so that you can see the detected markers on a UI (similar to appCutie) when using a video (and I added the support for webcams)