Permalink
Browse files

major changes:

   - use ExtUtils::MakeMaker now (finally!!!)
   - build all submodules in one library
  • Loading branch information...
1 parent b1d4a84 commit 3b5106d27d209299282245b41038bd8dac90e4ff dk committed Aug 21, 2007
Showing with 218 additions and 409 deletions.
  1. +0 −18 Geometry/Geometry.c
  2. +3 −6 Geometry/Geometry.pm
  3. +0 −18 Global/Global.c
  4. +4 −8 Global/Global.pm
  5. +1 −0 Global/Region.pm
  6. +16 −12 IPA.c
  7. +87 −4 IPA.pm
  8. +7 −23 Local/Local.c
  9. +3 −8 Local/Local.pm
  10. +90 −235 Makefile.PL
  11. +0 −18 Misc/Misc.c
  12. +2 −5 Misc/Misc.pm
  13. +0 −19 Morphology/Morphology.c
  14. +0 −2 Morphology/Morphology.cls
  15. +2 −7 Morphology/Morphology.pm
  16. +0 −18 Point/Point.c
  17. +2 −7 Point/Point.pm
  18. +1 −1 include/IPAsupp.h
View
@@ -5,24 +5,6 @@
#include "Geometry.inc"
#include "GeometrySupp.h"
-PImage_vmt CImage;
-
-XS( boot_IPA__Geometry)
-{
- dXSARGS;
-
- (void)items;
-
- XS_VERSION_BOOTCHECK;
-
- register_IPA__Geometry_Package();
-
- CImage = (PImage_vmt)gimme_the_vmt( "Prima::Image");
-
- ST(0) = &sv_yes;
- XSRETURN(1);
-}
-
PImage IPA__Geometry_mirror(PImage img,HV *profile)
{
dPROFILE;
View
@@ -1,22 +1,19 @@
# $Id$
package IPA::Geometry;
-use IPA;
+
use strict;
require Exporter;
-require DynaLoader;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-@ISA = qw(Exporter DynaLoader);
-$VERSION = '0.01';
+@ISA = qw(Exporter);
+$VERSION = '0.02';
@EXPORT = qw();
@EXPORT_OK = qw(mirror shift_rotate rotate90 rotate180);
%EXPORT_TAGS = (one2one => [qw(mirror)]);
-sub dl_load_flags { 0x01 };
use constant vertical => 1;
use constant horizontal => 2;
-bootstrap IPA::Geometry $VERSION;
1;
View
@@ -6,24 +6,6 @@
#include "GlobalSupp.h"
#include "gsclose.h"
-PImage_vmt CImage;
-
-XS( boot_IPA__Global)
-{
- dXSARGS;
-
- (void)items;
-
- XS_VERSION_BOOTCHECK;
-
- register_IPA__Global_Package();
-
- CImage = (PImage_vmt)gimme_the_vmt( "Prima::Image");
-
- ST(0) = &sv_yes;
- XSRETURN(1);
-}
-
PImage IPA__Global_close_edges(PImage img,HV *profile)
{
dPROFILE;
View
@@ -1,20 +1,16 @@
# $Id$
package IPA::Global;
use strict;
-use IPA;
require Exporter;
-require DynaLoader;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-@ISA = qw(Exporter DynaLoader);
-$VERSION = '0.01';
+@ISA = qw(Exporter);
+$VERSION = '0.02';
@EXPORT = qw();
-@EXPORT_OK = qw(close_edges fill_holes area_filter identify_contours fft band_filter butterworth fourier);
+@EXPORT_OK = qw(close_edges fill_holes area_filter identify_contours
+ fft band_filter butterworth fourier identify_scanlines);
%EXPORT_TAGS = (tracks => [qw(close_edges)]);
-sub dl_load_flags { 0x01 };
-bootstrap IPA::Global $VERSION;
-
sub pow2
{
my ( $i, $j) = ( 1, $_[0]);
View
@@ -1,3 +1,4 @@
+# $Id$
use strict;
package IPA::Region;
View
28 IPA.c
@@ -1,11 +1,16 @@
/* $Id$ */
#include "IPAsupp.h"
-#include "IPA.h"
-#include "IPA.inc"
PImage_vmt CImage;
+extern void register_IPA__Global_Package( void);
+extern void register_IPA__Geometry_Package( void);
+extern void register_IPA__Misc_Package( void);
+extern void register_IPA__Local_Package( void);
+extern void register_IPA__Point_Package( void);
+extern void register_IPA__Morphology_Package( void);
+
XS( boot_IPA)
{
dXSARGS;
@@ -14,29 +19,28 @@ XS( boot_IPA)
XS_VERSION_BOOTCHECK;
- register_IPA_Package();
-
CImage = (PImage_vmt)gimme_the_vmt( "Prima::Image");
+ register_IPA__Global_Package( );
+ register_IPA__Geometry_Package( );
+ register_IPA__Misc_Package( );
+ register_IPA__Local_Package( );
+ register_IPA__Point_Package( );
+ register_IPA__Morphology_Package( );
ST(0) = &sv_yes;
XSRETURN(1);
}
-int AV2intp(SV *asv,int **array)
-{
- return 0;
-}
-
PImage create_compatible_image(PImage img,Bool copyData)
{
PImage oimg;
oimg=createImage(img->w,img->h,img->type);
if (!oimg) {
return NULL;
}
- memcpy(oimg->palette,img->palette,img->palSize);
- if (copyData) {
+ if ((( img-> type & imBPP) <= 8) && !(img->type & imGrayScale))
+ memcpy(oimg->palette,img->palette,img->palSize * 3);
+ if (copyData)
memcpy(oimg->data,img->data,img->dataSize);
- }
return oimg;
}
View
91 IPA.pm
@@ -1,7 +1,7 @@
# $Id$
package IPA;
-use Prima::Classes;
use strict;
+use Prima;
require Exporter;
require DynaLoader;
@@ -10,7 +10,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $__import);
sub dl_load_flags { 0x01 };
-$VERSION = '1.03';
+$VERSION = '1.04';
@EXPORT = qw();
@EXPORT_OK = qw();
%EXPORT_TAGS = ();
@@ -238,6 +238,18 @@ Returns a histogram-equalized image.
Supported types: Byte
+=item ab IMAGE, a, b
+
+Returns C<IMAGE*a+b>.
+
+=item exp IMAGE
+
+Retuns C<exp(IMAGE)>
+
+=item log IMAGE
+
+Retuns C<log(IMAGE)>
+
=back
=head2 IPA::Local
@@ -358,7 +370,7 @@ See L<combine>
=back
-=item median IMAGE [ w = 0, h = 0 ]
+=item median IMAGE [ w = 3, h = 3 ]
Performs adaptive thresholding with median filter with window dimensions C<w> and C<h>.
@@ -380,6 +392,62 @@ Default value of neighborhood is 8.
Supported types: Byte
+=item gaussian SIZE, SIGMA
+
+Generates a square image of the given SIZe and populates with with gaussian
+function with given SIGMA.
+
+=item laplacian SIZE, SIGMA
+
+Generates a square image of the given SIZe and populates with with inverse
+gaussian function with given SIGMA.
+
+=item gradients IMAGE
+
+This function computes a two-dimensional gradient (magnitude and direction) of
+an image, using two convolution kernels. The magnitude is computed as the
+vector magnitude of the output of the two kernels, and the direction is
+computed as the angle between the two orthogonal gradient vectors.
+
+The convolution kernels are (currently limited to) 3x3 masks for calculating
+separate vertical and horizontal derivatives.
+
+(Copyright (c) 1988 by the University of Arizona Digital Image Analysis Lab).
+
+=item canny IMAGE [ size = 3, sigma = 2, ridge = 0 ]
+
+First part of the Canny edge detector (without ridge strength
+selection). The ridge strength must be supplied by the user.
+
+=item nms IMAGE [ set = 255, clear = 0 ]
+
+Applies non-maximal suppression to the image, and replaces all
+non-maximal pixels with the C<clear> color, and maximal with C<set> color.
+
+=item scale IMAGE [ size = 3, sigma_square = 4 ]
+
+Convolves a given image with a gaussian, where the latter is
+calculated with the given size and square root of sigma_square.
+
+=item ridge IMAGE [ anorm = false, mul = 1, scale = 2, size = 3 ]
+
+First part of the Lindeberg edge detector (without scale selection). The scale
+must be supplied by the user. C<size> is used in generation of the gaussian
+kernel. C<mul> is the custom multiply factor to the calclated ridge strength,
+the maximum absolute value to the principal curvatures. C<anorm> selects
+whether the Laplacian blob response should be included ( C<false> ) ), or
+suppressed ( C<true> ).
+
+=item convolution IMAGE, KERNEL
+
+Convolves IMAGE with the given KERNEL.
+
+=item zerocross IMAGE, cmp = 0
+
+Creates a map from IMAGE where white pixels are assigned to spots
+where image crosses the zero plane. The zero level is 0 by default,
+but can be changed by setting the C<cmp> argument.
+
=back
=head2 IPA::Global
@@ -392,6 +460,8 @@ The process can be described with the mapping function
where C<s> is the pixel value in the output images, and R is the source image.
+=over
+
=item close_edges IMAGE [ gradient, maxlen, minedgelen, mingradient ]
Closes edges of shapes on IMAGE, according to specified C<gradient> image.
@@ -530,6 +600,8 @@ Threshold value of the filter.
Multiplication factor used in homomorph equalization.
+=back
+
=item butterworth IMAGE [ low = 0, spatial = 1, homomorph = 0, power = 2.0, cutoff = 20.0, boost = 0.7 ]
Performs band filtering of IMAGE in frequency domain.
@@ -793,7 +865,7 @@ NUM range: 0 - 255 .
=item histogram IMAGE
-Returns anonymous array of 256 integers, each representing
+Returns array of 256 integers, each representing
number of pixels with the corresponding value for IMAGE.
Supported types: 8-bit
@@ -846,6 +918,17 @@ L. Vincent. Morphological Grayscale Reconstruction in Image Analysis:
Applications and Efficient Algorithms.
IEEE Transactions on Image Processing, vol. 2, no. 2, April 1993, pp. 176-201.
+=item *
+
+J. Canny, "A computational approach to edge detection, " IEEE Transactions on
+Pattern Analysis and Machine Intelligence, vol. 8, pp. 679--698, 1986. 18 Weber
+and Malik
+
+=item *
+
+Tony Lindeberg . "Edge Detection and Ridge Detection with Automatic Scale Selection ".
+International Journal of Computer Vision, vol. 30, n. 2, pp. 77--116, 1996.
+
=back
=head1 AUTHORS
View
@@ -19,24 +19,6 @@ typedef enum {
sobelNESW=3
} OPERATOR_TYPE;
-PImage_vmt CImage;
-
-XS( boot_IPA__Local)
-{
- dXSARGS;
-
- (void)items;
-
- XS_VERSION_BOOTCHECK;
-
- register_IPA__Local_Package();
-
- CImage = (PImage_vmt)gimme_the_vmt( "Prima::Image");
-
- ST(0) = &sv_yes;
- XSRETURN(1);
-}
-
/*******************************************************************
* Function : crispeningByte
* Parameters : PImage img
@@ -1750,25 +1732,27 @@ PImage IPA__Local_canny(PImage img,HV *profile)
PImage IPA__Local_nms(PImage img,HV *profile)
{
dPROFILE;
- double color = 0;
+ double set = 0xFF;
+ double clear = 0;
const char *method="IPA::Local::nms";
PImage out;
if ( !img || !kind_of(( Handle) img, CImage))
croak("%s: not an image passed", method);
- if ( pexist(color)) color = pget_f(color);
+ if ( pexist(set)) set = pget_f(set);
+ if ( pexist(clear)) clear = pget_f(clear);
out = create_compatible_image( img, true);
PIX_SRC_DST( img, out,
*dst = (
(y > 0 && (
- (x > 0 && src[src_ls-1] > *src) || (x < w - 1 && src[src_ls+1] > *src)
+ (x > 0 && src[-src_ls-1] > *src) || (x < w - 1 && src[-src_ls+1] > *src) || (src[-src_ls] > *src)
)) ||
(y < h-1 && (
- (x > 0 && src[src_ls-1] > *src) || (x < w - 1 && src[src_ls+1] > *src)
+ (x > 0 && src[src_ls-1] > *src) || (x < w - 1 && src[src_ls+1] > *src) || (src[src_ls] > *src)
)) ||
(x > 0 && src[-1] > *src) || (x < w - 1 && src[1] > *src)
- ) ? color : *src
+ ) ? clear : set
);
return out;
}
Oops, something went wrong.

0 comments on commit 3b5106d

Please sign in to comment.