Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Kuipers <t.kuipers@ultimaker.com>2019-05-20 15:21:05 +0300
committerTim Kuipers <t.kuipers@ultimaker.com>2019-05-20 15:22:27 +0300
commitbeaa5e0b7a300e3eab1eeaff79749ce4fb934632 (patch)
tree24e33a1f6de03fff951b64bba45166f3eca586e7 /plugins/ImageReader
parent9066f5f6d4f484cb2e3cfd8e83a79cfa39fb294f (diff)
fix luminance computation
Diffstat (limited to 'plugins/ImageReader')
-rw-r--r--plugins/ImageReader/ImageReader.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/ImageReader/ImageReader.py b/plugins/ImageReader/ImageReader.py
index ce3cab0b8f..50825f2464 100644
--- a/plugins/ImageReader/ImageReader.py
+++ b/plugins/ImageReader/ImageReader.py
@@ -101,8 +101,10 @@ class ImageReader(MeshReader):
for x in range(0, width):
for y in range(0, height):
qrgb = img.pixel(x, y)
- luminance = (0.2126 * qRed(qrgb) + 0.7152 * qGreen(qrgb) + 0.0722 * qBlue(qrgb)) / 255 # fast computation ignoring gamma
- height_data[y, x] = luminance
+ if use_logarithmic_function:
+ height_data[y, x] = (0.299 * math.pow(qRed(qrgb) / 255.0, 2.2) + 0.587 * math.pow(qGreen(qrgb) / 255.0, 2.2) + 0.114 * math.pow(qBlue(qrgb) / 255.0, 2.2))
+ else:
+ height_data[y, x] = (0.212655 * qRed(qrgb) + 0.715158 * qGreen(qrgb) + 0.072187 * qBlue(qrgb)) / 255 # fast computation ignoring gamma and degamma
Job.yieldThread()