Closed tvanderweide closed 7 years ago
Hello, the similarity function performs translation, rotation and scaling of the template image. Those operations generally require interpolation, so it makes perfect sense that the result is an array of floating point numbers. Imagine the simplest operation s.a. shifting 0.5 pixels in one direction --- the shifting algorithm has to guess what values correspond to the location where two pixels meet. If the algorithm is allowed to perform e.g. cubic interpolation, the guessed value is likely to be a non-integer, although all pixel values are integers. This approach gives you freedom on how to deal with interpolation --- you may keep the float numbers, or you can cast them back to integers. Anyway, the code you are interested in is the transform_img function.
I should have realized the interpolation from the zoom function as converting to floats. Thank you!
I'm working with 16-bit numpy arrays and when passed into the similarity function the transformed image has a dtype of float64. I haven't been able to find where this conversion is taking place.
img0.dtype dtype('uint16') result = ird.similarity(img0, img1, numiter = 1, order = 3) result['timg'].dtype dtype('float64')