From a6526627799c21a23bfe94723f3203ee8d995748 Mon Sep 17 00:00:00 2001 From: Edgar Riba Date: Thu, 19 Sep 2024 23:57:51 +0200 Subject: [PATCH] Release cargo packages (#140) * release all packages * fix paths * more fixeS * fix python * bumpt versions * fix kornia-io dep * try dry-run * use cross * attempt to use cross * release actions * install deps * try again * no dependencieS * install cross * release manual script * bump to 0.1.6-rc.5 --- .github/workflows/rust_release.yml | 14 ++++----- Cargo.toml | 13 ++++---- crates/kornia-core/Cargo.toml | 4 --- crates/kornia-core/src/tensor.rs | 30 +++++++++---------- crates/kornia-image/Cargo.toml | 4 --- crates/kornia-image/src/error.rs | 4 --- crates/kornia-image/src/image.rs | 10 +++---- crates/kornia-image/src/ops.rs | 4 +-- crates/kornia-imgproc/Cargo.toml | 1 - crates/kornia-imgproc/benches/bench_color.rs | 2 +- crates/kornia-imgproc/benches/bench_flip.rs | 4 +-- .../kornia-imgproc/benches/bench_metrics.rs | 3 +- crates/kornia-imgproc/benches/bench_resize.rs | 4 +-- crates/kornia-imgproc/benches/bench_warp.rs | 11 +++---- crates/kornia-imgproc/src/color/gray.rs | 4 +-- crates/kornia-imgproc/src/color/hsv.rs | 4 +-- crates/kornia-imgproc/src/core.rs | 8 ++--- crates/kornia-imgproc/src/flip.rs | 8 ++--- crates/kornia-imgproc/src/histogram.rs | 4 +-- crates/kornia-imgproc/src/metrics/huber.rs | 4 +-- crates/kornia-imgproc/src/metrics/l1.rs | 4 +-- crates/kornia-imgproc/src/metrics/mse.rs | 8 ++--- crates/kornia-imgproc/src/normalize.rs | 12 ++++---- crates/kornia-imgproc/src/resize.rs | 12 ++++---- crates/kornia-imgproc/src/threshold.rs | 24 +++++++-------- crates/kornia-imgproc/src/warp/affine.rs | 8 ++--- crates/kornia-imgproc/src/warp/perspective.rs | 6 ++-- crates/kornia-io/Cargo.toml | 1 - crates/kornia-io/benches/bench_io.rs | 2 +- crates/kornia-io/src/functional.rs | 8 ++--- examples/color_detector/src/main.rs | 2 +- examples/rtspcam/README.md | 14 ++++----- examples/video_write/README.md | 2 +- examples/webcam/README.md | 2 +- kornia-py/Cargo.toml | 9 ++++-- kornia-py/src/histogram.rs | 3 +- kornia-py/src/image.rs | 2 +- kornia-py/src/io/functional.rs | 3 +- kornia-py/src/io/jpeg.rs | 6 ++-- kornia-py/src/resize.rs | 6 ++-- kornia-py/src/warp.rs | 6 ++-- kornia-serve/src/compute.rs | 4 +-- scripts/release_rust.sh | 16 ++++++++++ 43 files changed, 152 insertions(+), 148 deletions(-) create mode 100755 scripts/release_rust.sh diff --git a/.github/workflows/rust_release.yml b/.github/workflows/rust_release.yml index 538cbfa4..aebf2e31 100644 --- a/.github/workflows/rust_release.yml +++ b/.github/workflows/rust_release.yml @@ -12,7 +12,6 @@ jobs: - x86_64-unknown-linux-gnu runs-on: ubuntu-latest steps: - - uses: ilammy/setup-nasm@v1 - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: @@ -24,9 +23,10 @@ jobs: with: command: login args: ${{ secrets.CARGO_REGISTRY_TOKEN_KORNIA }} - - name: Cargo Publish - uses: actions-rs/cargo@v1 - with: - command: publish - args: --verbose --target ${{ matrix.target }} --all-features - use-cross: true + - name: Publish packages into crates.io + run: | + cargo publish -p kornia-core --token ${{ secrets.CARGO_REGISTRY_TOKEN_KORNIA }} + cargo publish -p kornia-image --token ${{ secrets.CARGO_REGISTRY_TOKEN_KORNIA }} + cargo publish -p kornia-io --token ${{ secrets.CARGO_REGISTRY_TOKEN_KORNIA }} --all-features + cargo publish -p kornia-imgproc --token ${{ secrets.CARGO_REGISTRY_TOKEN_KORNIA }} + cargo publish -p kornia --token ${{ secrets.CARGO_REGISTRY_TOKEN_KORNIA }} --all-features diff --git a/Cargo.toml b/Cargo.toml index 6d4ad975..6512758a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,11 +22,12 @@ license-file = "LICENSE" readme = "README.md" repository = "https://github.com/kornia/kornia-rs" rust-version = "1.76" -version = "0.1.6+dev" +version = "0.1.6-rc.5" [workspace.dependencies] -kornia-core = { path = "crates/kornia-core", version = "0.1.6+dev" } -kornia-image = { path = "crates/kornia-image", version = "0.1.6+dev" } -kornia-io = { path = "crates/kornia-io", version = "0.1.6+dev" } -kornia-imgproc = { path = "crates/kornia-imgproc", version = "0.1.6+dev" } -kornia = { path = "crates/kornia", version = "0.1.6+dev" } +# NOTE: remember to update the kornia-py package version in `kornia-py/Cargo.toml` when updating the Rust package version +kornia-core = { path = "crates/kornia-core", version = "0.1.6-rc.5" } +kornia-image = { path = "crates/kornia-image", version = "0.1.6-rc.5" } +kornia-io = { path = "crates/kornia-io", version = "0.1.6-rc.5" } +kornia-imgproc = { path = "crates/kornia-imgproc", version = "0.1.6-rc.5" } +kornia = { path = "crates/kornia", version = "0.1.6-rc.5" } diff --git a/crates/kornia-core/Cargo.toml b/crates/kornia-core/Cargo.toml index 608afcaf..84ef74b9 100644 --- a/crates/kornia-core/Cargo.toml +++ b/crates/kornia-core/Cargo.toml @@ -17,7 +17,3 @@ arrow-buffer = "53.0.0" num-traits = "0.2" serde = { version = "1", features = ["derive"] } thiserror = "1" - - -[dev-dependencies] -kornia.workspace = true diff --git a/crates/kornia-core/src/tensor.rs b/crates/kornia-core/src/tensor.rs index 45a92e36..a116c925 100644 --- a/crates/kornia-core/src/tensor.rs +++ b/crates/kornia-core/src/tensor.rs @@ -68,7 +68,7 @@ pub(crate) fn get_strides_from_shape(shape: [usize; N]) -> [usiz /// # Example /// /// ``` -/// use kornia::core::{Tensor, CpuAllocator}; +/// use kornia_core::{Tensor, CpuAllocator}; /// /// let data: Vec = vec![1, 2, 3, 4]; /// let t = Tensor::::new_uninitialized([2, 2], CpuAllocator).unwrap(); @@ -186,7 +186,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data: Vec = vec![1, 2, 3, 4]; /// let t = Tensor::::from_shape_vec([2, 2], data, CpuAllocator).unwrap(); @@ -225,7 +225,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data: [u8; 4] = [1, 2, 3, 4]; /// let t = Tensor::::from_shape_slice([2, 2], &data, CpuAllocator).unwrap(); @@ -261,7 +261,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let t = Tensor::::from_shape_val([4], 0, CpuAllocator); /// assert_eq!(t.as_slice(), vec![0, 0, 0, 0]); @@ -301,7 +301,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let t = Tensor::::from_shape_fn([4], |[i]| i as u8, CpuAllocator); /// assert_eq!(t.as_slice(), vec![0, 1, 2, 3]); @@ -374,7 +374,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data: Vec = vec![1, 2, 3, 4]; /// @@ -406,7 +406,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data: Vec = vec![1, 2, 3, 4]; /// @@ -441,7 +441,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data: Vec = vec![1, 2, 3, 4]; /// @@ -543,7 +543,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data: Vec = vec![1, 2, 3, 4]; /// let t = Tensor::::from_shape_vec([4], data, CpuAllocator).unwrap(); @@ -628,7 +628,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data: Vec = vec![1, 2, 3, 4]; /// let t = Tensor::::from_shape_vec([4], data, CpuAllocator).unwrap(); @@ -667,7 +667,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data1: Vec = vec![1, 2, 3, 4]; /// let t1 = Tensor::::from_shape_vec([4], data1, CpuAllocator).unwrap(); @@ -732,7 +732,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data1: Vec = vec![1, 2, 3, 4]; /// let t1 = Tensor::::from_shape_vec([4], data1, CpuAllocator).unwrap(); @@ -765,7 +765,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data1: Vec = vec![1, 2, 3, 4]; /// let t1 = Tensor::::from_shape_vec([4], data1, CpuAllocator).unwrap(); @@ -798,7 +798,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data1: Vec = vec![1, 2, 3, 4]; /// let t1 = Tensor::::from_shape_vec([4], data1, CpuAllocator).unwrap(); @@ -831,7 +831,7 @@ where /// # Example /// /// ``` - /// use kornia::core::{Tensor, CpuAllocator}; + /// use kornia_core::{Tensor, CpuAllocator}; /// /// let data1: Vec = vec![1, 2, 3, 4]; /// let t1 = Tensor::::from_shape_vec([4], data1, CpuAllocator).unwrap(); diff --git a/crates/kornia-image/Cargo.toml b/crates/kornia-image/Cargo.toml index 56f64015..f3b7ea6d 100644 --- a/crates/kornia-image/Cargo.toml +++ b/crates/kornia-image/Cargo.toml @@ -14,9 +14,5 @@ version.workspace = true kornia-core.workspace = true # external -ndarray = { version = "0.15", features = ["rayon"] } num-traits = "0.2" thiserror = "1" - -[dev-dependencies] -kornia.workspace = true diff --git a/crates/kornia-image/src/error.rs b/crates/kornia-image/src/error.rs index 998dc714..abca529d 100644 --- a/crates/kornia-image/src/error.rs +++ b/crates/kornia-image/src/error.rs @@ -13,10 +13,6 @@ pub enum ImageError { #[error("Image data is not contiguous")] ImageDataNotContiguous, - /// Error when shape is not valid. - #[error("Invalid shape")] - InvalidShape(#[from] ndarray::ShapeError), - /// Error when the image shape is not valid. #[error("Invalid image shape")] InvalidImageShape(#[from] kornia_core::TensorError), diff --git a/crates/kornia-image/src/image.rs b/crates/kornia-image/src/image.rs index 5d914527..08556ce7 100644 --- a/crates/kornia-image/src/image.rs +++ b/crates/kornia-image/src/image.rs @@ -9,7 +9,7 @@ use crate::error::ImageError; /// # Examples /// /// ``` -/// use kornia::image::ImageSize; +/// use kornia_image::ImageSize; /// /// let image_size = ImageSize { /// width: 10, @@ -106,7 +106,7 @@ where /// # Examples /// /// ``` - /// use kornia::image::{Image, ImageSize}; + /// use kornia_image::{Image, ImageSize}; /// /// let image = Image::::new( /// ImageSize { @@ -155,7 +155,7 @@ where /// # Examples /// /// ``` - /// use kornia::image::{Image, ImageSize}; + /// use kornia_image::{Image, ImageSize}; /// /// let image = Image::::from_size_val( /// ImageSize { @@ -240,7 +240,7 @@ where /// # Examples /// /// ``` - /// use kornia::image::{Image, ImageSize}; + /// use kornia_image::{Image, ImageSize}; /// /// let image = Image::::from_size_val( /// ImageSize { @@ -315,7 +315,7 @@ where /// # Examples /// /// ``` - /// use kornia::image::{Image, ImageSize}; + /// use kornia_image::{Image, ImageSize}; /// /// let data = vec![0u8, 0, 255, 0, 0, 255]; /// diff --git a/crates/kornia-image/src/ops.rs b/crates/kornia-image/src/ops.rs index a747146d..db8d57fa 100644 --- a/crates/kornia-image/src/ops.rs +++ b/crates/kornia-image/src/ops.rs @@ -13,8 +13,8 @@ use crate::{Image, ImageError}; /// Example: /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::image::ops::cast_and_scale; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_image::ops::cast_and_scale; /// /// let image = Image::::new( /// ImageSize { diff --git a/crates/kornia-imgproc/Cargo.toml b/crates/kornia-imgproc/Cargo.toml index 9ce5bf06..4a3e749b 100644 --- a/crates/kornia-imgproc/Cargo.toml +++ b/crates/kornia-imgproc/Cargo.toml @@ -24,7 +24,6 @@ thiserror = "1" [dev-dependencies] kornia-io.workspace = true -kornia.workspace = true criterion = "0.5" image = "0.25.1" diff --git a/crates/kornia-imgproc/benches/bench_color.rs b/crates/kornia-imgproc/benches/bench_color.rs index a672d9dd..782433cb 100644 --- a/crates/kornia-imgproc/benches/bench_color.rs +++ b/crates/kornia-imgproc/benches/bench_color.rs @@ -1,7 +1,7 @@ use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; -use kornia::imgproc::color::gray_from_rgb; use kornia_image::Image; +use kornia_imgproc::color::gray_from_rgb; use rayon::prelude::*; // vanilla version diff --git a/crates/kornia-imgproc/benches/bench_flip.rs b/crates/kornia-imgproc/benches/bench_flip.rs index 813c41bc..f1295370 100644 --- a/crates/kornia-imgproc/benches/bench_flip.rs +++ b/crates/kornia-imgproc/benches/bench_flip.rs @@ -1,7 +1,7 @@ use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; -use kornia::image::Image; -use kornia::imgproc::flip; +use kornia_image::Image; +use kornia_imgproc::flip; use rayon::{ iter::{IndexedParallelIterator, ParallelIterator}, diff --git a/crates/kornia-imgproc/benches/bench_metrics.rs b/crates/kornia-imgproc/benches/bench_metrics.rs index 4249966f..a3d5dbab 100644 --- a/crates/kornia-imgproc/benches/bench_metrics.rs +++ b/crates/kornia-imgproc/benches/bench_metrics.rs @@ -1,6 +1,7 @@ use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; -use kornia::{image::Image, imgproc::metrics}; +use kornia_image::Image; +use kornia_imgproc::metrics; fn bench_mse(c: &mut Criterion) { let mut group = c.benchmark_group("mse"); diff --git a/crates/kornia-imgproc/benches/bench_resize.rs b/crates/kornia-imgproc/benches/bench_resize.rs index 2b5b4c32..a875e51d 100644 --- a/crates/kornia-imgproc/benches/bench_resize.rs +++ b/crates/kornia-imgproc/benches/bench_resize.rs @@ -1,7 +1,7 @@ use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; -use kornia::image::{Image, ImageSize}; -use kornia::imgproc::{interpolation::InterpolationMode, resize}; +use kornia_image::{Image, ImageSize}; +use kornia_imgproc::{interpolation::InterpolationMode, resize}; fn resize_image_crate(image: Image, new_size: ImageSize) -> Image { let image_data = image.as_slice(); diff --git a/crates/kornia-imgproc/benches/bench_warp.rs b/crates/kornia-imgproc/benches/bench_warp.rs index 97cba55e..c434ea74 100644 --- a/crates/kornia-imgproc/benches/bench_warp.rs +++ b/crates/kornia-imgproc/benches/bench_warp.rs @@ -1,13 +1,10 @@ use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; -use kornia::{ - image::Image, - imgproc::{ - interpolation::InterpolationMode, - warp::{get_rotation_matrix2d, warp_affine}, - }, +use kornia_image::Image; +use kornia_imgproc::{ + interpolation::InterpolationMode, + warp::{get_rotation_matrix2d, warp_affine, warp_perspective}, }; -use kornia_imgproc::warp::warp_perspective; fn bench_warp_affine(c: &mut Criterion) { let mut group = c.benchmark_group("WarpAffine"); diff --git a/crates/kornia-imgproc/src/color/gray.rs b/crates/kornia-imgproc/src/color/gray.rs index 5f2470b0..cc3783c9 100644 --- a/crates/kornia-imgproc/src/color/gray.rs +++ b/crates/kornia-imgproc/src/color/gray.rs @@ -23,8 +23,8 @@ const BW: f64 = 0.114; /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::color::gray_from_rgb; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::color::gray_from_rgb; /// /// let image = Image::::new( /// ImageSize { diff --git a/crates/kornia-imgproc/src/color/hsv.rs b/crates/kornia-imgproc/src/color/hsv.rs index 4b80e3da..23396619 100644 --- a/crates/kornia-imgproc/src/color/hsv.rs +++ b/crates/kornia-imgproc/src/color/hsv.rs @@ -25,8 +25,8 @@ use kornia_image::{Image, ImageError}; /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::color::hsv_from_rgb; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::color::hsv_from_rgb; /// /// let image = Image::::new( /// ImageSize { diff --git a/crates/kornia-imgproc/src/core.rs b/crates/kornia-imgproc/src/core.rs index 13616487..1315538f 100644 --- a/crates/kornia-imgproc/src/core.rs +++ b/crates/kornia-imgproc/src/core.rs @@ -19,8 +19,8 @@ use kornia_image::{Image, ImageError}; /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::core::std_mean; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::core::std_mean; /// /// let image = Image::::new( /// ImageSize { @@ -81,8 +81,8 @@ pub fn std_mean(image: &Image) -> (Vec, Vec) { /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::core::bitwise_and; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::core::bitwise_and; /// /// let image = Image::::new( /// ImageSize { diff --git a/crates/kornia-imgproc/src/flip.rs b/crates/kornia-imgproc/src/flip.rs index a237e9fe..da38796d 100644 --- a/crates/kornia-imgproc/src/flip.rs +++ b/crates/kornia-imgproc/src/flip.rs @@ -21,8 +21,8 @@ use rayon::{ /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::flip::horizontal_flip; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::flip::horizontal_flip; /// /// let image = Image::::new( /// ImageSize { @@ -84,8 +84,8 @@ where /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::flip::vertical_flip; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::flip::vertical_flip; /// /// let image = Image::::new( /// ImageSize { diff --git a/crates/kornia-imgproc/src/histogram.rs b/crates/kornia-imgproc/src/histogram.rs index a07d6b64..7b97ae58 100644 --- a/crates/kornia-imgproc/src/histogram.rs +++ b/crates/kornia-imgproc/src/histogram.rs @@ -21,8 +21,8 @@ use kornia_image::{Image, ImageError}; /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::histogram::compute_histogram; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::histogram::compute_histogram; /// /// let image = Image::::new( /// ImageSize { diff --git a/crates/kornia-imgproc/src/metrics/huber.rs b/crates/kornia-imgproc/src/metrics/huber.rs index 294639a2..10e22b41 100644 --- a/crates/kornia-imgproc/src/metrics/huber.rs +++ b/crates/kornia-imgproc/src/metrics/huber.rs @@ -23,7 +23,7 @@ use kornia_image::{Image, ImageError}; /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; +/// use kornia_image::{Image, ImageSize}; /// /// let image1 = Image::::new( /// ImageSize { @@ -43,7 +43,7 @@ use kornia_image::{Image, ImageError}; /// ) /// .unwrap(); /// -/// let huber = kornia::imgproc::metrics::huber(&image1, &image2, 1.0).unwrap(); +/// let huber = kornia_imgproc::metrics::huber(&image1, &image2, 1.0).unwrap(); /// assert_eq!(huber, 2.5); /// ``` /// diff --git a/crates/kornia-imgproc/src/metrics/l1.rs b/crates/kornia-imgproc/src/metrics/l1.rs index fabf4829..a4b905e0 100644 --- a/crates/kornia-imgproc/src/metrics/l1.rs +++ b/crates/kornia-imgproc/src/metrics/l1.rs @@ -22,8 +22,8 @@ use kornia_image::{Image, ImageError}; /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::metrics::l1_loss; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::metrics::l1_loss; /// /// let image1 = Image::::new( /// ImageSize { diff --git a/crates/kornia-imgproc/src/metrics/mse.rs b/crates/kornia-imgproc/src/metrics/mse.rs index 4b3dbfdb..1b4b9a8a 100644 --- a/crates/kornia-imgproc/src/metrics/mse.rs +++ b/crates/kornia-imgproc/src/metrics/mse.rs @@ -20,8 +20,8 @@ use kornia_image::{Image, ImageError}; /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::metrics::mse; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::metrics::mse; /// /// let image1 = Image::::new( /// ImageSize { @@ -91,8 +91,8 @@ pub fn mse( /// /// # Example /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::metrics::psnr; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::metrics::psnr; /// /// let image1 = Image::::new( /// ImageSize { diff --git a/crates/kornia-imgproc/src/normalize.rs b/crates/kornia-imgproc/src/normalize.rs index 5f512675..f163f0ba 100644 --- a/crates/kornia-imgproc/src/normalize.rs +++ b/crates/kornia-imgproc/src/normalize.rs @@ -25,8 +25,8 @@ use crate::parallel; /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::normalize::normalize_mean_std; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::normalize::normalize_mean_std; /// /// let image_data = vec![0f32, 1.0, 0.0, 1.0, 2.0, 3.0, 0.0, 1.0, 0.0, 1.0, 2.0, 3.0]; /// let image = Image::::new( @@ -102,8 +102,8 @@ where /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::normalize::find_min_max; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::normalize::find_min_max; /// /// let image_data = vec![0u8, 1, 0, 1, 2, 3, 0, 1, 0, 1, 2, 3]; /// let image = Image::::new( @@ -167,8 +167,8 @@ where /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::normalize::normalize_min_max; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::normalize::normalize_min_max; /// /// let image_data = vec![0.0f32, 1.0, 0.0, 1.0, 2.0, 3.0, 0.0, 1.0, 0.0, 1.0, 2.0, 3.0]; /// let image = Image::::new( diff --git a/crates/kornia-imgproc/src/resize.rs b/crates/kornia-imgproc/src/resize.rs index 388b6a78..9a19ecff 100644 --- a/crates/kornia-imgproc/src/resize.rs +++ b/crates/kornia-imgproc/src/resize.rs @@ -24,9 +24,9 @@ use std::num::NonZeroU32; /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::resize::resize_native; -/// use kornia::imgproc::interpolation::InterpolationMode; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::resize::resize_native; +/// use kornia_imgproc::interpolation::InterpolationMode; /// /// let image = Image::<_, 3>::new( /// ImageSize { @@ -107,9 +107,9 @@ where /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::resize::resize_fast; -/// use kornia::imgproc::interpolation::InterpolationMode; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::resize::resize_fast; +/// use kornia_imgproc::interpolation::InterpolationMode; /// /// let image = Image::<_, 3>::new( /// ImageSize { diff --git a/crates/kornia-imgproc/src/threshold.rs b/crates/kornia-imgproc/src/threshold.rs index 94af73b7..68f6aabf 100644 --- a/crates/kornia-imgproc/src/threshold.rs +++ b/crates/kornia-imgproc/src/threshold.rs @@ -19,8 +19,8 @@ use crate::parallel; /// # Examples /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::threshold::threshold_binary; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::threshold::threshold_binary; /// /// let data = vec![100u8, 200, 50, 150, 200, 250]; /// let image = Image::<_, 1>::new(ImageSize { width: 2, height: 3 }, data).unwrap(); @@ -78,8 +78,8 @@ where /// # Examples /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::threshold::threshold_binary_inverse; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::threshold::threshold_binary_inverse; /// /// let data = vec![100u8, 200, 50, 150, 200, 250]; /// let image = Image::<_, 1>::new(ImageSize { width: 2, height: 3 }, data).unwrap(); @@ -135,8 +135,8 @@ where /// # Examples /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::threshold::threshold_truncate; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::threshold::threshold_truncate; /// /// let data = vec![100u8, 200, 50, 150, 200, 250]; /// let image = Image::<_, 1>::new(ImageSize { width: 2, height: 3 }, data).unwrap(); @@ -191,8 +191,8 @@ where /// # Examples /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::threshold::threshold_to_zero; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::threshold::threshold_to_zero; /// /// let data = vec![100u8, 200, 50, 150, 200, 250]; /// let image = Image::<_, 3>::new(ImageSize { width: 2, height: 1 }, data).unwrap(); @@ -247,8 +247,8 @@ where /// # Examples /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::threshold::threshold_to_zero_inverse; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::threshold::threshold_to_zero_inverse; /// /// let data = vec![100u8, 200, 50, 150, 200, 250]; /// let image = Image::<_, 3>::new(ImageSize { width: 2, height: 1 }, data).unwrap(); @@ -307,8 +307,8 @@ where /// # Examples /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::threshold::in_range; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::threshold::in_range; /// /// let data = vec![100u8, 200, 50, 150, 200, 250]; /// diff --git a/crates/kornia-imgproc/src/warp/affine.rs b/crates/kornia-imgproc/src/warp/affine.rs index 8183543e..4b623ff0 100644 --- a/crates/kornia-imgproc/src/warp/affine.rs +++ b/crates/kornia-imgproc/src/warp/affine.rs @@ -59,7 +59,7 @@ pub fn invert_affine_transform(m: &[f32; 6]) -> [f32; 6] { /// # Example /// /// ``` -/// use kornia::imgproc::warp::get_rotation_matrix2d; +/// use kornia_imgproc::warp::get_rotation_matrix2d; /// /// let center = (0.0, 0.0); /// let angle = 90.0; @@ -100,9 +100,9 @@ fn transform_point(x: f32, y: f32, m: &[f32; 6]) -> (f32, f32) { /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::interpolation::InterpolationMode; -/// use kornia::imgproc::warp::warp_affine; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::interpolation::InterpolationMode; +/// use kornia_imgproc::warp::warp_affine; /// /// let src = Image::<_, 3>::from_size_val( /// ImageSize { diff --git a/crates/kornia-imgproc/src/warp/perspective.rs b/crates/kornia-imgproc/src/warp/perspective.rs index 4525dfde..8268db7a 100644 --- a/crates/kornia-imgproc/src/warp/perspective.rs +++ b/crates/kornia-imgproc/src/warp/perspective.rs @@ -68,9 +68,9 @@ fn transform_point(x: f32, y: f32, m: &[f32; 9]) -> (f32, f32) { /// # Example /// /// ``` -/// use kornia::image::{Image, ImageSize}; -/// use kornia::imgproc::interpolation::InterpolationMode; -/// use kornia::imgproc::warp::warp_perspective; +/// use kornia_image::{Image, ImageSize}; +/// use kornia_imgproc::interpolation::InterpolationMode; +/// use kornia_imgproc::warp::warp_perspective; /// /// let src = Image::::new( /// ImageSize { diff --git a/crates/kornia-io/Cargo.toml b/crates/kornia-io/Cargo.toml index c6648841..d904ee1b 100644 --- a/crates/kornia-io/Cargo.toml +++ b/crates/kornia-io/Cargo.toml @@ -33,7 +33,6 @@ turbojpeg = { version = "1.0.0", optional = true } [dev-dependencies] criterion = "0.5" tempfile = "3.10" -kornia = { workspace = true, features = ["jpegturbo"] } [features] gstreamer = ["futures", "gst", "gst-app", "tokio"] diff --git a/crates/kornia-io/benches/bench_io.rs b/crates/kornia-io/benches/bench_io.rs index c5a5e853..6e778b87 100644 --- a/crates/kornia-io/benches/bench_io.rs +++ b/crates/kornia-io/benches/bench_io.rs @@ -1,6 +1,6 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use kornia::io::functional::{read_image_any, read_image_jpeg}; +use kornia_io::functional::{read_image_any, read_image_jpeg}; fn bench_read_jpeg(c: &mut Criterion) { let mut group = c.benchmark_group("JpegReader"); diff --git a/crates/kornia-io/src/functional.rs b/crates/kornia-io/src/functional.rs index 618ff9b3..d6c15244 100644 --- a/crates/kornia-io/src/functional.rs +++ b/crates/kornia-io/src/functional.rs @@ -23,8 +23,8 @@ use super::jpeg::{ImageDecoder, ImageEncoder}; /// # Example /// /// ``` -/// use kornia::image::Image; -/// use kornia::io::functional as F; +/// use kornia_image::Image; +/// use kornia_io::functional as F; /// /// let image: Image = F::read_image_jpeg("../../tests/data/dog.jpeg").unwrap(); /// @@ -92,8 +92,8 @@ pub fn write_image_jpeg(file_path: impl AsRef, image: &Image) -> Re /// # Example /// /// ``` -/// use kornia::image::Image; -/// use kornia::io::functional as F; +/// use kornia_image::Image; +/// use kornia_io::functional as F; /// /// let image: Image = F::read_image_any("../../tests/data/dog.jpeg").unwrap(); /// diff --git a/examples/color_detector/src/main.rs b/examples/color_detector/src/main.rs index 90fc4036..288c8e93 100644 --- a/examples/color_detector/src/main.rs +++ b/examples/color_detector/src/main.rs @@ -1,7 +1,7 @@ use clap::Parser; -use kornia::image::{ops, Image}; use std::path::PathBuf; +use kornia::image::{ops, Image}; use kornia::imgproc; use kornia::io::functional as F; diff --git a/examples/rtspcam/README.md b/examples/rtspcam/README.md index 3035e415..6e70d01b 100644 --- a/examples/rtspcam/README.md +++ b/examples/rtspcam/README.md @@ -1,4 +1,4 @@ -An example showing how to use the RTSP camera with the `kornia::io` module with the ability to cancel the feed after a certain amount of time. This example will display the webcam feed in a [`rerun`](https://github.com/rerun-io/rerun) window. +An example showing how to use the RTSP camera with the `kornia_io` module with the ability to cancel the feed after a certain amount of time. This example will display the webcam feed in a [`rerun`](https://github.com/rerun-io/rerun) window. NOTE: This example requires the gstremer backend to be enabled. To enable the gstreamer backend, use the `gstreamer` feature flag when building the `kornia` crate and its dependencies. @@ -6,12 +6,12 @@ NOTE: This example requires the gstremer backend to be enabled. To enable the gs Usage: rtspcam [OPTIONS] --username --password --camera-ip --camera-port --stream Options: - -u, --username - -p, --password - --camera-ip - --camera-port - -s, --stream - -d, --duration + -u, --username + -p, --password + --camera-ip + --camera-port + -s, --stream + -d, --duration -h, --help Print help ``` diff --git a/examples/video_write/README.md b/examples/video_write/README.md index 35027082..a7517fe7 100644 --- a/examples/video_write/README.md +++ b/examples/video_write/README.md @@ -1,4 +1,4 @@ -An example showing how to write a video file using the `kornia::io` module along with the webcam capture example. Visualizes the webcam feed in a [`rerun`](https://github.com/rerun-io/rerun) window. +An example showing how to write a video file using the `kornia_io` module along with the webcam capture example. Visualizes the webcam feed in a [`rerun`](https://github.com/rerun-io/rerun) window. NOTE: This example requires the gstremer backend to be enabled. To enable the gstreamer backend, use the `gstreamer` feature flag when building the `kornia` crate and its dependencies. diff --git a/examples/webcam/README.md b/examples/webcam/README.md index d762593e..89b95027 100644 --- a/examples/webcam/README.md +++ b/examples/webcam/README.md @@ -1,4 +1,4 @@ -An example showing how to use the webcam with the `kornia::io` module with the ability to cancel the feed after a certain amount of time. This example will display the webcam feed in a [`rerun`](https://github.com/rerun-io/rerun) window. +An example showing how to use the webcam with the `kornia_io` module with the ability to cancel the feed after a certain amount of time. This example will display the webcam feed in a [`rerun`](https://github.com/rerun-io/rerun) window. NOTE: This example requires the gstremer backend to be enabled. To enable the gstreamer backend, use the `gstreamer` feature flag when building the `kornia` crate and its dependencies. diff --git a/kornia-py/Cargo.toml b/kornia-py/Cargo.toml index 4ffcfd7e..2a430da5 100644 --- a/kornia-py/Cargo.toml +++ b/kornia-py/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" license-file = "LICENSE" repository = "https://github.com/kornia/kornia-rs" rust-version = "1.76" -version = "0.1.6+dev" +version = "0.1.6-rc.5" [lib] name = "kornia_rs" @@ -18,7 +18,12 @@ crate-type = ["cdylib"] [dependencies] # kornia -kornia = { path = "../crates/kornia", features = ["gstreamer", "jpegturbo"] } +kornia-image = { path = "../crates/kornia-image" } +kornia-imgproc = { path = "../crates/kornia-imgproc" } +kornia-io = { path = "../crates/kornia-io", features = [ + "gstreamer", + "jpegturbo", +] } # external pyo3 = { version = "0.21.2", features = ["extension-module"] } diff --git a/kornia-py/src/histogram.rs b/kornia-py/src/histogram.rs index b7a46f52..4f73e5e5 100644 --- a/kornia-py/src/histogram.rs +++ b/kornia-py/src/histogram.rs @@ -1,7 +1,8 @@ use pyo3::prelude::*; use crate::image::{FromPyImage, PyImage}; -use kornia::{image::Image, imgproc}; +use kornia_image::Image; +use kornia_imgproc as imgproc; /// Compute the pixel-wise histogram of an image. /// -- diff --git a/kornia-py/src/image.rs b/kornia-py/src/image.rs index 9a56fb2d..ddd96aa9 100644 --- a/kornia-py/src/image.rs +++ b/kornia-py/src/image.rs @@ -1,6 +1,6 @@ use numpy::{PyArray, PyArray3, PyArrayMethods, PyUntypedArrayMethods}; -use kornia::image::{Image, ImageError, ImageSize}; +use kornia_image::{Image, ImageError, ImageSize}; use pyo3::prelude::*; // type alias for a 3D numpy array of u8 diff --git a/kornia-py/src/io/functional.rs b/kornia-py/src/io/functional.rs index 5060c50d..eb226410 100644 --- a/kornia-py/src/io/functional.rs +++ b/kornia-py/src/io/functional.rs @@ -1,7 +1,8 @@ use pyo3::prelude::*; use crate::image::{FromPyImage, PyImage, ToPyImage}; -use kornia::{image::Image, io::functional as F}; +use kornia_image::Image; +use kornia_io::functional as F; #[pyfunction] pub fn read_image_jpeg(file_path: &str) -> PyResult { diff --git a/kornia-py/src/io/jpeg.rs b/kornia-py/src/io/jpeg.rs index 303b2518..0f189435 100644 --- a/kornia-py/src/io/jpeg.rs +++ b/kornia-py/src/io/jpeg.rs @@ -1,7 +1,5 @@ -use kornia::{ - image::Image, - io::jpeg::{ImageDecoder, ImageEncoder}, -}; +use kornia_image::Image; +use kornia_io::jpeg::{ImageDecoder, ImageEncoder}; use pyo3::prelude::*; use crate::image::{FromPyImage, PyImage, PyImageSize, ToPyImage}; diff --git a/kornia-py/src/resize.rs b/kornia-py/src/resize.rs index 22931514..d504a722 100644 --- a/kornia-py/src/resize.rs +++ b/kornia-py/src/resize.rs @@ -1,10 +1,8 @@ use pyo3::prelude::*; use crate::image::{FromPyImage, PyImage, ToPyImage}; -use kornia::{ - image::{Image, ImageSize}, - imgproc::{interpolation::InterpolationMode, resize::resize_fast}, -}; +use kornia_image::{Image, ImageSize}; +use kornia_imgproc::{interpolation::InterpolationMode, resize::resize_fast}; #[pyfunction] pub fn resize(image: PyImage, new_size: (usize, usize), interpolation: &str) -> PyResult { diff --git a/kornia-py/src/warp.rs b/kornia-py/src/warp.rs index c5903ad6..402aa5b1 100644 --- a/kornia-py/src/warp.rs +++ b/kornia-py/src/warp.rs @@ -1,9 +1,9 @@ use pyo3::prelude::*; use crate::image::{FromPyImage, PyImage, ToPyImage}; -use kornia::image::{Image, ImageSize}; -use kornia::imgproc::interpolation::InterpolationMode; -use kornia::imgproc::warp; +use kornia_image::{Image, ImageSize}; +use kornia_imgproc::interpolation::InterpolationMode; +use kornia_imgproc::warp; #[pyfunction] pub fn warp_affine( diff --git a/kornia-serve/src/compute.rs b/kornia-serve/src/compute.rs index 0cb9c49c..a488125e 100644 --- a/kornia-serve/src/compute.rs +++ b/kornia-serve/src/compute.rs @@ -71,10 +71,10 @@ pub async fn compute_mean_std(query: Json) -> impl IntoResponse { .for_each(|image_path| { // read the image let image = - kornia::io::functional::read_image_jpeg(&image_path).expect("Failed to read image"); + kornia_io::functional::read_image_jpeg(&image_path).expect("Failed to read image"); // compute the std and mean - let (std, mean) = kornia::imgproc::core::std_mean(&image); + let (std, mean) = kornia_imgproc::core::std_mean(&image); // update the total std and mean diff --git a/scripts/release_rust.sh b/scripts/release_rust.sh new file mode 100755 index 00000000..89d2559f --- /dev/null +++ b/scripts/release_rust.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +# Set dry-run as default +DRY_RUN="--dry-run" + +# Check if --no-dry-run argument is passed +if [[ "$1" == "--no-dry-run" ]]; then + DRY_RUN="" +fi + +# Publish crates +cross publish -p kornia-core $DRY_RUN +cross publish -p kornia-image $DRY_RUN +cross publish -p kornia-io --all-features $DRY_RUN +cross publish -p kornia-imgproc $DRY_RUN +cross publish -p kornia --all-features $DRY_RUN