Create .dll with Visual Studio - opencv

I want to create my own .dll file with visual studio.
The problem is, that I have included Open CV inside my program, because I'm using a method from Open CV.
My question now is, is it possible to create my own .dll file although I'm using a Open CV library? Is the Open CV lib, included inside my own .dll than, or how does it work?
Thank and best wishes,
Andi!

I think you can do this in two ways:
Statically link OpenCV into your DLL
Run-time Dynamically link OpenCV from your DLL
The first one requires you to build OpenCV as a static library (output is a large .lib file, no .dll).
In your own DLL, you specify you want to link with opencv.lib.
The second one requires you to build OpenCV as a dynamic library (output is a small .lib file, and a big .dll).
In your own DLL, you would have to add code to manually load the OpenCV library and find the addresses of the functions you need to call from OpenCV (see https://msdn.microsoft.com/en-us/library/windows/desktop/ms685090%28v=vs.85%29.aspx)

Related

How to Combine .so and executable in one .so file

For my project, I am using openCV library api in my source code. SO I optimized the module of opencv library (I keep only required module ie: core,imgcodecs,imgproc,highgui,ml and videoio) and I combined these modules together and I created one .so file.Now I have one .so and one executable.
My question is how to combine this .so and executable and create one .so file.
Please help me on this. Thanks in advance.

link obj files in embarcadero c++ builder Dunit Test Project

I'have added a test case to DUnit Test project in embarcadero c++ builder 2010. I can compile it fine but the linker fails saying "unresolved external" to a method in an .obj file from original project. If I add the .obj file to DUnit project it works fine. However I don't want to do it as there are huge number of .obj files in the original project and it will be a pain to add .obj files each time you want to test a new class. Is there a way to point the linker to search directories to look in for .obj files and get them from there. ( I'm not using the command line, but the c++ builder 2010 IDE).
If you go into Project Properties you can configure the directories that are searched for includes, libraries, etc. You can do this by build type or for all configurations.
However it's usually a bad idea to directly link other .obj files from a different project, as they may have been compiled with different settings . Why don't you just add your test case to the project without deleting anything from it?

how can I debug with the OpenCV source code

I am using VS2010 with OpenCV 2.3.1, and opencv is installed by using OpenCV-2.3.1-win-superpack. Now I want to understand the facedetect sample (opencv\samples\c\facedetect.cpp) in detail, I wanna know how to process the specific xml feature file (haarcascade_frontalface_alt.xml), and how to decide which feature to be used. These are all
in the CascadeClassifier class, but when I use "go to definition", the result file is a .hpp
head file, so where is the implementation file? when I use vs2010 to debug, the debugger can not locate the implementation file either. some advice?
Add the opencv\modules directory to the 'source' entry in the vs-directories tab in the project settings. And make sure the pdb files are in the same directory as the debug dlls

integrating cvblobslib in opencv

here I have just started my fyp and ints gona be in opencv.
I needed to vectorize the image and in order to do that I chose to use cvblobslib.
I downloaded it and it was build successfully but when I use it in my project there's a link error saying that "could not open cvblobslib.obj"
the exact string is pasted below
fatal error LNK1104: cannot open file 'E:\Faizan\myWork\moCap\blobslib\Debug\cvblobslib.obj'
of the solutions which I found on net and tried on my project are to remove any spaces in path, build in release mode rather than in debug mode, but problem was not solved.
the thing is that the stated file does not get built with other files when cvblobslib is built, i.e it is not there in the stated folder.
any body please give a solution
What exactly are you trying to use the cvblobslib for? I also tried using this with no luck. I found that openCV has a lot of the same capabilities. For example, you can use cvCountours to detect "blobs" and filter them by area.
(ps. i tried leaving this as a comment. do you need certain amount of rep to do that?)
cvBlobsLib has been developed using Microsoft Visual C++ (6.0) and can also be used in .NET. A Linux version could be downloaded here.
cvBlobsLib is distributed in a static library (.lib). To use it, it is requred that you build the .lib file and later use that lib file in the desired project. To build the .lib file, simply open the MSVC++ project and build it (debug or release version).
To build the project where the library is to be used follow this steps (MSVC++ 6.0):
In Project/Settings/C++/Preprocessor/Additional Include directories add the directory where the blob library is stored
In Project/Settings/Link/Input/Additional library path add the directory where the blob library is stored and in Object/Library modules add the cvblobslib.lib file
Include the file BlobResult.h where you want to use blob variables.
In Project/Settings/C++/Precompiled Headers select Not use precompiled headers
NOTE: Verify that in the project where the cvblobslib.lib is used, the MFC Runtime Libraries are not mixed:
Check in Project->Settings->C/C++->Code Generation->Use run-time library of your project and set it to
Debug Multithreaded DLL (debug version) or to Multithreaded DLL ( release version ).
Check in "Project->Settings->General" how it uses the MFC. It should be "Use MFC in a shared DLL".
NOTE: The library can be compiled and used in .NET using this steps, but the menu options may differ a little
NOTE 2: In the .NET version, the character sets must be equal in the .lib and in the project. [OpenCV yahoo group: Msg 35500]
NOTE 3: cvBlobsLib might give errors when building with OpenCV v2.2 onwards. Try commenting out this line in file BlobLibraryConfiguration.h:
#define _SHOW_ERRORS
NOTE 4: If you are using the new cv::Mat for your images instead of the old IplImage, you can easily convert between them, such as by following the OpenCV C++ Cheatsheet.

import existing source code as referenced library in eclipse

I have some source codes from a friend that I would like to use as referenced library in my BlackBerry project. I'm not sure about how to package the source codes into a .jar file. I tried exporting the source to a JAR file and import it as external JAR in my project, it's giving me missing stack map error. I tried to preverify the .jar file generated from the source using the provided preverification tool from BlackBerry JDE, it didn't give me any output folder.
In fact, I'm not sure if the way I export the source is correct. Can anyone provide step-by-step instructions on how to package existing source code into a valid JAR file that can be imported into my project as a referenced library?
Again, I'm using eclipse.
I fought with this issue for months...
I have two solutions for you:
A-If you plan on having this library in more than one Application:
I posted my solution at the bottom of my original question: Blackberry Apps - Importing a code-signed jar into an application project
The basic solution was to build the library as a cldc project (plus some other magic), not as a library project. I actually had to open a case with RIM support to figure this out, it was a hot mess... Our case was complicated in that more than one application would have a copy of our "Library" and our library had to be signed. Which caused weird issues when two ALX files (from two different apps) both had the same signed library file.
The nice thing about this solution is that adding the library to the Application doesn't force you to have multiple COD files.
B - If your Jar is only going to be in one Application:
Then you should follow these instructions: http://supportforums.blackberry.com/t5/Java-Development/Eclipse-1-1-can-I-add-external-3-d-party-JAR-library/m-p/486787#M98033

Resources