97 #include "MagickCore/version.h" 143 assert(image != (
Image *) NULL);
152 sizeof(*channel_statistics));
170 for (y=0; y < (ssize_t) image->
rows; y++)
179 if (p == (
const Quantum *) NULL)
181 for (x=0; x < (ssize_t) image->
columns; x++)
199 if ((
double) p[i] > channel_statistics[channel].maxima)
200 channel_statistics[channel].
maxima=(double) p[i];
205 if ((
double) p[i] < channel_statistics[channel].
minima)
206 channel_statistics[channel].minima=(
double) p[i];
214 return(channel_statistics);
220 #define PrintFeature(feature) \ 221 GetMagickPrecision(),(feature)[0], \ 222 GetMagickPrecision(),(feature)[1], \ 223 GetMagickPrecision(),(feature)[2], \ 224 GetMagickPrecision(),(feature)[3], \ 225 GetMagickPrecision(),((feature)[0]+(feature)[1]+(feature)[2]+(feature)[3])/4.0 \ 227 #define FeaturesFormat " %s:\n" \ 228 " Angular Second Moment:\n" \ 229 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 231 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 233 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 234 " Sum of Squares Variance:\n" \ 235 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 236 " Inverse Difference Moment:\n" \ 237 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 239 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 241 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 243 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 245 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 246 " Difference Variance:\n" \ 247 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 248 " Difference Entropy:\n" \ 249 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 250 " Information Measure of Correlation 1:\n" \ 251 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 252 " Information Measure of Correlation 2:\n" \ 253 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \ 254 " Maximum Correlation Coefficient:\n" \ 255 " %.*g, %.*g, %.*g, %.*g, %.*g\n" 261 PrintFeature(channel_features[channel].angular_second_moment),
264 PrintFeature(channel_features[channel].variance_sum_of_squares),
265 PrintFeature(channel_features[channel].inverse_difference_moment),
270 PrintFeature(channel_features[channel].difference_variance),
271 PrintFeature(channel_features[channel].difference_entropy),
272 PrintFeature(channel_features[channel].measure_of_correlation_1),
273 PrintFeature(channel_features[channel].measure_of_correlation_2),
274 PrintFeature(channel_features[channel].maximum_correlation_coefficient));
297 target=channel_statistics[channel].
maxima;
302 target=channel_statistics[channel].
minima;
310 for (y=0; y < (ssize_t) image->
rows; y++)
320 if (p == (
const Quantum *) NULL)
322 for (x=0; x < (ssize_t) image->
columns; x++)
334 if ((max_locations != 0) && (n >= (ssize_t) max_locations))
341 if (x < (ssize_t) image->
columns)
349 const char *name,
const double scale,
const ChannelMoments *channel_moments)
353 { 1.0, 2.0, 3.0, 3.0, 6.0, 4.0, 6.0, 4.0 };
375 channel_moments[channel].ellipse_intensity);
393 for (i=0; i < (ssize_t) channel_phash[0].number_colorspaces; i++)
426 for (k=0; k < (ssize_t) channel_phash[0].number_colorspaces; k++)
429 channel_phash[channel].phash[k][j]);
430 if (k < (ssize_t) (channel_phash[0].number_colorspaces-1))
440 const char *name,
const double scale,
443 #define StatisticsFormat " %s:\n min: %.*g (%.*g)\n " \ 444 "max: %.*g (%.*g)\n mean: %.*g (%.*g)\n median: %.*g (%.*g)\n " \ 445 "standard deviation: %.*g (%.*g)\n kurtosis: %.*g\n " \ 446 "skewness: %.*g\n entropy: %.*g\n" 454 channel_statistics[channel].minima/(
double)
QuantumRange,
457 channel_statistics[channel].maxima/(
double)
QuantumRange,
467 channel_statistics[channel].entropy);
530 assert(image != (
Image *) NULL);
534 if (file == (FILE *) NULL)
538 if (locate != (
const char *) NULL)
556 if (limit != (
const char *) NULL)
568 statistic_type,max_locations,channel_statistics);
570 statistic_type,max_locations,channel_statistics);
572 statistic_type,max_locations,channel_statistics);
578 statistic_type,max_locations,channel_statistics);
580 "Magenta",statistic_type,max_locations,channel_statistics);
582 statistic_type,max_locations,channel_statistics);
584 statistic_type,max_locations,channel_statistics);
591 statistic_type,max_locations,channel_statistics);
598 statistic_type,max_locations,channel_statistics);
604 statistic_type,max_locations,channel_statistics);
635 (double) image->
rows);
640 (double) image->
page.
y);
676 (
unsigned long) (elapsed_time/60.0),(
unsigned long) floor(fmod(
677 elapsed_time,60.0)),(
unsigned long) (1000.0*(elapsed_time-
678 floor(elapsed_time))));
699 if (artifact != (
const char *) NULL)
705 if (artifact != (
const char *) NULL)
722 if ((magick_info == (
const MagickInfo *) NULL) ||
728 if ((magick_info != (
const MagickInfo *) NULL) &&
734 (void)
FormatLocaleFile(file,
" Geometry: %.20gx%.20g%+.20g%+.20g\n",(
double)
757 if (image->
type != type)
764 if (image->
depth == depth)
769 image->
depth,(
double) depth);
813 (
double) i,(
double) channel_statistics[i].depth);
833 scale,channel_statistics);
835 scale,channel_statistics);
837 scale,channel_statistics);
843 scale,channel_statistics);
845 scale,channel_statistics);
847 scale,channel_statistics);
849 scale,channel_statistics);
856 scale,channel_statistics);
869 scale,channel_statistics);
881 1.0/scale,channel_statistics);
888 scale=(double) ((1UL << image->
depth)-1);
957 "left and right diagonals, average):\n");
1023 for (y=0; y < (ssize_t) image->
rows; y++)
1026 if (p == (
const Quantum *) NULL)
1028 for (x=0; x < (ssize_t) image->
columns; x++)
1077 if (image->
colors <= 1024)
1091 for (i=0; i < (ssize_t) image->
colors; i++)
1137 if (image->
gamma != 0.0)
1181 (image->
page.
x != 0) || (image->
page.
y != 0))
1185 if ((image->
page.
x != 0) || (image->
page.
y != 0))
1190 if (image->
delay != 0)
1203 if (image->
scene != 0)
1211 if (image->
montage != (
char *) NULL)
1234 for (d=image->
directory; *d !=
'\0'; d++)
1237 while ((*q !=
'\xff') && (*q !=
'\0') &&
1238 ((
size_t) (q-d) <
sizeof(image_info->
filename)))
1246 if (tile == (
Image *) NULL)
1256 while (property != (
const char *) NULL)
1260 if (value != (
const char *) NULL)
1270 if (value != (
const char *) NULL)
1276 if (strlen(value) > 80)
1277 (
void) fputc(
'\n',file);
1304 for (n=0; n < (ssize_t) number_points; n++)
1307 convex_hull[n].x,convex_hull[n].y);
1319 for (n=0; n < (ssize_t) number_points; n++)
1322 bounding_box[n].x,bounding_box[n].y);
1333 if (name != (
char *) NULL)
1342 while (name != (
char *) NULL)
1371 for (i=0; i < (ssize_t) profile_length-5; i+=(ssize_t) length)
1381 case 5: tag=
"Image Name";
break;
1382 case 7: tag=
"Edit Status";
break;
1383 case 10: tag=
"Priority";
break;
1384 case 15: tag=
"Category";
break;
1385 case 20: tag=
"Supplemental Category";
break;
1386 case 22: tag=
"Fixture Identifier";
break;
1387 case 25: tag=
"Keyword";
break;
1388 case 30: tag=
"Release Date";
break;
1389 case 35: tag=
"Release Time";
break;
1390 case 40: tag=
"Special Instructions";
break;
1391 case 45: tag=
"Reference Service";
break;
1392 case 47: tag=
"Reference Date";
break;
1393 case 50: tag=
"Reference Number";
break;
1394 case 55: tag=
"Created Date";
break;
1395 case 60: tag=
"Created Time";
break;
1396 case 65: tag=
"Originating Program";
break;
1397 case 70: tag=
"Program Version";
break;
1398 case 75: tag=
"Object Cycle";
break;
1399 case 80: tag=
"Byline";
break;
1400 case 85: tag=
"Byline Title";
break;
1401 case 90: tag=
"City";
break;
1402 case 92: tag=
"Sub-Location";
break;
1403 case 95: tag=
"Province State";
break;
1404 case 100: tag=
"Country Code";
break;
1405 case 101: tag=
"Country";
break;
1406 case 103: tag=
"Original Transmission Reference";
break;
1407 case 105: tag=
"Headline";
break;
1408 case 110: tag=
"Credit";
break;
1409 case 115: tag=
"Src";
break;
1410 case 116: tag=
"Copyright String";
break;
1411 case 120: tag=
"Caption";
break;
1412 case 121: tag=
"Local Caption";
break;
1413 case 122: tag=
"Caption Writer";
break;
1414 case 200: tag=
"Custom Field 1";
break;
1415 case 201: tag=
"Custom Field 2";
break;
1416 case 202: tag=
"Custom Field 3";
break;
1417 case 203: tag=
"Custom Field 4";
break;
1418 case 204: tag=
"Custom Field 5";
break;
1419 case 205: tag=
"Custom Field 6";
break;
1420 case 206: tag=
"Custom Field 7";
break;
1421 case 207: tag=
"Custom Field 8";
break;
1422 case 208: tag=
"Custom Field 9";
break;
1423 case 209: tag=
"Custom Field 10";
break;
1424 case 210: tag=
"Custom Field 11";
break;
1425 case 211: tag=
"Custom Field 12";
break;
1426 case 212: tag=
"Custom Field 13";
break;
1427 case 213: tag=
"Custom Field 14";
break;
1428 case 214: tag=
"Custom Field 15";
break;
1429 case 215: tag=
"Custom Field 16";
break;
1430 case 216: tag=
"Custom Field 17";
break;
1431 case 217: tag=
"Custom Field 18";
break;
1432 case 218: tag=
"Custom Field 19";
break;
1433 case 219: tag=
"Custom Field 20";
break;
1434 default: tag=
"unknown";
break;
1437 (
double) dataset,(double) record);
1440 length=
MagickMin(length,profile_length-i);
1441 attribute=(
char *) NULL;
1444 sizeof(*attribute));
1445 if (attribute != (
char *) NULL)
1450 if (attribute_list != (
char **) NULL)
1452 for (j=0; attribute_list[j] != (
char *) NULL; j++)
1454 (void) fputs(attribute_list[j],file);
1455 (void) fputs(
"\n",file);
1473 if (property != (
const char *) NULL)
1479 while (property != (
const char *) NULL)
1483 if (value != (
const char *) NULL)
1490 if (artifact != (
const char *) NULL)
1496 while (artifact != (
const char *) NULL)
1500 if (value != (
const char *) NULL)
1507 if (
registry != (
const char *) NULL)
1513 while (
registry != (
const char *) NULL)
1518 if (value != (
const char *) NULL)
1529 if (strlen(format) > 1)
1530 format[strlen(format)-1]=
'\0';
1540 (
unsigned long) (elapsed_time/60.0),(
unsigned long) ceil(fmod(elapsed_time,
1541 60.0)),(
unsigned long) (1000.0*(elapsed_time-floor(elapsed_time))));
1544 (void) fflush(file);
MagickDoubleType MagickRealType
PixelIntensityMethod intensity
MagickExport ssize_t FormatMagickSize(const MagickSizeType size, const MagickBooleanType bi, const char *suffix, const size_t length, char *format)
static ssize_t GetPixelChannelOffset(const Image *magick_restrict image, const PixelChannel channel)
MagickExport MagickBooleanType QueryColorname(const Image *magick_unused(image), const PixelInfo *color, const ComplianceType compliance, char *name, ExceptionInfo *exception)
MagickExport ImageInfo * AcquireImageInfo(void)
MagickExport double GetUserTime(TimerInfo *time_info)
MagickExport double GetImageTotalInkDensity(Image *image, ExceptionInfo *exception)
MagickExport size_t ConcatenateMagickString(char *magick_restrict destination, const char *magick_restrict source, const size_t length)
static Quantum GetPixelAlpha(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
MagickExport MagickBooleanType IsHistogramImage(const Image *image, ExceptionInfo *exception)
MagickExport void ResetImagePropertyIterator(const Image *image)
static unsigned long StringToUnsignedLong(const char *magick_restrict value)
MagickExport ssize_t ParseCommandOption(const CommandOption option, const MagickBooleanType list, const char *options)
MagickExport ChannelStatistics * GetImageStatistics(const Image *image, ExceptionInfo *exception)
#define ThrowFatalException(severity, tag)
MagickExport MagickBooleanType IdentifyImage(Image *image, FILE *file, const MagickBooleanType verbose, ExceptionInfo *exception)
MagickExport WarningHandler SetWarningHandler(WarningHandler handler)
MagickExport const char * GetMagickDescription(const MagickInfo *magick_info)
MagickExport PointInfo * GetImageMinimumBoundingBox(Image *image, size_t *number_vertices, ExceptionInfo *exception)
MagickExport const char * GetImageArtifact(const Image *image, const char *artifact)
MagickExport char * GetNextImageRegistry(void)
#define MaximumNumberOfPerceptualHashes
double mean_error_per_pixel
static PixelTrait GetPixelChannelTraits(const Image *magick_restrict image, const PixelChannel channel)
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
MagickExport ssize_t FormatLocaleString(char *magick_restrict string, const size_t length, const char *magick_restrict format,...)
static Quantum GetPixelReadMask(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
MagickExport size_t CopyMagickString(char *magick_restrict destination, const char *magick_restrict source, const size_t length)
MagickExport MagickBooleanType SignatureImage(Image *image, ExceptionInfo *exception)
char magick[MagickPathExtent]
#define MAGICKCORE_QUANTUM_DEPTH
MagickExport void ResetImageArtifactIterator(const Image *image)
#define MaximumNumberOfImageMoments
CompressionType compression
static ssize_t PrintChannelMoments(FILE *file, const PixelChannel channel, const char *name, const double scale, const ChannelMoments *channel_moments)
RectangleInfo tile_offset
MagickExport void GetPixelInfo(const Image *image, PixelInfo *pixel)
static Quantum ClampToQuantum(const MagickRealType quantum)
MagickExport Image * GetPreviousImageInList(const Image *images)
#define MagickCoreSignature
double normalized_mean_error
MagickExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
static ChannelStatistics * GetLocationStatistics(const Image *image, const StatisticType type, ExceptionInfo *exception)
#define PrintFeature(feature)
MagickExport void GetPathComponent(const char *path, PathType type, char *component)
MagickExport ssize_t FormatLocaleFile(FILE *file, const char *magick_restrict format,...)
MagickExport char ** StringToList(const char *text)
MagickExport char * AcquireString(const char *source)
static ssize_t PrintChannelFeatures(FILE *file, const PixelChannel channel, const char *name, const ChannelFeatures *channel_features)
MagickExport const char * CommandOptionToMnemonic(const CommandOption option, const ssize_t type)
MagickExport const Quantum * GetVirtualPixels(const Image *image, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
MagickExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
char filename[MagickPathExtent]
MagickExport void GetColorTuple(const PixelInfo *pixel, const MagickBooleanType hex, char *tuple)
MagickExport PointInfo * GetImageConvexHull(const Image *image, size_t *number_vertices, ExceptionInfo *exception)
MagickExport const StringInfo * GetImageProfile(const Image *image, const char *name)
#define UndefinedCompressionQuality
MagickExport void PrintStringInfo(FILE *file, const char *id, const StringInfo *string_info)
MagickExport MagickBooleanType IsStringTrue(const char *value)
static void GetPixelInfoPixel(const Image *magick_restrict image, const Quantum *magick_restrict pixel, PixelInfo *magick_restrict pixel_info)
MagickExport ChannelMoments * GetImageMoments(const Image *image, ExceptionInfo *exception)
MagickExport int GetMagickPrecision(void)
#define MagickMaximumValue
MagickExport Image * ReadImage(const ImageInfo *image_info, ExceptionInfo *exception)
static ssize_t PrintChannelPerceptualHash(Image *image, FILE *file, const ChannelPerceptualHash *channel_phash)
MagickExport void ResetImageRegistryIterator(void)
static ssize_t PrintChannelLocations(FILE *file, const Image *image, const PixelChannel channel, const char *name, const StatisticType type, const size_t max_locations, const ChannelStatistics *channel_statistics)
char magick_filename[MagickPathExtent]
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
MagickExport const char * GetMagickVersion(size_t *version)
MagickExport const char * GetNextImageProperty(const Image *image)
MagickExport const MagickInfo * GetMagickInfo(const char *name, ExceptionInfo *exception)
MagickExport ImageType IdentifyImageType(const Image *image, ExceptionInfo *exception)
void(* WarningHandler)(const ExceptionType, const char *, const char *)
MagickExport void ConcatenateColorComponent(const PixelInfo *pixel, const PixelChannel channel, const ComplianceType compliance, char *tuple)
RectangleInfo extract_info
MagickExport char * GetNextImageProfile(const Image *image)
static size_t GetPixelChannels(const Image *magick_restrict image)
MagickExport int LocaleCompare(const char *p, const char *q)
char filename[MagickPathExtent]
#define GetMagickModule()
PrimaryInfo green_primary
MagickExport size_t GetNumberColors(const Image *image, FILE *file, ExceptionInfo *exception)
MagickExport void GetTimerInfo(TimerInfo *time_info)
MagickExport ChannelFeatures * GetImageFeatures(const Image *image, const size_t distance, ExceptionInfo *exception)
static PixelChannel GetPixelChannelChannel(const Image *magick_restrict image, const ssize_t offset)
MagickExport ImageInfo * DestroyImageInfo(ImageInfo *image_info)
RenderingIntent rendering_intent
double normalized_maximum_error
MagickExport size_t GetImageDepth(const Image *image, ExceptionInfo *exception)
MagickExport Image * GetNextImageInList(const Image *images)
MagickExport char * DestroyString(char *string)
MagickExport const char * GetMagickMimeType(const MagickInfo *magick_info)
static ssize_t PrintChannelStatistics(FILE *file, const PixelChannel channel, const char *name, const double scale, const ChannelStatistics *channel_statistics)
MagickExport const char * GetImageProperty(const Image *image, const char *property, ExceptionInfo *exception)
size_t number_colorspaces
MagickExport double GetElapsedTime(TimerInfo *time_info)
ChromaticityInfo chromaticity
ColorspaceType colorspace[MaximumNumberOfPerceptualColorspaces+1]
MagickExport const char * GetNextImageArtifact(const Image *image)
MagickExport MagickBooleanType ConcatenateString(char **magick_restrict destination, const char *magick_restrict source)
MagickExport void * RelinquishMagickMemory(void *memory)
MagickExport void * GetImageRegistry(const RegistryType type, const char *key, ExceptionInfo *exception)
MagickExport char * CloneString(char **destination, const char *source)
CompositeOperator compose
MagickExport void ResetImageProfileIterator(const Image *image)
OrientationType orientation
ColorspaceType colorspace
PixelInfo transparent_color
MagickExport ChannelPerceptualHash * GetImagePerceptualHash(const Image *image, ExceptionInfo *exception)
MagickExport size_t GetStringInfoLength(const StringInfo *string_info)
PixelInfo background_color
MagickExport size_t GetImageListLength(const Image *images)
MagickExport Image * DestroyImage(Image *image)
static SplayTreeInfo * registry
ColorspaceType colorspace