Skip to content
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

Image.Pixel sample offset #2212

Closed
alramhtims opened this issue Oct 15, 2018 · 2 comments
Closed

Image.Pixel sample offset #2212

alramhtims opened this issue Oct 15, 2018 · 2 comments

Comments

@alramhtims
Copy link

If this issue is not a bug report or improvement request, please check the Dynamo forum, and start a thread there to discuss your issue.

2.0

(Which version of Dynamo are you using? Go to Help > About if you're not sure.)

2019.1

(Which version of Revit are you using?)

Windows 8.1 Enterprise

(e.g. Windows 7, Windows 8.1, etc)

Sampled an image with the Image.Pixels node

What did you expect to see?

The image was symmetrical, the resulting values should have been symmetrical.

What did you see instead?

The values appear to be sampling starting at 0,0 instead of the center of the first sample square and this is throwing the values off.

You can download the files from the Forum post:
https://forum.dynamobim.com/t/image-pixel-symmetry/26958?u=marla_smith

@mjkkirschner
Copy link
Member

Hi @alramhtims I think you might be right.
https://github.com/DynamoDS/Dynamo/blob/ec10f936824152e7dd7d6d019efdcda0d78a5264/src/Libraries/CoreNodes/FileSystem.cs#L372

It looks to me like the expression should be
Color.ByColor(image.GetPixel(x * (image.Width / (numX-1)), y * (image.Height / (numY-1)))))

because numx is not the max value of x but the number of x and x will never be equal to that number. so we'll never get a value which is equal to the max image width or image height.

@QilongTang
Copy link
Contributor

This is verified in Dynamo 2.1
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants