HullLab/AutoMorph

run3dmorph: opencv 'resize' failing

Opened this issue · 1 comments

Hi! I'm testing out run3dmorph on my new computer and ran into an issue in the mesh extraction step. Full traceback is below. I think that there may be an interger overflow issue in the opencv 'resize' function (error: (-215:Assertion failed) !ssize.empty() in function 'resize'); see this stack overflow post. In any case I'd love to know how to fix this!

INFO: Generating height map...
	INFO: Time elapsed: 9.497 seconds

	INFO: Beginning mesh extraction...
Traceback (most recent call last):
  File "/Applications/AutoMorph/run3dmorph/run3dmorph", line 112, in <module>
    morph3d(control_file,False)
  File "/Applications/AutoMorph/run3dmorph/run3dmorph", line 68, in morph3d
    edge,image_clean,triangulation,triangles,faceColors,length,width,bottom_height,top_height = mesh.extractMesh(run,obj)
  File "/Applications/AutoMorph/run3dmorph/mesh.py", line 229, in extractMesh
    hmap_resized,rgb_resized = imagePreparation(settings,obj)
  File "/Applications/AutoMorph/run3dmorph/mesh.py", line 57, in imagePreparation
    hmap_resized = resize(hmap,settings['pixel_size_x'],settings['pixel_size_y'])
  File "/Applications/AutoMorph/run3dmorph/mesh.py", line 42, in resize
    resized = cv2.resize(image,(0,0),fx=x_calibration,fy=y_calibration)
cv2.error: OpenCV(4.1.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/resize.cpp:3718: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

Just ran into this same issue on Grace. It turned out the problem is that if Fiji isn't available (not installed or not in environment, etc), the height map generation fails silently. The mesh extraction then fails because it can't find the height map.

We should add 2 checks:

  • Is Fiji available on the system?
  • Between height map generation and mesh extraction, does the height map file exists?