The previously accepted answer doesn't work for me in R2017b - here is what does, using OP's example img.
When you use roipoly, it resets caxis to [0 1]. So just change the scale in your img to [0 1]. In this case, here are the series of commands you'd use:
Use 'caxis' to find out what the scale of your image is.
Say it's [0 1000]. This will give back
Now, divide your img by 1000 to reduce the caxis to [0 1]. Then use roipoly on that.
img = img ./ 1000
mask = roipoly(img)