I am currently doing one project about Mobile Robot Teleoperation, so stream video over network is one of my part. Actually there are many different approaches, but I chose OpenCV as my main approach because of its advantages in term of Computer Vision. But the crazy thing I have to do is making 2 server and client programs which run in Windows and Linux, respectively. Ok, now let’s go together:
Install OpenCV
OpenCV (Open Source Computer Vision) is a library of programming functions for real time computer vision.
- OpenCV is released under a BSD license, it is free for both academic and commercial use.
- The library has >500 optimized algorithms (see figure below). It is used around the world, has >2M downloads and >40K people in the user group. Uses range from interactive art, to mine inspection, stitching maps on the web on through advanced robotics.
For more information, go to OpenCV Wiki. It is not difficult to build OpenCV in Linux, just base on Install Guide but make sure that install all Prerequisites: Python, Intel TBB, …
In Windows counterpart, I can easily build OpenCV using Microsoft Studio, but I am using program which has multi-thread (POSIX) feature, so I can’t use this library for that. So I prefer to build OpenCV using Cygwin, but I didn’t get success yet :d. So what I have done with that ?
- Download OpenCV-2.1.0-win32-vs2008.exe and install it
- Download OpenCV libs compiled by Cygwin and put it to the /bin and /lib from Python OpenCV project. Just download opencv210_mingw.7z
And don’t forget to install Cygwin and needed packages like gcc, make, cmake, … before that
Program
This post describes very well about what do you have to do with OpenCV and socket programming. Thank Nashruddin for great effort. But I would like to contribute some things here: cmake list and delay function.
I really love Cmake so much, it is very handy and powerful tool for cross platform applications. If you don’t know what is Cmake, have a look at http://cmake.org/, you will love it for sure.
In the folder which has your source code, just create a file named CMakeLists.txt. For the server part it will be:
project(MobileApp)
cmake_minimum_required(VERSION 2.6)
# Find OpenCV package
FIND_PACKAGE(OpenCV REQUIRED)
# Vision program
add_executable(stream_server stream_server.c)
target_link_libraries(stream_server ${OpenCV_LIBS})
REQUIRED
For the client counterpart:
project(MobileApp)
cmake_minimum_required(VERSION 2.6)
# Find OpenCV package
FIND_PACKAGE(OpenCV REQUIRED)
# Vision program
add_executable(stream_client stream_client.c)
target_link_libraries(stream_client ${OpenCV_LIBS})
To build the application, follow these steps:
$ mkdir build $ cd build $ cmake .. $ make
cmake will automatically generate your Makefile based on your system configuration, so whenever you move it to other computer or other platform it will check again.
Note: there is one issue that cmake couldn’t understand the parameter OpenCV_LIBS even thought it can detect OpenCV libs, so you need to add OpenCV libs by using other variable OpenCV_DIR.So you need to change ${OpenCV_LIBS} to ${OpenCV_DIR}/libs. Have a look at FindOpenCV.cmake
Related posts:
- How to fix libdc1394 error: Failed to initialize libdc1394 I am doing a project about Mobile Robot Teleoperation which uses OpenCV for Computer Vision, but I always get error: libdc1394 error: Failed to initialize libdc1394 The reason is: There is no file /dev/raw1394 since the raw1394 driver is not loaded. So you need to insert that driver: $ sudo modprobe raw1394 Check your permission [...]...
- How to setup Video calls in Skype on 64-bit Ubuntu system Skype is a software to make free video and voice calls, send instant messages and share files with other Skype users. You can use Skype in almost famous platforms: Windows, Linux, Mac OS and for your mobiles as well. For Linux users, you can easily download and install Skype binary package from here. With the 32-bit [...]...
- Howto get direct link from files, folders in box.net Homepage: http://box.huhiho.com/ Box.net is the most famous online box store with great stability, not limited time of existence of the file, so we will not be worry about my file is suddenly deleted hehe. Nowadays it is very easy to create a free account in box.net but they limit some free functions. Now free account [...]...
- Howto install Vietnamese Input Method Scim-Unikey on Ubuntu Today, I would like to introduce the Vietnamese input method in Ubuntu. Scim-Unikey is the most stable package for typing Vietnamese characters, by combining the advantages of Smart Character Input Method (SCIM) and the most famous Vietnam input method Unikey. Scim-Unikey now is maintained by Ubuntu-VN and Vietnamese Ubuntu Community. If you want to learn [...]...
- Howto Install and setup TFTPD in Ubuntu workstation I was doing my own project using TMS320DM355 EVM with MontaVista realtime Linux is installed some months ago. At that time, I search in Google many times but I didn’t get success to install TFTP. Finally, I found out one great tutorial about that. In my system, I use TFTP protocol to download Linux kernel, [...]...
- Howto Install Vietnamese Input Method ibus-unikey in Ubuntu IBus (Intelligent Input Bus for Linux/Unix OS) become the main Language Input Method manager since Ubuntu 9.10. For Vietnamese people and ones who want to learn and type Vietnamese language, unikey is usually the best choice in Windows and Linux as well. This article is going to guide to install ibus-unikey in Ubuntu. Ibus-Unikey package [...]...



{ 2 comments… read them below or add one }
Hi,
Currently, I am also doing a project related to Mobile Robot, seem to be the same as yours.
The hardware of robot is going to finish soon and i am programming for a wireless control. A laptop with a webcam is attached on Robot, transfer Image data (via Wifi) back to other laptop and i do some image processing on this laptop to control mobile robot. I’ve been programming just like your post above and followed Nashruddin’s code. But i have two problems and really want your help:
– My program have some errors: Cannot open include file: ‘pthread.h’, , … I am using VC2008 and OpenCV2.1 on Window system >> How can I fix these errors?.. It seems that I have to install BSD and …multi-thread???
- The second problem is about data of image. Because, at the cilent side, i use CAMSHIFT for processing Image to track object so i need color-image. >> Multi-chanel Image can be stream? How to do that?
Any help will be greatly appreciate!!!
Thanks in advance!
where’s my last post?