Esempio n. 1
0
/* Call im_profile via arg vector.
 */
static int
profile_vec( im_object *argv )
{
	int dir = *((int *) argv[2]);

	return( im_profile( argv[0], argv[1], dir ) );
}
Esempio n. 2
0
/**
 * im_mpercent_hist:
 * @hist: input histogram image
 * @percent: threshold percentage
 * @out: output threshold value
 *
 * Just like im_mpercent(), except it works on an image histogram. Handy if
 * you want to run im_mpercent() several times without having to recompute the
 * histogram each time.
 *
 * See also: im_mpercent().
 *
 * Returns: 0 on success, -1 on error
 */
int
im_mpercent_hist( IMAGE *hist, double percent, int *out )
{
	IMAGE *base;
	IMAGE *t[6];
	double pos;

	if( im_check_hist( "im_mpercent", hist ) )
		return( -1 );

	if( !(base = im_open( "im_mpercent", "p" )) )
		return( -1 );
	if( im_open_local_array( base, t, 6, "im_mpercent", "p" ) ) {
		im_close( base );
		return( -1 );
	}

	if( im_histcum( hist, t[1] ) ||
		im_histnorm( t[1], t[2] ) ||
		im_lessconst( t[2], t[3], percent * t[2]->Xsize ) ||
		im_fliphor( t[3], t[4] ) ||
		im_profile( t[4], t[5], 1 ) ||
		im_avg( t[5], &pos ) ) {
		im_close( base );
		return( -1 );
	}
	im_close( base );

	*out = pos;

	return( 0 );
}
Esempio n. 3
0
static VALUE
img_profile(VALUE obj, int dir)
{
	GetImg(obj, data, im);
	OutImg(obj, new, data_new, im_new);

    if (im_profile(im, im_new, dir))
        vips_lib_error();

    return new;
}