switch to new im_compass()
plus im_linedet() and im_gradient()
This commit is contained in:
parent
25fd67bb84
commit
2e3d7db0e6
@ -1,6 +1,7 @@
|
|||||||
19/10/13 started 7.37.0
|
19/10/13 started 7.37.0
|
||||||
- redone im_rotate_*mask45(), im_gauss_*mask*(), im_log_*mask(), im_dilate(),
|
- redone im_rotate_*mask45(), im_gauss_*mask*(), im_log_*mask(), im_dilate(),
|
||||||
im_erode(), im_rank_image() as classes
|
im_erode(), im_rank_image(), im_compass(), im_linedet(), im_gradient()
|
||||||
|
as classes
|
||||||
- vips_init() now does some ABI compat checking, though this change requires
|
- vips_init() now does some ABI compat checking, though this change requires
|
||||||
an ABI break
|
an ABI break
|
||||||
- add "interlace" option to vips_jpegsave()
|
- add "interlace" option to vips_jpegsave()
|
||||||
|
11
TODO
11
TODO
@ -1,13 +1,4 @@
|
|||||||
- started compass .. convolution with a rotating mask
|
- need to do conv sep
|
||||||
|
|
||||||
vips im_gradient k2.jpg x.v line.mat
|
|
||||||
vips compass k2.jpg x2.v line.mat --times 2 --angle 90 --combine sum
|
|
||||||
|
|
||||||
should give the same result, you'd think
|
|
||||||
|
|
||||||
deprecated/vips7compat.c defs for compass/grad/lindet commented out for now
|
|
||||||
|
|
||||||
need to do sep
|
|
||||||
|
|
||||||
- do conv and morph quickly as simple wrappers over the vips7 operations
|
- do conv and morph quickly as simple wrappers over the vips7 operations
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ libconvolution_la_SOURCES = \
|
|||||||
morph.c \
|
morph.c \
|
||||||
convol_dispatch.c \
|
convol_dispatch.c \
|
||||||
im_addgnoise.c \
|
im_addgnoise.c \
|
||||||
im_compass.c \
|
|
||||||
im_aconv.c \
|
im_aconv.c \
|
||||||
im_aconvsep.c \
|
im_aconvsep.c \
|
||||||
im_conv.c \
|
im_conv.c \
|
||||||
|
@ -1,158 +0,0 @@
|
|||||||
/* im_compass
|
|
||||||
*
|
|
||||||
* Author: N. Dessipris (Copyright, N. Dessipris 1991)
|
|
||||||
* Written on: 08/05/1991
|
|
||||||
* Modified on:
|
|
||||||
* 11/3/01 JC
|
|
||||||
* - rewritten, calling im_conv() and im_maxvalue()
|
|
||||||
* 3/2/10
|
|
||||||
* - gtkdoc
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
This file is part of VIPS.
|
|
||||||
|
|
||||||
VIPS is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
02110-1301 USA
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <config.h>
|
|
||||||
#endif /*HAVE_CONFIG_H*/
|
|
||||||
#include <vips/intl.h>
|
|
||||||
|
|
||||||
#include <vips/vips.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* im_lindetect:
|
|
||||||
* @in: input image
|
|
||||||
* @out: output image
|
|
||||||
* @mask: convolution mask
|
|
||||||
*
|
|
||||||
* @in is convolved four times with @mask, each time @mask is rotated by 45
|
|
||||||
* degrees. Each output pixel is the largest absolute value of the four
|
|
||||||
* convolutions.
|
|
||||||
*
|
|
||||||
* See also: im_compass(), im_gradient(), im_conv().
|
|
||||||
*
|
|
||||||
* Returns: 0 on success, -1 on error
|
|
||||||
*/
|
|
||||||
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 = im_local_imask( out,
|
|
||||||
im_rotate_imask45( mask, mask->filename ) )) )
|
|
||||||
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 );
|
|
||||||
}
|
|
@ -1011,9 +1011,9 @@ im_conv_raw( IMAGE *in, IMAGE *out, INTMASK *mask )
|
|||||||
im_generate_fn generate;
|
im_generate_fn generate;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#endif /*DEBUG*/
|
|
||||||
printf( "im_conv_raw: starting with matrix:\n" );
|
printf( "im_conv_raw: starting with matrix:\n" );
|
||||||
im_print_imask( mask );
|
im_print_imask( mask );
|
||||||
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
/* Check parameters.
|
/* Check parameters.
|
||||||
*/
|
*/
|
||||||
|
@ -2088,7 +2088,6 @@ im_recomb( IMAGE *in, IMAGE *out, DOUBLEMASK *recomb )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
int
|
int
|
||||||
im_compass( VipsImage *in, VipsImage *out, INTMASK *mask )
|
im_compass( VipsImage *in, VipsImage *out, INTMASK *mask )
|
||||||
{
|
{
|
||||||
@ -2162,7 +2161,6 @@ im_gradient( IMAGE *in, IMAGE *out, INTMASK *mask )
|
|||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vips__round( VipsImage *in, VipsImage *out, VipsOperationRound round )
|
vips__round( VipsImage *in, VipsImage *out, VipsOperationRound round )
|
||||||
|
@ -81,20 +81,12 @@ void vips_convolution_operation_init( void );
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int im_aconvsep( VipsImage *in, VipsImage *out,
|
int im_aconvsep( VipsImage *in, VipsImage *out,
|
||||||
DOUBLEMASK *mask, int n_layers );
|
DOUBLEMASK *mask, int n_layers );
|
||||||
int im_aconv( VipsImage *in, VipsImage *out,
|
|
||||||
DOUBLEMASK *mask, int n_layers, int cluster );
|
|
||||||
int im_conv( VipsImage *in, VipsImage *out, INTMASK *mask );
|
|
||||||
int im_conv_f( VipsImage *in, VipsImage *out, DOUBLEMASK *mask );
|
|
||||||
int im_convsep( VipsImage *in, VipsImage *out, INTMASK *mask );
|
int im_convsep( VipsImage *in, VipsImage *out, INTMASK *mask );
|
||||||
int im_convsep_f( VipsImage *in, VipsImage *out, DOUBLEMASK *mask );
|
int im_convsep_f( VipsImage *in, VipsImage *out, DOUBLEMASK *mask );
|
||||||
|
|
||||||
int im_compass( VipsImage *in, VipsImage *out, INTMASK *mask );
|
|
||||||
int im_gradient( VipsImage *in, VipsImage *out, INTMASK *mask );
|
|
||||||
int im_lindetect( VipsImage *in, VipsImage *out, INTMASK *mask );
|
|
||||||
|
|
||||||
int im_sharpen( VipsImage *in, VipsImage *out,
|
int im_sharpen( VipsImage *in, VipsImage *out,
|
||||||
int mask_size,
|
int mask_size,
|
||||||
double x1, double y2, double y3,
|
double x1, double y2, double y3,
|
||||||
|
@ -42,9 +42,6 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int im_dilate( VipsImage *in, VipsImage *out, INTMASK *mask );
|
|
||||||
int im_erode( VipsImage *in, VipsImage *out, INTMASK *mask );
|
|
||||||
|
|
||||||
int im_rank( VipsImage *in, VipsImage *out, int width, int height, int index );
|
int im_rank( VipsImage *in, VipsImage *out, int width, int height, int index );
|
||||||
|
|
||||||
int im_cntlines( VipsImage *im, double *nolines, int flag );
|
int im_cntlines( VipsImage *im, double *nolines, int flag );
|
||||||
|
@ -897,6 +897,18 @@ int im_tone_map( VipsImage *in, VipsImage *out, VipsImage *lut );
|
|||||||
*/
|
*/
|
||||||
#define vips_class_map_concrete_all vips_class_map_all
|
#define vips_class_map_concrete_all vips_class_map_all
|
||||||
|
|
||||||
|
int im_dilate( VipsImage *in, VipsImage *out, INTMASK *mask );
|
||||||
|
int im_erode( VipsImage *in, VipsImage *out, INTMASK *mask );
|
||||||
|
|
||||||
|
int im_aconv( VipsImage *in, VipsImage *out,
|
||||||
|
DOUBLEMASK *mask, int n_layers, int cluster );
|
||||||
|
int im_conv( VipsImage *in, VipsImage *out, INTMASK *mask );
|
||||||
|
int im_conv_f( VipsImage *in, VipsImage *out, DOUBLEMASK *mask );
|
||||||
|
|
||||||
|
int im_compass( VipsImage *in, VipsImage *out, INTMASK *mask );
|
||||||
|
int im_gradient( VipsImage *in, VipsImage *out, INTMASK *mask );
|
||||||
|
int im_lindetect( VipsImage *in, VipsImage *out, INTMASK *mask );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
Loading…
Reference in New Issue
Block a user