Permalink
Browse files

Fix sobel implementation.

  • Loading branch information...
aaron42net committed Aug 1, 2018
1 parent 34c6f6a commit 44448b2f4c6a330b6a4df57b62b9908976e30b22
Showing with 15 additions and 7 deletions.
  1. +1 −1 cmd/fotomat/version.go
  2. +14 −6 vips/convolution.h
View
@@ -2,5 +2,5 @@ package main
const (
// FotomatVersion is updated by git-hooks/pre-commit
FotomatVersion = "2.8.241"
FotomatVersion = "2.8.242"
)
View
@@ -59,18 +59,26 @@ cgo_sobel(VipsImage *in, VipsImage **out) {
VipsImage *sx = NULL;
VipsImage *sy = NULL;
VipsImage *ax = NULL;
VipsImage *ay = NULL;
VipsImage *add = NULL;
int ret = -1;
if (!vips_conv(band, &sx, x, NULL)) {
if (!vips_conv(band, &sy, y, NULL)) {
if (!vips_add(sx, sy, &add, NULL)) {
if (!vips_cast(add, out, VIPS_FORMAT_UCHAR, NULL)) {
ret = 0;
if (!vips_abs(sx, &ax, NULL)) {
if (!vips_conv(band, &sy, y, NULL)) {
if (!vips_abs(sy, &ay, NULL)) {
if (!vips_add(ax, ay, &add, NULL)) {
if (!vips_cast(add, out, VIPS_FORMAT_UCHAR, NULL)) {
ret = 0;
}
g_object_unref(add);
}
g_object_unref(ay);
}
g_object_unref(add);
g_object_unref(sy);
}
g_object_unref(sy);
g_object_unref(ax);
}
g_object_unref(sx);
}

0 comments on commit 44448b2

Please sign in to comment.