hi friends, I want to view an .obj file on a 3D plot with matlab, not displaying the content, it is been 3 day i search but worthless. Thank you for help.

 採用された回答

Walter Roberson
Walter Roberson 2015 年 9 月 19 日

0 投票

9 件のコメント

jiji hr
jiji hr 2015 年 9 月 19 日
in fact it doesn't really answer my question because i don't have texture in my object files but i don't know if i can adapt it to my case (i am a biginner with matlab). any way i will try with. and thank you a lot for your answer.
jiji hr
jiji hr 2015 年 9 月 19 日
if i understood the source code very well i think it takes an image then it parses it in an .obj file, but my problem is that i have an .obj file and i want to know how can i get the 3D model from. This .obj file does not contain texture.
Walter Roberson
Walter Roberson 2015 年 9 月 19 日
The readobj will return an empty .vt field if the .obj file has no texture information. It will not be a problem.
If I understand the code it looks to me as if you could use
obj = readobj('FileName.obj'); %use appropriate file
patch('vertices', obj.v, 'faces', obj.f.v);
shading interp
colormap(gray(256));
lighting phong
camproj('perspective');
axis square
axis off
axis equal
axis tight
cameramenu
However I do not know how the color will come out.
Here readobj is the code from the first of the two links above.
Image Analyst
Image Analyst 2015 年 9 月 19 日
I don't have readobj(). What toolbox is it in? What program created the obj file in the first place? I know Visual Studio creates obj files but I doubt you'd want to open them in MATLAB.
Walter Roberson
Walter Roberson 2015 年 9 月 20 日
readobj is here
Somendra Meena
Somendra Meena 2020 年 2 月 27 日
lineno:2 is giving me an error
Error using patch
Value must be of numeric type and greater than 1
Error in read3dModel (line 13)
patch('Faces', obj.f.v, 'vertices', obj.v);
I'm using this model for sample : https://free3d.com/3d-model/hand-v1--945174.html
Walter Roberson
Walter Roberson 2020 年 2 月 27 日
What is class(obj.v) and also size()? I wonder if it is []
Gayathri
Gayathri 2022 年 7 月 27 日
Hi Roberson,
In relation to this question, I want to know how to detect a new object and validate(extract features like colour, dimensions, texture etc; compare and validate) it with a reference obj file using the above set of code?
How can I give the colour of the new object and how similar it is with the reference obj file.
Can I say how much does the material resemble with mtl file of the reference obj file?
Walter Roberson
Walter Roberson 2022 年 7 月 28 日
I do not understand about "detect a new object" ? The above code is for reading and displaying whatever is in a .obj file, not for deciding which entry has what meaning.

サインインしてコメントする。

その他の回答 (1 件)

Mariem Khlifi
Mariem Khlifi 2022 年 3 月 5 日

0 投票

toolbox_graph has a function read_obj that does that.

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by