Loading...
Searching...
No Matches
Magick::ImagePerceptualHash Class Reference

## Public Member Functions

| ImagePerceptualHash (const ImagePerceptualHash &imagePerceptualHash_)
| ImagePerceptualHash (const std::string &hash_)
| operator std::string () const
ChannelPerceptualHash | channel (const PixelChannel channel_) const
bool | isValid () const
double | sumSquaredDifferences (const ImagePerceptualHash &channelPerceptualHash_)
| ImagePerceptualHash (const Image &image_)

## Private Attributes

std::vector< ChannelPerceptualHash > | _channels

## Detailed Description

Definition at line 244 of file Statistic.h.

## Constructor & Destructor Documentation

## ImagePerceptualHash() [1/4]

Magick::ImagePerceptualHash::ImagePerceptualHash | ( | void |  | ) |

Definition at line 485 of file Statistic.cpp.

: _channels()
{
}

## ImagePerceptualHash() [2/4]

Magick::ImagePerceptualHash::ImagePerceptualHash | ( | const ImagePerceptualHash & | imagePerceptualHash_ | ) |

Definition at line 490 of file Statistic.cpp.

: _channels(imagePerceptualHash_._channels)
{
}

## ImagePerceptualHash() [3/4]

Magick::ImagePerceptualHash::ImagePerceptualHash | ( | const std::string & | hash_ | ) |

Definition at line 496 of file Statistic.cpp.

: _channels()
{
if (hash_.length() != 210)
throw ErrorOption("Invalid hash length");
_channels.push_back(Magick::ChannelPerceptualHash(RedPixelChannel,
hash_.substr(0, 70)));
_channels.push_back(Magick::ChannelPerceptualHash(GreenPixelChannel,
hash_.substr(70, 70)));
_channels.push_back(Magick::ChannelPerceptualHash(BluePixelChannel,
hash_.substr(140, 70)));
}
Magick::ChannelPerceptualHash
Definition Statistic.h:82

## ~ImagePerceptualHash()

Magick::ImagePerceptualHash::~ImagePerceptualHash | ( | void |  | ) |

Definition at line 510 of file Statistic.cpp.

{
}

## ImagePerceptualHash() [4/4]

Magick::ImagePerceptualHash::ImagePerceptualHash | ( | const Image & | image_ | ) |

Definition at line 575 of file Statistic.cpp.

: _channels()
{
MagickCore::ChannelPerceptualHash*
channel_perceptual_hash;
PixelTrait
traits;
GetPPException;
channel_perceptual_hash=GetImagePerceptualHash(image_.constImage(),
exceptionInfo);
if (channel_perceptual_hash != (MagickCore::ChannelPerceptualHash *) NULL)
{
traits=GetPixelChannelTraits(image_.constImage(),RedPixelChannel);
if ((traits & UpdatePixelTrait) != 0)
_channels.push_back(Magick::ChannelPerceptualHash(RedPixelChannel,
&channel_perceptual_hash[RedPixelChannel]));
traits=GetPixelChannelTraits(image_.constImage(),GreenPixelChannel);
if ((traits & UpdatePixelTrait) != 0)
_channels.push_back(Magick::ChannelPerceptualHash(GreenPixelChannel,
&channel_perceptual_hash[GreenPixelChannel]));
traits=GetPixelChannelTraits(image_.constImage(),BluePixelChannel);
if ((traits & UpdatePixelTrait) != 0)
_channels.push_back(Magick::ChannelPerceptualHash(BluePixelChannel,
&channel_perceptual_hash[BluePixelChannel]));
channel_perceptual_hash=(MagickCore::ChannelPerceptualHash *)
RelinquishMagickMemory(channel_perceptual_hash);
}
ThrowPPException(image_.quiet());
}

## Member Function Documentation

## channel()

Magick::ChannelPerceptualHash Magick::ImagePerceptualHash::channel | ( | const PixelChannel | channel_ | ) | const

Definition at line 524 of file Statistic.cpp.

{
for (std::vector<ChannelPerceptualHash>::const_iterator it =
_channels.begin(); it != _channels.end(); ++it)
{
if (it->channel() == channel_)
return(*it);
}
return(ChannelPerceptualHash());
}

## isValid()

bool Magick::ImagePerceptualHash::isValid | ( |  | ) | const

Definition at line 536 of file Statistic.cpp.

{
if (_channels.size() != 3)
return(false);
if (_channels[0].channel() != RedPixelChannel)
return(false);
if (_channels[1].channel() != GreenPixelChannel)
return(false);
if (_channels[2].channel() != BluePixelChannel)
return(false);
return(true);
}

## operator std::string()

Magick::ImagePerceptualHash::operator std::string | ( |  | ) | const

Definition at line 514 of file Statistic.cpp.

{
if (!isValid())
return(std::string());
return static_cast<std::string>(_channels[0]) +
static_cast<std::string>(_channels[1]) +
static_cast<std::string>(_channels[2]);
}

## sumSquaredDifferences()

double Magick::ImagePerceptualHash::sumSquaredDifferences | ( | const ImagePerceptualHash & | channelPerceptualHash_ | ) |

Definition at line 553 of file Statistic.cpp.

{
double
ssd;
size_t
i;
if (!isValid())
throw ErrorOption("instance is not valid");
if (!channelPerceptualHash_.isValid())
throw ErrorOption("channelPerceptualHash_ is not valid");
ssd=0.0;
for (i=0; i<3; i++)
{
ssd+=_channels[i].sumSquaredDifferences(_channels[i]);
}
return(ssd);
}

## Field Documentation

## _channels

std::vector<ChannelPerceptualHash> Magick::ImagePerceptualHash::_channels

private

Definition at line 279 of file Statistic.h.

The documentation for this class was generated from the following files:

- /build/imagemagick-icbe39/imagemagick-7.1.2.3+dfsg1/Magick++/lib/Magick++/Statistic.h
- /build/imagemagick-icbe39/imagemagick-7.1.2.3+dfsg1/Magick++/lib/Statistic.cpp