8 #define MAGICKCORE_IMPLEMENTATION 1 9 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1 19 : _channel(SyncPixelChannel),
26 _ellipseEccentricity(0.0),
27 _ellipseIntensity(0.0)
32 : _channel(channelMoments_._channel),
33 _huInvariants(channelMoments_._huInvariants),
34 _centroidX(channelMoments_._centroidX),
35 _centroidY(channelMoments_._centroidY),
36 _ellipseAxisX(channelMoments_._ellipseAxisX),
37 _ellipseAxisY(channelMoments_._ellipseAxisY),
38 _ellipseAngle(channelMoments_._ellipseAngle),
39 _ellipseEccentricity(channelMoments_._ellipseEccentricity),
40 _ellipseIntensity(channelMoments_._ellipseIntensity)
65 return(_ellipseAxisX);
70 return(_ellipseAxisY);
75 return(_ellipseAngle);
80 return(_ellipseEccentricity);
85 return(_ellipseIntensity);
93 return(_huInvariants.at(index_));
98 return(_channel != SyncPixelChannel);
102 const MagickCore::ChannelMoments *channelMoments_)
103 : _channel(channel_),
105 _centroidX(channelMoments_->centroid.x),
106 _centroidY(channelMoments_->centroid.y),
107 _ellipseAxisX(channelMoments_->ellipse_axis.x),
108 _ellipseAxisY(channelMoments_->ellipse_axis.y),
109 _ellipseAngle(channelMoments_->ellipse_angle),
110 _ellipseEccentricity(channelMoments_->ellipse_eccentricity),
111 _ellipseIntensity(channelMoments_->ellipse_intensity)
117 _huInvariants.push_back(channelMoments_->invariant[i]);
121 : _channel(SyncPixelChannel),
129 : _channel(channelPerceptualHash_._channel),
130 _srgbHuPhash(channelPerceptualHash_._srgbHuPhash),
131 _hclpHuPhash(channelPerceptualHash_._hclpHuPhash)
136 const PixelChannel channel_,
const std::string &hash_)
137 : _channel(channel_),
144 if (hash_.length() != 70)
155 if (sscanf(hash_.substr(i*5,5).c_str(),
"%05x",&hex) != 1)
158 value=((
unsigned short)hex) / pow(10.0, (
double)(hex >> 17));
162 _srgbHuPhash[i]=value;
164 _hclpHuPhash[i-7]=value;
172 Magick::ChannelPerceptualHash::operator std::string()
const 181 return(std::string());
195 value=_srgbHuPhash[i];
197 value=_hclpHuPhash[i-7];
200 while(hex < 7 && fabs(value*10) < 65536)
209 hex=(hex<<16)+(
unsigned int)(value < 0.0 ? -(value - 0.5) : value + 0.5);
210 (void) FormatLocaleString(buffer,6,
"%05x",hex);
211 hash+=std::string(buffer);
223 return(_channel != SyncPixelChannel);
238 ssd+=((_srgbHuPhash[i]-channelPerceptualHash_._srgbHuPhash[i])*
239 (_srgbHuPhash[i]-channelPerceptualHash_._srgbHuPhash[i]));
240 ssd+=((_hclpHuPhash[i]-channelPerceptualHash_._hclpHuPhash[i])*
241 (_hclpHuPhash[i]-channelPerceptualHash_._hclpHuPhash[i]));
251 return(_srgbHuPhash.at(index_));
259 return(_hclpHuPhash.at(index_));
263 const PixelChannel channel_,
264 const MagickCore::ChannelPerceptualHash *channelPerceptualHash_)
265 : _channel(channel_),
274 _srgbHuPhash[i]=channelPerceptualHash_->phash[0][i];
275 _hclpHuPhash[i]=channelPerceptualHash_->phash[1][i];
280 : _channel(SyncPixelChannel),
289 _standardDeviation(0.0),
292 _sumFourthPower(0.0),
300 : _channel(channelStatistics_._channel),
301 _area(channelStatistics_._area),
302 _depth(channelStatistics_._depth),
303 _entropy(channelStatistics_._entropy),
304 _kurtosis(channelStatistics_._kurtosis),
305 _maxima(channelStatistics_._maxima),
306 _mean(channelStatistics_._mean),
307 _minima(channelStatistics_._minima),
308 _skewness(channelStatistics_._skewness),
309 _standardDeviation(channelStatistics_._standardDeviation),
310 _sum(channelStatistics_._sum),
311 _sumCubed(channelStatistics_._sumCubed),
312 _sumFourthPower(channelStatistics_._sumFourthPower),
313 _sumSquared(channelStatistics_._sumSquared),
314 _variance(channelStatistics_._variance)
344 return(_channel != SyncPixelChannel);
374 return(_standardDeviation);
389 return(_sumFourthPower);
403 const MagickCore::ChannelStatistics *channelStatistics_)
404 : _channel(channel_),
405 _area(channelStatistics_->area),
406 _depth(channelStatistics_->depth),
407 _entropy(channelStatistics_->entropy),
408 _kurtosis(channelStatistics_->kurtosis),
409 _maxima(channelStatistics_->maxima),
410 _mean(channelStatistics_->mean),
411 _minima(channelStatistics_->minima),
412 _skewness(channelStatistics_->skewness),
413 _standardDeviation(channelStatistics_->standard_deviation),
414 _sum(channelStatistics_->sum),
415 _sumCubed(channelStatistics_->sum_cubed),
416 _sumFourthPower(channelStatistics_->sum_fourth_power),
417 _sumSquared(channelStatistics_->sum_squared),
418 _variance(channelStatistics_->variance)
428 : _channels(imageMoments_._channels)
437 const PixelChannel channel_)
const 439 for (std::vector<ChannelMoments>::const_iterator it = _channels.begin();
440 it != _channels.end(); ++it)
442 if (it->channel() == channel_)
451 MagickCore::ChannelMoments*
455 channel_moments=GetImageMoments(image_.
constImage(),exceptionInfo);
456 if (channel_moments != (MagickCore::ChannelMoments *) NULL)
461 for (i=0; i < (ssize_t) GetPixelChannels(image_.
constImage()); i++)
465 if (traits == UndefinedPixelTrait)
467 if ((traits & UpdatePixelTrait) == 0)
473 &channel_moments[CompositePixelChannel]));
474 channel_moments=(MagickCore::ChannelMoments *) RelinquishMagickMemory(
487 : _channels(imagePerceptualHash_._channels)
494 if (hash_.length() != 210)
498 hash_.substr(0, 70)));
500 hash_.substr(70, 70)));
502 hash_.substr(140, 70)));
509 Magick::ImagePerceptualHash::operator std::string()
const 512 return(std::string());
514 return static_cast<std::string
>(_channels[0]) +
515 static_cast<std::string>(_channels[1]) +
516 static_cast<std::string
>(_channels[2]);
520 const PixelChannel channel_)
const 522 for (std::vector<ChannelPerceptualHash>::const_iterator it =
523 _channels.begin(); it != _channels.end(); ++it)
525 if (it->channel() == channel_)
533 if (_channels.size() != 3)
536 if (_channels[0].channel() != RedPixelChannel)
539 if (_channels[1].channel() != GreenPixelChannel)
542 if (_channels[2].channel() != BluePixelChannel)
559 if (!channelPerceptualHash_.
isValid())
560 throw ErrorOption(
"channelPerceptualHash_ is not valid");
565 ssd+=_channels[i].sumSquaredDifferences(_channels[i]);
574 MagickCore::ChannelPerceptualHash*
575 channel_perceptual_hash;
581 channel_perceptual_hash=GetImagePerceptualHash(image_.
constImage(),
583 if (channel_perceptual_hash != (MagickCore::ChannelPerceptualHash *) NULL)
585 traits=GetPixelChannelTraits(image_.
constImage(),RedPixelChannel);
586 if ((traits & UpdatePixelTrait) != 0)
588 &channel_perceptual_hash[RedPixelChannel]));
589 traits=GetPixelChannelTraits(image_.
constImage(),GreenPixelChannel);
590 if ((traits & UpdatePixelTrait) != 0)
592 &channel_perceptual_hash[GreenPixelChannel]));
593 traits=GetPixelChannelTraits(image_.
constImage(),BluePixelChannel);
594 if ((traits & UpdatePixelTrait) != 0)
596 &channel_perceptual_hash[BluePixelChannel]));
597 channel_perceptual_hash=(MagickCore::ChannelPerceptualHash *)
598 RelinquishMagickMemory(channel_perceptual_hash);
610 : _channels(imageStatistics_._channels)
619 const PixelChannel channel_)
const 621 for (std::vector<ChannelStatistics>::const_iterator it = _channels.begin();
622 it != _channels.end(); ++it)
624 if (it->channel() == channel_)
633 MagickCore::ChannelStatistics*
637 channel_statistics=GetImageStatistics(image_.
constImage(),exceptionInfo);
638 if (channel_statistics != (MagickCore::ChannelStatistics *) NULL)
643 for (i=0; i < (ssize_t) GetPixelChannels(image_.
constImage()); i++)
647 if (traits == UndefinedPixelTrait)
649 if ((traits & UpdatePixelTrait) == 0)
652 &channel_statistics[
channel]));
655 &channel_statistics[CompositePixelChannel]));
656 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