int im_lindetect( IMAGE *in, IMAGE *out, INTMASK *mask ) { IMAGE *filtered[4]; IMAGE *absed[4]; int i; if( im_open_local_array( out, filtered, 4, "im_lindetect:1", "p" ) || im_open_local_array( out, absed, 4, "im_lindetect:2", "p" ) ) return( -1 ); for( i = 0; i < 4; i++ ) { if( im_conv( in, filtered[i], mask ) || !(mask = (INTMASK *) im_local( out, (im_construct_fn) im_rotate_imask45, (im_callback_fn) im_free_imask, mask, mask->filename, NULL )) ) return( -1 ); } for( i = 0; i < 4; i++ ) if( im_abs( filtered[i], absed[i] ) ) return( -1 ); return( im_maxvalue( absed, out, 4 ) ); }
/** * im_gradient: * @in: input image * @out: output image * @mask: convolution mask * * @in is convolved with @mask and with @mask after a 90 degree rotation. The * result is the sum of the absolute value of the two convolutions. * * See also: im_lindetect(), im_gradient(), im_conv(). * * Returns: 0 on success, -1 on error */ int im_gradient( IMAGE *in, IMAGE *out, INTMASK *mask ) { IMAGE *t[4]; INTMASK *rmask; if( im_open_local_array( out, t, 4, "im_gradient", "p" ) ) return( -1 ); if( !(rmask = im_local_imask( out, im_rotate_imask90( mask, mask->filename ) )) ) return( -1 ); if( im_conv( in, t[0], mask ) || im_conv( in, t[1], rmask ) || im_abs( t[0], t[2] ) || im_abs( t[1], t[3] ) || im_add( t[2], t[3], out ) ) return( -1 ); return( 0 ); }
int im_gradient( IMAGE *in, IMAGE *out, INTMASK *mask ) { IMAGE *t[GTEMPS]; INTMASK *rmask; if( im_open_local_array( out, t, GTEMPS, "im_gradient", "p" ) ) return( -1 ); if( !(rmask = (INTMASK *) im_local( out, (im_construct_fn) im_rotate_imask90, (im_callback_fn) im_free_imask, mask, mask->filename, NULL )) ) return( -1 ); if( im_conv( in, t[0], mask ) || im_conv( in, t[1], rmask ) || im_abs( t[0], t[2] ) || im_abs( t[1], t[3] ) || im_add( t[2], t[3], out ) ) return( -1 ); return( 0 ); }
static int disp_ps( IMAGE *dummy, IMAGE *in, IMAGE *out ) { IMAGE *t[3]; if( im_open_local_array( out, t, 3, "im_disp_ps temp 1", "p" ) ) return( -1 ); if( in->BandFmt != IM_BANDFMT_COMPLEX ) { if( im_fwfft( in, t[0] ) ) return( -1 ); in = t[0]; } if( im_abs( in, t[1] ) || im_scaleps( t[1], t[2] ) || im_rotquad( t[2], out ) ) return( -1 ); return( 0 ); }
/** * im_compass: * @in: input image * @out: output image * @mask: convolution mask * * @in is convolved 8 times with @mask, each time @mask is rotated by 45 * degrees. Each output pixel is the largest absolute value of the 8 * convolutions. * * See also: im_lindetect(), im_gradient(), im_conv(). * * Returns: 0 on success, -1 on error */ int im_compass( IMAGE *in, IMAGE *out, INTMASK *mask ) { IMAGE *filtered[8]; IMAGE *absed[8]; int i; if( im_open_local_array( out, filtered, 8, "im_compass:1", "p" ) || im_open_local_array( out, absed, 8, "im_compass:2", "p" ) ) return( -1 ); for( i = 0; i < 8; i++ ) { if( im_conv( in, filtered[i], mask ) || !(mask = im_local_imask( out, im_rotate_imask45( mask, mask->filename ) )) ) return( -1 ); } for( i = 0; i < 8; i++ ) if( im_abs( filtered[i], absed[i] ) ) return( -1 ); return( im_maxvalue( absed, out, 8 ) ); }
int im_c2ps( IMAGE *in, IMAGE *out ) { return( im_abs( in, out ) ); }