gtkdoc for im_zerox
This commit is contained in:
parent
297890cebd
commit
9643cc6606
|
@ -1,16 +1,4 @@
|
||||||
/* @(#) Functions which detects the +ve and -ve edges of
|
/* detect zero-crossings
|
||||||
* @(#) zero crossings of an image depending on the flag
|
|
||||||
* @(#) Function im_zerox() assumes that the imin file is an integer image
|
|
||||||
* @(#) either memory mapped or in a buffer.
|
|
||||||
* @(#) The output image is byte with
|
|
||||||
* @(#) zero crossing set to 255 and all othre values set to zero
|
|
||||||
* @(#)
|
|
||||||
* @(#) int im_zerox(pimin, pimout, flag)
|
|
||||||
* @(#) IMAGE *pimin, *pimout;
|
|
||||||
* @(#) int flag;
|
|
||||||
* @(#)
|
|
||||||
* @(#) All functions return 0 on success and -1 on error
|
|
||||||
* @(#)
|
|
||||||
*
|
*
|
||||||
* Copyright: 1990, N. Dessipris.
|
* Copyright: 1990, N. Dessipris.
|
||||||
*
|
*
|
||||||
|
@ -22,6 +10,9 @@
|
||||||
* - some bugs removed
|
* - some bugs removed
|
||||||
* 11/5/06
|
* 11/5/06
|
||||||
* - small clean ups
|
* - small clean ups
|
||||||
|
* 11/11/10
|
||||||
|
* - small cleanups
|
||||||
|
* - gtkdoc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -64,7 +55,7 @@
|
||||||
#include <dmalloc.h>
|
#include <dmalloc.h>
|
||||||
#endif /*WITH_DMALLOC*/
|
#endif /*WITH_DMALLOC*/
|
||||||
|
|
||||||
#define loop( TYPE ) \
|
#define LOOP( TYPE ) { \
|
||||||
for( i = 0; i < ne; i++ ) { \
|
for( i = 0; i < ne; i++ ) { \
|
||||||
TYPE p1 = ((TYPE *)p)[i]; \
|
TYPE p1 = ((TYPE *)p)[i]; \
|
||||||
TYPE p2 = ((TYPE *)p)[i + ba]; \
|
TYPE p2 = ((TYPE *)p)[i + ba]; \
|
||||||
|
@ -75,7 +66,8 @@
|
||||||
q[i] = 255; \
|
q[i] = 255; \
|
||||||
else \
|
else \
|
||||||
q[i] = 0; \
|
q[i] = 0; \
|
||||||
}
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
/* Zerox generate function.
|
/* Zerox generate function.
|
||||||
*/
|
*/
|
||||||
|
@ -112,43 +104,56 @@ zerox_gen( REGION *or, void *seq, void *a, void *b )
|
||||||
PEL *q = (PEL *) IM_REGION_ADDR( or, le, y );
|
PEL *q = (PEL *) IM_REGION_ADDR( or, le, y );
|
||||||
|
|
||||||
switch( in->BandFmt ) {
|
switch( in->BandFmt ) {
|
||||||
case IM_BANDFMT_CHAR: loop( signed char ); break;
|
case IM_BANDFMT_CHAR: LOOP( signed char ); break;
|
||||||
case IM_BANDFMT_SHORT: loop( signed short ); break;
|
case IM_BANDFMT_SHORT: LOOP( signed short ); break;
|
||||||
case IM_BANDFMT_INT: loop( signed int ); break;
|
case IM_BANDFMT_INT: LOOP( signed int ); break;
|
||||||
case IM_BANDFMT_FLOAT: loop( float ); break;
|
case IM_BANDFMT_FLOAT: LOOP( float ); break;
|
||||||
case IM_BANDFMT_DOUBLE: loop( double ); break;
|
case IM_BANDFMT_DOUBLE: LOOP( double ); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error_exit( "im_zerox: internal error" );
|
g_assert( 0 );
|
||||||
/*NOTREACHED*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* im_zerox:
|
||||||
|
* @in: input image
|
||||||
|
* @out: output image
|
||||||
|
* @sign: detect positive or negative zero crossings
|
||||||
|
*
|
||||||
|
* im_zerox() detects the positive or negative zero crossings @in,
|
||||||
|
* depending on @sign. If @sign is -1, negative zero crossings are returned,
|
||||||
|
* if @sign is 1, positive zero crossings are returned.
|
||||||
|
*
|
||||||
|
* The output image is byte with zero crossing set to 255 and all other values
|
||||||
|
* set to zero. Input can have any number of channels, and be any non-complex
|
||||||
|
* type.
|
||||||
|
*
|
||||||
|
* See also: im_conv(), im_rot90.
|
||||||
|
*
|
||||||
|
* Returns: 0 on success, -1 on error
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
im_zerox( IMAGE *in, IMAGE *out, int flag )
|
im_zerox( IMAGE *in, IMAGE *out, int flag )
|
||||||
{
|
{
|
||||||
IMAGE *t1 = im_open_local( out, "im_zerox#1" , "p" );
|
IMAGE *t1;
|
||||||
|
|
||||||
if( !t1 )
|
|
||||||
return( -1 );
|
|
||||||
if( flag != -1 && flag != 1 ) {
|
if( flag != -1 && flag != 1 ) {
|
||||||
im_error( "im_zerox", "%s", _( "flag not -1 or 1" ) );
|
im_error( "im_zerox", "%s", _( "flag not -1 or 1" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
if( im_piocheck( in, t1 ) )
|
|
||||||
return( -1 );
|
|
||||||
if( vips_bandfmt_iscomplex( in->BandFmt ) ||
|
|
||||||
in->Coding != IM_CODING_NONE ) {
|
|
||||||
im_error( "im_zerox", "%s", _( "non-complex uncoded only" ) );
|
|
||||||
return( -1 );
|
|
||||||
}
|
|
||||||
if( in->Xsize < 2 ) {
|
if( in->Xsize < 2 ) {
|
||||||
im_error( "im_zerox", "%s", _( "image too narrow" ) );
|
im_error( "im_zerox", "%s", _( "image too narrow" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
if( !(t1 = im_open_local( out, "im_zerox" , "p" )) ||
|
||||||
|
im_piocheck( in, t1 ) ||
|
||||||
|
im_check_uncoded( "im_zerox", in ) ||
|
||||||
|
im_check_noncomplex( "im_zerox", in ) )
|
||||||
|
return( -1 );
|
||||||
if( vips_bandfmt_isuint( in->BandFmt ) )
|
if( vips_bandfmt_isuint( in->BandFmt ) )
|
||||||
/* Unsigned type, therefore there will be no zero-crossings.
|
/* Unsigned type, therefore there will be no zero-crossings.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue