What do the optional libraries in the OpenCV build provide? - visual-studio-2010

I am trying to build OpenCV from source (latest SVN trunk) and there are several "optional" dependencies, which will amount to several gigabytes of downloading on their own, especially with the Qt Framework.
For example:
CUDA
GHOSTSCRIPT
MIKTEX
PYTHON
EIGEN
IPP
JASPER
JPEG
OPENEXR
OPENNI
PNG
QT
QT_OPENGL
TBB
TIFF
VIDEOINPUT
XIMEA
Can someone provide a list of what each of these external things provides - ranked by importance? (Sometimes subjective answers are the most insightful answers.) Which ones are built in the binary distribution?

Usually you can leave all the flags in default state unless you need to enable or disable some special features. All really important libraries are already there.
Options you listened can be split into several groups:
Image input/output
Actually OpenCV comes with a copy of these libraries for platforms where these libraries are missed (like Windows or Android).
TIFF
JASPER - jpeg2000 format
JPEG
PNG
OPENEXR - this one is not included into OpenCV
Video IO
VIDEOINPUT - video IO API for Windows platform. Since version 2.3.0 OpenCV embeds it and this flag is useful only to exclude videoinput library from build.
OPENNI - driver for Kinect
XIMEA - API for XIMEA cameras
Libraries of performance primitives
IPP - few dozens of OpenCV functions have IPP accelerated versions.
TBB - OpenCV has a number of functions parallelized with Intel TBB library.
EIGEN - some math functions (like SVD) can use power of Eigen library but OpenCV always provides alternative implementation.
GPU acceleration
CUDA - OpenCV comes with gpu module having a lot of functions accelerated with NVIDIA CUDA technology. If CUDA SDK is not found, then all functions degrade to CPU implementation.
Enhanced GUI
QT - OpenCV GUI functions (like imshow) has a QT version. Without QT they will default to native OS interfaces. (In case of Windows it will be WinAPI).
QT_OPENGL
Bindings to other languages
PYTHON - also build bindings for Python language
Building documentation
GHOSTSCRIPT - obsolete in 2.3.x (does not affect build)
MIKTEX - Windows only. Used to generate documentation in PDF format
Actually this is just a partial answer to your question. You have listened less than half of the options that can be set on OpenCV configuration step - other half is hidden because those options are not available for your platform.

Related

OpenGl without compatible graphics card?

Basically I have a windows system that does not have a graphics card, and I am trying to execute a .jar file in cmd, which gives the following output:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\shattered>java -jar test.jar
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: OpenGL is not supported by the video driver.
I am only somewhat tech literate but the takeaway I got from that was that I needed to get OpenGl. So I did some research and found a few mentions of OpenGl software mode or something but I have no idea of how to go about doing so. Any help would be greatly appreciated, cheers!
And before it is mentioned, I have tried updating the video driver.
First on the "what":
OpenGL is a application programming interface (API) between the graphics facilities of the operating system (which in broad term covers everything between putting windows to the screen down to placing single pixels) and individual programs. The main purpose of OpenGL is providing access to accelerated graphics infrastructure optimized for rasterizing graphics primitives most suitable for 3D image generation.
Now to the "how":
The typical OpenGL implementation ships as part of the drivers of 3D graphics accelerator processors (GPUs). However since (a very old) version of OpenGL, namely OpenGL-1.1, has been specified as part of the Win32 API every version of Windows since Windows 95B and Windows NT-4 includes a fallback software implementation that can be used in case no accelerated OpenGL version is available. However if any version beyond OpenGL-1.1 is required this fallback does not provide it.
However you can substitute the standard OpenGL interface with an advanced software rasterizer implementation: The Mesa project provides a version of their software rasterizer that provides even modern core profile OpenGL. The usual recommendation is to place these substitute opengl32.dll besides the .exe file of the program that requires it; in fact on modern Windows systems with system file protection it's actually impossible to replace the original DLLs without jumping a few hoops. The MSys2 project offers prebuilt versions of substitute DLLs.
Current (as of writing this):
64 Bit version: https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/mingw-w64-x86_64-mesa-17.0.0-1-any.pkg.tar.xz/download
32 Bit version: https://sourceforge.net/projects/msys2/files/REPOS/MINGW/i686/mingw-w64-i686-mesa-17.0.0-1-any.pkg.tar.xz/download
XZ archives can be unpacked with 7-zip.
Default VGA/VESA driver is also used for gfx card without propper driver. Such cards usually emulate EGA/VGA/VESA until initialized so windows default driver works for them.
So during boot freeze the screen and look at the PID/VID table of installed devices. from that numbers you can detect which gfx card you really have and look for drivers.
In rare case you really got just EGA/VGA/VESA (which I doubt) in the old MS-DOS times there were OpenGL software drivers even for those. What you need is find OpebGL DLL for your platform like (opengl32.dll) and place it either directly to your executable or into known path like system32 ... In such case you should get at least OpenGL 1.0 support in SW rendering mode
btw if my memory serves well in the old times of win3.11 and win9x this OpenGL32.dll was a part of windows instalation and we got the OpenGL screen savers running on VESA cards natively.

Packaging SDL2 when compiling on Ubuntu

I have created a game for my Uni project, said game runs fine however I can't run it on the University computers that don't have SDL2 installed and getting SDL2 installed on them is not possible.
Is there a way to package the SDL2 files while compiling so that I can run it on any Ubuntu system?
The above comments are right. You should use the Linux tool 'chrpath' or the rpath flag with gcc in order to reference your own packaged SDL libraries in your game binary.
As a starting point, I advise you to take a look at the Makefile of the GPL game Rock Dodger CE on bitbucket. It does what you are looking for. It references SDL2 libraries with the -rpath compiler flag.
In addition, that game ships the SDL2 libraries for 3 Linux architectures (i686, Amd64, ARMv7l).
(Look at the download section for the 'multiarch' package for Linux.) You can use those compiled libraries if they fit your requirements and you don't want to rebuild everything yourself.
I agree with you on the fact that there is not (yet) a comprehensive documentation about how to create "universal" packages for SDL2 games on Linux. Or I haven't found it yet ;)
Building compatible binaries for many Linux distributions requires first to understand the 'Linux Standard Base 5.0'. The tool Linux App Checker (from LSB) is designed to help you to achieve maximum portability for your binaries.
From my experience, I think that CentOS 5 is by far the most appropriate 'Long Term Support' Linux distribution for building universal binaries.

Direct3D 11 issues in Windows 10(D3DX11_IMAGE_LOAD_INFO is removed)

As i catch it structure D3DX11_IMAGE_LOAD_INFO is deprecated in DX 11 for Windows 8.1 and up, what kind of structure can i use for replacement for this structure.
D3DX11_IMAGE_LOAD_INFO is part of the D3DX11 utility library from the DirectX SDK.
D3DX9, D3DX10, and D3DX11 are all deprecated along with the legacy DirectX SDK. See MSDN for the full details here.
Depending on what exactly you were wanting to do with D3DX11 here, there are a number of different options (all of which are open source under the MIT license).
The DirectXTex library provides the functionality in D3DX for loading bitmaps, resizing and converting them, generating mipmaps, compressing, and then writing them out as .DDS files. This is usually overkill for most applications to do at run-time, and not a particularly good use of end-user's time anyhow, but it's great for writing custom content tool pipelines for texture processing. The DirectXTex package includes a 'sample' which is the venerable texconv command-line tool written to use DirectXTex instead of D3DX.
The DDSTextureLoader module is intended to handle efficient loading of .DDS files and creating Direct3D 11 resources from them. It does not perform any runtime conversions, so some legacy files with pixel formats that do not directly map to a DXGI format will fail to load and in some cases the DXGI format of the file is not supported by the device and will also fail to load. For these cases, you will want to use DirectXTex to convert them offline to something that you can rely on being able to load on your target machine. This code supports the full range of Direct3D 11 resources including 1D, 2D, 3D, cubemaps, and texture arrays with mipmaps. The DDSTextureLoader module is included in both the DirectXTK library and in the DirectXTex package.
For very simple cases, there is also a WICTextureLoader module which can load standard bitmap files, does some runtime conversions and resizing, and then creates a Direct3D 11 texture 2D from it. It can optionally enable the 'auto-gen mipmaps' feature of Direct3D 11 to provide some basic mipmap support as well (standard bitmap files can't store mipmaps with the base image the way a .DDS file can). This makes use of the Windows Imaging Component (WIC), but is much more 'heavyweight' than DDSTextureLoader. This gives you less control over the quality of the filtering (particularly mipmaps), and does not support complex textures like volume maps, cubemaps, or texture arrays. The WICTextureLoader module is also included in both the DirectXTK library and in the DirectXTex package.
The ScreenGrab module is intended as a light-weight texture saver for creating 'screen shot' bitmap files from render target textures. The ScreenGrab module is included in the DirectXTK library and DirectXTex package.
-- excerpt from this post
For a complete catalog of replacements for legacy D3DX, see this post. There are similar posts for samples, tools, and the DirectX components.
Since you've marked this question with the VS 2013 tag, I'm assuming you are using Visual Studio 2013. You should read about the Windows 8.1 SDK that comes with it. There's a NuGet package for DirectX Tool Kit that works with VS 2013 Update 5, as well as a "Direct3D Game" template package for VS 2013 that you might want to check out.

Blurred Qt Quick Text

This is an example from Qt Quick examples inside Qt Creator, when I run the project all texts lost their quality and blurred, the attached picture describes clearly the problem.
Qt Version: 5.4.1
Platform: Windows 7
It is an old bug that may be reproduced on some hardware when Qt uses system OpenGL capabilities "[QTBUG-31983] Font rendering on Windows XP shows artifacts with QML Text element"
Before Qt version 5.5 there are two types of Qt releases for Windows: ANGLE and OpenGL. They can be distinguished by the suffix "opengl" in the installer file name, for example:
qt-opensource-windows-x86-msvc2013_opengl-5.4.1.exe
qt-opensource-windows-x86-msvc2013-5.4.1.exe
See "Qt 5 on Windows ANGLE and OpenGL" for the explanation.
The ANGLE build does not have such defect. Only OpenGL build is affected. OpenGL is poorly supported by default on many Windows installations. In some cases it can just crash during QML window initialization. The manual video driver installation was required. However, for some old hardware it is a problem to find such good video card driver that have enough support for OpenGL.
Possible solutions:
Use ANGLE Qt build
It is possible to subclass the standard QML Text control with default render type Text.NativeRendering:
Text { renderType: Text.NativeRendering; }
ANGLE Qt build could be a good solution if Windows XP should not be supported.
If no intensive graphics usage is required the better solution is to use software OpenGL rendering. Before Qt 5.4 it is was possible to use MSYS Mesa library opengl32.dll (only some specific version should be used). If such library is placed in the executable folder of Qt application built with OpenGL Qt version, that library is automatically used for software rendering instead of default hardware rendering. Starting from Qt 5.4 such library is provided by Qt: opengl32sw.dll (http://doc.qt.io/qt-5/windows-requirements.html).
The software OpenGL emulation works perfectly on all types of hardware and it does not require any special video card driver.
Starting from Qt 5.4 there is the application attribute Qt::AA_UseSoftwareOpenGL:
Forces the usage of a software based OpenGL implementation on
platforms that use dynamic loading of the OpenGL implementation. This
will typically be a patched build of Mesa llvmpipe, providing OpenGL
2.1. The value may have no effect if no such OpenGL implementation is available. The default name of this library is opengl32sw.dll and can
be overridden by setting the environment variable QT_OPENGL_DLL. See
the platform-specific pages, for instance Qt for Windows, for more
information. This value has been added in Qt 5.4.
This happened to my QT 5.4.2 MinGW project as well. Using Text.NativeRendering solved the blurry text in my case.
This renders the font with native rendering. But not solves the problem with default Qt rendering.
import QtQuick 2.4
import QtQuick.Window 2.0
Window {
visible: true
width: 512
height: 300
Text {
anchors.centerIn: parent
text: "Hello World!"
renderType: Text.NativeRendering
}
}

How to get all available install options for a port?

Basically I'd like to install opencv so that it makes use of tbb and boost with the complete source code. However I think I will need to know how to display all the available install options for a port. (Install options I mean "+sth" after a port name, is that how you call it?)
In my concrete example, my line starts like
sudo port install opencv +tbb +python27
but I am not sure how to get the dev and the boost options...
Any ideas how to display options? Or specifically for opencv?
Thanks!
In addition to the answer provided by Barnabas Szabolcs, I have also found the info command is helpful for finding more information about a port, including the available variants, but also provides other interesting bits of information, such as the software license, maintainers, etc.
port info opencv
The above command results in the following output (as of the current portfile):
opencv #3.0.0_1 (graphics, science)
Variants: contrib, dc1394, debug, eigen, java, opencl, openni,
python27, python34, qt4, qt5, tbb, universal, vtk
Description: OpenCV is a library that is mainly aimed at real time
computer vision. Some example areas would be
Human-Computer Interaction (HCI), Object Identification,
Segmentation and Recognition, Face Recognition, Gesture
Recognition, Motion Tracking, Ego Motion, Motion
Understanding, Structure From Motion (SFM), and Mobile
Robotics.
Homepage: http://opencv.org
Extract Dependencies: unzip
Build Dependencies: cmake, pkgconfig
Library Dependencies: zlib, bzip2, libpng, jpeg, jasper, tiff, ilmbase, openexr,
ffmpeg
Platforms: darwin
License: BSD
Maintainers: stromnov#macports.org, openmaintainer#macports.org
Sorry, I have found it:
Port install options are called not options but variants. And the command is:
port variants opencv
in my case.
For those who care -- although in the code of opencv I have fond USING_BOOST flags -- there is no extra variant for boost support (perhaps it is automatic?).
My complete install line is
sudo port install opencv +debug +python27 +qt4 +tbb

Resources