Skip to content

Commit

Permalink
zoom according to aspect ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
bertiqwerty committed Nov 11, 2024
1 parent 03acb39 commit b3b8f9c
Show file tree
Hide file tree
Showing 13 changed files with 145 additions and 90 deletions.
86 changes: 37 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions rvimage-domain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ name = "rvimage-domain"
license = "MIT OR Apache-2.0"
description = "Process elements in the image domain such as polygons or bounding boxes for RV Image"
readme = "README.md"
version = "0.4.5"
version = "0.4.6"
homepage = "https://github.com/bertiqwerty/rvimage"
repository = "https://github.com/bertiqwerty/rvimage"
keywords = ["polygon", "RLE", "canvas", "image"]
categories = ["computer-vision"]

[dependencies]
serde = { version = "~1.0", features = ["derive"] }
serde_json = "~1.0"
image = "~0.25"
imageproc = "~0.25"
serde = { version = "1.0.214", features = ["derive"] }
serde_json = "1.0.132"
image = "0.25.4"
imageproc = "0.25"
6 changes: 3 additions & 3 deletions rvimage-domain/src/bb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,14 @@ impl BbF {
Self::from_arr(&[x, y, w, h])
}

pub fn center_scale(&self, factor: f64, shape: ShapeI) -> Self {
pub fn center_scale(&self, x_factor: f64, y_factor: f64, shape: ShapeI) -> Self {
let x = self.x;
let y = self.y;
let w = self.w;
let h = self.h;
let (cx, cy) = (w * 0.5 + x, h * 0.5 + y);
let topleft = (cx + factor * (x - cx), cy + factor * (y - cy));
let btmright = (cx + factor * (x + w - cx), cy + factor * (y + h - cy));
let topleft = (cx + x_factor * (x - cx), cy + y_factor * (y - cy));
let btmright = (cx + x_factor * (x + w - cx), cy + y_factor * (y + h - cy));
let (x_tl, y_tl) = topleft;
let (x_br, y_br) = btmright;
let w = x_br - x_tl;
Expand Down
9 changes: 5 additions & 4 deletions rvimage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,24 @@ regex = "1.11.0"
reqwest = { version = "0.12.8", features = ["blocking", "json"] }
rfd = "0.15.0"
rusttype = "0.9.3"
serde = { version = "1.0.210", features = ["derive"] }
serde_json = "1.0.128"
serde = { version = "1.0.214", features = ["derive"] }
serde_json = "1.0.132"
ssh2 = { version = "0.9.4", features = [
"vendored-openssl",
"openssl-on-win32",
] }
toml = "0.8.19"
walkdir = "2.5"
tokio = { version = "1.40.0", optional = true, features = ["rt-multi-thread"] }
tokio = { version = "1.41.1", optional = true, features = ["rt-multi-thread"] }
uuid = { version = "1.11.0", features = ["v4", "fast-rng"] }
exmex = "0.20.3"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
tracing-appender = "0.2.3"
backtrace = "0.3.74"
zip = "2.2.0"
rvimage-domain = "0.4.5"
# rvimage-domain = "0.4.5"
rvimage-domain = { "path" = "../rvimage-domain" }
clap = { version = "4.5.20", features = ["derive"] }
chrono = { version = "0.4.38", features = ["serde"] }
whoami = "1.5.2"
Loading

0 comments on commit b3b8f9c

Please sign in to comment.