cdbharath / shadow_detection_and_removal

Shadow removal by subregion matching and illumination transfer
22 stars 7 forks source link

Error while trying with another jpg file #1

Open risbac opened 4 years ago

risbac commented 4 years ago

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.

ambuje commented 4 years ago

Were you able to resolve this issue? Having same issue.

risbac commented 4 years ago

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 :-(

ambuje commented 4 years ago

Did you found any other solution?

risbac commented 4 years ago

No not yet. I found other similar projects, but I didn't test anything yet. if you find a good solution i'm interested :)

cgurram1 commented 4 years ago

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.

pancost commented 2 years ago

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')