1 | initial version |
My guess is that the problem is not in function that draws rectangle in image, but in displaying this image on screen. If your image is bigger than your screen it should be downsized. There many ways to reduce size, and some of them involve removing part of rows/columns. So it can be that top line of your rectangle belongs to one of those removed rows. Happend to me number of times when I opened my images with IrfanView (not necessary top line).
To check this assumption store image with the rectangle in file.