I find it difficult to solve the problem of creating a mask. My image is big, 40959px X 24575px and im trying to create a mask for it. I noticed that I have no problems with images up to a certain size (I tested about 33,000 pixels x 22,000 pixels), but for sizes larger than my error occurs inside my mask (the error is that it blackens in the middle of the polygon and the white area extends to the left edge. The result should be no black area inside the polygon and no white area extending to the left edge of the image).
So my code looks like this:
pixel_points_list = latLonToPixel(dataSet, lat_lon_pairs)
print pixel_points_list
image = cv2.imread(in_tmpImgFilePath,-1)
print image.shape
mask = np.zeros(image.shape, dtype=np.uint8)
roi_corners = np.array([pixel_points_list], dtype=np.int32)
print roi_corners
"""
[[[ 213 6259]
[22301 23608]
[25363 22223]
[27477 23608]
[35058 18433]
[12168 282]
[ 213 6259]]]
"""
channel_count = image.shape[2]
ignore_mask_color = (255,)*channel_count
cv2.fillPoly(mask, roi_corners, ignore_mask_color)
cv2.imwrite("mask.tif",mask)
And this is the im mask receiving with these coordinates (mini mask):

, . pixel_points_list , im , fillPoly im .
, 4 (5) :
roi_corners = array([[ 213 6259]
[22301 23608]
[35058 18433]
[12168 282]
[ 213 6259]])

- , ?
!