{
  "id": 163992,
  "title": "understanding from scratch with code: J-UNIWARD ( Universal Wavelet Relative Distortion)",
  "url": "/competitions/alaska2-image-steganalysis/discussion/163992",
  "author_name": "",
  "post_date": "2020-07-04T10:19:23.066123400Z",
  "votes": 14,
  "comment_count": 6,
  "views": 0,
  "content": "<p>not 100% completed or checked. \nhere is the final version (see attached PPT J-uniward_v1.pptx)</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F7d5b8694eb42287e2c573401bbfd7a31%2FSelection_046.png?generation=1593857927119581&amp;alt=media\" alt=\"\">\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F8d79bc9e74bec38a8f2019e065aebc81%2FSelection_047.png?generation=1593857927308471&amp;alt=media\" alt=\"\"></p>\n\n<p>see ppt for more slides ...</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F3e68931911b9ba28ba72e9534e4fbbc0%2FSelection_048.png?generation=1593857927863266&amp;alt=media\" alt=\"\"></p>",
  "messages": [
    {
      "id": "914896",
      "postDate": "07/04/2020 10:19:23",
      "content": "<p>not 100% completed or checked. \nhere is the final version (see attached PPT J-uniward_v1.pptx)</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F7d5b8694eb42287e2c573401bbfd7a31%2FSelection_046.png?generation=1593857927119581&amp;alt=media\" alt=\"\">\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F8d79bc9e74bec38a8f2019e065aebc81%2FSelection_047.png?generation=1593857927308471&amp;alt=media\" alt=\"\"></p>\n\n<p>see ppt for more slides ...</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F3e68931911b9ba28ba72e9534e4fbbc0%2FSelection_048.png?generation=1593857927863266&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "not 100% completed or checked. \nhere is the final version (see attached PPT J-uniward_v1.pptx)\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F7d5b8694eb42287e2c573401bbfd7a31%2FSelection_046.png?generation=1593857927119581&amp;alt=media)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F8d79bc9e74bec38a8f2019e065aebc81%2FSelection_047.png?generation=1593857927308471&amp;alt=media)\n\nsee ppt for more slides ...\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F3e68931911b9ba28ba72e9534e4fbbc0%2FSelection_048.png?generation=1593857927863266&amp;alt=media)",
      "votes": null
    },
    {
      "id": "915201",
      "postDate": "07/04/2020 14:43:36",
      "content": "<p>final version J-uniward_v1.pptx (1.17 MB) has been uploaded. It explain the HUGO embedding simulator.</p>\n\n<p>Note that there are many variants of implementation. there is no guarantee that this is the actual version used in ALASKA2 challenge. </p>\n\n<p>The objective of these slide and code is mainly to understand how stenography works. </p>",
      "rawMarkdown": "final version J-uniward_v1.pptx (1.17 MB) has been uploaded. It explain the HUGO embedding simulator.\n\nNote that there are many variants of implementation. there is no guarantee that this is the actual version used in ALASKA2 challenge. \n\nThe objective of these slide and code is mainly to understand how stenography works.",
      "votes": null
    },
    {
      "id": "915202",
      "postDate": "07/04/2020 14:44:34",
      "content": "<p>Super cool, <a href=\"/hengck23\">@hengck23</a></p>\n\n<p>It's like I'm seeing my ideas pop up right in front of me, lol. One thing though: <code>ndimage.correlate</code> doesn't have matlab's <code>res_size=full</code> outputs for the convolution, so you have to roll them yourself:</p>\n\n<p>```\ndef imfilter(im, f, res_size='same', pad=0):\n    # Note to self: Assumes single channel!</p>\n\n<pre><code># https://sourceforge.net/p/octave/image/ci/default/tree/inst/imfilter.m#l55\nimrows, imcols = im.shape\nfrows, fcols = f.shape\nC = im.dtype\n\nif res_size!='full':\n    return ndimage.correlate(\n        im, f, mode='constant'\n    ).astype(C)#.transpose()\n\nim = np.pad(im, (frows//2, fcols//2), mode='constant')\nif frows%2 == 0: im = im[1:]\nif fcols%2 == 0: im = im[:, 1:]\n\nreturn ndimage.correlate(\n    im, f, mode='constant'\n).astype(C)#.transpose()\n</code></pre>\n\n<p>```</p>\n\n<p>Then comparing python + matlab:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F933480%2F2e8fe713e8fc6b1b6233609bfc58f4fe%2FScreen%20Shot%202020-07-04%20at%209.39.43%20AM.png?generation=1593873852356453&amp;alt=media\" alt=\"\"></p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F933480%2F375b92f0488f8924ab83c738d9eb4808%2FScreen%20Shot%202020-07-04%20at%209.45.43%20AM.png?generation=1593873968111924&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "Super cool, @hengck23\n\nIt's like I'm seeing my ideas pop up right in front of me, lol. One thing though: `ndimage.correlate` doesn't have matlab's `res_size=full` outputs for the convolution, so you have to roll them yourself:\n\n```\ndef imfilter(im, f, res_size='same', pad=0):\n    # Note to self: Assumes single channel!\n    \n    # https://sourceforge.net/p/octave/image/ci/default/tree/inst/imfilter.m#l55\n    imrows, imcols = im.shape\n    frows, fcols = f.shape\n    C = im.dtype\n\n    if res_size!='full':\n        return ndimage.correlate(\n            im, f, mode='constant'\n        ).astype(C)#.transpose()\n    \n    im = np.pad(im, (frows//2, fcols//2), mode='constant')\n    if frows%2 == 0: im = im[1:]\n    if fcols%2 == 0: im = im[:, 1:]\n\n    return ndimage.correlate(\n        im, f, mode='constant'\n    ).astype(C)#.transpose()\n```\n\nThen comparing python + matlab:\n\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F933480%2F2e8fe713e8fc6b1b6233609bfc58f4fe%2FScreen%20Shot%202020-07-04%20at%209.39.43%20AM.png?generation=1593873852356453&amp;alt=media)\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F933480%2F375b92f0488f8924ab83c738d9eb4808%2FScreen%20Shot%202020-07-04%20at%209.45.43%20AM.png?generation=1593873968111924&amp;alt=media)",
      "votes": null
    },
    {
      "id": "915207",
      "postDate": "07/04/2020 14:48:14",
      "content": "<p><a href=\"/authman\">@authman</a> </p>\n\n<p>thanks for the information. I haven't have time to cross check the matlab code (since i don't have matlab and it is a pain to run octave.)</p>\n\n<p>But the way you can run octave in python with use oct2py. this may be easier to cross check</p>",
      "rawMarkdown": "authman \n\nthanks for the information. I haven't have time to cross check the matlab code (since i don't have matlab and it is a pain to run octave.)\n\nBut the way you can run octave in python with use oct2py. this may be easier to cross check",
      "votes": null
    },
    {
      "id": "915213",
      "postDate": "07/04/2020 14:52:51",
      "content": "<p>Nice, I didn't know about that. I had been using <a href=\"https://octave-online.net/\">https://octave-online.net/</a> because, as you've mentioned, it's an annoyance to install and I have no desire to have octave running locally 😅</p>",
      "rawMarkdown": "Nice, I didn't know about that. I had been using https://octave-online.net/ because, as you've mentioned, it's an annoyance to install and I have no desire to have octave running locally 😅",
      "votes": null
    },
    {
      "id": "915572",
      "postDate": "07/04/2020 20:57:40",
      "content": "<p><a href=\"/hengck23\">@hengck23</a> J-uniward is also available in C++ code <a href=\"http://dde.binghamton.edu/download/stego_algorithms/\">http://dde.binghamton.edu/download/stego_algorithms/</a></p>\n\n<p>Question: would a) a flipped (LR or UD) image and b) rotated (90 or 270 degrees) image give the matching DCT (rotated or flipped) DCT spots when computing the cost? In other words I'm asking if you compute (e.g. with J-uniward) the distortion costs in the DCT domain of an image, are there shortcuts to get the corresponding cost for the rotated/flipped counterparts? (i.e. similar to the fact that you can flip and rotate a jpeg image losslessly in the DCT domain).</p>",
      "rawMarkdown": "hengck23 J-uniward is also available in C++ code http://dde.binghamton.edu/download/stego_algorithms/\n\nQuestion: would a) a flipped (LR or UD) image and b) rotated (90 or 270 degrees) image give the matching DCT (rotated or flipped) DCT spots when computing the cost? In other words I'm asking if you compute (e.g. with J-uniward) the distortion costs in the DCT domain of an image, are there shortcuts to get the corresponding cost for the rotated/flipped counterparts? (i.e. similar to the fact that you can flip and rotate a jpeg image losslessly in the DCT domain).",
      "votes": null
    },
    {
      "id": "915580",
      "postDate": "07/04/2020 21:48:36",
      "content": "<p>This implementation is octave-compatible:\n<a href=\"https://github.com/daniellerch/aletheia/blob/master/external/octave/J_UNIWARD.m\">https://github.com/daniellerch/aletheia/blob/master/external/octave/J_UNIWARD.m</a></p>",
      "rawMarkdown": "This implementation is octave-compatible:\nhttps://github.com/daniellerch/aletheia/blob/master/external/octave/J_UNIWARD.m",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 915201,
      "author_name": "hengck23",
      "author_url": "",
      "post_date": "07/04/2020 14:43:36",
      "content": "<p>final version J-uniward_v1.pptx (1.17 MB) has been uploaded. It explain the HUGO embedding simulator.</p>\n\n<p>Note that there are many variants of implementation. there is no guarantee that this is the actual version used in ALASKA2 challenge. </p>\n\n<p>The objective of these slide and code is mainly to understand how stenography works. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 915202,
      "author_name": "authman",
      "author_url": "",
      "post_date": "07/04/2020 14:44:34",
      "content": "<p>Super cool, <a href=\"/hengck23\">@hengck23</a></p>\n\n<p>It's like I'm seeing my ideas pop up right in front of me, lol. One thing though: <code>ndimage.correlate</code> doesn't have matlab's <code>res_size=full</code> outputs for the convolution, so you have to roll them yourself:</p>\n\n<p>```\ndef imfilter(im, f, res_size='same', pad=0):\n    # Note to self: Assumes single channel!</p>\n\n<pre><code># https://sourceforge.net/p/octave/image/ci/default/tree/inst/imfilter.m#l55\nimrows, imcols = im.shape\nfrows, fcols = f.shape\nC = im.dtype\n\nif res_size!='full':\n    return ndimage.correlate(\n        im, f, mode='constant'\n    ).astype(C)#.transpose()\n\nim = np.pad(im, (frows//2, fcols//2), mode='constant')\nif frows%2 == 0: im = im[1:]\nif fcols%2 == 0: im = im[:, 1:]\n\nreturn ndimage.correlate(\n    im, f, mode='constant'\n).astype(C)#.transpose()\n</code></pre>\n\n<p>```</p>\n\n<p>Then comparing python + matlab:</p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F933480%2F2e8fe713e8fc6b1b6233609bfc58f4fe%2FScreen%20Shot%202020-07-04%20at%209.39.43%20AM.png?generation=1593873852356453&amp;alt=media\" alt=\"\"></p>\n\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F933480%2F375b92f0488f8924ab83c738d9eb4808%2FScreen%20Shot%202020-07-04%20at%209.45.43%20AM.png?generation=1593873968111924&amp;alt=media\" alt=\"\"></p>",
      "votes": null,
      "replies": [
        {
          "id": 915207,
          "author_name": "hengck23",
          "author_url": "",
          "post_date": "07/04/2020 14:48:14",
          "content": "<p><a href=\"/authman\">@authman</a> </p>\n\n<p>thanks for the information. I haven't have time to cross check the matlab code (since i don't have matlab and it is a pain to run octave.)</p>\n\n<p>But the way you can run octave in python with use oct2py. this may be easier to cross check</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 915213,
          "author_name": "authman",
          "author_url": "",
          "post_date": "07/04/2020 14:52:51",
          "content": "<p>Nice, I didn't know about that. I had been using <a href=\"https://octave-online.net/\">https://octave-online.net/</a> because, as you've mentioned, it's an annoyance to install and I have no desire to have octave running locally 😅</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 915580,
          "author_name": "daniellerch",
          "author_url": "",
          "post_date": "07/04/2020 21:48:36",
          "content": "<p>This implementation is octave-compatible:\n<a href=\"https://github.com/daniellerch/aletheia/blob/master/external/octave/J_UNIWARD.m\">https://github.com/daniellerch/aletheia/blob/master/external/octave/J_UNIWARD.m</a></p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 915572,
      "author_name": "antorsae",
      "author_url": "",
      "post_date": "07/04/2020 20:57:40",
      "content": "<p><a href=\"/hengck23\">@hengck23</a> J-uniward is also available in C++ code <a href=\"http://dde.binghamton.edu/download/stego_algorithms/\">http://dde.binghamton.edu/download/stego_algorithms/</a></p>\n\n<p>Question: would a) a flipped (LR or UD) image and b) rotated (90 or 270 degrees) image give the matching DCT (rotated or flipped) DCT spots when computing the cost? In other words I'm asking if you compute (e.g. with J-uniward) the distortion costs in the DCT domain of an image, are there shortcuts to get the corresponding cost for the rotated/flipped counterparts? (i.e. similar to the fact that you can flip and rotate a jpeg image losslessly in the DCT domain).</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "914896": "not 100% completed or checked. \nhere is the final version (see attached PPT J-uniward_v1.pptx)\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F7d5b8694eb42287e2c573401bbfd7a31%2FSelection_046.png?generation=1593857927119581&amp;alt=media)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F8d79bc9e74bec38a8f2019e065aebc81%2FSelection_047.png?generation=1593857927308471&amp;alt=media)\n\nsee ppt for more slides ...\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F113660%2F3e68931911b9ba28ba72e9534e4fbbc0%2FSelection_048.png?generation=1593857927863266&amp;alt=media)",
    "915201": "final version J-uniward_v1.pptx (1.17 MB) has been uploaded. It explain the HUGO embedding simulator.\n\nNote that there are many variants of implementation. there is no guarantee that this is the actual version used in ALASKA2 challenge. \n\nThe objective of these slide and code is mainly to understand how stenography works.",
    "915202": "Super cool, @hengck23\n\nIt's like I'm seeing my ideas pop up right in front of me, lol. One thing though: `ndimage.correlate` doesn't have matlab's `res_size=full` outputs for the convolution, so you have to roll them yourself:\n\n```\ndef imfilter(im, f, res_size='same', pad=0):\n    # Note to self: Assumes single channel!\n    \n    # https://sourceforge.net/p/octave/image/ci/default/tree/inst/imfilter.m#l55\n    imrows, imcols = im.shape\n    frows, fcols = f.shape\n    C = im.dtype\n\n    if res_size!='full':\n        return ndimage.correlate(\n            im, f, mode='constant'\n        ).astype(C)#.transpose()\n    \n    im = np.pad(im, (frows//2, fcols//2), mode='constant')\n    if frows%2 == 0: im = im[1:]\n    if fcols%2 == 0: im = im[:, 1:]\n\n    return ndimage.correlate(\n        im, f, mode='constant'\n    ).astype(C)#.transpose()\n```\n\nThen comparing python + matlab:\n\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F933480%2F2e8fe713e8fc6b1b6233609bfc58f4fe%2FScreen%20Shot%202020-07-04%20at%209.39.43%20AM.png?generation=1593873852356453&amp;alt=media)\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F933480%2F375b92f0488f8924ab83c738d9eb4808%2FScreen%20Shot%202020-07-04%20at%209.45.43%20AM.png?generation=1593873968111924&amp;alt=media)",
    "915207": "authman \n\nthanks for the information. I haven't have time to cross check the matlab code (since i don't have matlab and it is a pain to run octave.)\n\nBut the way you can run octave in python with use oct2py. this may be easier to cross check",
    "915213": "Nice, I didn't know about that. I had been using https://octave-online.net/ because, as you've mentioned, it's an annoyance to install and I have no desire to have octave running locally 😅",
    "915572": "hengck23 J-uniward is also available in C++ code http://dde.binghamton.edu/download/stego_algorithms/\n\nQuestion: would a) a flipped (LR or UD) image and b) rotated (90 or 270 degrees) image give the matching DCT (rotated or flipped) DCT spots when computing the cost? In other words I'm asking if you compute (e.g. with J-uniward) the distortion costs in the DCT domain of an image, are there shortcuts to get the corresponding cost for the rotated/flipped counterparts? (i.e. similar to the fact that you can flip and rotate a jpeg image losslessly in the DCT domain).",
    "915580": "This implementation is octave-compatible:\nhttps://github.com/daniellerch/aletheia/blob/master/external/octave/J_UNIWARD.m"
  },
  "source": "meta"
}