Introduction to EVP
(Effective Image and Video Processing toolbox for scilab)

TUTORIAL
EVP vs. SIVP & SIP
INSTALL
Dependencies
Functions

EVP is created as a sub-project of Scilab Aurora.
EVP intends to do image processing and video processing tasks.
EVP is meant to a effective toolbox for Scilab.
It uses OpenCV for image I/O, uses FFMPEG for video I/O. We implement a lot of filters and image transform by ourselves.


TUTORIAL:

#1,How to use libvideo:

in = video_open( filename );
[frame_rate, frame_num] = video_info( in );
img = video_read_frame( in );
// do something with the image ...
video_close(in);
// or: video_close_all();

out = video_open_w( filename, bit_rate, width, height, frame_rate );
// prepare img with size width*height ...
video_write_frame( img, out);
video_close_w( out);
// or :video_close_all_w();

Here is a example for converting video format:

in = video_open( 'ww.mpg');
out = video_open_w ('out.swf', 400000, 352, 288, 25);

[frame, num ] = video_info(in)

for i=1:num
im = video_read_frame(in);
video_write_frame( im, out );
end

video_close_w( out );
video_close(in);

#2, How to use libimg:

img = imread( filename );
imwrite( img, filename );

#3, How to use libimdraw & libtimer

imdraw(img, 0, dst_x, dst_y, dst_w, dst_h );
imshow(img);

t1 = time();
// do something
time()-t1

sleep( millonseconds );

Here is a example: a simple video player
(Following is Window Version. Look demos/player.sce for full code.)

in = video_open( 'ww.mpg');
[frame, num ] = video_info(in)
for i=1:num
im = video_read_frame(in);
sleep(30);
imdraw(im, 0, 0,0,352, 288);
end
video_close(in);

#4, Resize, rotate

im = imread("lena.png");
img=Rotate(im,30);

#5, add filter to image

Here is a example to add mosaic filter to a image:

// add filter: mosaic
img = Mosaic(im,8);
// show the effect
imshow(img);


EVP vs. SIVP & SIP:

EVP refers some source code fo SIVP (http://sivp.sourceforge.net/).Thanks to SIVP team.

Advantages:
1, Support almost all video format under both Linux and Windows.
We use FFmpeg. FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. FFmpeg is a charming library. Now we can open almost all type of video file under both Linux and windows. For more information, go to http://ffmpeg.mplayerhq.hu/

2, We provide a more efficient way to read and write video file. VFW is a out of date , and can not fulfill our requetment.

3, a more efficient way to show image:
We implement imdraw in a special way. The tradition methon is converting image to ppm format, passing it to TCL/TK to show it in a window. This methon is system independent, but it is not a efficient way, can not fulfill Scilab Aurora's requestment. So I have to use Win32 API (under Windows), and gdk-pixbuf (under Linux). It is proved that our effort makes sense.

4. We implement quite a lot of filters. Most of them is implemented by scilab script, which reduces the loss in image type converting. Resize and rotate is implemented for efficiency also;

5. It is much easier to use, we includes all the dependent libraries in our binary installer.

Disadvantages:
1, For some reasons, we uses OpenCV to read and write image. However it seems that Image Magic is a better library to processing images. While OpenCV is uesful for compute vision.

2, imshow is not well done, we will finish it in the future.


INSTALL:

Thanks to Yang Kaigui who makes a GUI installer for both Windows & Linux Version.
We have test it under Windows, Ubuntu, Debian and FC5.
You can also install evp by hand:
(Windows) unpack the file to $SCILAB/contrib
(Linux) unpak the file to SCILAB/contrib, and mv libs/* $SCILAB/libs

Notice:
If you can load libraries propery under FC5, run fllowing script:
chcon -t texrel_shlib_t $SCILAB/libs/*

If you can not install EVP propery in your system, it is better to compile the source by yourself.
EVP uses OpenCV for image I/O, and uses FFMPEG for video I/O.
The imdraw function is system dependency.On windows, it uses Win32 API.On Linux, it uses xlib and gdk-pixbuf-2.0.
So you have all the libraries installed before compile.
See note.txt under each src/ directories for more detail

After complie, copy they to $SCILAB/contribe/
Run scilab, and you will get EVP in toolbox>EVP.
Good Luck.


Dependencies

Scilab >= 4.0 (http://www.scilab.org/)
Xlib & gdk-pixbuf-2.0 (Linux)
(We include these libraries in binary version. But if you want to install from source, install those libraries first.)
OpenCV >= 0.9.6 (http://sourceforge.net/projects/opencvlibrary/)
FFMPEG >= 0.4.9 (http://ffmpeg.sourceforge.net/)


Functions:

Look man for detail.


Authors:

Jonbo <jonbo@126.com>
- Wrote video I/O, image I/O, imdraw, libtimer

Yang Kaigui <justforward.xm@gmail.com>
- filters, and EVP Linux port and GUI installer

Zhou Xiyue <zxy_0725@163.com>
- resize and rotate

Scilab Aurora Team

Homepage : http://scilab-aurora.sourceforge.net/


FAQ:
1,Some error with FC5:
If you can't load libraries propery under FC5, run fllowing script:
chcon -t texrel_shlib_t $SCILAB/libs/*


TODO:

imshow