c - opencv的cvSaveImage函数源代码

标签 c opencv

我需要查看以下opencv C函数的源代码,但我尚未在opencv源代码中找到正确的目录。

  1. cvSmooth()
  2. cvResize()
  3. cvSaveImage()

我使用的是OpenCV 2.3.1,有谁知道在哪里可以找到这三个C函数的源代码?

最佳答案

使用 grep 很容易,考虑到它们至少使用部分 GNU 代码风格,将函数的返回类型放在实现上方的行上,并且 grep 可以搜索包含行开头标记的模式,如 grep 手册所述:

Grep manual: The caret ^ and the dollar sign $ are metacharacters that respectively match the empty string at the beginning and end of a line. The symbols \< and > respectively match the empty string at the beginning and end of a word. The symbol \b matches the empty string at the edge of a word, and \B matches the empty string provided it's not at the edge of a word.

grep "^cvSmooth" -rn .

-r 选项告诉 grep 递归搜索,以便它搜索您要求搜索的路径的所有子文件夹。

-n 选项告诉 grep 包含它找到的任何匹配项的行号,这可以帮助我们进一步缩小要查找的范围。

末尾的 . 路径指示符告诉 grep 搜索当前目录。

这给了我以下输出:

./modules/imgproc/src/smooth.cpp:3514:cvSmooth( const void* srcarr, void* dstarr, int smooth_type,

它准确地告诉您在源代码中哪里可以找到 cvSmooth 的实现。您可以对要查找的其余函数执行相同的操作。

学习使用 grep,因为它在尝试浏览源代码(尤其是大型项目)时非常有用。另外,感谢 openCV 的作者使用该代码风格策略,因为这在 grep 时确实很有帮助!

关于c - opencv的cvSaveImage函数源代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31185449/

相关文章:

programming-languages - 轨迹栏的含义

c - putc 在单独的行 C 中将字符串打印到单词

c - c程序如何获得库函数的定义,如printf

c++ - 在缓冲区内分离数据时出现问题 (WinAPI)

c - 释放指针

python - cv2.imshow 和 numpy.dstack 核心转储

macos - Mac 上奇怪的 C 库链接问题 - Segmentation Fault

python - 在 OpenCV 中填充单色背景

python - Tkinter 嵌套主循环

python - openCV 和 python : Morphological transformation outside boundaries