cpp program for SIFT feature extraction - c++

I am using the MATLAB to process the images currently to extract the features of the image and compare it with a reference image. The MATLAB is installed on a windows system.
Now I want to write a cpp program for SIFT in a linux machine. How to use the MATLAB commands there?
Problem: Can I use the executable created in a windows machine in linux? if so how?
Is OPENCV the only option in linux or is there any other way to implement SIFT?
regards,
shiksha

Related

Check if OpenCV is compiled with GTK support from C++ code

My problem is the same as in:
OpenCV GTK+2.x error
I am facing this problem deploying my code in systems where OpenCV is available but has not been installed with GTK support. I have no control over OpenCV installation in these systems.
How can I discriminate where OpenCV is compiled without GTK support from C++ code, possibly without relying on catching exceptions? I would simply avoid calling imshow in these cases.
you could check dependencies by executing ldd opencv-lib and parse the output using e.g. regex to check for some kind of gtk libs.
Or use this approach: linux/gcc: ldd functionality from inside a C/C++ program
setenv("LD_TRACE_LOADED_OBJECTS", "1", 1);
FILE *ldd = popen("/lib/libz.so");

Edit C++ project in VSCode and OpenCV without installing the whole library

I am working in a C++ project with OpenCV in Windows and VSCode. The project is meant to be built and run in a Docker Container, thus I do not need OpenCV in Windows. If needed, I use OpenCV as installed in WSL.
VSCode complains all the time in #include <opencv2/opencv.hpp> about not being able to find the library, and consequently it refuses to look for errors along the rest of the file.
I do not need OpenCV and I know that the compiling process can become tedious over Windows, so I would like VSCode to ignore this error and go on checking the rest of the files. Having IntelliSense working with OpenCV classes would be ideal.
Is there some way to have this without installing OpenCV in Windows?
This sounds like a good use case for VS Code Dev Containers. Dev containers let you use a docker file to define an isolated linux based development environment—including which tools and libraries are installed—in a reproducible way that does not effect your local machine.
Check out the Dev Container docs and the example c++ dev container for help getting started. If you already have an OpenCV docker image, you can use this as the base for your dev cotntainer
If you are using VSCode on Windows and would like it to OpenCV that is in WSL, you will need to install an extension on VSCode called Remote - WSL, developed by Microsoft.
You'll be able to use Linux specific toolchains, utilities and even run Linux-based applications directly from VSCode on Windows..

How to deploy a Tensorflow trained model for inference for a Windows standalone application

I would like to use a model trained with Tensorflow in a Windows standalone desktop application. I only need to perform predictions, I can train the model with Tensorflow Python API. What is the recommended approach?
I know there is a C++ API, but it is really hard to compile it, especially on Windows. Can I find any prebuilt C++ Tensorflow binaries for Windows?
Is there an easy way to distribute Python with Tensorflow as a Windows installer prerequisite?
Can I import the Tensorflow model in another technology and use it for inference? OpenCv DNN module has a function which imports data from Tensorflow, but I understood it has many limitations, and I was not able to import and use a model with OpenCv.
Thanks for help!
I was challenging the same issues as you.
You should at least try to compile it (try CMake, it might be easier)
If you still having trouble:
Compiler is out of Heap Space
Standalone Windows Lib
Basic Tensorflow Handling with C++
I asked a similar question and eventually found my own way to the answer. In the end, I found the Tensorflow instructions were actually pretty good (it was my reading them that was bad!). I have not tried using Bazel for Windows, but building Tensorflow using CMake ended up working fine.
The main issue was the compiler heap space issue. This always seems to occur in some random place if you are using the MS Visual Studio 32-bit compiler (default). The key is to make sure you run vcvarsall.bat or vcvars64.bat or whatever it takes to invoke the 64-bit compiler (in Task Manager, it should show up as cl.exe, not cl.exe *32) I found it hard (read: impossible) to get Visual Studio to use the 64-bit compiler, but using the MSBuild tool to compile on the command line worked fine.
Once you can build the example program, you have an example of an application that links to a static tensorflow library to do its stuff. You can just make your own application link to this library for what you want.

Serial Communication in OpenCV

I am building an application involving identification of color of object and then sorting it with the help of a robotic hand manipulator. The code for Color Identification is ready in OpenCV, what I do not know is how to transfer this data to my Arduino UNO board connected by USB. I have made this kind of application previously in MATLAB, but have no idea how to do it in OpenCV. Do we have any way to send data over Serial port in OpenCV?
Have you considered using OpenFrameworks? I personally haven't played around with OpenCV but I have played around with serial communications to arduinos on OF. OF also includes the OpenCV library so you can link your work with it.
Prerequisites :Install opencv with python bindings.I usually work on Mac Os.Its pretty easy installing opencv with python bindings on mac using macports.I have no idea about windows and linux but there is no shortage of tutorials to do so.Just google.
And about python,don't worry,You can learn a lot of python in 2 days.Google python classes are definitely a good start.
Check this out for different python opencv methods.And this is a good site for starting opencv with python

Converting Matlab to C++

I need to convert some MATLAB code to C++. I am using Visual Studio 2010 and have MATLAB compiler installed. I am wondering how do I go about doing this.
Also when I publish my project will the end user have to install anything by MATLAB? (this cannot be the case)
You can compile Matlab scripts into standalone executables, but I'm not familiar with a Matlab tool to convert Matlab code to Visual C++ code. You can convert Matlab code to C or C++ using Simulink Coder (formerly Real-Time Workshop), which is available from Mathworks as a separate product.
To run the standalone executable, the user will have to install the Matlab Compiler Runtime. From the Matlab Compiler web page:
Executables and libraries created with the MATLAB Compiler product use a runtime engine called the MATLAB Compiler Runtime (MCR). The MCR is provided with MATLAB Compiler for distribution with your application and can be deployed royalty-free.
You will not get rid of the Matlab runtimes. I often had problems using Matlab Compiler. It basically is like a wrapper around the Matlab runtime, generates clumsy code and did introduce many problems for deployment. C alternatives ... ? I could not find any. So I recently switched to ilnumerics, which is like Matlab in C# - only much faster and no translation necessary. it works out great so far because we use ASP.NET anyway and hence save jumping between languages and can directly use the 3d plots of ilnumerics.
Another option you have is to use the MATLAB Engine. It probably isn't an option for real-time applications, but otherwise it's really nice. You basically call MATLAB functions right from C++. Figures (plots) will be display just as if you were running local MATLAB. When the program starts, a MATLAB console is created.