pyxelate icon indicating copy to clipboard operation
pyxelate copied to clipboard

question about the _svd function

Open joe-zxh opened this issue 3 years ago • 2 comments
trafficstars

Hi, sedthh, this is a great work that I am really appreciate!

But I am confusing about the svd function.

X_ are in range[0., 1.] before calling self._svd. https://github.com/sedthh/pyxelate/blob/ae2de9249d11063d0c1563b8e30a634c7d07faf8/pyxelate/pyx.py#L362-L365

But in _svd function, the result still divide 255. What is the purpose to cast the range of color to [0, 1. / 255.]? https://github.com/sedthh/pyxelate/blob/ae2de9249d11063d0c1563b8e30a634c7d07faf8/pyxelate/pyx.py#L337

Thank you for your great work, and I am looking forward to hearing from you!

joe-zxh avatar Jul 23 '22 03:07 joe-zxh

By the way, I notice that the equalize_adapthist function will cast the color range back to [0, 1.]. https://github.com/sedthh/pyxelate/blob/ae2de9249d11063d0c1563b8e30a634c7d07faf8/pyxelate/pyx.py#L369

joe-zxh avatar Jul 23 '22 04:07 joe-zxh

Thank you for the question!

Some of the skimage functions take 0-1 float as input, others as 0-255 int, and some of them also return one or the other as output. Resize is one of those functions that messed things up this way.

It is possible I have made an error somewhere, when adding new functions into a pipeline where I already change the values back to forth. But the data should either be [0., 1.] float or [0, 255] int, so either one of the functions before SVD actually casts to 255 int or I made an error.

sedthh avatar Jul 28 '22 09:07 sedthh