Professional Documents
Culture Documents
Semester: VI
Faculty Name:
Dr. Ninad Mehendale
2 Theory: 4
3 Code: 4
3.1 Tool Used/language: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.2 Programs: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.3 Output: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5 Conclusion 7
AR and MDS 2022-23
Experiment: Four
Inserting AR object in Webcam
Satbir Singh Sohal, 16010320105
3 Code:
3.1 Tool Used/language:
Using AR (Augmented Reality) with MATLAB provides a powerful platform for developing AR
applications. MATLAB provides various toolboxes and functions for computer vision, image processing,
and machine learning, which can be used to develop AR applications. These toolboxes and functions
enable MATLAB users to develop AR applications that can detect markers, track objects, and overlay
virtual content on real-world scenes.
AR and MDS 2022-23
In MATLAB, AR applications can be developed using the Image Processing Toolbox, Computer
Vision Toolbox, and the Robotics System Toolbox. These toolboxes provide functions for image
acquisition, feature extraction, feature detection, image registration, and projection, which are
essential for AR applications. MATLAB’s Simulink also provides blocks that can be used for AR
application development.
To develop an AR application in MATLAB, the following steps can be followed:
1. Capture video frames: Capture video frames from a camera or a video file using MATLAB’s
video capture functions.
2. Detect markers or features: Use MATLAB’s computer vision functions to detect markers or
features in the video frames that can be used to anchor virtual objects in the real world.
3. Track objects: Use MATLAB’s tracking algorithms to track the detected markers or features
across multiple video frames.
4. Render virtual objects: Use MATLAB’s 3D graphics capabilities to render virtual objects and
overlay them onto the real-world scene.
5. Project virtual objects: Use MATLAB’s projection functions to project the virtual objects onto
the real-world scene based on the position and orientation of the markers or features detected
in the video frames.
6. Display the augmented video: Display the augmented video on the screen or export it to a
video file.
3.2 Programs:
cam = webcam(1);
objectImg = imread(’download.jpg’);
objectImg = imresize(objectImg, [480, 640]);
videoPlayer = vision.VideoPlayer(’Position’, [100, 100, 640, 480]);
while true
frame = snapshot(cam);
step(videoPlayer, overlayFrame);
end
AR and MDS 2022-23
3.3 Output:
5 Conclusion
1. We successfully inserted an AR object in webcam feed using MATLAB.
2. We explored the various applications of inserting AR objects in webcam feed as well as the
computer vision techniques to detect markers or features in the webcam feed.
References
[1] Anónimo, A. (2008). Blog del año 2002 con un formato horrible. http://www.blogfeo.
blogspot.com.
AR and MDS 2022-23
[2] Mendoza, S. and Duende, J. (2022). Libro apantallante que probablemente no leı́ste y solo lo
pusiste por poner algo. Ediciones Tepito, 1st edition.
[3] Pérez, J. (2008). Artı́culo de dudosa calidad de una página web patito. Recuperado de: https:
//XD.com. Fecha de consulta: 03/11/2021.