mirror of
https://github.com/yuzu-emu/FasTC
synced 2024-11-22 04:13:33 +00:00
Add multiplier to make the differences more noticable
This commit is contained in:
parent
f1151ff767
commit
841a1b0c72
3 changed files with 14 additions and 4 deletions
|
@ -97,7 +97,7 @@ namespace FasTC {
|
|||
double ComputePSNR(Image<PixelType> *other);
|
||||
double ComputeSSIM(Image<PixelType> *other);
|
||||
|
||||
Image<PixelType> Diff(Image<PixelType> *other);
|
||||
Image<PixelType> Diff(Image<PixelType> *other, float mult);
|
||||
|
||||
double ComputeEntropy();
|
||||
double ComputeMeanLocalEntropy();
|
||||
|
|
|
@ -199,7 +199,7 @@ const PixelType & Image<PixelType>::operator()(uint32 i, uint32 j) const {
|
|||
}
|
||||
|
||||
template<typename PixelType>
|
||||
Image<PixelType> Image<PixelType>::Diff(Image<PixelType> *other) {
|
||||
Image<PixelType> Image<PixelType>::Diff(Image<PixelType> *other, float mult) {
|
||||
if (!other) {
|
||||
std::cerr << "Image::Diff - ERROR: other == null" << std::endl;
|
||||
assert(false);
|
||||
|
@ -219,6 +219,7 @@ Image<PixelType> Image<PixelType>::Diff(Image<PixelType> *other) {
|
|||
for (int j = 0; j < GetHeight(); ++j) {
|
||||
for (int i = 0; i < GetWidth(); ++i) {
|
||||
result(i, j) = PixelAbs((*this)(i, j) - (*other)(i, j));
|
||||
result(i, j) *= mult;
|
||||
result(i, j).MakeOpaque();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,15 +80,24 @@ void gen_random(char *s, const int len) {
|
|||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if(argc != 3 && argc != 4) {
|
||||
if(argc < 3 || argc > 5) {
|
||||
PrintUsageAndExit();
|
||||
}
|
||||
|
||||
bool diff_images = false;
|
||||
float diff_multiplier = 1.0;
|
||||
int arg = 1;
|
||||
if (strncmp(argv[arg], "-d", 2) == 0) {
|
||||
diff_images = true;
|
||||
arg++;
|
||||
|
||||
if (argc == 5) {
|
||||
diff_multiplier = static_cast<float>(atoi(argv[arg]));
|
||||
if (diff_multiplier < 0) {
|
||||
PrintUsageAndExit();
|
||||
}
|
||||
arg++;
|
||||
}
|
||||
}
|
||||
|
||||
ImageFile img1f (argv[arg]);
|
||||
|
@ -109,7 +118,7 @@ int main(int argc, char **argv) {
|
|||
FasTC::Image<> &img2 = *img2f.GetImage();
|
||||
|
||||
if (diff_images) {
|
||||
FasTC::Image<> diff = img1.Diff(&img2);
|
||||
FasTC::Image<> diff = img1.Diff(&img2, diff_multiplier);
|
||||
|
||||
char fname_buf [5 + 16 + 4]; // "diff-" + hash + ".png"
|
||||
strncat(fname_buf, "diff-", 5);
|
||||
|
|
Loading…
Reference in a new issue