{
  "id": 12730,
  "title": "colorspace of jpeg images",
  "url": "/competitions/diabetic-retinopathy-detection/discussion/12730",
  "author_name": "",
  "post_date": "2015-03-08T21:18:47.333Z",
  "votes": null,
  "comment_count": 3,
  "views": 2631,
  "content": "<p>I am trying to convert the images into the HSV color space using scikit-image in python. I thought that jpeg was in RGB but the images converted using rgb2hsv do not look correct.</p>\n<p>import numpy as np<br>from skimage import color<br>from skimage import io<br>import os<br># get the path to the script so we can use relative paths<br>full_path = os.path.realpath(__file__)<br>script_path, file = os.path.split(full_path)<br>sep = os.path.sep</p>\n<p>path_to_image = script_path + sep + 'lena.jpg'<br>image = io.imread(path_to_image).astype(np.float32)<br># Jpeg has values of 0-255 we need values normalized of 0.0 - 1.0<br>image = image/255<br>image_grey = color.rgb2grey(image)<br>lena_hsv = color.rgb2hsv(image)</p>\n<p>io.imshow(lena_hsv)<br>io.show()</p>",
  "messages": [
    {
      "id": "65727",
      "postDate": "03/08/2015 21:18:47",
      "content": "<p>I am trying to convert the images into the HSV color space using scikit-image in python. I thought that jpeg was in RGB but the images converted using rgb2hsv do not look correct.</p>\n<p>import numpy as np<br>from skimage import color<br>from skimage import io<br>import os<br># get the path to the script so we can use relative paths<br>full_path = os.path.realpath(__file__)<br>script_path, file = os.path.split(full_path)<br>sep = os.path.sep</p>\n<p>path_to_image = script_path + sep + 'lena.jpg'<br>image = io.imread(path_to_image).astype(np.float32)<br># Jpeg has values of 0-255 we need values normalized of 0.0 - 1.0<br>image = image/255<br>image_grey = color.rgb2grey(image)<br>lena_hsv = color.rgb2hsv(image)</p>\n<p>io.imshow(lena_hsv)<br>io.show()</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65755",
      "postDate": "03/09/2015 06:06:37",
      "content": "<p>This is what I'm getting on matlab, is it ok? I'm not sure what you mean by 'look correct'</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65757",
      "postDate": "03/09/2015 06:39:35",
      "content": "<p>If I use photoshop to convert the images look virtually identical. I suspect that it is an artifact of how matplotlib or other Python libraries is rendering hsv. It seems that the information from the .jpeg files is being preserved and therefore not a problem.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "66072",
      "postDate": "03/12/2015 22:46:50",
      "content": "<p>Maybe trouble in order of colours in io.imread(). i think used BGR. Try to split image and merge in RGB.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 65755,
      "author_name": "codekitty",
      "author_url": "",
      "post_date": "03/09/2015 06:06:37",
      "content": "<p>This is what I'm getting on matlab, is it ok? I'm not sure what you mean by 'look correct'</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65757,
      "author_name": "densonsmith",
      "author_url": "",
      "post_date": "03/09/2015 06:39:35",
      "content": "<p>If I use photoshop to convert the images look virtually identical. I suspect that it is an artifact of how matplotlib or other Python libraries is rendering hsv. It seems that the information from the .jpeg files is being preserved and therefore not a problem.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 66072,
      "author_name": "kain198",
      "author_url": "",
      "post_date": "03/12/2015 22:46:50",
      "content": "<p>Maybe trouble in order of colours in io.imread(). i think used BGR. Try to split image and merge in RGB.&nbsp;</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "65727": "",
    "65755": "",
    "65757": "",
    "66072": ""
  },
  "source": "meta"
}