Not through the CMake, directly view the OPENCV function source code _ Source

Source: Internet
Author: User

This morning, you need to look at the source code for the OpenCV cvcolor function, although you often use the OpenCV library to do some image-related processing, but did not see the OpenCV source code, after some lookup, there are two main methods:
1. Use CMake. We know that the full version of the OpenCV we download on the official web will typically have build and sources two folders, and if we just want to use the OpenCV library, the build folder is sufficient. If you want to see the source code for OPENCV, you need the sources folder, but the Sources folder is just a few scattered files, with Visual Studio open a. cpp file, casually select a function click on the right button, found not "view definition", The reason: There is no connection between all the source files, that is, no engineering documents have been established, and CMake is doing such a thing. Specific reference to the following blog post: link;
2. Use the OPENCV official website +visual Studio mode.

The 2nd way is the next thing I want to focus on, sometimes, we are lazy to use cmake, or, we are using someone else's computer, but suddenly a flash of light, want to see a function of the source code, below, I look at the Cvcanny the function of the source, for example, Follow these steps (you need a OPENCV sources folder on your computer and an IDE for Visual Studio or similar functionality):
1. First, determine the module in which the Cvcanny function resides. If you already know that the Cvcanny function is located in the Imgproc module of OPENCV, you can ignore this step, and if you don't know, you can view the module of the Cvcanny function by OpenCV's official website:
Open OPENCV official website--documentation--reference--Search Cvcanny keyword
You can search for the following:

Then click on the search to the Cvcanny function, there will be a new page, of course, our goal is to determine the module of the Cvcanny function, we found that the new page of the Web site:

There is a small part of "Modules/imgproc", so we can know that the Cvcanny function belongs to the Imgproc module. So, after you know the module in which the Cvcanny function is located, what do you do next? Please continue to look down.
2. Use Visual Studio for source search. Open Visual Studio, in:
Edit-Find and Replace-find the following input in the file:

The content of the lookup is of course cvcanny, and the scope of the search is SOURCES\MODULES\IMGPROC\SRC
Here, you can see that step 1 above determines that the module in which the function is located is designed to narrow the scope of the lookup and speed up the lookup.
Find the following results:

This time, double-click the corresponding line can see the Cvcanny function of the source code.

Here, I completed the "Use OPENCV official website +visual Studio" View the OPENCV function source code this method introduction.
Or above, this method is mainly convenient to lazy to use cmake or just a flash to see the source code friends, if you want to view the source code, of course, it is necessary to use CMake to establish the corresponding engineering documents, to check up to be more convenient.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.