stand on the shoulders of giants s i v p - pudn.comread.pudn.com › downloads123 › doc › 521790...

27
1 S I V P (Scilab Image and Video Processing Toolbox) A Scilab Toolbox based on OpenCV Shiqi Yu( Shiqi Yu( 于仕琪 于仕琪 ) ) [email protected] [email protected] http://sivp.sourceforge.net/ http://sivp.sourceforge.net/ June 9, 2006 June 9, 2006 Stand on the Shoulders of Giants

Upload: others

Post on 09-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

1

S I V P(Scilab Image and Video Processing Toolbox)

A Scilab Toolbox based on OpenCV

Shiqi Yu(Shiqi Yu( 于仕琪于仕琪 ))[email protected]@gmail.com

http://sivp.sourceforge.net/http://sivp.sourceforge.net/

June 9, 2006June 9, 2006

Stand on the Shoulders of Giants

Page 2: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

OpenCV China Website

Everyone can edit the web pages. API document, tutorials, examples, slides, ... Web forum

Chinese Doc Improvement Project

(中文文档改善计划)

Page 3: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

3

What's Scilab?

Page 4: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

4

Scilab

Scilab is a open source scientific software package for numerical computations providing a powerful open computing environment for engineering and scientific applications.

Scilab syntax is largely based on the Matlab language.

Page 5: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

5

Scilab

Scilab code examples:

-->m=[1,2,3; 4,5,6] m = 1. 2. 3. 4. 5. 6. -->m(:,2) ans = 2. 5. -->plot(m(:))

Page 6: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

6

Scilab

Why to do image processing in Scilab?

It's more convenient for algorithm design using script languages than programming languages (C/C++).

Page 7: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

7

SIVP

SIP vs. SIVP

Scilab Image Processing Toolbox (SIP) http://siptoolbox.sf.net

SIVP is inspirited by SIP, and developed on OpenCV nor ImageMagick as SIP.

SIVP supports video r/w and grabbing frames from cameras.

Most SIVP functions are fast than SIP functions.

Page 8: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

8

SIVP intends to do image processing and video processing tasks. SIVP is meant to be a useful, efficient, and free image and video processing toolbox for Scilab.

Useful: A toolbox must be useful.

Efficient: Efficiency is important for researchers.

Free: The toolbox should be free software and benefits more people. (GPL license)

SIVP

Page 9: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

9

■ Image read, image write BMP, PNG, JPEG, TIFF, PBM, PGM, PPM, PBM,

PGM, PPM■ Video file read/write■ Video capture for cameras or 1394 devices■ Image processing

edge, filter2, imnoise, imcrop, imhist, imlincomb, imadd, rgb2ntsc, ...

■ Interface image showing

SIVP

Page 10: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

10

■ Install SIVP under LinuxDownload the newest source code and then

$tar zxvf sivp­0.4.3.tar.gz #uncompress

$cd sivp­0.4.3

$./configure

$make

#make install # as root

■ SIVP will be in Debian depository.

Installation

Page 11: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

11

■ Install SIVP under WindowsWe made an friendly installer for Windows version

Installation

Page 12: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

12

Examples

■ Load SIVP to Scilab SIVP help, demos will appear in the menus

Page 13: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

13

■ Load, show and process an image­­>im=rgb2gray(imread('lena.png'));­­>imshow(im);­­>imc=edge(im, 'canny', [0.06, 0.2]);­­>imshow(imc);

Examples

Page 14: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

14

Examples

■ Video file/camera read

n = aviopen('video.avi');im = avireadframe(n); //get the 1st frameim = avireadframe(n); //get the 2nd frameaviclose(n);

n = camopen(); //to open a camera

Page 15: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

15

Examples

■ Video file write     im = imread('lena.png');    n = avifile('lena.avi', [300;300], 30);

    for ii=1:200        ims = im(ii:512­ii, ii:512­ii, :);        addframe(n, ims);    end

    aviclose(n);

Page 16: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

16

Examples

■ Get help­­>help canny

Demo

Page 17: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

17

SIVP Development

C Interface

int intex1c(char *fname){  int i1, i2;  int ierr;  int l1, m1, n1, m2, n2, l2, m3, n3, l3, m4, n4, l4, l5, l6;  int minlhs=1, minrhs=4, maxlhs=5, maxrhs=4;  int * data;

  CheckRhs(minrhs,maxrhs) ;  CheckLhs(minlhs,maxlhs) ;

Page 18: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

18

SIVP Development

C Interface

  GetRhsVar(1, "i", &m1, &n1, &l1);  ...  int * data = istk(l2); //get data pointer

  ...

  CreateVarFrom(2,"b",&m2,&n2,&l3, &l2);  ...

  LhsVar(1) = 2; //set output

  return 0;}

Page 19: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

19

SIVP Development

■ Macro

function [X]=foo1(A)X = abs(A);

endfunction

■ Online HelpFomated information is stored in an xml file. The file can

be formated to html or other formats.

Page 20: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

20

Performance Comparison

■ Hardware: Intel P4 3.0G CPU, 512M RAM

■ Software: SIP and SIVP: Linux 2.6 Matlab: Windows XP

Page 21: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

21

Performance Comparison

■ True color image reading The Y dim is the time needed

Page 22: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

22

Performance Comparison

■ Gray image reading

Page 23: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

23

Performance Comparison

■ Sobel operator

Page 24: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

24

Performance Comparison

■ Video reading

Page 25: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

25

Performance Comparison

■ True color image showing

Page 26: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

26

Help SIVP

If you want to help SIVP, do as follows:

1. Learn and use Scilab;2. Download and use SIVP (svn version is recommended.)

3. Know how to use subversion, gcc, make, autoconf, automake.

4. Read the SIVP source code and modify it.5. Send email to me. ^-^

Doc writer/Tester: Step 1-2;Developer: Step 1-5

Page 27: Stand on the Shoulders of Giants S I V P - pudn.comread.pudn.com › downloads123 › doc › 521790 › Sivp-intro.pdfOpenCV nor ImageMagick as SIP. SIVP supports video r/w and grabbing

27

Future Plan

■ Improve image showing function

■ More image processing functions

■ Fix bugs