Navigation Menu

Skip to content

Commit

Permalink
Fix sobel implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron42net committed Aug 1, 2018
1 parent 34c6f6a commit 44448b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/fotomat/version.go
Expand Up @@ -2,5 +2,5 @@ package main


const ( const (
// FotomatVersion is updated by git-hooks/pre-commit // FotomatVersion is updated by git-hooks/pre-commit
FotomatVersion = "2.8.241" FotomatVersion = "2.8.242"
) )
20 changes: 14 additions & 6 deletions vips/convolution.h
Expand Up @@ -59,18 +59,26 @@ cgo_sobel(VipsImage *in, VipsImage **out) {


VipsImage *sx = NULL; VipsImage *sx = NULL;
VipsImage *sy = NULL; VipsImage *sy = NULL;
VipsImage *ax = NULL;
VipsImage *ay = NULL;
VipsImage *add = NULL; VipsImage *add = NULL;


int ret = -1; int ret = -1;
if (!vips_conv(band, &sx, x, NULL)) { if (!vips_conv(band, &sx, x, NULL)) {
if (!vips_conv(band, &sy, y, NULL)) { if (!vips_abs(sx, &ax, NULL)) {
if (!vips_add(sx, sy, &add, NULL)) { if (!vips_conv(band, &sy, y, NULL)) {
if (!vips_cast(add, out, VIPS_FORMAT_UCHAR, NULL)) { if (!vips_abs(sy, &ay, NULL)) {
ret = 0; 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); g_object_unref(sx);
} }
Expand Down

0 comments on commit 44448b2

Please sign in to comment.