如何用MATLAB读stl并显示点云文件

本文介绍了如何在MATLAB环境中读取STL点云文件并进行显示。虽然生成的图形可能不够美观,但通过提供的函数和简单步骤,读者可以成功实现点云数据的可视化。
摘要由CSDN通过智能技术生成
function [VertexData,FVCD,isBinary]=stl2matlab(stlfile)
% STL2MATLAB reads STL-file, ASCII or binary format, into Matlab
%
% Usage:
%
% [VertexData, FVCD]=stl2matlab(stlfile)
%
% Input:
%
% stlfile - STL-file
%
% Output:
%
% VertexData - Cellarray containing matrices with vertices
% FVCD - FaceVertexColorData
% isBinary - Flag with STL-file information
%
% To plot the STL-object use plotSTL(VertexData) or plotSTL(VertexData,FVCD)
%
% m-file can be downloaded at
% http://www.mathworks.com/matlabcentral/fileexchange/13253-iges-toolbox
%
% written by Per Bergstrm 2012-01-09
%

if nargin == 0
    warning('No STL-file is specified');
end

VertexData=cell(1,3);

try
    
    % Try to read an STL ASCII file
    [VertexData{
    1}, VertexData{
   2}, VertexData{
   3}, FVCD] = stlAread(stlfile);
    isBinary=false;
    
catch
    
    try
        
        % Try to read an STL binary file
        [VertexData{
    1}, VertexData{
   
  • 6
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值