From dfc9c0efaa7b16e32e29490abc0ad2744aef2fb5 Mon Sep 17 00:00:00 2001 From: cristy Date: Fri, 31 Oct 2014 17:20:14 +0000 Subject: [PATCH] --- MagickCore/vision.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/MagickCore/vision.c b/MagickCore/vision.c index 2f9990146..8f9a90813 100644 --- a/MagickCore/vision.c +++ b/MagickCore/vision.c @@ -252,6 +252,8 @@ static MagickBooleanType ConnectedComponentsStatistics(const Image *image, if (status == MagickFalse) break; + if (object[i].area < MagickEpsilon) + continue; GetColorTuple(&object[i].color,MagickFalse,mean_color); (void) fprintf(stdout, " %.20g: %.20gx%.20g%+.20g%+.20g %.1f,%.1f %.20g %s\n",(double) @@ -556,7 +558,7 @@ MagickExport Image *ConnectedComponentsImage(const Image *image, GetPixelInfoPixel(image,p+neighbor_offset,&target); if (((x+dx) < 0) || ((x+dx) >= (ssize_t) image->columns) || ((y+dy) < 0) || ((y+dy) >= (ssize_t) image->rows) || - (IsEquivalentIntensity(image,&pixel,&target) == MagickFalse)) + (IsFuzzyEquivalencePixelInfo(&pixel,&target) == MagickFalse)) { p+=GetPixelChannels(image); continue; @@ -670,10 +672,6 @@ MagickExport Image *ConnectedComponentsImage(const Image *image, component_image=DestroyImage(component_image); ThrowImageException(ResourceLimitError,"TooManyObjects"); } - artifact=GetImageArtifact(image,"connected-components:verbose"); - if (IsStringTrue(artifact) != MagickFalse) - status=ConnectedComponentsStatistics(image,component_image,(size_t) n, - exception); artifact=GetImageArtifact(image,"connected-components:area-threshold"); area_threshold=0.0; if (artifact != (const char *) NULL) @@ -681,6 +679,10 @@ MagickExport Image *ConnectedComponentsImage(const Image *image, if (area_threshold > 0.0) status=MergeConnectedComponents(component_image,(size_t) n,area_threshold, exception); + artifact=GetImageArtifact(image,"connected-components:verbose"); + if (IsStringTrue(artifact) != MagickFalse) + status=ConnectedComponentsStatistics(image,component_image,(size_t) n, + exception); if (status == MagickFalse) component_image=DestroyImage(component_image); return(component_image); -- 2.40.0