File size: 912 Bytes
346b70f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Color Extraction Module

Extract colors from 3D mesh materials and textures

## Purpose

- Sample colors from mesh faces
- Read from textures via UV coordinates
- Apply area-weighted sampling

## Layout

```
extraction/
β”œβ”€β”€ context.md    # This file
β”œβ”€β”€ __init__.py   # API: extract_colors()
β”œβ”€β”€ sampler.py    # Random sampling strategies
└── reader.py     # Read colors from materials
```

## Scope

- In-scope: Color extraction, texture sampling, UV mapping
- Out-of-scope: Color quantization, atlas generation

## Entrypoints

- `extract_colors(mesh, sample_rate, simplify_details, detail_sensitivity)` - Main extraction function
- `get_face_colors(mesh, simplify_details, detail_sensitivity)` - Read colors from mesh
- `sample_colors(colors, sample_rate, areas)` - Sample with weighting

## Dependencies

- Internal: preprocessing.simplify_texture
- External: NumPy, trimesh, OpenCV