{
  "id": 149673,
  "title": "My notebook keep restarting just when I read the image",
  "url": "/competitions/global-wheat-detection/discussion/149673",
  "author_name": "",
  "post_date": "2020-05-09T12:32:05.416445400Z",
  "votes": 1,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I just load the data, and tried to show an image by cv.imshow(), and not only the image didn't show up but the notebook restart again.</p>\n\n<p>My code is like:\n<code>img = cv2.imread('image</code>1.jpg'),\ncv2.imshow('image_sample', img)</p>\n\n<p>Does my notebook crushed?</p>",
  "messages": [
    {
      "id": "839503",
      "postDate": "05/09/2020 12:32:05",
      "content": "<p>I just load the data, and tried to show an image by cv.imshow(), and not only the image didn't show up but the notebook restart again.</p>\n\n<p>My code is like:\n<code>img = cv2.imread('image</code>1.jpg'),\ncv2.imshow('image_sample', img)</p>\n\n<p>Does my notebook crushed?</p>",
      "rawMarkdown": "I just load the data, and tried to show an image by cv.imshow(), and not only the image didn't show up but the notebook restart again.\n\nMy code is like:\n`img = cv2.imread('image `1.jpg'),\ncv2.imshow('image_sample', img)\n\nDoes my notebook crushed?",
      "votes": null
    },
    {
      "id": "840155",
      "postDate": "05/09/2020 19:47:47",
      "content": "<p>I don't think cv2.imshow() is meant for notebooks. Use matplotlib instead as so:\n<code>\nimport matplotlib.pyplot as plt\nimg = cv2.imread('...')\nplt.imshow(img)\n</code></p>\n\n<p>Also, you seem to have a comma at the end of your first line which may cause trouble.</p>",
      "rawMarkdown": "I don't think cv2.imshow() is meant for notebooks. Use matplotlib instead as so:\n```\nimport matplotlib.pyplot as plt\nimg = cv2.imread('...')\nplt.imshow(img)\n```\n\nAlso, you seem to have a comma at the end of your first line which may cause trouble.",
      "votes": null
    },
    {
      "id": "840412",
      "postDate": "05/10/2020 02:10:17",
      "content": "<p>Thanks! It solved my problem, although I don't know why cv2.imshow() don't work in notebook.</p>",
      "rawMarkdown": "Thanks! It solved my problem, although I don't know why cv2.imshow() don't work in notebook.",
      "votes": null
    },
    {
      "id": "840421",
      "postDate": "05/10/2020 02:26:52",
      "content": "<p>It is not intended for use in notebooks and required a system GUI window in order to display. Since the kernels here don't provide a gui, it will not work. Matplotlib on the other hand is specifically built to work within a notebook by displaying the images as output within the notebook.</p>",
      "rawMarkdown": "It is not intended for use in notebooks and required a system GUI window in order to display. Since the kernels here don't provide a gui, it will not work. Matplotlib on the other hand is specifically built to work within a notebook by displaying the images as output within the notebook.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 840155,
      "author_name": "matthewmasters",
      "author_url": "",
      "post_date": "05/09/2020 19:47:47",
      "content": "<p>I don't think cv2.imshow() is meant for notebooks. Use matplotlib instead as so:\n<code>\nimport matplotlib.pyplot as plt\nimg = cv2.imread('...')\nplt.imshow(img)\n</code></p>\n\n<p>Also, you seem to have a comma at the end of your first line which may cause trouble.</p>",
      "votes": null,
      "replies": [
        {
          "id": 840412,
          "author_name": "laurencelin",
          "author_url": "",
          "post_date": "05/10/2020 02:10:17",
          "content": "<p>Thanks! It solved my problem, although I don't know why cv2.imshow() don't work in notebook.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 840421,
          "author_name": "matthewmasters",
          "author_url": "",
          "post_date": "05/10/2020 02:26:52",
          "content": "<p>It is not intended for use in notebooks and required a system GUI window in order to display. Since the kernels here don't provide a gui, it will not work. Matplotlib on the other hand is specifically built to work within a notebook by displaying the images as output within the notebook.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "839503": "I just load the data, and tried to show an image by cv.imshow(), and not only the image didn't show up but the notebook restart again.\n\nMy code is like:\n`img = cv2.imread('image `1.jpg'),\ncv2.imshow('image_sample', img)\n\nDoes my notebook crushed?",
    "840155": "I don't think cv2.imshow() is meant for notebooks. Use matplotlib instead as so:\n```\nimport matplotlib.pyplot as plt\nimg = cv2.imread('...')\nplt.imshow(img)\n```\n\nAlso, you seem to have a comma at the end of your first line which may cause trouble.",
    "840412": "Thanks! It solved my problem, although I don't know why cv2.imshow() don't work in notebook.",
    "840421": "It is not intended for use in notebooks and required a system GUI window in order to display. Since the kernels here don't provide a gui, it will not work. Matplotlib on the other hand is specifically built to work within a notebook by displaying the images as output within the notebook."
  },
  "source": "meta"
}