diff --git a/app/Operations/DoubleEntropyOp.cpp b/app/Operations/DoubleEntropyOp.cpp index b553bb100b974576abef1e9c63377196d559421d..ff55790da40c5c6c21c7f3e96ed36303fcafe552 100644 --- a/app/Operations/DoubleEntropyOp.cpp +++ b/app/Operations/DoubleEntropyOp.cpp @@ -39,10 +39,12 @@ DoubleEntropyOp::DoubleEntropyOp() : DoubleOperation(qApp->translate("Operations void DoubleEntropyOp::operator()(const Image_t<double>* image, const std::map<const imagein::Image_t<double>*, std::string>&) { double entropy = 0.; - + int min = image->min(); + int max = image->max(); for(unsigned int c = 0; c < image->getNbChannels(); ++c) { Histogram histo = image->getHistogram(c); - for(int i = 0; i < 256; ++i) { +// for(int i = -255; i < 256 ; ++i) { + for(int i = min; i<= max; i++){ if(histo[i] > 0) { double p = (double)histo[i] / image->getWidth() /image->getHeight(); entropy += p * log(p); @@ -52,8 +54,12 @@ void DoubleEntropyOp::operator()(const Image_t<double>* image, const std::map<co entropy = - entropy / log(2); outText(qApp->translate("Operations", "Entropy of the image = %1").arg(entropy).toStdString()); + } bool DoubleEntropyOp::needCurrentImg() const { return true; } + +DoubleEntropyOp::~DoubleEntropyOp() { +} diff --git a/app/Operations/DoubleEntropyOp.h b/app/Operations/DoubleEntropyOp.h index 4df8cd7f3f13e29cc3577b3cb4e882abeb1f3d44..61ddffc345f083aab44542e2ebd1cff8ee89c028 100644 --- a/app/Operations/DoubleEntropyOp.h +++ b/app/Operations/DoubleEntropyOp.h @@ -27,6 +27,8 @@ class DoubleEntropyOp : public DoubleOperation public: DoubleEntropyOp(); + virtual ~DoubleEntropyOp(); + void operator()(const imagein::Image_t<double>*, const std::map<const imagein::Image_t<double>*, std::string>&); bool needCurrentImg() const; diff --git a/app/Operations/EntropyOp.cpp b/app/Operations/EntropyOp.cpp index c14e27935f96a6d4c992ce4f6c3a939260f11d02..4631cbe11c66b3a121c86f6eeaf630aa6b1843d1 100644 --- a/app/Operations/EntropyOp.cpp +++ b/app/Operations/EntropyOp.cpp @@ -57,3 +57,6 @@ void EntropyOp::operator()(const Image* image, const std::map<const imagein::Ima bool EntropyOp::needCurrentImg() const { return true; } + +EntropyOp::~EntropyOp() { +} diff --git a/app/Operations/EntropyOp.h b/app/Operations/EntropyOp.h index 2848b6fd277e33e23ce7f3a0ce7cdfa84047f3af..53f01b565a3fab8c345666947b95518421a71886 100644 --- a/app/Operations/EntropyOp.h +++ b/app/Operations/EntropyOp.h @@ -27,6 +27,8 @@ class EntropyOp : public Operation public: EntropyOp(); + virtual ~EntropyOp(); + void operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&); bool needCurrentImg() const; diff --git a/lib/detiq-t b/lib/detiq-t index 9376ae7717171c4a1e7ab4027f2d656742689763..8f5e49b95200fc47fffcb06bf7a2a612ea72464e 160000 --- a/lib/detiq-t +++ b/lib/detiq-t @@ -1 +1 @@ -Subproject commit 9376ae7717171c4a1e7ab4027f2d656742689763 +Subproject commit 8f5e49b95200fc47fffcb06bf7a2a612ea72464e