{
  "id": 223020,
  "title": "Why are three channels present in the images?",
  "url": "/competitions/ranzcr-clip-catheter-line-classification/discussion/223020",
  "author_name": "",
  "post_date": "2021-03-02T06:01:24.675032700Z",
  "votes": 2,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I started analyzing the data of the x-ray images and all three channels in an image seem to be the same.</p>\n<p>`<br>\nimport matplotlib.pyplot as plt<br>\nimport cv2</p>\n<p>img = \"/kaggle/input/ranzcr-clip-catheter-line-classification/test/1.2.826.0.1.3680043.8.498.24641136930096467169760392302420182106.jpg\"<br>\nimg = cv2.imread(img)<br>\ndisplay(img.shape)</p>\n<p>plt.subplot(140+1)<br>\nplt.imshow(img[:,:,0])<br>\nplt.subplot(140+2)<br>\nplt.imshow(img[:,:,1])<br>\nplt.subplot(140+3)<br>\nplt.imshow(img[:,:,2])<br>\nplt.subplot(140+4)<br>\nplt.imshow(img)<br>\nplt.show()<br>\n`<br>\nAll three channels result in the same output and the multichannel IMG is in grayscale. If I am wrong anywhere in plotting the images. please help with the correct approach, else please explain why are there three channels?</p>",
  "messages": [
    {
      "id": "1222773",
      "postDate": "03/02/2021 06:01:24",
      "content": "<p>I started analyzing the data of the x-ray images and all three channels in an image seem to be the same.</p>\n<p>`<br>\nimport matplotlib.pyplot as plt<br>\nimport cv2</p>\n<p>img = \"/kaggle/input/ranzcr-clip-catheter-line-classification/test/1.2.826.0.1.3680043.8.498.24641136930096467169760392302420182106.jpg\"<br>\nimg = cv2.imread(img)<br>\ndisplay(img.shape)</p>\n<p>plt.subplot(140+1)<br>\nplt.imshow(img[:,:,0])<br>\nplt.subplot(140+2)<br>\nplt.imshow(img[:,:,1])<br>\nplt.subplot(140+3)<br>\nplt.imshow(img[:,:,2])<br>\nplt.subplot(140+4)<br>\nplt.imshow(img)<br>\nplt.show()<br>\n`<br>\nAll three channels result in the same output and the multichannel IMG is in grayscale. If I am wrong anywhere in plotting the images. please help with the correct approach, else please explain why are there three channels?</p>",
      "rawMarkdown": "I started analyzing the data of the x-ray images and all three channels in an image seem to be the same.\n\n`\nimport matplotlib.pyplot as plt\nimport cv2\n\nimg = \"/kaggle/input/ranzcr-clip-catheter-line-classification/test/1.2.826.0.1.3680043.8.498.24641136930096467169760392302420182106.jpg\"\nimg = cv2.imread(img)\ndisplay(img.shape)\n\nplt.subplot(140+1)\nplt.imshow(img[:,:,0])\nplt.subplot(140+2)\nplt.imshow(img[:,:,1])\nplt.subplot(140+3)\nplt.imshow(img[:,:,2])\nplt.subplot(140+4)\nplt.imshow(img)\nplt.show()\n`\nAll three channels result in the same output and the multichannel IMG is in grayscale. If I am wrong anywhere in plotting the images. please help with the correct approach, else please explain why are there three channels?",
      "votes": null
    },
    {
      "id": "1222796",
      "postDate": "03/02/2021 06:34:15",
      "content": "<p>use <code>img = cv2.imread(img, cv2.IMREAD_UNCHANGED)</code> and it will have 1 channel correctly</p>",
      "rawMarkdown": "use `img = cv2.imread(img, cv2.IMREAD_UNCHANGED)` and it will have 1 channel correctly",
      "votes": null
    },
    {
      "id": "1222805",
      "postDate": "03/02/2021 06:46:24",
      "content": "<p>Thanks for the response. It is really because of generous and experienced people like you that Kaggle has become a great community for beginners too.</p>",
      "rawMarkdown": "Thanks for the response. It is really because of generous and experienced people like you that Kaggle has become a great community for beginners too.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1222796,
      "author_name": "christofhenkel",
      "author_url": "",
      "post_date": "03/02/2021 06:34:15",
      "content": "<p>use <code>img = cv2.imread(img, cv2.IMREAD_UNCHANGED)</code> and it will have 1 channel correctly</p>",
      "votes": null,
      "replies": [
        {
          "id": 1222805,
          "author_name": "pskiitm",
          "author_url": "",
          "post_date": "03/02/2021 06:46:24",
          "content": "<p>Thanks for the response. It is really because of generous and experienced people like you that Kaggle has become a great community for beginners too.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1222773": "I started analyzing the data of the x-ray images and all three channels in an image seem to be the same.\n\n`\nimport matplotlib.pyplot as plt\nimport cv2\n\nimg = \"/kaggle/input/ranzcr-clip-catheter-line-classification/test/1.2.826.0.1.3680043.8.498.24641136930096467169760392302420182106.jpg\"\nimg = cv2.imread(img)\ndisplay(img.shape)\n\nplt.subplot(140+1)\nplt.imshow(img[:,:,0])\nplt.subplot(140+2)\nplt.imshow(img[:,:,1])\nplt.subplot(140+3)\nplt.imshow(img[:,:,2])\nplt.subplot(140+4)\nplt.imshow(img)\nplt.show()\n`\nAll three channels result in the same output and the multichannel IMG is in grayscale. If I am wrong anywhere in plotting the images. please help with the correct approach, else please explain why are there three channels?",
    "1222796": "use `img = cv2.imread(img, cv2.IMREAD_UNCHANGED)` and it will have 1 channel correctly",
    "1222805": "Thanks for the response. It is really because of generous and experienced people like you that Kaggle has become a great community for beginners too."
  },
  "source": "meta"
}