Skip to content
Advertisement

Is there a way to fix value-error problem

Hello guys i am trying to implement an algortihm to remove water from underwater images and make image more noticable , but i got an errror ValueError: max() arg is an empty sequence , at the function homomorpic on this line r = max(np.ravel(result[:,:i])) , the error is caused because the result array is empty but i filled it above .Here the code below.

JavaScript

Thanks for any help or suggestion.

Advertisement

Answer

In this loop for i in range(3): the first value of i would be 0.

This will later on lead to this r = max(np.ravel(result[:,:0])) where the result from the slicing would be empty.

You would want to shift yourrange forward like this:

JavaScript
Advertisement