imageofVLprojection

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 3.8, Creation date: 2017-05-11, Last change: 2025-09-14

returns an image of a VL projection using the matlab camera view concept

Description

To get a real projection image using the graphics camera parameter it is absolutely necessary to switch to perspective mode first (this is part of this function) before taking a snapshot (getframe);
>> set(gca,'Projection','perspective');
The image size in mm defines the opening angle: 2*tan(alpha)=x/2 / norm(pc-pt)
The angle alpha is the complete opening angle, same for both dimensions.
Therefor the target screen height is x = 2 * tan (alpha/2) * norm(pc-pt)

See Also: imwarpT

Example Illustration

 missing image of imageofVLprojection(VL,isize,pc,pt,pixnum,cup)

Syntax

[I,Ic,pixs,Tc,Tt,C]=imageofVLprojection([VL,isize,pc,pt,pixnum,cup])

Input Parameter

VL: Vertex list; default is a square for testing
isize: image size [x y] centered; this defines the view angle
pc: position of camera; default is [0 +100 0];
pt: position of screen; default is [0 -100 0];
pixnum: pixels of image; default is isize;
cup: cup vector; default is [1 0 0]

Output Parameter

I: Grey scale matrix [0..1]
Ic: Color Matrix struct I.cdata
pixs: pixel size in mm; scaling
Tc: HT matrix of camera position
Tt: HT matrix of target position
C: SG of the perspective cone in space

Examples


imageofVLprojection('',[200 200],[0 -400 0],[0 100 0],1); % Original
imageofVLprojection('',[200 200],[0 -400 0],[0 100 0],2); % Dots smaller
imageofVLprojection('',[200 200],[0 -400 0],[0 200 0],2); % Dots outward
imageofVLprojection('',[200 200],[0 -400 0],[0 600 0],2); % Dots out
imageofVLprojection(100*rand(10,3)-50,[200 200],[0 -400 0],[0 600 0]);




Copyright 2017-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Last html export of this page out of FM database by TL: 2025-09-21