OpenCV .xml file copying for object detection - c++

I'm new to Visual Studio, I want to run the OpenCV object detection code, this site says:
Remember to copy the files haarcascade_frontalface_alt.xml and
haarcascade_eye_tree_eyeglasses.xml in your current directory. They
are located in opencv/data/haarcascades
Can someone explain me how to do that?

This means that when using/shipping you app, don't forget to make sure that these XML files are available and accessible.

Related

Is it possible to step into a member function defined in a .dll file?

I downloaded an SDK from NVIDIA and I'm using Visual Studio 2015 to run the demo project files provided in the SDK.
The demo project files in the SDK worked as expected until I made some small changes in the code (If you'd like details about the changes, please see last paragraph).
After making these changes, a line in the code seems to run forever. Using the debugger I found that there's a member function in that line of code that is not returning anything and therefore the program flow is just stuck at that line. I tried stepping into this function but it's defined in a .dll file that came with the SDK.
Visual Studio tells me that the symbol file is not loaded and the PDB file cannot be found on the Microsoft Server. The debugger lets me see the disassembly code but I don't know if I can identify the problem using that.
So now I'm stuck at a line of code because the member function defined in a .dll file won't return anything and just keeps on running (I've left it running for over an hour and still it didn't return anything).
I want to identify the reason why this is happening, but I'm unable to see the source code of the member function so I have no idea what's happening inside the member function or how to debug it. Is there any way I can identify the cause of this problem? Is it possible to somehow see the source code of the member function in a way that I can understand what is going on?
More details on changes I made:
I've separated this from main body of the question because I don't see it as being very relevant but it may be useful for the answerer. The SDK stitches videos together into a single video (creating 360 view videos). The demo project works fine as long as I use the demo video files. The video files are fed into the project using command line arguments. When I feed my own video files to the demo project, that's when I face this problem, otherwise the member function returns successfully and the project successfully creates a stitched video. The only thing I changed is the input to the project (i.e. the video files), I haven't changed the source code at all.
If the provider of the DLL doesn't deliver the source code, you obviously can't see it. That would be the common way to handle it - unless they are open source, their source code is the company's intellectual property, so of course they are not showing it to you.
If it is open source, you typically can download the debug-DLLs (which contain the source code). Microsoft also delivers many runtime DLLs in version with source code (but of course not Windows itself). Check in the SDK if there is a debug version of that DLL, and link with it instead of the one you are currently using.
So, in a nutshell, you can't see it unless they give it to you.
As stated by VTT and Aganju, I cannot step into the member function defined in the DLL unless the source code is provided to me with the DLL. This answers what I asked. For my specific case, I was working with NVIDIA VRWorks 360 Video SDK, the problem was caused by not having the right codec for the video files that get stitched. Although this is mentioned nowhere in the SDK documentation, the video codec that should be used is H264 - MPEG-4 AVC (part 10) (AVC1).

Is it possible to make ImageMagick++ based applications check the local directory for dlls

I'm creating an application that uses ImageMagick++ to load and convert a sequence of pngs into gifs.
Everything works on my dev machine (unless I uninstall ImageMagick++), but it crashes on other users machines when it tries to use the gif and png coders. I don't want end users to have to install ImageMagick in order to user the software.
It requires IM_MOD_RL_gif_.dll and IM_MOD_RL_png_.dll from the ImageMagick install directory: C:\Program Files (x86)\ImageMagick-6.8.9-Q16\modules\coders
It finds all the dlls and functions correctly when copied to the local directory except the coders.
Which don't work regardless of whether I copy them directly to the program directory. The following locations also failed (based off of advice I found elsewhere on the web).
applicationDir/
applicationDir/ImageMagick-6.8.9-Q16/modules/coders
applicationDir/bin/ImageMagick-6.8.9-Q16/modules/coders
applicationDir/modules/coders
Is there anyway to make an application using ImageMagick++ check the local directory for coder dll's without having to rebuild ImageMagick++ myself?
I'll respond here because I've seen a similar question unanswered elsewhere.
You just need to set the environment variable MAGICK_CODER_MODULE_PATH for the process using the coders.

SFML not loading image (Possibly due to placing in wrong place?)

I'm not sure whether I'm doing something stupid or visual studio is doing something wrong.
I've never really used C++ with VS before, but I managed to get SFML working, and now I cannot load images.
This is how I put the image in the project:
However when I write:
if (!tileTexture.loadFromFile("ConceptTile.png"))
return EXIT_FAILURE;
It returns EXIT_FAILURE.
Can anyone give an answer to why this isn't working?
If it helps that png file isn't appearing anywhere in the debug directories, just dlls, exes, and pdbs.
I've looked online to try to find out where I am supposed to put images but I can't find any articles or help no matter what keywords I type.
Make sure you change the file properties within the project to copy it to the output directory. By default (and without further paths given in the string) SFML should look for the file in your working directory. You don't have to add image files to your project, if you ensure they're at the right place. Also make sure to not include them as resources (as SFML won't be able to load them without some additional code).
Open Windows Explorer and move to the folder that contains the C++ files and paste the image there and it shall work or make a folder and change the directory in code, for example, if you name the folder images :
(!tileTexture.loadFromFile("images/ConceptTile.png"))
return EXIT_FAILURE;
and it shall work.

How to copy qt source files to my project and let them compile pass?

In my project, I use QWizard and QWizardPages, but at last I found these classes have too much restrict, and I want to modify their source code. But I think it's not a good idea to directly modify qt source, but copy them to my project folder and rename the class names. Is their somebody do the same thing before? I can't compile the files successfully, it seems qMywizard.cpp include the generated moc file of qMywizard.h at the end, and the moc file can't be compile without the QMyWizardPrivate definition. I'm also afraid that many macros can't be recognized when files change location. Can anyone give me some advice?
Qt source is in git. Clone it, make a branch, write your modifications there and compile it with their build system. Also, make sure to understand and follow the license obligations on modifications (especially if you are using the LGPL).

where are images stored inside programs?

i'm new to programs so bear with me
For example, Firefox.. I go to the C/program files/mozilla/firefox folder ..but I don't see the images/buttons they used for the default theme of the program
Also, photoshop and other programs: how are the buttons, images, and other media stored (not in a folder from what I see)?
same thing when I made a simple program in visual c++, i don't see where the icon is located at?
thanksvery much
Images are usually stored as resources in DLL or EXE files.
You can see the resources by opening a compiled binary in Visual Studio.
Firefox stores images in JAR files for skins.
In the resource section of the executable file. This section of file acts as an embedded storage location which is indexed by the resource table.
You can use a program such as ResHacker to browse or even change native embedded resources.