-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to using C-order for image data #9
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Not tested, going to complete convertToCartesianImage and test maybe
Not tested yet!
Getting closer
Have not **implemented** the hasColor parameter yet
Untested!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Within the realm of computing, there are two ways of storing multidimensional data:
int data[z][y][x]
. This is backwards from traditional mathematics where you represent coordinates as (x, y, z). This format of storing data can also be thought of as slowest-varying to fastest-varying. The z-axis typically varies slowest, followed by y-axis, finished with the x axis.Previously, this package wasn't using C-order or Fortran-order but did a weird collage of both. This could be confusing to new users and I wanted to stick to a particular syntax.
Why switch to C-order?
Python, Numpy, and many other libraries use this format for storing and indexing data. Numpy provides support for changing the order but it can be a pain to include for each call. Thus, I decided to stick with this syntax that Python follows.
What changes were made?
Here is the general thought process I used. When returning coordinates, Fortran-order was used because that is intuitive for the average user who is familiar with coordinates from math courses. For example, it is much more intuitive to use (x, y) for a point rather than (y, x). The polar domain equivalent is (r, theta).
Images and image shapes or sizes are in C-order to stick with the overwhelming agreement in the Python community.
Color channels are considered to be faster varying than the x axis.
For example, let's assume you have 50 RGB images with a width of 1024px and height of 2048px. The Numpy array of the images should be (50, 2048, 50, 3). This is what
polarTransform
expects when given an image. Let's say that you convert it to the polar domain, the resulting image will have a shape of (50, angular size, radial size, 3).Color images with channels > 1 must be specified by using the parameter
hasColor
. This is handled by moving the color channel to the front of the dimensions, performing transformation, and then moving back after transformation is complete.