An open API service indexing awesome lists of open source software.

https://github.com/fechbmaster/3dnirmapper

A 3D Mapper to map NIR images on a 3D tooth model.
https://github.com/fechbmaster/3dnirmapper

image-processing python python3

Last synced: 12 months ago
JSON representation

A 3D Mapper to map NIR images on a 3D tooth model.

Awesome Lists containing this project

README

          

[![PyPI version](https://badge.fury.io/py/nirmapper.svg)](https://badge.fury.io/py/nirmapper)

# 3DNIRmapper

3DNIRMapper maps multiple textures with given camera parameters on a 3d-model using a z-buffer approach. It was originaly developed to map nearinfrared pictures on a 3d tooth model and was developed in proceedings of my master thesis.

For example with the given camera parameters it can map these two images to a 3d-modell...

[![preview](https://github.com/fechbmaster/3DNIRmapper/blob/master/nirmapper/resources/images/sample1.jpg)](#readme)
[![preview](https://github.com/fechbmaster/3DNIRmapper/blob/master/nirmapper/resources/images/sample2.jpg)](#readme)

...by projecting them to the image area and resolving the overlapping parts as shown here:

[![preview](https://github.com/fechbmaster/3DNIRmapper/blob/master/nirmapper/resources/images/overlap.png)](#readme)

...and finally creates the combined textured 3d-modell:

[![preview](https://github.com/fechbmaster/3DNIRmapper/blob/master/nirmapper/resources/images/result.png)](#readme)

The program is able to import wavefront objects and exports them to textured Collada files.

The package is on [pypi](https://pypi.org/project/nirmapper/)
or can be cloned on [github](https://github.com/fechbmaster/3DNIRmapper).

```
pip install nirmapper
```

## CLI Usage

The program comes with a cli, developed with Click. It contains two commands.

### map

The first command maps textures to a 3d-model:
```bash
Usage: nirmapper map [OPTIONS] NAME MODEL_SRC TEXTURE_SRC DST

Options:
--zfactor FLOAT The z factor defines how big the z-buffer should be
for the visibility analysis. If results are bad put
this up to 2 or 3. Be careful with values below zero
because zfactor is multiplied with resolution of
camera and must match aspect ratio of resolution.
--thread / --unthread
--help Show this message and exit.
```
where
* NAME is the name of the model.
* MODEL_SRC is the path to the model.
* TEXTURE_SRC ist the path of the textures to map.
* DST is the destination path.

The camera parameters must be provided for every picture in a XML-file inside the TEXTURE_SRC that looks like this:

```xml

35

1280
1024


32
25.6


-1.2196
1.2096
9.8



0.715
-0.169
0.082
0.674

```
It can contain either euler or quaternion rotation - although quaternions are highly recommended. For every texture to map there must be an .xml file with the same file name providing those parameters. An example can be found in nirmapper/resources/xmlExample/.

### example

The second cli call creates a cube, tooth or elephant example:

```bash
Usage: nirmapper example [OPTIONS] DST

Options:
--type [cube|tooth|elephant]
--help Show this message and exit.

```
where:
* DST is the destination path.

## Code Usage

To use the implemented modules for own developments or improvement just include them to your project:

```python
import nirmapper
```

For example if you want to use on of the examples:

```python
from nirmapper.examples import generate_cube_example

dst = '/tmp/Cube'

generate_cube_example(dst)
```

## Tests

All tests can be found in the `tests` directory. To run the tests:

```bash
# Install pywavefront in develop mode
python setup.py develop

# Install required packages for running tests
pip install -r test-requirements.txt

# Run all tests
pytest
```

License
-------

3DNIRMapper is [Apache-licensed](https://github.com/fechbmaster/3DNirmapper/LICENSE)