Skip to content

Commit

Permalink
Merge pull request #27 from dancergraham/fix-intensity-values
Browse files Browse the repository at this point in the history
Test intensity values for files with and without RGB
  • Loading branch information
dancergraham authored Oct 26, 2024
2 parents bc20a12 + c32326b commit 67f984a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
Binary file modified .github/workflows/CI.yml
Binary file not shown.
10 changes: 4 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# How to contribute
### How to contribute

All contributions welcome
- Ideas, feature requests 💡
- bug reports 🪲
- [Ideas, feature requests](https://github.com/dancergraham/e57-python/issues) 💡
- [bug reports](https://github.com/dancergraham/e57-python/issues) 🪲
- documentation 📃
- sample files 🌫️
- tests
- rust code 🦀
- python code 🐍
- tell your friends, share the project online / via social media, ... 🗣️

## Best practice

If you know how, you should fork the repo, create a new branch and then submit a pull request.
Fork the repo, create a new branch and then submit a pull request.

(If you are new to GitHub, you might start with a basic tutorial and check out a more detailed guide to pull requests.)

Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "e57-python"
version = "0.1.0-a8"
version = "0.2.0-a1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -9,7 +9,7 @@ name = "e57"
crate-type = ["cdylib"]

[dependencies]
pyo3 = "0.20.3"
e57 = { version = "0.10.5",features =["crc32c"]}
numpy = "0.20.0"
pyo3 = "0.21.2"
e57 = { version = "0.11.7",features =["crc32c"]}
numpy = "0.21.0"
ndarray = "0.15.6"
6 changes: 2 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,14 @@ unsafe fn read_points(py: Python<'_>, filepath: &str) -> PyResult<E57> {
let mut color_vec = Vec::with_capacity(pc.records as usize * 3);
let mut intensity_vec = Vec::with_capacity(pc.records as usize);
let mut nrows = 0;
let intensity_min = pc.intensity_limits.map(|limits| limits.min).unwrap_or(0.0);
let intensity_max = pc.intensity_limits.map(|limits| limits.max).unwrap_or(1.0);
for pointcloud in file.pointclouds() {
let mut iter = file
.pointcloud_simple(&pointcloud)
.expect("this file should contain a pointcloud");
iter.spherical_to_cartesian(true);
iter.cartesian_to_spherical(false);
iter.intensity_to_color(true);
iter.normalize_intensity(false);
iter.apply_pose(true);

for p in iter {
Expand All @@ -73,8 +72,7 @@ unsafe fn read_points(py: Python<'_>, filepath: &str) -> PyResult<E57> {
color_vec.extend([color.red, color.green, color.blue])
}
if let Some(intensity) = p.intensity {
let rescaled_intensity = (intensity * (intensity_max - intensity_min)) + intensity_min;
intensity_vec.push(rescaled_intensity)
intensity_vec.push(intensity);
}
}
}
Expand Down

0 comments on commit 67f984a

Please sign in to comment.