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.
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 Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

질문:

2015년 9월 19일

댓글:

2022년 7월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by