dfd-tud / deda

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

Exception "too many indices for array" #22

Closed sebitnt closed 2 weeks ago

sebitnt commented 4 years ago

Hi, after scanning the testpage I'd like to convert it to a mask. So I ran "deda_anonmask_create -r Testpage.bmp" and got the following error: Traceback (most recent call last): File "C:\...\deda_anonmask_create-script.py", line 11, in <module> load_entry_point('deda==2.0b1', 'console_scripts', 'deda_anonmask_create')() File "C:\...\deda_anonmask_create.py", line 50, in <lambda> main = lambda:Main()() File "C:\...\deda_anonmask_create.py", line 43, in __call__ mask = calibrationScan2Anonmask(fp.read(),self.args.copy) File "C:\...\privacy.py", line 274, in calibrationScan2Anonmask return AnonmaskCreator(imbin,verbose)(copy) File "C:\...\privacy.py", line 105, in __call__ self.restoreOrientation() File "C:\...privacy.py", line 153, in restoreOrientation dot = np.min(cEdges[:,0]), np.min(cEdges[:,1]) IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed When I analyze the scanned file with Photoshop, I can clearly see the dots. The testpage was printed on a Kyocera printer. Am I doing something wrong? Thank you in advance!

timojuez commented 2 weeks ago

Please use png or jpeg as input.

timojuez commented 2 weeks ago

Found the issue: For BMP inputs, PIL sets the info["dpi"] to 72.009 although this can be wrong. Fixed in new version. You can also specify the dpi number as a parameter.