title: How to solve this problem [SpyderKernelApp] WARNING | No such comm:
body: <p>I just started to understand OpenSV and try to make it not distorted after resizing the image. This is my code:</p>
  <pre><code>import numpy as np
  import cv2
  # upload the file as a color image and as a gray image
  img = cv2.imread('C:/Users/HomePC/Desktop/1.jpg')
  img_gray = cv2.imread('C:/Users/HomePC/Desktop/1.jpg',0)
  
  # display images in a window
  cv2.imshow('Window',img)
  # all windows are closed after pressing any key
  cv2.waitKey (0)
  cv2.destroyAllWindows()
  
  # save images to a file
  image = cv2.imread('C:/Users/HomePC/Desktop/1.jpg')
  cv2.imwrite('C:/Users/HomePC/Desktop/1.png',image)
  
  img = cv2.imread ('C:/Users/HomePC/Desktop/1.jpg')
  img = cv2.imread ('C:/Users/HomePC/Desktop/1.jpg',1)
  (h, w, d) = image.shape#
  print(&quot;width ={}, height ={}, depth ={}&quot;. format (w, h, d))
  
  # access to individual pixels
  # access to RGB (!) pixels with coordinates x = 50, y = 100
  (B, G, R) = image[100 , 50]
  print(&quot;R={}, G={}, B={}&quot;. format (R, G, B))
  
  # slice arrays and cut out images
  # extract a 100x100 pixel square ROI ( Region of Interest ) from the
  # input image starting at x=320 ,y=60 at ending at x=420 ,y= 160
  roi = image[560:660,320:420]
  cv2.imshow(&quot;ROI &quot;, roi)
  cv2.waitKey(0)
  
  # resize images
  # resize the image to 200x200px , ignoring aspect ratio
  resized = cv2.resize(image, (200 , 200 ))
  cv2.imshow(&quot;Fixed Resizing &quot;, resized)
  cv2.waitKey(0)
  
  img = cv2.imread('C:/Users/HomePC/Desktop/1.jpg')
  h,w= img.shape[0:2] # height and width of the original image
  h_new = 500 # the height of the new image
  ratio =w/h # the ratio of width to height
  w_new = int( h_new * ratio) # width of the new image
  resized = cv2.resize(img, (w_new, h_new)) # new image, in the cottage width in the first place!
  # although the shape function has a height as the first argument
  print(resized.shape)
  cv2.imshow('1',resized)
  </code></pre>
  <p>When I try to make the image not distorted after resizing, the spider gives me this error:</p>
  <p>Kernel died, restarting</p>
  <p>[SpyderKernelApp] WARNING | No such comm: a45c4fb203fc11ebaed21831bf76912a</p>
  <p>It happened after adding this piece of code:</p>
  <pre><code>img = cv2.imread('C:/Users/HomePC/Desktop/1.jpg')
  h,w= img.shape[0:2] # height and width of the original image
  h_new = 500 # the height of the new image
  ratio =w/h # the ratio of width to height
  w_new = int( h_new * ratio) # width of the new image
  resized = cv2.resize(img, (w_new, h_new)) # new image, in the cottage width in the first place!
  # although the shape function has a height as the first argument
  print(resized.shape)
  cv2.imshow('1',resized)
  </code></pre>