-R, --dereference-recursive likewise, but follow all symlinks --include=FILE_PATTERN search only files that match FILE_PATTERN --exclude=FILE_PATTERN skip files and directories matching FILE_PATTERN --exclude-from=FILE skip files matching any file pattern from FILE --exclude-dir=PATTERN directories that match PATTERN will be skipped.
这说明,我们可以通过include来限定hpp文件
前面提到过*表示全部,所以我们把include的关键词设置为*.hpp就可以了
因此我们再输入:
1
grep --include="*.h""namedWindow(" -R *
bash的指令要求是可以叠加的,无需在意顺序,反正参数往后面叠就行了
然后我们得到:
1 2 3 4 5 6 7 8 9 10
$ grep --include="*.hpp""namedWindow" -R * modules/core/include/opencv2/core/opengl.hpp:do this with namedWindow function or with other OpenGL toolkit (GLUT, for example). modules/highgui/include/opencv2/highgui.hpp: cv::namedWindow(windowName); // not required modules/highgui/include/opencv2/highgui.hpp://! Flags for cv::namedWindow modules/highgui/include/opencv2/highgui.hpp:The function namedWindow creates a window that can be used as a placeholder for images and modules/highgui/include/opencv2/highgui.hpp:CV_EXPORTS_W void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE); modules/highgui/include/opencv2/highgui.hpp:If you need to show an image that is bigger than the screen resolution, you will need to call namedWindow("", WINDOW_NORMAL) before the imshow. modules/highgui/src/backend.hpp: // namedWindow modules/highgui/src/window_framebuffer.hpp: // namedWindow modules/highgui/src/window_winrt_bridge.hpp: CvWindow* namedWindow(cv::String name);
可以看出,我们需要的关键信息再highgui.cpp里面
打开对应文件
我们先进入这个文件夹
1
cd ./modules/highgui/include/opencv2/
接下来使用less指令打开这个文件并进行查找
less 是 Linux/Git Bash 中最强大的文本查看器。它不会修改文件,而且支持高亮搜索。
1
less highgui.hpp
查找方式也很简单,输入/+关键字就行了
1
/namedWindow
最终,我们查找到用法:
1 2 3 4 5 6 7 8 9 10 11 12
//! Flags for cv::namedWindow enumWindowFlags { WINDOW_NORMAL = 0x00000000, //!< the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size. WINDOW_AUTOSIZE = 0x00000001, //!< the user cannot resize the window, the size is constrainted by the image displayed. WINDOW_OPENGL = 0x00001000, //!< window with opengl support.
WINDOW_FULLSCREEN = 1, //!< change the window to fullscreen. WINDOW_FREERATIO = 0x00000100, //!< the image expends as much as it can (no ratio constraint). WINDOW_KEEPRATIO = 0x00000000, //!< the ratio of the image is respected. WINDOW_GUI_EXPANDED=0x00000000, //!< status bar and tool bar WINDOW_GUI_NORMAL = 0x00000010, //!< old fashious way };