Comments (2)
Hi @Allfu , glad you like it!
Current Status
As you can see here
augmented-reality/src/ar_main.py
Lines 116 to 117 in 970b0cf
if color
is False
, which it is by default, I am using a single color to render the model, ignoring whatever colors have been defined in the model file.
The default color used to render the model is defined here:
augmented-reality/src/ar_main.py
Line 21 in 970b0cf
Render Model with colors
If you only want to render the model with colors - assuming they have been defined in the .obj file - and not textures, you should call the render
function with the last parameter set to True
:
augmented-reality/src/ar_main.py
Line 99 in 970b0cf
The call to the render
function is done here:
augmented-reality/src/ar_main.py
Line 80 in 970b0cf
an example of a model with colors is the Pirate Ship (https://github.com/juangallostra/augmented-reality/blob/master/models/pirate-ship-fat.obj). Colors are defined in hex format:
augmented-reality/models/pirate-ship-fat.obj
Line 104 in 970b0cf
To load colors you should also uncomment the lines:
augmented-reality/src/objloader_simple.py
Lines 25 to 26 in 970b0cf
See below an example result of the Pirate Ship and Fox colored models:
The second one is taken from piotrekk94's fork: https://github.com/piotrekk94/tx2-ar, which has some other improvements.
Render model with textures
If what you want is to display a texture for the model, then yes, you should combine the OBJ model with the MTL file.
The code I am using to load OBJ models is based on this one: https://www.pygame.org/wiki/OBJFileLoader
As you can see in the link, there is a second class I removed which loads MTL files. In addition to that, lines
augmented-reality/src/objloader_simple.py
Lines 27 to 28 in 970b0cf
should be uncommented. The problem with textures is that you will then need OpenGL (or something similar) to render the model, which was work I didn't want to do at the time. It is possible, however, to do so.
This is a useful resource if you are wishing to dig deeper on how to do it: https://rdmilligan.wordpress.com/2015/10/15/augmented-reality-using-opencv-opengl-and-blender/
from augmented-reality.
got it!
thanks for your help!
thanks!
from augmented-reality.
Related Issues (20)
- how to use a colorful AR model? HOT 1
- I only get a random image being render everywhere with random sizes HOT 5
- How to detect the plane on the ground? HOT 1
- Track reference surface
- Add support for colored models
- Migrate to Python 3 HOT 1
- the 3d model not stable( flash of move always) HOT 1
- the 3d model not stable( flash of move always) HOT 1
- some error occured HOT 2
- Split requirements file
- why change the sign of homography matrix in function "projection_matrix"?
- An error occurred when running ar_main.py. How to resolve it HOT 1
- Hi, getting error of being unable to capture video HOT 4
- Standard size of the model image and video ? HOT 7
- Dimensions of a card HOT 3
- Size of loaded model and textures HOT 6
- Matching more than one object simultaneously HOT 5
- error: unrecognized arguments: HOT 2
- Is it possible to run it in web? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from augmented-reality.