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 个评论

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.
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.
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.
readobj is here
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
What is class(obj.v) and also size()? I wonder if it is []
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?
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 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by