Skip to content

Commit

Permalink
pass into hist_find_ndim
Browse files Browse the repository at this point in the history
  • Loading branch information
n0vad3v committed Nov 14, 2024
1 parent bba2167 commit 9ab4185
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions vips/arithmetic.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ int hist_find(VipsImage *in, VipsImage **out) {
return vips_hist_find(in, out, NULL);
}

int hist_find_ndim(VipsImage *in, VipsImage **out) {
return vips_hist_find_ndim(in, out, NULL);
int hist_find_ndim(VipsImage *in, VipsImage **out, int bins) {
return vips_hist_find_ndim(in, out, "bins", bins, NULL);
}

int hist_cum(VipsImage *in, VipsImage **out) {
Expand Down
4 changes: 2 additions & 2 deletions vips/arithmetic.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ func vipsHistFind(in *C.VipsImage) (*C.VipsImage, error) {
}

// https://www.libvips.org/API/current/libvips-arithmetic.html#vips-hist-find-ndim
func vipsHistFindNdim(in *C.VipsImage) (*C.VipsImage, error) {
func vipsHistFindNdim(in *C.VipsImage, bins int) (*C.VipsImage, error) {
incOpCounter("histFindNdim")
var out *C.VipsImage

if err := C.hist_find_ndim(in, &out); err != 0 {
if err := C.hist_find_ndim(in, &out, C.int(bins)); err != 0 {
return nil, handleImageError(out)
}

Expand Down
2 changes: 1 addition & 1 deletion vips/arithmetic.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int stats(VipsImage *in, VipsImage **out);
int maxpos(VipsImage *in, double *out);
int minpos(VipsImage *in, double *out);
int hist_find(VipsImage *in, VipsImage **out);
int hist_find_ndim(VipsImage *in, VipsImage **out);
int hist_find_ndim(VipsImage *in, VipsImage **out, int bins);
int hist_cum(VipsImage *in, VipsImage **out);
int hist_norm(VipsImage *in, VipsImage **out);
int hist_entropy(VipsImage *in, double *out);
5 changes: 3 additions & 2 deletions vips/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -1720,8 +1720,9 @@ func (r *ImageRef) HistogramFind() error {
return nil
}

func (r *ImageRef) HistogramFindNdim() error {
out, err := vipsHistFindNdim(r.image)
// Make a one, two or three dimensional histogram of a 1, 2 or 3 band image. Divide each axis into `bins` bins .. ie. output is 1 x bins, bins x bins, or bins x bins x bins bands. bins defaults to 10.
func (r *ImageRef) HistogramFindNdim(bins int) error {
out, err := vipsHistFindNdim(r.image, bins)
if err != nil {
return err
}
Expand Down

0 comments on commit 9ab4185

Please sign in to comment.