Operácie

Robotic Vision

Zo stránky SensorWiki

Verzia z 22:35, 21. november 2015, ktorú vytvoril Balogh (diskusia | príspevky)

Support page to the MOOC Course by Peter Corke

Matlab code

 im = iread('/path/to/image.jpg');
 idisp(im); // special display for the course from the vision package

Compare this

a = 100;
b = 200;

a+b
a-b 
a/b

a = uint8(100);
b = uint8(200);

a+b
a-b 
a/b

Getting an image from videocamera. Grab and display a image from the camera.

 cam = VideoCamera(0);
 im = cam.grab();
 clear cam // In order to turn the camera off, use the clear function.


Getting an image from movie.

cam = Movie('traffic_sequence.mpg');
cam.grab(); // next sequence image


Creating an image from code

Create a 200x200 matrix of zeros (representing black) and set the first (top, left) element to 1 (representing white). Display the image.

 im = zeros(200, 200);
 im(1,1) = 1;
 idisp(im)

 im(150:160,60:70) = 0.5;
 idisp(im)

 circle = kcircle(30);
 idisp(circle)

 im = ipaste(im, circle*0.7, [100 30]);
 idisp(im)

 im = iline(im, [30 40], [150 190], 0.9);
 idisp(im)

 im = testpattern('rampx', 200);
 idisp(im)

 im = testpattern('squares', 200, 50, 25);