Skip to content

Commit 208c70d

Browse files
committed
fix: ocr luminance calculation fix
1 parent 3f44115 commit 208c70d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/rust/src/hardsubx/imgops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use palette::{FromColor, Hsv, Lab, Srgb};
1+
use palette::{FromColor, Hsv, Lab, LinSrgb};
22

33
#[no_mangle]
44
pub extern "C" fn rgb_to_hsv(R: f32, G: f32, B: f32, H: &mut f32, S: &mut f32, V: &mut f32) {
5-
let rgb = Srgb::new(R, G, B);
5+
let rgb = LinSrgb::new(R, G, B);
66

77
let hsv_rep = Hsv::from_color(rgb);
88

@@ -14,7 +14,7 @@ pub extern "C" fn rgb_to_hsv(R: f32, G: f32, B: f32, H: &mut f32, S: &mut f32, V
1414
#[no_mangle]
1515
pub extern "C" fn rgb_to_lab(R: f32, G: f32, B: f32, L: &mut f32, a: &mut f32, b: &mut f32) {
1616
// Normalize input RGB from 0-255 to 0.0-1.0
17-
let rgb = Srgb::new(R / 255.0, G / 255.0, B / 255.0);
17+
let rgb = LinSrgb::new(R / 255.0, G / 255.0, B / 255.0);
1818

1919
// Convert from sRGB to Lab (D65 white point is default)
2020
let lab_rep = Lab::from_color(rgb);

0 commit comments

Comments
 (0)