C++ OpenCV Source - c++

I have downloaded OpenCV. I have got the demos working but what I really want to do is step throuh the source code and see what is going on.
In C# I download source code and set it up so that I can step through it but I do not know how to do this or even if it is possible in C++. I do not even know how to set the source code up so that I can right click on a method name and then click go to definition.
Is it possible to do the same things with source code in C++ as in C#, if so how do I do this?

I'm assuming you want the IDE to show the source code while debugging, or when you click something like "go to declaration" or "follow object under cursor". You will need to tell the IDE where to find the source code.
The Windows OpenCV installer includes the source code, so if you want to locate it manually, check where the installer installs its magic. In Visual Studio, you can add source directories to the Environment in Preferences.

You need to download OpenCV 2.2 for Windows (with VS 2010 project).
OpenCV-2.2.0-win32-vs2010.exe
installation package containing OpenCV source code,
documentation, samples and pre-compiled
32-bit binaries for Visual Studio 2010 developers.
It does not contain 64-bit binaries, binaries
for other compilers, such as VS2008 or MinGW.
It does not have TBB or IPP support built-in.
If you need those, reconfigure and rebuild OpenCV from the source code

Related

How to use Chromium Embedded Framework with Visual Studio 2017 (C++)?

I would like to use CEF with VS 2017 using C++ (not C#, so CEFSharp won't work here). I can't quite understand how to do this. From what I have read, it seems like I need to build the source into a .sln file and then modify the existing code, however their site also says there are binaries available to download, which is confusing me.
How do I program in C++ using CEF and VS 2017?
Download CEF3 binaries, and extract archive to folder
Download and install CMake
Open CMake, and set:
Where is the source code: folder
Where to build the binaries: folder/build
Press Configure
Press Generate
Open solution in folder/build/cef.sln
Build Debug/Release
Reference in your project folder/build/libcef_dll_wrapper/[Debug|Release]/libcef_dll_wrapper.lib
Copy files to your bin folder:
folder/[Debug|Release]
folder/Resources

how to recompile a .lib in Visual Studio 2013

I have a project that uses Effects11.lib and Effects11d.lib but when I build my project I get a bunch of "error LNK2038: mismatch detected for '__MSC_VER':value '1600' doesn't match value '1800'". And from what I have found, this is saying that the .lib was built for a different version of VS than what I am using and I need to recompile them. Issue is I am not sure how to do this. Never had to recompile a lib before.
Looking through the authors site for this book # http://www.d3dcoder.net/d3d11.htm, it looks like the Effects11.lib is Ms-Pl licensed source code.
http://msdn.microsoft.com/en-us/library/windows/desktop/ff728664(v=vs.85).aspx
which then links to
https://fx11.codeplex.com/
which has a download for the source of that library at
https://fx11.codeplex.com/releases/view/150822
which seems to have project files which are buildable with VS2013 which you are using so you should be able to build effects.lib for vs2013 and continue with your development.
Alternative you could contact the author himself from his webpage and see if he can do this for you and link to it as its likely you're not the only one hitting this issue?
To recompile a .lib file, you first have to have the source code. You then open the vcproject of the library project, and then you change your settings and then you can recompile. I also found on the web that for some types of c++ in order to get it to recompile, you will have to delete the .o file generated in the library's directory. But, I do not know if that applies to your compiler. I hope this answers your question.
Those static libraries are built with VS 2010, but you are using VS 2013. The link error is telling you that.
The fix in this case is to visit the Effects 11 site on CodePlex and then build a fresh copy of the Effects 11 with your VS 2013 compiler. Alternatively, you can use the NuGet package fx11_desktop_2013 which is the same version built for VS 2013.
Note that as you are using VS 2013 which includes the Windows 8.1 SDK with the somewhat dated Luna book, you may be trying to make use of the deprecated D3DX11 library. You can certainly do that with VS 2013, but you have to make some adjustments to the project include/lib paths to get it to work. See MSDN. The Effects 11 library version from CodePlex or NuGet has no dependencies at all on the legacy DirectX SDK.
I have some general notes about that book here as well.
For a complete list of D3DX11 alternatives, see Living without D3DX.

Open CV 2.2 Include Directory Missing

I have several Windows 7 64bit systems with OpenCV 2.2 installed on them using CMake and Visual Studio 2008 Standard. CMake generates everything in C:\libs\OpenCV-2.2.0\build just fine and Visual Studio 2008 compiles everything without complaint.
However, every time I do this process on various machines I find that the include directory (C:\libs\OpenCV-2.2.0\build\include\opencv2) is either empty or nearly so. I usually end up thrashing around compiling different versions and poking on random project files until it appears and every time I think I have it figured out. However, with each new install I'm back to the begining.
Is this a known issue for 64bit build of OpenCV 2.2 on Windows 7 64bit using Visual Studio 2008 and is there a known workaround?
Various questions here seem to be hinting at the same thing and guides online are either old or don't reference the problem at all.
To solve this problem compile everything in release and debug then right click the INSTALL project in Visual Studio 2008 and choose Build. This will "install" numerous files and move all the include files into the proper location.
Now /include will contain subfolders
opencv
opencv2
and /include/opencv2 will contain numerous subfolders:
calib3d
contrib
core
feature2d
flann
gpu
highgui
imgproc
legacy
ml
objdetect
video
I just had the same problem. The Answer which explains that you have to rightclick and build the "INSTALL" project after you have built the debug/release works for me now. BUT: for me it was not a "build" folder which was created, but a folder called "install". Inside of that folder there is a include folder now which contains all the stuff you need for the include. The OpenCV version im using is OpenCV v3.2.
well i have the same problem with visual studio 2010,
and the answer
""To solve this problem compile everything in release and debug then right click the INSTALL project in Visual Studio 2008 and choose Build. This will "install" numerous files and move all the include files into the proper location""
cannot work on this. because when you choose 2010 visual configuration
there are no option to do debg or release. u do this afterwars from visual studio
when complile in debug or release mod. has one anny answer.
you my friend that have managed to create a full buld properly
can you please make one with qt support ,and with examples and docs cmake configuration amd please e mail it to me??
it wont take you more than some minutes
and this will be a great help because i try many days to solve it
How are you making \build\ ?
I didn't think opencv did out-of-source builds properly. At least I've never got them to work - have you tried setting the build dir to a completely separate tree?

How do I start a CUDA app in Visual Studio 2010?

Direct Question: How do I create a simple hello world CUDA project within visual studio 2010?
Background: I've written CUDA kernels. I'm intimately familiar with the .vcproj files from Visual Studio 2005 -- tweaked several by hand. In VS 2005, if I want to build a CUDA kernel, I add a custom build rule and then explicitly define the nvcc call to build the files.
I have migrated to Win 7, and VS 2010 because I really want to try out nSight. I have nSight 1.5 installed. But this is where I'm totally lost. If I proceed as before, nvcc reports that it only supports msvc 8.0 & 9.0. But the website clearly states that it supports VS 2010.
I read somewhere else that I need to have VS 2008 (msvc 9.0) also installed -- my word. Doing so now.
But I'm guessing that at least part of my problems stem from the homegrown custom build tool specifications. Several websites talk about adding a *.rules file to the build, but I've gathered that this is only applicable to VS 2008. Under "Build Customizations" I see CUDA 3.1 and 3.2, but when I add kernels to the project they aren't built. Another website proclaims that the key is three files: Cuda.props Cuda.xml Cuda.targets, but it doesn't say how or where to add these files -- or rather I'll gamble that I just don't understand the notes referenced in the website.
So does anyone know how to create a simple project in VS 2010 which builds a CUDA kernel -- using either the nSight 1.5 setup or the NvCudaRuntimeApi.v3.2.rules file which ships with the CUDA 3.2 RC?
Thanks in advance! I'd offer a bounty, but I only have 65 points total.
CUDA TOOLKIT 4.0 and later
The build customisations file (installed into the Program Files\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations directory) "teaches" Visual Studio how to compile and link any .cu files in your project into your application. If you chose to skip installing the customisations, or if you installed VS2010 after CUDA, you can add them later by following the instructions in Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\extras\visual_studio_integration.
Create a new project using the standard MS wizards (e.g. an empty console project)
Implement your host (serial) code in .c or .cpp files
Add the NVIDIA build customisation (right click on the project, Build customizations, tick the relevant CUDA box)
See note 1 if using CUDA 4.0
Implement your wrappers and kernels in .cu files
If you added .cu files before the build customisations, then you'll need to set the type of the .cu files to CUDA C/C++ (right-click on the file, Properties, set Item Type)
Add the CUDA runtime library (right click on the project and choose Properties, then in Linker -> Input add cudart.lib to the Additional Dependencies)
Then just build your project and the .cu files will be compiled to .obj and added to the link automatically
Incidentally I would advocate avoiding cutil if possible, instead roll your own checking. Cutil is not supported by NVIDIA, it's just used to try to keep the examples in the SDK focussed on the actual program and algorithm design and avoid repeating the same things in every example (e.g. command line parsing). If you write your own then you will have much better control and will know what is happening. For example, the cutilSafeCall wrapper calls exit() if the function fails - a real application (as opposed to a sample) should probably handle the failure more elegantly!
NOTE
For CUDA 4.0 only you may need to apply this fix to the build customisations. This patch fixes the following message:
The result "" of evaluating the value "$(CudaBuildTasksPath)" of the "AssemblyFile" attribute in the element is not valid
This answer applies to CUDA 3.2, from 4.0 onwards CUDA supports the VC 10 compiler directly, see other answers for more information
You need either VS 2008 or the 6.1 Windows SDK installed. That's because NSight 1.5 RC or the CUDA 3.2 SDK use the VC 9 compiler under the hood. I've got this working successfully with 2008 installed and am told it should work with the SDK but haven't tried.
With NSight 1.5 and/or the CUDA 3.2 SDK you shouldn't need to muck with any custom build rules. I've been there and it's painful. With the latest builds all that goes away:
Create your VC++ project.
Add a .CU file to it.
Select the project file in the Solution Explorer.
Open Project | Build Customizations...
Check the "CUDA 3.2 (.targets,
.props)" customization.
Select a .CU file in your project and hit Alt-Enter to show it's properties.
Make sure it's Item Type is set to "CUDA C/C++"
It should just build. Let me know if this helps and if you run into problems as this is from memory.
The good news it getting CUDA working with VS 2010 just got much easier.
Ade
BTW: I'll update my blog post.
Another Good tutorial here:
http://www.stevenmarkford.com/installing-nvidia-cuda-with-visual-studio-2010/
if you get an error about '<' note this step (from a previous answer):
If you added .cu files before the build customisations, then you'll need to set the type of the .cu files to CUDA C/C++ (right-click on the file, Properties, set Item Type)
But if you follow their steps, it should work!

How to update MFC source code?

After several Visual Studio patches and a service pack or two, my MFC source code no longer matches my MFC binaries. When I trace into MFC, I either see assembly or old source code.
How do I get my MFC sources to match my binaries again?
Since there are no other answers I'll tell you the obvious (and the most painful) one. Reinstall everything. And if possible install Visual Studio with SP slipstreamed.
Although I don't know what you meant by "old source", I don't think there were any changes to MFC between Visual Studio 2005 and SP1. But I might be mistaking.
I'm not sure why it's not picking it up automatically - when you build a dll, the source location is stamped in the pdb. Anyway, try setting the source file path in Visual Studio to first point to the "updated" MFC source. If that doesn't work, step into the MFC function again (so you get the "incorrect" source), then close out that file, then browse to and open the "correct" source file. See if the debugger jumps to the appropriate location then.
There are a number of updates from the MS download centre, searching MFC. but the only one mentioning source is the OLEUI2.cpp update to VS.Net 2003. Maybe it hasn't actually been changed but does need recompiling?