Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by 082349872349872 on Monday September 16, 2024 @05:23AM
(#41554264)
> Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration. —SKB
[ Parent
| on HN ]
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by yarg on Monday September 16, 2024 @06:08AM
(#41554518)
That reads like an XKCD alt-text.
(That would've been RM; SKB is Stan Kelly-Bootle)
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by bonoboTP on Monday September 16, 2024 @08:15AM
(#41555259)
It's actually somewhat of a reality in some image processing code, and some people feel really passionate about whether the topleft corner pixel is located at (0.5,0.5) or (0,0).
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by djbusby on Monday September 16, 2024 @08:21AM
(#41555310)
The center of the pixel is at 0.5 but the top left of the pixel at the top left is 0. And the bottom right of the top left pixel is at 1.
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by marcosdumay on Monday September 16, 2024 @09:15AM
(#41555744)
Or the top left is located at -0.5 and every other place has the coordinates one would naively expect.
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by 1000100_1000101 on Monday September 16, 2024 @09:38AM
(#41555948)
Direct3D made this a thing. Trying to draw unscaled 2D elements you often end up with blurry images as it bilinearly filters with the neighbouring pixels.
This is because of a mess with where it considered pixels located, where texture samples are considered located, and where, when rasterizing an included pixel, the texture coordinates sampled. See detail at [0].
If your graphics API was blurring all your images, you'd be passionate about that half-pixel offset too.
[0] https://www.gamedev.net/blogs/entry/1848486-understanding-ha...
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by bonoboTP on Monday September 16, 2024 @02:54PM
(#41559274)
I can relate. Spent countless hours on this stuff with computer vision and convnets. The intricacies of align_corners, implementation differences between deep learning frameworks, striding and pooling when numbers aren't neatly divisible, uuh.
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by yarg on Monday September 16, 2024 @10:43AM
(#41556624)
Funnily enough, I actually wrote code that does that very thing this morning.
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by danbruc on Monday September 16, 2024 @11:10AM
(#41556869)
Pixels are point samples, they do not have corners, they are not little squares. [1]
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by account42 on Monday September 16, 2024 @12:10PM
(#41557557)
Except when they are. No camera samples points, almost all are closer to the little squares model.
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by danbruc on Monday September 16, 2024 @05:51PM
(#41561394)
I am quite deep into dangerous half-knowledge territory here, but I think this is wrong. The optics of a camera will transform a point source according to its point spread function [1] and you are then integrating the contributions of all point spread functions overlapping a given sensor element, which often is a little square. So taking into account the optics, what you have actually sampled is not a square, you only integrated across a square. And each spot within the sensor element was illuminated with different light that got integrated together into a single pixel value, so you can not just turn around and say that each spot on the sensor element was illuminated with the same color, the one you got from integrating across the entire sensor element. If the scene you imaged had no frequency content above the Nyquist frequency [2], then you should be able to exactly reconstruct the illumination of the sensor, including at scales smaller than a single sensor element.
Re:Byte Ordering: On Holy Wars and a Plea for Peace (1980)
by ranger207 on Monday September 16, 2024 @09:30AM
(#41555868)
xkcd did reference it in https://xkcd.com/394/