Simple Remote Camera Server/Client 

Ruigang Yang, Jan 2002

What It Can do

New July 2002: A new version using the generic camera control interface is available now. No FireI API is necessary

The project contains two parts, a camera server and a receiving client. The camera server captures live frames from a local capture device, a 1394 camera, for example. The client software can receive frames from the camera server through TCP/IP links. The server software uses Microsoft's DirectShow architecture, a brief introduction can be found here. In the current implementation, the server is streaming the video to all of its connected clients (could be more than one) without any flow control mechanism.  The images can be optionally JPEG compressed and distortion corrected (provided the camera has been calibrated and its intrinsic parameters are known). The compression ratio is user selectable. 

Requirements
Server:    MS Windows family with DirectX 8.0a or above, Intel's JPEG Library and Intel's imaging processing library (all freely available from Intel's website), unibrain's Fire-I API  (This is used for automatic camera parameter control, it is possible to remove unibrain related code in videoCap.cpp. In particular, comment out the setCameraProfile function in videoCap.cpp.) 
Client:     MS Windows, Intel's JPEG Library and Intel's Imaging Processing Library, vlgrfmts.lib (in OpenCV/otherlibs)
Usage
The entire software package can be downloaded here (148 KB).  Please refer to my DirectShow introduction page about how to set up compiler path etc.

Server: dxcamserver cam_index cam_config port_number [ptions]

cam_index The relative index of the camera you want to us. If there is only one camera, use 0.
cam_config A text configuration file to describe the camera operation parameters, such as frame rate, brightness, etc. NOTE: If you are not using drivers from Unibrain, the cam_config won't work.
port_number The server port 
options -q -- QUIET mode, no video window.
-y -- No compression, YUV422 mode.
-j [factor] -- JPEG compression with a quality factor from 0 to 100, default is 75. This quality factor can also be changed at run time by pressing '0' to '9' while 0 is the best quality (lossless) and 1 is the worst quality.
-r cam_para -- enable radial distortion correction, cam_para  is single line text file with 10 numbers, namely (fc, cc(0, 1),alpha_c,kc(1, 2, 3, 4, 5). Please refer to Jean-Yves Bouguet's camera calibration page for a detailed description of parameters.
You can also turn on/off the radial distortion function at run time by pressing the 'r' key. Note that the active movie window DOES NOT show the result after the correction. 

To quit the server, press 'Q' (shift + 'q').

As an example, we also provide a receiving client (camRecv):
 Client: camRecv server_name server_port [-s number prefix]
It shows the resulting images received from the server. The effect of compression and radial distortion correction can be observed on the client side. It can also dump frames to disk file by using the -s flag. For example, the command "camRecv lookout17a.cs.unc.edu 5501 -s 10 test" will receive 10 frames from the server lookout17a on port 5501 and save the images  using the prefix "test". The format of the saved images depends on the format of the camera server. If  the camera server sends compressed JPEG streams, the images will be saved as JPEG files, otherwise, they will be saved as Windows BMP files.

 

Calibrated image samples (UNC access only)
I have calibrated five cameras and captured some images for research purposes. The images are at \\lookout17a\calibration, under directory data2, data3, and dummy. They are captured at 320x240 at about 10 fps, all the images are synchronized and radial distortion removed. The photo (below left) shows the camera setup. Only the middle five cameras , numbered from 0 to 4, are used. Images are named by its camera number followed by the frame number. For example c02f0054.jpg means that it is  frame 54  from camera 2 (the middle one). A set of sample images are shown here (below right). The camera's projection matrices are here. Each is presented as a 3x4 row matrix (assume the non-linear distortions have been corrected, as these samples are) mapping a point in world coordinate (WC) to the camera image coordinate. WC is defined as a right hand system, with positive y up, positive z towards the camera (coming out of the image), and positive x towards the right. The z = 0 plane is roughly at the edge of the lower desk (where the dummy's hand touches). The unit in the matrices is millimeter.

 

Camera setup c00f0008.jpg samples/c01f0008.jpg samples/c02f0008.jpg
samples/c03f0008.jpg     samples/c04f0008.jpg