Robotic Vision: Rozdiel medzi revíziami
Zo stránky SensorWiki
 Vytvorená stránka „Support page to the MOOC Course by Peter Corke  == Matlab code ==  <source lang="matlab">  im = iread('/path/to/image.jpg');  idisp(im); // special display for the cours...“  | 
				Bez shrnutí editace  | 
				||
| Riadok 31: | Riadok 31: | ||
  im = cam.grab();  |   im = cam.grab();  | ||
  clear cam // In order to turn the camera off, use the clear function.  |   clear cam // In order to turn the camera off, use the clear function.  | ||
</source>  | |||
Getting an image from movie.  | |||
<source lang="matlab">  | |||
cam = Movie('traffic_sequence.mpg');  | |||
cam.grab(); // next sequence image  | |||
</source>  | |||
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.  | |||
<source lang="matlab">  | |||
 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);  | |||
</source>  | </source>  | ||
Verzia z 22:35, 21. november 2015
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);