Open risbac opened 4 years ago
Were you able to resolve this issue? Having same issue.
No I didn't solve it. I didn't try with another file in fact, I hoped to have an answer here. So far I'm blocked unfortunately :-(
Did you found any other solution?
No not yet. I found other similar projects, but I didn't test anything yet. if you find a good solution i'm interested :)
Hello !
I have a few photos I would love to treat with a good shadow removal method. I tried your code, with a random jpg, and I have an error :
shadow_detect.py:19: RuntimeWarning: invalid value encountered in double_scalars hsi[i][j][0] = math.acos(((blur[i][j][2]-blur[i][j][1])*(blur[i][j][2]-blur[i][j][0]))/(2*math.sqrt((blur[i][j][2]-blur[i][j][1])*(blur[i][j][2]-blur[i][j][1])+(blur[i][j][2]-blur[i][j][0])*(blur[i][j][1]-blur[i][j][0])))) Traceback (most recent call last): File "shadow_detect.py", line 21, in <module> ratio_map[i][j] = hsi[i][j][0]/(hsi[i][j][2]+0.01) ValueError: cannot convert float NaN to integer
I took a small jpeg file online to test it, and renamed it "shadow.jpg", before running your code.
i tried with default image and getting same error. u got any solution.
Hello !
I have a few photos I would love to treat with a good shadow removal method. I tried your code, with a random jpg, and I have an error :
shadow_detect.py:19: RuntimeWarning: invalid value encountered in double_scalars hsi[i][j][0] = math.acos(((blur[i][j][2]-blur[i][j][1])*(blur[i][j][2]-blur[i][j][0]))/(2*math.sqrt((blur[i][j][2]-blur[i][j][1])*(blur[i][j][2]-blur[i][j][1])+(blur[i][j][2]-blur[i][j][0])*(blur[i][j][1]-blur[i][j][0])))) Traceback (most recent call last): File "shadow_detect.py", line 21, in <module> ratio_map[i][j] = hsi[i][j][0]/(hsi[i][j][2]+0.01) ValueError: cannot convert float NaN to integer
I took a small jpeg file online to test it, and renamed it "shadow.jpg", before running your code.
Try float image dtype: img = cv2.imread(input_file).astype('float32')
Hello !
I have a few photos I would love to treat with a good shadow removal method. I tried your code, with a random jpg, and I have an error :
shadow_detect.py:19: RuntimeWarning: invalid value encountered in double_scalars hsi[i][j][0] = math.acos(((blur[i][j][2]-blur[i][j][1])*(blur[i][j][2]-blur[i][j][0]))/(2*math.sqrt((blur[i][j][2]-blur[i][j][1])*(blur[i][j][2]-blur[i][j][1])+(blur[i][j][2]-blur[i][j][0])*(blur[i][j][1]-blur[i][j][0])))) Traceback (most recent call last): File "shadow_detect.py", line 21, in <module> ratio_map[i][j] = hsi[i][j][0]/(hsi[i][j][2]+0.01) ValueError: cannot convert float NaN to integer
I took a small jpeg file online to test it, and renamed it "shadow.jpg", before running your code.