Skip to main content

Opencv Web camera and Video streams in Windows subsystem for Linux WSL, by FFmpeg and GStreamer

Opencv in Windows Subsystem for Linux (WSL) is a compatibility layer designed to running Linux binary executables (in ELF format) natively on Windows 10. I love it. There are some limitations to mention. The first biggest is the lack of support of CUDA, which could be a limitation for deep learning application and learning in WSL. The second trouble for Opencv development is the lack of Web camera support. This suspends WSL almost on a useless level for me until now. 

VideoCapture cap;   is not working in WSL for now
cap.open(0); 

opencv WSL web camera ffmpeg
FFMPEG to WSL opencv program and back to WEB browser in windows
This Video capture is right now not possible at in Ubuntu running under Windows (WSL). I will hit this limitation in this article. I will show you how to reach a video camera and learn something more about video streaming. Yes, the opencv processed frames will be stream to the web player on simple web site.

Check the goal of this opencv tutorial on this video


What you will learn about Opencv and FFMPEG

  • Stream video from windows to Linux in WSL environment. 
  • Capture video stream in Linux opencv application 
  • Opencv compiled in Linux with GStreamer and FFmpeg 
  • Stream video processing output by GStreamer back to Windows 
  • present video stream from opencv in web browser HTML 5 video player 
It is pretty complex. The environment is not so easy to prepare. Actually, the environment and installation is the holy grail to achieve this goal. Additionally,  you will acquire good knowledge enough to work with IP cameras, Video streams and create your own video stream as a result of opencv processing. Let's dive into it.

Architecture, Behind opencv VideoCapture web camera 

There are windows 10, and Ubuntu Linux running on Hyper-V installed easily from the windows store. Windows has installed FFmpeg. Linux has installed FFmpeg, GStreamer and opencv build from source with support of both mentioned. Video capture is done by FFmpeg from Windows. Video is coded by the H264 codec and send to localhost UDP. UPD://127.0.0.1:5000. Video is captured in opencv by VideoCapture cap.open("UDP://127.0.0.1:5000"). The opencv installed with GStreamer by VideoWriter stream("send video to 127.0.0.1:5010"). The video is captured back in windows by ffmpeg where the source is RTP:127.0.0.5010 into MyOutput.mp4. This is the whole pipeline. You can capture stream produced from Opencv on Web. We will get there as well.
opencv video stream architecture gstreamer
Opencv FFMPEG GStreamer for WSL to WEB

Install  GStreamer apt-get (linux)

The following commands are valid for Ubuntu 18.04. running under windows subsystem for Linux. I am not sure about any special package repository to install GStreamer. I think that a special repository is needed to install extra support for H.265 codecs for example.  Google for more information or send me a message if you failed to install GStreamer. it is important. 
sudo apt-get install gstreamer1.0*
sudo apt install ubuntu-restricted-extras
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

Build and compile FFMPEG (linux)

I am actually building FFMPEG from the source. Install some needed package by apt-get. Download source by wget, untar, configure build and compile by make. This is clear. It is not the basic tutorial. 
sudo apt-get -y install git make nasm pkg-config libx264-dev libxext-dev
libxfixes-dev zlib1g-dev

sudo wget -O ffmpeg-2.8.tar.bz2 "https://www.ffmpeg.org/releases/ffmpeg-2.8.tar.bz2"

sudo tar -xvf ffmpeg-2.8.tar.bz2
sudo rm -Rf ffmpeg-2.8.tar.bz2 cd /home/nomce/libs/ffmpeg-2.8


./configure --enable-nonfree --enable-gpl --enable-libx264
--enable-x11grab --enable-zlib
 make -j2
 sudo make install
 sudo ldconfig -v

If you are not able to install whole FFMPEG make sure that libavcodec-dev, libavformat-dev, libswscale-dev are installed. This should be fine to receive a video stream by cap.open("UDP://127.0.0.1:5000");.

Install FFMPEG in windows 

We are supposed to capture a web camera by FFMPEG in windows and send the stream into the Linux. We need to install the FFMPEG as well on the windows machine. Just download FFmpeg for windows here.  

Compile OPENCV with FFMPEG and GStreamer (linux)

This is pretty much as the opencv team describes the installation under Linux.  There is just one difference in CMAKE configuration -D WITH_GSTREAMER=ON -D WITH_FFMPEG=ON.

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev
 libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2
 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev


git clone https://github.com/opencv/opencv.git

cd ~/opencv
mkdir build
cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local
 -D WITH_GSTREAMER=ON -D WITH_FFMPEG=ON ..


The output of CMAKE configuration should include FFMPEG and GStreamer. Otherwise, you can not continue and achieve the goal of this tutorial. 

--   Video I/O:
--     DC1394:                      YES (2.2.5)
--     FFMPEG:                      YES
--       avcodec:                   YES (57.107.100)
--       avformat:                  YES (57.83.100)
--       avutil:                    YES (55.78.100)
--       swscale:                   YES (4.8.100)
--       avresample:                YES (3.7.0)
--     GStreamer:                   YES (1.14.5)
--     v4l/v4l2:                    YES (linux/videodev2.h)

Once you achieve that Cmake configuration output contains FFMPEG and GStreamer compile and install opencv by following. This can take some time up to your machine. 

make -j8
sudo make install

Check your Opencv libraries installation

Your first simple program should be the following code. It will tels you of your opencv libs are OK. 
source.cpp
int main(int argcconst char** argv)
{
    std::cout << cv::getBuildInformation() << std::endl;

This source.cpp should be configured for compilation by CMakeLists.txt placed in same folder as your source.
cmake_minimum_required(VERSION 2.8)
project( ProjectName )
find_package( OpenCV REQUIRED )
add_executable( ProjectName source.cpp )
target_link_libraries( ProjectName ${OpenCV_LIBS} )

The results can look like this and important is part of Video I/O:, where FFMPEG and GStreamer should be lister with YES and version.
General configuration for OpenCV 4.1.2-dev =====================================
  Version control:               4.1.2-121-g5dd3e6052e

  Platform:
    Timestamp:                   2019-11-09T13:55:51Z
    Host:                        Linux 4.4.0-17134-Microsoft x86_64
    CMake:                       3.10.2
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               RELEASE

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (16 files):         + SSSE3 SSE4_1
      SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (5 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (29 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (6 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                /usr/bin/c++  (ver 7.3.0)
    C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type 
    C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type 
    C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=
    Linker flags (Release):      -Wl,--gc-sections  
    Linker flags (Debug):        -Wl,--gc-sections  
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          dl m pthread rt
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 calib3d core dnn features2d flann gapi highgui
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 java js python2 python3
    Applications:                tests perf_tests apps
    Documentation:               NO
    Non-free algorithms:         NO

  GUI: 
    GTK+:                        YES (ver 2.24.32)
      GThread :                  YES (ver 2.56.4)
      GtkGlExt:                  NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
    JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
    WEBP:                        build (ver encoder: 0x020e)
    PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
    TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     /usr/lib/x86_64-linux-gnu/libImath.so /
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      YES (2.2.5)
    FFMPEG:                      YES
      avcodec:                   YES (57.107.100)
      avformat:                  YES (57.83.100)
      avutil:                    YES (55.78.100)
      swscale:                   YES (4.8.100)
      avresample:                YES (3.7.0)
    GStreamer:                   YES (1.14.5)
    v4l/v4l2:                    YES (linux/videodev2.h)

  Parallel framework:            pthreads

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP:                   2019.0.0 Gold [2019.0.0]
           at:                   /home/vlada/opencv/opencv/build/3rdparty/ippicv
    Intel IPP IW:                sources (2019.0.0)
              at:                /home/vlada/opencv/opencv/build/3rdparty/ippicv
    Lapack:                      NO
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.5.1)

  OpenCL:                        YES (no extra features)
    Include path:                /home/vlada/opencv/opencv/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python (for build):            /usr/bin/python2.7

  Java:                          
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /usr/local
General configuration for OpenCV 4.1.2-dev =====================================
  Version control:               4.1.2-121-g5dd3e6052e

  Platform:
    Timestamp:                   2019-11-09T13:55:51Z
    Host:                        Linux 4.4.0-17134-Microsoft x86_64
    CMake:                       3.10.2
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               RELEASE

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (16 files):         + SSSE3 SSE4_1
      SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (5 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (29 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (6 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 

  
    To be built:                 calib3d core dnn features2d flann gapi highgui 
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 java js python2 python3
    Applications:                tests perf_tests apps
    Documentation:               NO
    Non-free algorithms:         NO

  GUI: 
    GTK+:                        YES (ver 2.24.32)
      GThread :                  YES (ver 2.56.4)
      GtkGlExt:                  NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
    JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
    WEBP:                        build (ver encoder: 0x020e)
    PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
    TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
    JPEG 2000:                   build (ver 1.900.1)

    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      YES (2.2.5)
    FFMPEG:                      YES
      avcodec:                   YES (57.107.100)
      avformat:                  YES (57.83.100)
      avutil:                    YES (55.78.100)
      swscale:                   YES (4.8.100)
      avresample:                YES (3.7.0)
    GStreamer:                   YES (1.14.5)
    v4l/v4l2:                    YES (linux/videodev2.h)

  Parallel framework:            pthreads

  Trace:                         YES (with Intel ITT)

  

  OpenCL:                        YES (no extra features)
    Include path:                /home//opencv/opencv/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python (for build):            /usr/bin/python2.7

  Java:                          
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /usr/local
-----------------------------------------------------------------

FFMPEG basics for this tutorial

FFMPEG is very powerful and this is very restricted to our purpose. You will definitely use the following commands.

FFMPEG list available devices

This command tel you information about microphones, cameras you can capture by FFMPEG
ffmpeg -list_devices true -f dshow -i dummy


FFMPEG devices list

Stream from FFMPEG to VLC first

This example will just perform the video stream from your web camera to the VLC player. The FFMPEG command will use input source -i as an integrated camera (web camera). The bit rate for the video stream should be chosen according to used codec and resolution. This setting mean video bitrate 2014 kbit/s -b:v 2014k. I used codec H.264 as clear by options -vcodec libx264. I hope that this helps -preset ultrafast -tune zerolatency as well. -ar is an audio sampling frequency rate. The full command is as follows. 

C:\ffmpeg\bin>ffmpeg -f dshow -i video="Integrated Camera"
 -preset ultrafast -tune zerolatency -vcodec libx264 -r 10
  -b:v 2014k -s 640x480 -ab 32k -ar 44100 -f mpegts -flush_packets
   0 udp://192.168.0.116:5120?pkt_size=1316

The task in VLC is much easier. Open Network stream and put here udp://@192.168.0.116:5120. Just make sure about @.  The result is a video from a web camera displayed in the VLC player.


Video stream VLC ffmpeg


Stream from FFMPEG Web camera to Opencv under WSL

Now connect FFmpeg and stream video into WSL opencv program. The first is to start web camera streaming like in previous case in VLC example.  
ffmpeg -list_devices true -f dshow -i dummy
C:\ffmpeg\bin>ffmpeg -f dshow -i video="Integrated Camera"
 -preset ultrafast -tune zerolatency -vcodec libx264 -r 10
  -b:v 2014k -s 640x480 -ab 32k -ar 44100 -f mpegts -flush_packets
   0 udp://192.168.0.116:5120?pkt_size=1316
The video is captured by VideoCapture cap("udp://192.168.0.116:5120");. The captured img frame is resized to match VideoWriter and send by GStreamer pipeline to same IP adress but different port host=192.168.0.116 port=8080


#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/videoio/videoio.hpp>
#include <opencv2/imgcodecs/imgcodecs.hpp>

using namespace cv;
using namespace std;


int main(int argcconst char** argv)
{
    std::cout << cv::getBuildInformation() << std::endl;

 VideoCapture cap("udp://192.168.0.116:5120");
 VideoWriter videoStream("appsrc ! videoconvert ! videoscale !"
  "video/x-raw,width=320,height=240 ! theoraenc !"
  "oggmux ! tcpserversink host=192.168.0.116 port=8080"
   "recover-policy=keyframe sync-method=latest-keyframe sync=true"
   ,CAP_GSTREAMER,0,5,Size(320,240),true);


 for (;;)
 {
  if (!cap.isOpened()) {
     cout << "Video Capture Fail" << endl;
   break;
  }
  else {
   Mat img;
   cap >> img;
   cout << "Sending video back" << endl; 
   cv::resize(img, img, cv::Size(320,240));
   videoStream.write(img);
  }
 }
 return 0;
}

Once your program is compiled and FFMPEG sending video from windows. just run the code above in Linux. Once you receive a video frame from windows the "Sending video back" message will be displayed. Do not capture by VLC!! I have some problems to capture video stream from linux back in windows by VLC. Use the simple code below. 

Receive display opencv video stream on Web 

The simple web site is just a simple Html 5 video player, where the source is my video stream rtsp://192.168.0.116:8080.

<!DOCTYPE html>
<html>
        <head>
                <meta http-equiv="content-type" content="text/html; charset=utf-8">
                <title>opencv video</title>
        </head>
<body>
        <video id="video1" width=640 height=480 controls>
        <source src="rtsp://192.168.0.116:8080">
        </video>

<script> 
var myVideo = document.getElementById("video1"); 
function playPause() { 
  if (myVideo.paused
    myVideo.play(); 
  else 
    myVideo.pause(); 
function makeBig() { 
    myVideo.width = 560
function makeSmall() { 
    myVideo.width = 320
function makeNormal() { 
    myVideo.width = 420
}
</script> 

</body>
</html>

Great. You learned 

  • capture video stream in opencv,
  • send video from windows,
  • stream opencv result to web browser 
  • reach web camera in WSL

 This is all for now. Share and subscribe


Comments

Popular posts from this blog

Opencv 3.1 Tutorial Optical flow (calcOpticalFlowFarneback)

Farneback Optical flow Opencv simple C++ tutorial and code to achieve optical flow and farneback optical flow of moving an object in opencv video. Lets check the video example and the achieved result on my blog. Working and well describe code is included. 

Optical Flow Farneback parameters remarksYou need 2 images at least to calculate optical flow, the previous image (prevgray) and current image (img).  !! The previous image must be initialized first !!  Both images have to be gray scale. 
Result is computer in flowUmat which has same size as inputs but format is CV_32FC2

0.4- image pyramid or simple image scale
1 is number of pyramid layers. 1 mean that flow is calculated only from previous image.  12 is win size.. Flow is computed over the window larger value is more robust to the noise.  2 mean number of iteration of algorithm 8 is polynomial degree expansion recommended value are 5 - 7 1.2 standard deviation used to smooth used derivatives recommended values from 1.1 - 1,5
calcO…

Fast Opencv people pedestrian detection Tutorial by CascadeClassifier

Simple Opencv C++ tutorial and example of people detection in video samples and pictures. There is nothing you cannot achieve in few simple steps. People detection and performace tasks in opencv could be solved if you have little bit knowledge of programing. Or just simple follow the steps..  Opencv tutorial instalation of opencv You can simple prepare the project inside the Visual Studio 2015 by Nuget Packages. This approach is easy for beginers and better than standard installation with all the environmental variables problems. Just follow the installation steps inside here 


Opencv is great and complex tools. There is lot of image processing and also machine learning features. You can simply learn your own detector. I would like to prepare some tutorial how to learn your own detector. It is long time run. 
All, you need to do, is some experience and basic opencv tools.  under opencv/build/x64/vc14/bin
opencv_createsamples.exe
opencv_traincascade.exe
Prepare your dataset and files w…

Install opencv Visual Studio 2015

Install opencv for Visual Studio 2015  Opencv tutorial how to build opencv from source in Visual Studio 2015. This is usefull when the new version just release and there is no prebuild library awailable..  If you download prebuild libs for windows Visual studio some times agou there is problem the newest VS just mussing. Lets checkt the version of libraries and VS.
Prebuild libs are only for version VC11 and VC12. This mean Visual Studio 2012 and 2013.

This step helps you compile your own opencv libs for VC14  - Visual Studio 2015 Community edition.

Important !!
 Now a days just use NUGET packages in Visual studio and you can code under 1 minutes. here.

Prepare third party libs for opencv  This step depends on your requirements. If you want python lets install python. But i can reccomend to install following parts. 
Intel © Threading Building Blocks (TBB)Intel © Integrated Performance Primitives (IPP)http://www.ffmpeg.org Build opencv 3.0.0  Download Opencv 3.0.0 gold https://github.com…

Opencv C++ Tutorial, Mat Roi, Region of interest

Opencv ROI, Region of Interest Simple opencv C++ tutorial how to work with ROI. Code example about selecting the rectangle region of interest inside the image and cut or display part of the image from the bigger picture. There is nothing what is difficult about this. Only trick is about one line of code. 
Rect RectangleToSelect(x,y,width,height) Mat source; Mat roiImage = source(RectangleToSelect);
This is first post from this series. This simple opencv tutorials are all over the web. I would like to visualize all my steps through the code and //comment them. Each tutorial will contain small amount of step to keep reader focused.  First tutorial about mat resizeing is available under that link Mat Resize
I am using Visual Studio 2015,  How to use Opencv 3.0.0 with Visual Studio can be found here install opencv visual studio 2015. In Visual studio 2015 is best options to use NUGET packages, Here is described how to install Opencv by NUGET. It is easy. Working under one minute after you f…

Opencv VideoCapture File, Web Camera, RTSP stream

Opencv VideoCapture File, Camera and stream Opencv tutorial simple code in C++ to capture video from File, Ip camera stream and also the web camera plug into the computer. The key is to have installed the FFMPEG especially in case of reading the stream of IP cameras. In windows just use Opencv Installation by Nugets packages Here. Simple easy under 2 minutes installation. In Linux you need to follow the instruction below. If you are on Debian Like package system. Under Fedora Red hat dist just use a different approach. Code is simple and installation is the key.. 
Windows use nugets packages Linux you have to install and build Opencv With FFMPEG. Also simple.  It is easy to capture video in OpenCV Video capture
 in OpenCV is a really easy task, but for a little bit experienced user. 
What is the problem?
The problem is the installation of Opencv without recommended dependencies.

Just install all basic libs that are recommended on the website.
# Basic packagessudo apt-get -y install …

Opencv reading IP camera, Video stream, Web camera, images and

Opencv reading video files, reading video stream, Images, IP and Web cameras. I would like to cover this all in one post. Yes, video writer is also important to store your results and achievements in video. There is couple of simple trick and if you follow them, you will never have a problem with the reading and writing video, stream, files in future. Basic opencv web camera reading There is couple think you need to take care. My favorite installation on windows platform is trough NUGET package system. It is easy in few steps. I describe this many times for example VS 2017 here. Nuget set up your project without any linking settings, library path selection, global environmental variables and you can directly start coding in few seconds. Just select and install nuget and compile code below. Nothing else.  You need to take care if you have included several thinks. highgui.hpp core.hpp, imgproc.hpp, videoio, imgcodecs. All of them are not necessary to read the web camera but for example…

Opencv build and install Visual Studio 2017 Contrib library

Easy install and build of Opencv 3+ tested on 3.2 version with contributor library and additional features described step by step, picture by picture. After this tutorial you can modify setting of CMAKE project according to HW possibilities and available libraries to build your own Opencv library. Most of the time, Prebuild libs with already generated DLL, LIBS are used to start project and coding. In case, that new visual studio 2017 is available there is no prebuild libraries for VS141, Thich is from my point of view confusing naming of Libraries compatible with Visual Studio 2017. Opencv VS 2017 install options Alternatives to this tutorial. You can skip this.  There is possibility use some compatibility pack downloaded to VS140 and use same prebuild library as in case of Visual Studio 2015 this is described hereThe second way is to try use some prebuild NUGET package. I am using nugets a lot. Simple installation under one line of code inside nuget packages console. here
Opencv Ins…

Head and people detection in opencv

LBP cascade for detect head and people in opencv  LBP cascade free to download to use in opencv to detect people and heads. Code example and cascade description. All you need to write your own people head detector from the youtube video.
Cascade is trained on my own people and head datasets. There are no perfect but in some cases are better then default opencv cascades. They are just different.. For example you can count that the head detector have much more false detection than the people detector.. The shape and feature space is much more common and close to others shapes than the whole people detector.


Issues with opencv detectMultiScale head and people detector Please let me know if cascades worked as expected.. In code example there is ground threshold settings and reccomentation. 



LBP cascade head detection properties Sure you can find inside file.
<!-- This is just basic 16 stage lbp cascade head detector develop by  V.K. from https://funvision.blogspot.com --> <?xml …

Opencv 3.1 people detection by CascadeClassifier

People detection by Cascade Classifier Opencv The comparison of Opencv Cascade for people detections. Default opencv cascades are good one. You can simply achive better result but you need to collect the training data. On my blog you can find the datasets for car detection. There is more than 2000 positives car samples available for you and test to learn your own detector..  Here in this article, I just want to show my cascade compare to cascade which are default in opencv.  LBP cascade for people detection Also I recently publish LBP cascade for people detection. You can download 12 stage LBP cascade LBP cascade for download. There is couple or maybe more than 3 tutorials how to use detect multiscale in opencv. Just download the LBP cascade and enjoy coding in Opencv..


Haar Cascade Classifier for People detection In this short tutorial, I would like to test some standard haar cascade in opencv 3.1.  My first note is where you can find this cascades. When you download opencv for wind…

Opencv C++ Tutorial Mat resize

Opencv Mat Resize   Resize the Mat or Image in the Opencv C++ tutorial. It is obviously simple task and important to learn. This tutorial is visualized step by step and well-described each of them. The main trick is in that simple code.

Mat Input;
Mat Resized;
int ColumnOfNewImage = 60;
int RowsOfNewImage = 60;
resize(Input, Resized, Size(ColumnOfNewImage,RowsOfNewImage));

This code just takes an Input image and resized save to output Mat. How big is the resized image is based on the Size? Size just contains two parameters. Simple numbers of how the result should be big. The simple number of columns (width) and rows (height). That is basically it. Enjoy

                                                Boring same face again and again. 


Load Image, resize and save Opencv C++ #include <Windows.h> #include "opencv2\highgui.hpp" #include "opencv2\imgproc.hpp" #include "opencv2\video\background_segm.hpp" #include "opencv2\video\tracking.hpp"
using n…