dfd-tud / deda

https://dfd.inf.tu-dresden.de
GNU General Public License v3.0
1.57k stars 92 forks source link

Getting attribute error when calling 'numerator' #8

Closed jkuhnregnier closed 6 years ago

jkuhnregnier commented 6 years ago

I have followed the installation instructions, but whenever I called the python file deda_parse_print.py with my scanned image, I am getting an the following error in the extract_yd.py file:

 dpi = [n.numerator for n in pilimg.info["dpi"]]
AttributeError: 'float' object has no attribute 'numerator'

Once I corrected the code to dpi = [int(n).numerator for n in pilimg.info["dpi"]] the error went away and I was able to run your Python script.

timojuez commented 6 years ago

Hi and thank you for your report. What python version are you using? What file format is your input?

You can temporarily bypass the errror by passing --dpi and the dpi value to deda_parse_print.

jkuhnregnier commented 6 years ago

Ah, good to know! I will try that out some time soon. My Python version is Python 3.6.4.

By the way, on a side note, I was wondering whether you know of a good way to get pictures that include the tracking dots. I wanted to fiddle with it myself, but my own printer doesn't seem to print them (that's what DEDA says), thus, the question.

timojuez commented 6 years ago

I cannot reproduce the error at the moment. What file type was your input?

If you own a modern colour laser printer (younger than 10 years) it very likely prints tracking dots. Some scanners remove them to map the paper structure to plain white by a threshold. In this case deactivate this feature. We will upload example scans soon. A dataset is available e.g. at http://madm.dfki.de/downloads-ds-mic.

jkuhnregnier commented 6 years ago

I have used a jpeg file as input. The file was a standard 300 dpi scanner file.

Thank you so much for the link and the hint. I have tried Deda on a relatively new Epson printer and ran the file through deda and it came back and said that it couldn't find any tracking pixels. I also manually looked at the file through Photoshop.

timojuez commented 6 years ago

Fixed in the development version. The error probably is caused by the combination of an old version of pillow and the input format. $ pip3 install -U Pillow

jkuhnregnier commented 6 years ago

Thanks @timojuez for the help and the fix!