biigle / laserpoints

:m: BIIGLE module to perform a heuristic laser point detection on images
GNU General Public License v3.0
0 stars 0 forks source link

Gracefully handle empty/broken images #24

Closed mzur closed 6 years ago

mzur commented 6 years ago

I see quite a few errors with the laser point detection in this volume because it has so many empty/broken images. Gracefully handle this in delphiApply.py and return a useful error message here:

Traceback (most recent call last):
  File delphiApply.py, line 24, in <module>
    width, height, _ = img.shape
    ValueError: need more than 0 values to unpack

and here:

Traceback (most recent call last):
  File delphiApply.py, line 23, in <module>
    img = imread(imgfile)
  File .../scipy/misc/pilutil.py, line 154, in imread
    im = Image.open(name)
  File .../PIL/Image.py, line 1986, in open
    raise IOError("cannot identify image file")
    IOError: cannot identify image file

Also gracefully handle this in delphiGather.py and skip the images that can't be read:

Traceback (most recent call last):
  File delphiGather.py, line 58, in <module>
    lps[idx * numLaserpoints + idx2] = lpimg[j[0], j[1]]
    IndexError: too many indices for array