Operácie

Robotic Vision

Zo stránky SensorWiki

Support page to the MOOC Course by Peter Corke

Further reading

Vision in humans and nature

   Stone, J. V. (2012).Vision and Brain: How We Perceive the World. Cambridge, MA: MIT Press.
   Ings, S. (2007). The Eye: A Natural History. London: Bloomsbury.
   Land, M. & Nilsson, D-E. (2002). Animal eyes. New York: Oxford University Press.
   Hughes, H. (1999). Sensory Exotica: A World beyond Human Experience. Cambridge, MA: MIT Press.

Computer and robot vision in general

   Corke, P. (2013). Robotics, Vision and Control. Berlin: Springer.
   Szeliski, R. (2011). Computer vision: Algorithms and applications. New York: Springer.

Multiview/3D vision specifically

   Hartley, R. & Zisserman, A. (2003). Multiple view geometry in computer vision. Cambridge: University Press.
   Ma, Y., Soatto, S., Košecká, J., & Sastry, S. (2006). An invitation to 3-D vision: From images to geometric models. New York: Springer.


Matlab code

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

 im = iread('monalisa.png', 'grey', 'double');  // 0.0 - 1.0 instead of 0 - 255
 about(im);

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);

 im = iread('monalisa.png', 'grey');
 about im
 idisp(im)

 im(194,276)
 ans = 26

 im2 = im(180:210,260:290);
 idisp(im2)

 lin = im(190,260:290);
 plot(lin)

 im3 = im(1:4:end,1:4:end);
 idisp(im3)

 im4 = im(end:-1:1,1:end);
 idisp(im4)

Thresholding

 im = iread('penguins.png', 'grey', 'double');
 idisp(im)
 figure
 ihist(im)
 b = im > 0.45;
 figure
 idisp(b)

 // Use the slider to adjust the threshold setting.
 ithresh(im)

Diadic Operations

 cam = Movie('traffic_sequence.mpg', 'double', 'grey');  // double is important, because uint8 can't do e.g. 50 - 65

 // Extract the first and second frames from the movie. 
 
 im1 = cam.grab();
 im2 = cam.grab();

 // Display the image difference.
 idisp(im1-im2)

 idisp(im1-im2, 'invsigned')  // colors: red / blue for positive / negative values

Spatial operators: Moving average

  % Load the Mona Lisa image.
  im = iread('monalisa.png', 'grey', 'double');

  %  Perform an average over a 7x7 window by 
  %  correlating the image with a 7x7 matrix of 1's using the 
  %  toolbox function iconv(). Display with the original image.

  s7 = iconv(im, ones(7,7));
  idisp(im)
  figure(2)
  idisp(s7)
 
  % again with 21x21 window. 
  s21 = iconv(im, ones(21,21));
  idisp(s21)

Introducing kernels

Create a Gaussian kernal with a standard deviation of 5 and a half radius of 15 pixels using the kgauss() function.

 K = kgauss(5, 15);
 // Display the kernel a greycale image.
 idisp(K)
 figure
 surf(K)

 // Load the Mona Lisa image and correlate this with the Gaussian kernel. Display the image.
 im = iread('monalisa.png', 'grey', 'double');
 s = iconv(K, im);
 idisp(s)

Edges

 // Load the penguins.jpg image and display.
 im = iread('penguins.jpg','grey','double');
 idisp(im)