Help! Project a 3D Mesh to an image - how to get the corresponding 2d coordinates with 3D points
3 ビュー (過去 30 日間)
古いコメントを表示
I'm rendering a 3d mesh using opengl as renderer and the trimesh function.
trimesh(... face, mesh(:, 1), mesh(:, 3), mesh(:, 2), ... 'EdgeColor', 'none', ... 'FaceVertexCData', tex/255, 'FaceColor', 'interp', ... 'FaceLighting', 'phong' ... );
set(gca, ... 'DataAspectRatio', [ 1 1 1 ], ... 'PlotBoxAspectRatio', [ 1 1 1 ], ... 'Units', 'pixels', ... 'GridLineStyle', 'none', ... 'Visible', 'off', 'box', 'off', ... 'Projection', 'perspective'... );
then, I want to know the 2d pixel coordinates of every 3D points without any other calculation.
I've been playing with this for a while and am pretty much stumped, any help would be hugely appreciated.
0 件のコメント
回答 (1 件)
George Abrahams
2024 年 2 月 10 日
編集済み: George Abrahams
2024 年 2 月 10 日
If you're not commited to using the MATLAB axes' camera, my 3D Rendering Toolbox on File Exchange contains the function world2image which will give you the 2D (X,Y) coordinates of every 3D (X,Y,Z) vertex.
N.B. Technically world2image will also give you a Z-coordinate, which is used for Z-buffering if you want to subsequently rasterize/render the mesh, but you can just ignore this.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!