3

I'm creating a colour-over-grayscale image to show classification of image blocks. I need to upsample a low-resolution classification image to match the original image size, using zero-order.

When I use skimage.transform.rescale(I,16,order=0), I get the desired result: rescale result However, when I use scipy.ndimage.zoom(I,16,order=0), I get the following image with misalignment of the upsampled classification blocks and the original image patches (note the non-square blocks at the edges): zoom result My questions are:

  1. Is this expected behaviour?
  2. Why the difference?

I could see the zoom behaviour causing unexpected grief, since I only noticed it here with the obvious misalignment of blocks.

[edit 1]: perhaps related question.

[edit 2]: Should be able to pull this repo and run python main.py with one of two imports at the top commented (flagged).

jessexknight
  • 756
  • 7
  • 20
  • This doesn't seem right. Can you post a link to your mask and the code that rescales it so that we can verify? – Stefan van der Walt Jan 12 '18 at 00:34
  • Thanks. I've added the link to the repo in the question. – jessexknight Jan 12 '18 at 18:31
  • 1
    This seems to be a subtlety of the way arrays are represented in the different libraries. See the SciPy roadmap here: https://github.com/scipy/scipy/blame/master/doc/ROADMAP.rst.txt#L176 – Stefan van der Walt Jan 18 '18 at 06:42
  • Aha! Great find - thanks. You can post this as an answer and I'll accept. – jessexknight Jan 18 '18 at 15:17
  • 1
    I think it is solved now, but in case people still need the answer but couldn't find it: https://raw.githubusercontent.com/scipy/scipy/d67829bf4f8885d85011a24b729c9fa763342b4b/doc/ROADMAP.rst.txt – Mark May 27 '21 at 13:04
  • Thanks, this is slightly more precise link: https://github.com/scipy/scipy/blob/d67829bf4f8885d85011a24b729c9fa763342b4b/doc/ROADMAP.rst.txt#ndimage – jessexknight May 27 '21 at 13:43

0 Answers0