9 #define MAGICKCORE_IMPLEMENTATION 1 10 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1 20 : _channel(SyncPixelChannel),
27 _ellipseEccentricity(0.0),
28 _ellipseIntensity(0.0)
33 : _channel(channelMoments_._channel),
34 _huInvariants(channelMoments_._huInvariants),
35 _centroidX(channelMoments_._centroidX),
36 _centroidY(channelMoments_._centroidY),
37 _ellipseAxisX(channelMoments_._ellipseAxisX),
38 _ellipseAxisY(channelMoments_._ellipseAxisY),
39 _ellipseAngle(channelMoments_._ellipseAngle),
40 _ellipseEccentricity(channelMoments_._ellipseEccentricity),
41 _ellipseIntensity(channelMoments_._ellipseIntensity)
66 return(_ellipseAxisX);
71 return(_ellipseAxisY);
76 return(_ellipseAngle);
81 return(_ellipseEccentricity);
86 return(_ellipseIntensity);
94 return(_huInvariants.at(index_));
99 return(_channel != SyncPixelChannel);
103 const MagickCore::ChannelMoments *channelMoments_)
104 : _channel(channel_),
106 _centroidX(channelMoments_->centroid.x),
107 _centroidY(channelMoments_->centroid.y),
108 _ellipseAxisX(channelMoments_->ellipse_axis.x),
109 _ellipseAxisY(channelMoments_->ellipse_axis.y),
110 _ellipseAngle(channelMoments_->ellipse_angle),
111 _ellipseEccentricity(channelMoments_->ellipse_eccentricity),
112 _ellipseIntensity(channelMoments_->ellipse_intensity)
118 _huInvariants.push_back(channelMoments_->invariant[i]);
122 : _channel(SyncPixelChannel),
130 : _channel(channelPerceptualHash_._channel),
131 _srgbHuPhash(channelPerceptualHash_._srgbHuPhash),
132 _hclpHuPhash(channelPerceptualHash_._hclpHuPhash)
137 const PixelChannel channel_,
const std::string &hash_)
138 : _channel(channel_),
145 if (hash_.length() != 70)
156 if (sscanf(hash_.substr(i*5,5).c_str(),
"%05x",&hex) != 1)
159 value=((
unsigned short)hex) / pow(10.0, (
double)(hex >> 17));
163 _srgbHuPhash[i]=value;
165 _hclpHuPhash[i-7]=value;
173 Magick::ChannelPerceptualHash::operator std::string()
const 182 return(std::string());
196 value=_srgbHuPhash[i];
198 value=_hclpHuPhash[i-7];
201 while(hex < 7 && fabs(value*10) < 65536)
210 hex=(hex<<16)+(
unsigned int)(value < 0.0 ? -(value - 0.5) : value + 0.5);
211 (void) FormatLocaleString(buffer,6,
"%05x",hex);
212 hash+=std::string(buffer);
224 return(_channel != SyncPixelChannel);
239 ssd+=((_srgbHuPhash[i]-channelPerceptualHash_._srgbHuPhash[i])*
240 (_srgbHuPhash[i]-channelPerceptualHash_._srgbHuPhash[i]));
241 ssd+=((_hclpHuPhash[i]-channelPerceptualHash_._hclpHuPhash[i])*
242 (_hclpHuPhash[i]-channelPerceptualHash_._hclpHuPhash[i]));
252 return(_srgbHuPhash.at(index_));
260 return(_hclpHuPhash.at(index_));
264 const PixelChannel channel_,
265 const MagickCore::ChannelPerceptualHash *channelPerceptualHash_)
266 : _channel(channel_),
275 _srgbHuPhash[i]=channelPerceptualHash_->phash[0][i];
276 _hclpHuPhash[i]=channelPerceptualHash_->phash[1][i];
281 : _channel(SyncPixelChannel),
290 _standardDeviation(0.0),
293 _sumFourthPower(0.0),
301 : _channel(channelStatistics_._channel),
302 _area(channelStatistics_._area),
303 _depth(channelStatistics_._depth),
304 _entropy(channelStatistics_._entropy),
305 _kurtosis(channelStatistics_._kurtosis),
306 _maxima(channelStatistics_._maxima),
307 _mean(channelStatistics_._mean),
308 _minima(channelStatistics_._minima),
309 _skewness(channelStatistics_._skewness),
310 _standardDeviation(channelStatistics_._standardDeviation),
311 _sum(channelStatistics_._sum),
312 _sumCubed(channelStatistics_._sumCubed),
313 _sumFourthPower(channelStatistics_._sumFourthPower),
314 _sumSquared(channelStatistics_._sumSquared),
315 _variance(channelStatistics_._variance)
345 return(_channel != SyncPixelChannel);
375 return(_standardDeviation);
390 return(_sumFourthPower);
404 const MagickCore::ChannelStatistics *channelStatistics_)
405 : _channel(channel_),
406 _area(channelStatistics_->area),
407 _depth(channelStatistics_->depth),
408 _entropy(channelStatistics_->entropy),
409 _kurtosis(channelStatistics_->kurtosis),
410 _maxima(channelStatistics_->maxima),
411 _mean(channelStatistics_->mean),
412 _minima(channelStatistics_->minima),
413 _skewness(channelStatistics_->skewness),
414 _standardDeviation(channelStatistics_->standard_deviation),
415 _sum(channelStatistics_->sum),
416 _sumCubed(channelStatistics_->sum_cubed),
417 _sumFourthPower(channelStatistics_->sum_fourth_power),
418 _sumSquared(channelStatistics_->sum_squared),
419 _variance(channelStatistics_->variance)
429 : _channels(imageMoments_._channels)
438 const PixelChannel channel_)
const 440 for (std::vector<ChannelMoments>::const_iterator it = _channels.begin();
441 it != _channels.end(); ++it)
443 if (it->channel() == channel_)
452 MagickCore::ChannelMoments*
456 channel_moments=GetImageMoments(image_.
constImage(),exceptionInfo);
457 if (channel_moments != (MagickCore::ChannelMoments *) NULL)
462 for (i=0; i < (ssize_t) GetPixelChannels(image_.
constImage()); i++)
466 if (traits == UndefinedPixelTrait)
468 if ((traits & UpdatePixelTrait) == 0)
474 &channel_moments[CompositePixelChannel]));
475 channel_moments=(MagickCore::ChannelMoments *) RelinquishMagickMemory(
488 : _channels(imagePerceptualHash_._channels)
495 if (hash_.length() != 210)
499 hash_.substr(0, 70)));
501 hash_.substr(70, 70)));
503 hash_.substr(140, 70)));
510 Magick::ImagePerceptualHash::operator std::string()
const 513 return(std::string());
515 return static_cast<std::string
>(_channels[0]) +
516 static_cast<std::string>(_channels[1]) +
517 static_cast<std::string
>(_channels[2]);
521 const PixelChannel channel_)
const 523 for (std::vector<ChannelPerceptualHash>::const_iterator it =
524 _channels.begin(); it != _channels.end(); ++it)
526 if (it->channel() == channel_)
534 if (_channels.size() != 3)
537 if (_channels[0].channel() != RedPixelChannel)
540 if (_channels[1].channel() != GreenPixelChannel)
543 if (_channels[2].channel() != BluePixelChannel)
560 if (!channelPerceptualHash_.
isValid())
561 throw ErrorOption(
"channelPerceptualHash_ is not valid");
566 ssd+=_channels[i].sumSquaredDifferences(_channels[i]);
575 MagickCore::ChannelPerceptualHash*
576 channel_perceptual_hash;
582 channel_perceptual_hash=GetImagePerceptualHash(image_.
constImage(),
584 if (channel_perceptual_hash != (MagickCore::ChannelPerceptualHash *) NULL)
586 traits=GetPixelChannelTraits(image_.
constImage(),RedPixelChannel);
587 if ((traits & UpdatePixelTrait) != 0)
589 &channel_perceptual_hash[RedPixelChannel]));
590 traits=GetPixelChannelTraits(image_.
constImage(),GreenPixelChannel);
591 if ((traits & UpdatePixelTrait) != 0)
593 &channel_perceptual_hash[GreenPixelChannel]));
594 traits=GetPixelChannelTraits(image_.
constImage(),BluePixelChannel);
595 if ((traits & UpdatePixelTrait) != 0)
597 &channel_perceptual_hash[BluePixelChannel]));
598 channel_perceptual_hash=(MagickCore::ChannelPerceptualHash *)
599 RelinquishMagickMemory(channel_perceptual_hash);
611 : _channels(imageStatistics_._channels)
620 const PixelChannel channel_)
const 622 for (std::vector<ChannelStatistics>::const_iterator it = _channels.begin();
623 it != _channels.end(); ++it)
625 if (it->channel() == channel_)
634 MagickCore::ChannelStatistics*
638 channel_statistics=GetImageStatistics(image_.
constImage(),exceptionInfo);
639 if (channel_statistics != (MagickCore::ChannelStatistics *) NULL)
644 for (i=0; i < (ssize_t) GetPixelChannels(image_.
constImage()); i++)
648 if (traits == UndefinedPixelTrait)
650 if ((traits & UpdatePixelTrait) == 0)
653 &channel_statistics[
channel]));
656 &channel_statistics[CompositePixelChannel]));
657 channel_statistics=(MagickCore::ChannelStatistics *) RelinquishMagickMemory(
double centroidY(void) const
double standardDeviation() const
ChannelMoments channel(const PixelChannel channel_) const
~ChannelPerceptualHash(void)
PixelChannel channel(void) const
double ellipseIntensity(void) const
double sumSquaredDifferences(const ChannelPerceptualHash &channelPerceptualHash_)
double srgbHuPhash(const size_t index_) const
ChannelPerceptualHash channel(const PixelChannel channel_) const
PixelChannel channel(void) const
const MagickCore::Image * constImage(void) const
void quiet(const bool quiet_)
double sumSquaredDifferences(const ImagePerceptualHash &channelPerceptualHash_)
double sumFourthPower() const
double huInvariants(const size_t index_) const
double ellipseAxisY(void) const
#define ThrowPPException(quiet)
double ellipseEccentricity(void) const
ChannelPerceptualHash(void)
ImagePerceptualHash(void)
double hclpHuPhash(const size_t index_) const
double ellipseAxisX(void) const
ChannelStatistics channel(const PixelChannel channel_) const
double centroidX(void) const
PixelChannel channel(void) const
~ImagePerceptualHash(void)
double ellipseAngle(void) const
double sumSquared() const