Skip to content

Commit 2ead875

Browse files
author
Adrià Arrufat
committed
Update face aligment example
1 parent c784809 commit 2ead875

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

examples/build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
.dependencies = .{
66
.zignal = .{
7-
.url = "https://github.com/bfactory-ai/zignal/archive/0776105d88325fbeb42f11e6a99371ace421e20b.tar.gz",
8-
.hash = "12204c77931cfeaa780324506f738baf97c2a95f8c4fccf30a3e1fa8fdbe0f87bb27",
7+
.url = "https://github.com/bfactory-ai/zignal/archive/c784809c4c0eb914694998b5434c25d9efd379b9.tar.gz",
8+
.hash = "1220a6447aee50bedc4ecea70a562ef2833267011878db344661627485cdce756b80",
99
},
1010
},
1111

examples/src/face_alignment.zig

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ pub fn extractAlignedFace(
5959
const angle = std.math.atan2(p.y, p.x);
6060
const scale = @sqrt(p.x * p.x + p.y * p.y);
6161
const center = transform.project(.{ .x = side / 2, .y = side / 2 });
62-
var rotated = try image.rotateFrom(allocator, center.x, center.y, angle);
62+
var rotated: Image(Rgba) = undefined;
63+
try image.rotateFrom(allocator, center, angle, &rotated);
6364
defer rotated.deinit(allocator);
6465

6566
const rect = Rectangle.initCenter(center.x, center.y, side * scale, side * scale);
66-
var crop = try rotated.crop(allocator, rect);
67-
defer crop.deinit(allocator);
68-
crop.resize(out);
67+
var chip: Image(Rgba) = undefined;
68+
try rotated.crop(allocator, rect, &chip);
69+
defer chip.deinit(allocator);
70+
chip.resize(out);
6971
}
7072

7173
pub export fn extract_aligned_face(

src/image.zig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ const std = @import("std");
22
const Allocator = std.mem.Allocator;
33
const Rgba = @import("color.zig").Rgba;
44
const as = @import("meta.zig").as;
5-
const isScalar = @import("meta.zig").isScalar;
6-
const isStruct = @import("meta.zig").isStruct;
75
const Rectangle = @import("geometry.zig").Rectangle(f32);
86
const Point2d = @import("point.zig").Point2d(f32);
97

0 commit comments

Comments
 (0)