Professional Documents
Culture Documents
Reg#2017-MC-__317_
Cameras are starting point for any real world practical machine vision application. Luckily your laptop
has a built in camera to get started with machine vision.
Write a MATLAB code to start your webcam, preview camera image, capture image and save it in a
folder.
NOTE: Code font size should be 10 pts.
Code:
https://www.mathworks.com/help/supportpkg/usbwebcams/ug/webcam.html
webcamlist
cam = webcam %to open the web camera
preview(cam)
closePreview(cam)
img = snapshot(cam); % to capture the image
imshow(img) % to display the captured image
Are you interested in using your cell phone camera (a high resolution) in your engineering project?
If yes, you are at the right place! In this tutorial, we will configure mobile camera for any robotic or
vision project in Matlab.
https://www.youtube.com/channel/UCJA5xHsVppYct6zYSKePC9w
Write a MATLAB code to start your mobile cam, preview camera image, capture image and save it in a
folder.
Code:
Task 03:
Write a MATLAB function to
Upon execution,
Code:
R=resolution, F=number of frames (60), D= Directory, Fr= Frame rate
(Separate File saved)
MC_303_317('320x240',60,'machineVision','C:\Users\hubiaijaz\Desktop\soft copies\
8th semester\Machine vision\lab 3',20)
(File saved by the name: MC_303_317)
function MyVid1 = MC_303_317(R,F,S,D,Fr)
clear cam
cam = webcam
cd ('C:\Users\hubia ijaz\Desktop\soft copies\8th semester\Machine vision\lab 3')
cam.Resolution = R;
for i=1:F % F= 60
img=snapshot(cam);
imwrite(img,['303_317MC1',num2str(i),'.jpg']); % Snapshot from image 1 to 60
end
for i=1:F
img=imread(strcat('303_317MC1',num2str(i),'.jpg'));
Myvid(:,:,:,i) = img; % Reading snapshots
end
n=VideoWriter('Video');
n.FrameRate=Fr;
open(n);
writeVideo(n,Myvid);
close(n)
end
Image 18 Image 55
60 Images
Video screenshot
Code:
Guidelines:
You can make a group of two students from same section. Try to Code efficiently with minimum
number of lines. Report your own results as Plagiarism can leads to zero marks.
Rumi: Write down one famous teaching, or poem verse of Rumi from which you are influenced!
“ When the world pushes you to your knees, you’re in the perfect position to pray.”
Rumi