mikucy / CS131

My own solutions for CS131_fall1718 homework release
81 stars 33 forks source link

hw4_release find_seams #2

Closed AaronLu47 closed 6 years ago

AaronLu47 commented 6 years ago

Hello, When I am working with the function find_seams, I have got the error like this:


IndexError Traceback (most recent call last)

in () 3 # Alternatively, find k seams for removal and duplicate them. 4 start = time() ----> 5 seams = find_seams(img, W_new - W) 6 end = time() 7 ~/Desktop/cv&nlp/CS131_release/hw4_release/seam_carving.py in find_seams(image, k, axis, efunc, cfunc) 331 # Store the new seam with value i+1 in the image 332 # We can assert here that we are only writing on zeros (not overwriting existing seams) --> 333 assert np.all(seams[np.arange(H), indices[np.arange(H), seam]] == 0), "we are overwriting seams" 334 seams[np.arange(H), indices[np.arange(H), seam]] = i + 1 335 IndexError: arrays used as indices must be of integer (or boolean) type but I didn't modify the code. Have you got any problems like this? How can I fix this error? Hope for your reply, thanks a lot!
AaronLu47 commented 6 years ago

I have fixed this error! Because I didn't notice that the result of the function remove_seam() is float... There is no error like this using your remove_seam(). Thank u for sharing code!

mikucy commented 6 years ago

@AaronLu47 Thanks for commenting, you are welcome.