这个错误提示是因为你使用了 ndimage,但是没有正确导入该模块。

要解决这个问题,你需要在代码开头添加以下语句:

from scipy import ndimage

这样就可以正确使用 ndimage 了。

NameError name ndimage is not defined 怎么解决