title: Opencv: error: (-215:Assertion failed) _src.total() > 0 in function 'cv::warpPerspective'
body: <p>I have image path which has Chinese characters inside, and I try to decode path with cv2 in Python3: </p>
  
  <pre><code>def main(src):
      global img, img2, ROI, src_path, dst_path
      src_path = src
      main_path = os.path.dirname(src)
      dst_path = main_path + '/output.jpg'
      stream = open(src_path, "rb")
      bytes = bytearray(stream.read())
      numpyarray = np.asarray(bytes, dtype = np.uint8)
      img = cv2.imdecode(numpyarray, cv2.IMREAD_UNCHANGED)
      print(img)
  </code></pre>
  
  <p>The image is read correctly,  I have the following output:</p>
  
  <pre><code>[[[58 63 64]
    [52 57 58]
    [56 61 62]
    ...
    [65 55 71]
    [63 53 69]
    [64 54 70]]
  
   [[54 59 60]
    [48 53 54]
    [49 54 55]
    ...
    [65 55 71]
    [68 58 74]
    [68 58 74]]
  
   [[55 60 61]
    [62 67 68]
    [53 58 59]
    ...
    [71 61 77]
    [76 66 82]
    [73 63 79]]
  
   ...
  
   [[38 46 45]
    [38 46 45]
    [42 48 47]
    ...
    [55 58 62]
    [57 60 64]
    [51 54 58]]
  
   [[32 40 39]
    [30 38 37]
    [35 43 42]
    ...
    [50 54 55]
    [58 62 63]
    [54 58 59]]
  
   [[28 36 35]
    [26 34 33]
    [38 46 45]
    ...
    [26 30 31]
    [51 55 56]
    [75 79 80]]]
  </code></pre>
  
  <p>But I get <code>Traceback</code> while transfer selected points coordinates to <code>dst</code>, in order to make <code>perspective transform</code> for the region of interest selected by mouse click. </p>
  
  <pre><code>Traceback (most recent call last):
  
    File "D:\roi_pt_ocr\roi_perspective_transform.py", line 77, in on_mouse
      perspective_transform(tpPointsChoose, src_path, dst_path)
  
    File "D:\roi_pt_ocr\roi_perspective_transform.py", line 109, in perspective_transform
      dst = cv2.warpPerspective(img, M, (x_length, y_length))
  
  error: OpenCV(3.4.4) C:\projects\opencv-python\opencv\modules\imgproc\src\imgwarp.cpp:2903: error: (-215:Assertion failed) _src.total() &gt; 0 in function 'cv::warpPerspective'
  </code></pre>
  
  <p>Does someone can help me to figure out why this error happens while image are read correctly? Thanks.</p>