Problem with Wavefront read_wobj function to read an .obj file into MATLAB

3 次查看(过去 30 天)
I am currently using MATLAB R2017a and have installed the Wavefront toolbox. I run read_wobj function to open a .obj 3D file. But everytime the following message is shown:
Reading Object file : nf_6_new_double.obj
%
% Wavefront OBJ file
% Created in RealityCapture v1.0.3.3939
%www.capturingreality.com
% 2031735 vertices, 4063610 faces
%
Reading Material file : nf_6_new.mtl
%
% Wavefront material file
% Created in RealityCapture v1.0.3.3939
%www.capturingreality.com
%
Finished Reading Material file
Lines processed : 10000
Lines processed : 20000
Lines processed : 30000
Lines processed : 40000
Lines processed : 50000
Lines processed : 2780000
Lines processed : 2790000
Lines processed : 2800000
Lines processed : 2810000
Lines processed : 2820000
Lines processed : 2830000
Field assignment to a non-structure array object.
Error in read_wobj (line 198) objects(no).data.vertices=array_vertices(findex);
Error in Angle_3DF (line 7) OBJ=read_wobj('nf_6_new_double.obj');
Similar problem is mentioned in this link:
https://www.mathworks.com/matlabcentral/answers/300038-has-anyone-tried-to-use-wavefront-read_wobj-function-to-read-an-obj-file-into-matlab
I also tried according to the answers in that link. But still the same. Anyone have a solution for this situation? Thanks in advance.

回答(1 个)

Ajay Joseph
Ajay Joseph 2021-1-25
Dont use read_wobj() use readobj(). It take a little longer to extract the data. Once the obj data is extracted using readobj(). I saved the file as a mat file to matlab's current folder using save('OBJ'). If you manage to save it then use the following to read vertices and faces.
load (OBJ.mat)
Vert = OBJ.v;
Fac = OBJ.f.v;
Happy days

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by