Professional Documents
Culture Documents
Image Capturing.
Image Processing..
Object Identification…
Movement Algorithm….
Output to Printer Port…..
for ui=1:20
f=getsnapshot(vid);
imview(f);
flushdata(vid);
end
stop(vid);
Copyright ® IIT Guwahati
Robotics Club
Image Capturing.
Construct a video input object.
obj = videoinput('matrox', 1);
frame = getsnapshot(obj);
image(frame);
delete(obj);
Copyright ® IIT Guwahati
Robotics Club
Image Processing..
imread : to read an image
eg i=imread(‘name.jpg’);
imview : to view the image
eg imview(i);
im2bw : converts a coloured image to black and white
eg b=im2bw(i);
or b=im2bw(i,.4);
edge : returns edges in an image
eg e=edge(b); this returns a matrix or image with only the
edges, in e.
Copyright ® IIT Guwahati
Robotics Club
Image Processing..
RGB components
For example, the red, green, and blue color
components of the pixel (10,5) are stored in
RGB(10,5,1), RGB(10,5,2), and RGB(10,5,3),
respectively.
eg
a=imread(‘name.jpg’);
r=a(100,100,1);
g=a(100,100,2);
b=a(100,100,3); Copyright ® IIT Guwahati
Robotics Club
Image Processing..
imcrop
bwarea
bwareaopen
bwlabel
regionprops – area,centroid
imsubtract
Copyright ® IIT Guwahati
Robotics Club
Output to Printer Port…..
putvalue(dio,[0 1]);
Write the value 8 as a decimal value and
as a binary vector. putvalue(dio,8)
putvalue(dio,[0 0 0 1])