OpenCV extended image processing - filters - c++

How do I access the OpenCV extended image process module? I need one filter specifically: fastGlobalSmootherFilter.
I have OpenCV 3.2.0 incorporated into my C++ project. I'm looking for this method:
http://docs.opencv.org/master/da/d17/group__ximgproc__filters.html#gaf8673fe9147160ad96ac6053fac3c106
which is in this module:
http://docs.opencv.org/master/df/d2d/group__ximgproc.html.
I found it through the research page here:
https://sites.google.com/site/globalsmoothing/
I've tried searching through the OpenCV header files, but none reference this function. I can't find edge_filter.hpp which is supposed to house some of these filters. How does one actually call the method?

At OpenCV developer site, you will find instructions for building the contrib modules (or extras)
https://github.com/opencv/opencv_contrib/blob/master/README.md
By default, they are not included in your build.

Related

vtk: Modelling examples not working (Delaunay3D, finance etc)

I'm new to vtk, and I've succesfully built vtk 8.1.1 from source, using Cmake and Visual Studio 2017, with the default options and examples.
I've already solved an issue with the Infovis folder examples.
Now, I'm trying to run the examples from the Modelling folder:
The problem is that when I try to run these examples, it opens a window that closes so fast I can't even see what it says, so I have no clue about the error.
The Delaunay3D.cxx file begins with these comments:
`// Delaunay3D
// Usage: Delaunay3D InputFile(.vtp) OutputFile(.vtu)
// where
// InputFile is an XML PolyData file with extension .vtp
// OutputFile is an XML Unstructured Grid file with extension .vtu
`
So it looks like I need external data files, and the same is true for the other examples. But, where do I get these files, and where do I place them?
Some of the examples in the source files are not complete i.e. as you found out, some of them require external input files which may be missing or mistakes in CMakeLists.txt etc. In the parent folder of the folder that you have attached screenshot of (i.e. the Modelling directory) there is also a folder for Python examples. In that folder, there is a Delaunay3D.py file which creates random points as input instead of reading them from file. So you can do the same. The names and signatures of functions in Python and C++ are the same by modifying the Delaunay3D.cxx code or adding some code in the TestDelaunay3D.cxx. But there is no such file for the finance example, unfortunately.
I find it useful to use VTK code along with Paraview. Paraview is built on top of VTK. It has most of the VTK filters available through the GUI. In Paraview you can also create some data and save it to file using File->Save Data. You can then use that as input for the examples. Once you become familiar with VTK file types and VTK sources, generating data does not require a lot of code. So you can do it yourself by modifying any of the example code (like it is done in the Delaunay3D.py).
About where to place the input files, in this particular case you can place them anywhere but when you run the executable that was built, you must enter the path of the input file correctly on the command line.
Updates based on comments:
The Python wrappers provide almost complete features available with the C++ version. The exceptions are noted here. If you decide to use VTK Python then a good resource to read is the VTK Numpy interface.
Paraview implements a majority of VTK filters and sources. So it can do a lot of creation and modification of geometries. In addition, you can use programmable filters and sources for doing things which are not available through Gui. In the programmable filters you can write any Python script which can import vtk and use all its functionality.
But if for your use case you only need a subset of the functionality Paraview provides then you may want to write your own GUI.

opencv framework not found in iOS

I'm trying to add opencv framework into built project(https://github.com/amolaks76/iOS-Camera-and-OpenCV) I found from Github. I'm just trying to run the app on my iPhone to see how opencv works with Swift.
I added opencv.framework which I found from opencv website. Even if I add the framework, it still complains like below image.
one thing I found is that opencv.framework has different image than apple's framework like below:
I've seen other stackoverflow questions about this matter and people suggested to make sure Always Search User Paths is Yes. I'm updating my search path setting below:
can you guys tell me what I'm doing wrong here?
use following
#import "opencv2/opencv.hpp"
and in build settings -> compile as -> objective c++
you need to download ovencv frame work from https://github.com/Itseez/opencv
add it to your project

Why I can not find balanceWhite in opencv 3.0 beta?

I download and installed prebuild OpenCV 3.0 beta (C++) and tried to play with some of its functions. But I could not find a way to use balanceWhite which is documented here:
http://docs.opencv.org/trunk/modules/xphoto/doc/whitebalance.html#balancewhite
How can I use this function?
It is not defined and I can not find any definition for it and no header file to include.
to use the xphoto module, you will need to download and build the opencv_contrib repo
Since the modules are not yet definitive, they haven't been added to the library yet.
However, you can find them here

OpenCV C++ listing files in a directory?

I am developing a C++ project with OpenCV. I was thinking to use Boost library to do a simple ls, but I would like to follow opencv standars..
How can I do a cross plataform listing files with opencv?
OpenCV is not created to solve such problems - you have to use another API. Look at this stacloverflow discussion. It seems that it's cross-platform.
There is a header
opencv2\contrib\contrib.hpp
It contains a class called Directory and few functions like GetListFiles,
GetListFolders and GetListFilesR.
You can try it out, but it's not available in Opencv3.

Getting Webcam to work in OpenCV

I'm trying to get my webcam to capture video in OpenCV, version 2.2 in Windows 7 64 bit. However, I'm having some difficulties. None of the sample binaries that come with OpenCV can detect my webcam. Recently I came across this posting which suggested that the answer lies in recompiling a file, opencv_highgui with the property HAVE_VIDEOINPUT HAVE_DSHOW in the property page.
Can't access webcam with OpenCV
However, I'm unsure about procedurally how to do this. Can someone recommend as to how to go about this? Thanks.
Roughly, these are the important steps:
Download the OpenCV 2.2 source code,
set up a project to compile it, according to the InstallGuide,
make any changes you need to make in the code,
build the opencv_highgui library (dll and lib files, probably), and
replace these in your original project.
If you can configure the project to generate the highgui files only (and not every library in OpenCV), do so, since the change you need to do shouldn't affect other modules. This saves some time.
The detailed instructions to build OpenCV are in: http://opencv.willowgarage.com/wiki/InstallGuide. You should follow this guide.