How to plot on grid with refinements?
Related question
My data comes in the form of a (3 × N) array
[[x_0, ..., x_N-1],
[y_0, ..., y_N-1],
[z_0, ..., z_N-1]]
I want to plot it such that the first two lines code the X, Y position of a pixel and the third line sets the pixel's color.
However, I do not want any interpolation to take place. Rather, the space is tiled by the fact that all points lie on a grid, with lower divisions being refinements of the original grid. Here is some dummy data
[[4, 12, 24, 4, 12, 20, 28, 8, 18, 22, 28, 17, 19, 22, 17, 19], # X
[4, 4, 8, 12, 12, 20, 20, 24, 26, 26, 28, 29, 29, 30, 31, 31], # Y
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]] # Z (color)
These pixels have size
D = [8, 8, 16, 8, 8, 8, 8, 16, 4, 4, 8, 2, 2, 4, 2, 2]
Illustrated here is the desired position and spatial extent for the pixels corresponding to the dummy data above.
Now, I could interpolate my data to match the finest grid points, but that will be inefficient and not very elegant. Some areas of my grid may be much more refined than others.
Is there a way to make this kind of plot in matplotlib?
EDIT
To clarify, refining a pixel in position (x, y) of size (d×d) gives 4 pixels in positions (x - d/4, y - d/4), (x + d/4, y - d/4), (x - d/4, y + d/4),(x + d/4, y + d/4), each of size (d/2 × d/2). Positions always refer to the center of a pixel.
python matplotlib pixel
|
show 3 more comments
Related question
My data comes in the form of a (3 × N) array
[[x_0, ..., x_N-1],
[y_0, ..., y_N-1],
[z_0, ..., z_N-1]]
I want to plot it such that the first two lines code the X, Y position of a pixel and the third line sets the pixel's color.
However, I do not want any interpolation to take place. Rather, the space is tiled by the fact that all points lie on a grid, with lower divisions being refinements of the original grid. Here is some dummy data
[[4, 12, 24, 4, 12, 20, 28, 8, 18, 22, 28, 17, 19, 22, 17, 19], # X
[4, 4, 8, 12, 12, 20, 20, 24, 26, 26, 28, 29, 29, 30, 31, 31], # Y
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]] # Z (color)
These pixels have size
D = [8, 8, 16, 8, 8, 8, 8, 16, 4, 4, 8, 2, 2, 4, 2, 2]
Illustrated here is the desired position and spatial extent for the pixels corresponding to the dummy data above.
Now, I could interpolate my data to match the finest grid points, but that will be inefficient and not very elegant. Some areas of my grid may be much more refined than others.
Is there a way to make this kind of plot in matplotlib?
EDIT
To clarify, refining a pixel in position (x, y) of size (d×d) gives 4 pixels in positions (x - d/4, y - d/4), (x + d/4, y - d/4), (x - d/4, y + d/4),(x + d/4, y + d/4), each of size (d/2 × d/2). Positions always refer to the center of a pixel.
python matplotlib pixel
if needed, you may assume that I already have a function to computes the size d of a pixel based on its position (its simply proportional to the index of its non-zero bit of largest weight)
– Alexis
Nov 26 '18 at 14:52
What isd
here?
– ImportanceOfBeingErnest
Nov 26 '18 at 14:53
the width of a pixel (I define it in the EDIT). e.g. in the dummy data aboved
for the (4,4) pixel is 8 because the pixel is 8 by 8 on the blue grid.
– Alexis
Nov 26 '18 at 14:54
What I mean is, e.g. the first pixel is centered at (4,4), but what is it'sd
value? 16 I suppose? So do you have an array ofd
values for each pixel?
– ImportanceOfBeingErnest
Nov 26 '18 at 14:56
1
I'm sorry, I had swapped two values inD
, which explains what is shown on your figure I believe (I edited my post). I triple-checked everything else and found no inconsistency. The formula is correct but perhaps we misunderstood each other? The formula you gave are the positions of the corners of a pixel. The one I gave were the positions of the centers of the 4 pixels that are obtained by splitting a pixel. Thanks for the time you've been spending on this.
– Alexis
Nov 26 '18 at 15:52
|
show 3 more comments
Related question
My data comes in the form of a (3 × N) array
[[x_0, ..., x_N-1],
[y_0, ..., y_N-1],
[z_0, ..., z_N-1]]
I want to plot it such that the first two lines code the X, Y position of a pixel and the third line sets the pixel's color.
However, I do not want any interpolation to take place. Rather, the space is tiled by the fact that all points lie on a grid, with lower divisions being refinements of the original grid. Here is some dummy data
[[4, 12, 24, 4, 12, 20, 28, 8, 18, 22, 28, 17, 19, 22, 17, 19], # X
[4, 4, 8, 12, 12, 20, 20, 24, 26, 26, 28, 29, 29, 30, 31, 31], # Y
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]] # Z (color)
These pixels have size
D = [8, 8, 16, 8, 8, 8, 8, 16, 4, 4, 8, 2, 2, 4, 2, 2]
Illustrated here is the desired position and spatial extent for the pixels corresponding to the dummy data above.
Now, I could interpolate my data to match the finest grid points, but that will be inefficient and not very elegant. Some areas of my grid may be much more refined than others.
Is there a way to make this kind of plot in matplotlib?
EDIT
To clarify, refining a pixel in position (x, y) of size (d×d) gives 4 pixels in positions (x - d/4, y - d/4), (x + d/4, y - d/4), (x - d/4, y + d/4),(x + d/4, y + d/4), each of size (d/2 × d/2). Positions always refer to the center of a pixel.
python matplotlib pixel
Related question
My data comes in the form of a (3 × N) array
[[x_0, ..., x_N-1],
[y_0, ..., y_N-1],
[z_0, ..., z_N-1]]
I want to plot it such that the first two lines code the X, Y position of a pixel and the third line sets the pixel's color.
However, I do not want any interpolation to take place. Rather, the space is tiled by the fact that all points lie on a grid, with lower divisions being refinements of the original grid. Here is some dummy data
[[4, 12, 24, 4, 12, 20, 28, 8, 18, 22, 28, 17, 19, 22, 17, 19], # X
[4, 4, 8, 12, 12, 20, 20, 24, 26, 26, 28, 29, 29, 30, 31, 31], # Y
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]] # Z (color)
These pixels have size
D = [8, 8, 16, 8, 8, 8, 8, 16, 4, 4, 8, 2, 2, 4, 2, 2]
Illustrated here is the desired position and spatial extent for the pixels corresponding to the dummy data above.
Now, I could interpolate my data to match the finest grid points, but that will be inefficient and not very elegant. Some areas of my grid may be much more refined than others.
Is there a way to make this kind of plot in matplotlib?
EDIT
To clarify, refining a pixel in position (x, y) of size (d×d) gives 4 pixels in positions (x - d/4, y - d/4), (x + d/4, y - d/4), (x - d/4, y + d/4),(x + d/4, y + d/4), each of size (d/2 × d/2). Positions always refer to the center of a pixel.
python matplotlib pixel
python matplotlib pixel
edited Nov 26 '18 at 15:48
Alexis
asked Nov 26 '18 at 14:42
AlexisAlexis
2119
2119
if needed, you may assume that I already have a function to computes the size d of a pixel based on its position (its simply proportional to the index of its non-zero bit of largest weight)
– Alexis
Nov 26 '18 at 14:52
What isd
here?
– ImportanceOfBeingErnest
Nov 26 '18 at 14:53
the width of a pixel (I define it in the EDIT). e.g. in the dummy data aboved
for the (4,4) pixel is 8 because the pixel is 8 by 8 on the blue grid.
– Alexis
Nov 26 '18 at 14:54
What I mean is, e.g. the first pixel is centered at (4,4), but what is it'sd
value? 16 I suppose? So do you have an array ofd
values for each pixel?
– ImportanceOfBeingErnest
Nov 26 '18 at 14:56
1
I'm sorry, I had swapped two values inD
, which explains what is shown on your figure I believe (I edited my post). I triple-checked everything else and found no inconsistency. The formula is correct but perhaps we misunderstood each other? The formula you gave are the positions of the corners of a pixel. The one I gave were the positions of the centers of the 4 pixels that are obtained by splitting a pixel. Thanks for the time you've been spending on this.
– Alexis
Nov 26 '18 at 15:52
|
show 3 more comments
if needed, you may assume that I already have a function to computes the size d of a pixel based on its position (its simply proportional to the index of its non-zero bit of largest weight)
– Alexis
Nov 26 '18 at 14:52
What isd
here?
– ImportanceOfBeingErnest
Nov 26 '18 at 14:53
the width of a pixel (I define it in the EDIT). e.g. in the dummy data aboved
for the (4,4) pixel is 8 because the pixel is 8 by 8 on the blue grid.
– Alexis
Nov 26 '18 at 14:54
What I mean is, e.g. the first pixel is centered at (4,4), but what is it'sd
value? 16 I suppose? So do you have an array ofd
values for each pixel?
– ImportanceOfBeingErnest
Nov 26 '18 at 14:56
1
I'm sorry, I had swapped two values inD
, which explains what is shown on your figure I believe (I edited my post). I triple-checked everything else and found no inconsistency. The formula is correct but perhaps we misunderstood each other? The formula you gave are the positions of the corners of a pixel. The one I gave were the positions of the centers of the 4 pixels that are obtained by splitting a pixel. Thanks for the time you've been spending on this.
– Alexis
Nov 26 '18 at 15:52
if needed, you may assume that I already have a function to computes the size d of a pixel based on its position (its simply proportional to the index of its non-zero bit of largest weight)
– Alexis
Nov 26 '18 at 14:52
if needed, you may assume that I already have a function to computes the size d of a pixel based on its position (its simply proportional to the index of its non-zero bit of largest weight)
– Alexis
Nov 26 '18 at 14:52
What is
d
here?– ImportanceOfBeingErnest
Nov 26 '18 at 14:53
What is
d
here?– ImportanceOfBeingErnest
Nov 26 '18 at 14:53
the width of a pixel (I define it in the EDIT). e.g. in the dummy data above
d
for the (4,4) pixel is 8 because the pixel is 8 by 8 on the blue grid.– Alexis
Nov 26 '18 at 14:54
the width of a pixel (I define it in the EDIT). e.g. in the dummy data above
d
for the (4,4) pixel is 8 because the pixel is 8 by 8 on the blue grid.– Alexis
Nov 26 '18 at 14:54
What I mean is, e.g. the first pixel is centered at (4,4), but what is it's
d
value? 16 I suppose? So do you have an array of d
values for each pixel?– ImportanceOfBeingErnest
Nov 26 '18 at 14:56
What I mean is, e.g. the first pixel is centered at (4,4), but what is it's
d
value? 16 I suppose? So do you have an array of d
values for each pixel?– ImportanceOfBeingErnest
Nov 26 '18 at 14:56
1
1
I'm sorry, I had swapped two values in
D
, which explains what is shown on your figure I believe (I edited my post). I triple-checked everything else and found no inconsistency. The formula is correct but perhaps we misunderstood each other? The formula you gave are the positions of the corners of a pixel. The one I gave were the positions of the centers of the 4 pixels that are obtained by splitting a pixel. Thanks for the time you've been spending on this.– Alexis
Nov 26 '18 at 15:52
I'm sorry, I had swapped two values in
D
, which explains what is shown on your figure I believe (I edited my post). I triple-checked everything else and found no inconsistency. The formula is correct but perhaps we misunderstood each other? The formula you gave are the positions of the corners of a pixel. The one I gave were the positions of the centers of the 4 pixels that are obtained by splitting a pixel. Thanks for the time you've been spending on this.– Alexis
Nov 26 '18 at 15:52
|
show 3 more comments
1 Answer
1
active
oldest
votes
There is no inbuilt function that would allow to plot an irregular grid like the one specified in the question. The solution would be to define a Collection of "pixels" with the respective edges.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from matplotlib.ticker import MultipleLocator
x = np.array([4, 12, 24, 4, 12, 20, 28, 8, 18, 22, 28, 17, 19, 22, 17, 19]) # X
y = np.array([4, 4, 8, 12, 12, 20, 20, 24, 26, 26, 28, 29, 29, 30, 31, 31]) # Y
z = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) # Z (color)
D = np.array([8, 8, 16, 8, 8, 8, 8, 16, 4, 4, 8, 2, 2, 4, 2, 2])
def irregularmesh(x, y, s, c, ax=None, **kwargs):
xedge = np.c_[-s, s, s, -s]/2. + np.atleast_2d(x).T
yedge = np.c_[-s, -s, s, s]/2. + np.atleast_2d(y).T
xy = np.stack((xedge,yedge), axis=2)
# Create collection of rectangles.
pc = PolyCollection(xy, closed=True, **kwargs)
pc.set_array(c)
ax = ax or plt.gca()
ax.add_collection(pc)
return pc
######## Plotting ################
fig, ax = plt.subplots()
pc = irregularmesh(x, y, D, z, ax=ax, linewidth=0, cmap="inferno")
fig.colorbar(pc, ax=ax)
ax.margins(0)
ax.autoscale()
for axis in [ax.xaxis, ax.yaxis]:
axis.set_major_locator(MultipleLocator(4))
plt.show()
It took me some time to understand it, but it does work like a charm!
– Alexis
Nov 26 '18 at 16:22
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53483513%2fhow-to-plot-on-grid-with-refinements%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is no inbuilt function that would allow to plot an irregular grid like the one specified in the question. The solution would be to define a Collection of "pixels" with the respective edges.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from matplotlib.ticker import MultipleLocator
x = np.array([4, 12, 24, 4, 12, 20, 28, 8, 18, 22, 28, 17, 19, 22, 17, 19]) # X
y = np.array([4, 4, 8, 12, 12, 20, 20, 24, 26, 26, 28, 29, 29, 30, 31, 31]) # Y
z = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) # Z (color)
D = np.array([8, 8, 16, 8, 8, 8, 8, 16, 4, 4, 8, 2, 2, 4, 2, 2])
def irregularmesh(x, y, s, c, ax=None, **kwargs):
xedge = np.c_[-s, s, s, -s]/2. + np.atleast_2d(x).T
yedge = np.c_[-s, -s, s, s]/2. + np.atleast_2d(y).T
xy = np.stack((xedge,yedge), axis=2)
# Create collection of rectangles.
pc = PolyCollection(xy, closed=True, **kwargs)
pc.set_array(c)
ax = ax or plt.gca()
ax.add_collection(pc)
return pc
######## Plotting ################
fig, ax = plt.subplots()
pc = irregularmesh(x, y, D, z, ax=ax, linewidth=0, cmap="inferno")
fig.colorbar(pc, ax=ax)
ax.margins(0)
ax.autoscale()
for axis in [ax.xaxis, ax.yaxis]:
axis.set_major_locator(MultipleLocator(4))
plt.show()
It took me some time to understand it, but it does work like a charm!
– Alexis
Nov 26 '18 at 16:22
add a comment |
There is no inbuilt function that would allow to plot an irregular grid like the one specified in the question. The solution would be to define a Collection of "pixels" with the respective edges.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from matplotlib.ticker import MultipleLocator
x = np.array([4, 12, 24, 4, 12, 20, 28, 8, 18, 22, 28, 17, 19, 22, 17, 19]) # X
y = np.array([4, 4, 8, 12, 12, 20, 20, 24, 26, 26, 28, 29, 29, 30, 31, 31]) # Y
z = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) # Z (color)
D = np.array([8, 8, 16, 8, 8, 8, 8, 16, 4, 4, 8, 2, 2, 4, 2, 2])
def irregularmesh(x, y, s, c, ax=None, **kwargs):
xedge = np.c_[-s, s, s, -s]/2. + np.atleast_2d(x).T
yedge = np.c_[-s, -s, s, s]/2. + np.atleast_2d(y).T
xy = np.stack((xedge,yedge), axis=2)
# Create collection of rectangles.
pc = PolyCollection(xy, closed=True, **kwargs)
pc.set_array(c)
ax = ax or plt.gca()
ax.add_collection(pc)
return pc
######## Plotting ################
fig, ax = plt.subplots()
pc = irregularmesh(x, y, D, z, ax=ax, linewidth=0, cmap="inferno")
fig.colorbar(pc, ax=ax)
ax.margins(0)
ax.autoscale()
for axis in [ax.xaxis, ax.yaxis]:
axis.set_major_locator(MultipleLocator(4))
plt.show()
It took me some time to understand it, but it does work like a charm!
– Alexis
Nov 26 '18 at 16:22
add a comment |
There is no inbuilt function that would allow to plot an irregular grid like the one specified in the question. The solution would be to define a Collection of "pixels" with the respective edges.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from matplotlib.ticker import MultipleLocator
x = np.array([4, 12, 24, 4, 12, 20, 28, 8, 18, 22, 28, 17, 19, 22, 17, 19]) # X
y = np.array([4, 4, 8, 12, 12, 20, 20, 24, 26, 26, 28, 29, 29, 30, 31, 31]) # Y
z = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) # Z (color)
D = np.array([8, 8, 16, 8, 8, 8, 8, 16, 4, 4, 8, 2, 2, 4, 2, 2])
def irregularmesh(x, y, s, c, ax=None, **kwargs):
xedge = np.c_[-s, s, s, -s]/2. + np.atleast_2d(x).T
yedge = np.c_[-s, -s, s, s]/2. + np.atleast_2d(y).T
xy = np.stack((xedge,yedge), axis=2)
# Create collection of rectangles.
pc = PolyCollection(xy, closed=True, **kwargs)
pc.set_array(c)
ax = ax or plt.gca()
ax.add_collection(pc)
return pc
######## Plotting ################
fig, ax = plt.subplots()
pc = irregularmesh(x, y, D, z, ax=ax, linewidth=0, cmap="inferno")
fig.colorbar(pc, ax=ax)
ax.margins(0)
ax.autoscale()
for axis in [ax.xaxis, ax.yaxis]:
axis.set_major_locator(MultipleLocator(4))
plt.show()
There is no inbuilt function that would allow to plot an irregular grid like the one specified in the question. The solution would be to define a Collection of "pixels" with the respective edges.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from matplotlib.ticker import MultipleLocator
x = np.array([4, 12, 24, 4, 12, 20, 28, 8, 18, 22, 28, 17, 19, 22, 17, 19]) # X
y = np.array([4, 4, 8, 12, 12, 20, 20, 24, 26, 26, 28, 29, 29, 30, 31, 31]) # Y
z = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) # Z (color)
D = np.array([8, 8, 16, 8, 8, 8, 8, 16, 4, 4, 8, 2, 2, 4, 2, 2])
def irregularmesh(x, y, s, c, ax=None, **kwargs):
xedge = np.c_[-s, s, s, -s]/2. + np.atleast_2d(x).T
yedge = np.c_[-s, -s, s, s]/2. + np.atleast_2d(y).T
xy = np.stack((xedge,yedge), axis=2)
# Create collection of rectangles.
pc = PolyCollection(xy, closed=True, **kwargs)
pc.set_array(c)
ax = ax or plt.gca()
ax.add_collection(pc)
return pc
######## Plotting ################
fig, ax = plt.subplots()
pc = irregularmesh(x, y, D, z, ax=ax, linewidth=0, cmap="inferno")
fig.colorbar(pc, ax=ax)
ax.margins(0)
ax.autoscale()
for axis in [ax.xaxis, ax.yaxis]:
axis.set_major_locator(MultipleLocator(4))
plt.show()
answered Nov 26 '18 at 16:08
ImportanceOfBeingErnestImportanceOfBeingErnest
133k13145221
133k13145221
It took me some time to understand it, but it does work like a charm!
– Alexis
Nov 26 '18 at 16:22
add a comment |
It took me some time to understand it, but it does work like a charm!
– Alexis
Nov 26 '18 at 16:22
It took me some time to understand it, but it does work like a charm!
– Alexis
Nov 26 '18 at 16:22
It took me some time to understand it, but it does work like a charm!
– Alexis
Nov 26 '18 at 16:22
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53483513%2fhow-to-plot-on-grid-with-refinements%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
if needed, you may assume that I already have a function to computes the size d of a pixel based on its position (its simply proportional to the index of its non-zero bit of largest weight)
– Alexis
Nov 26 '18 at 14:52
What is
d
here?– ImportanceOfBeingErnest
Nov 26 '18 at 14:53
the width of a pixel (I define it in the EDIT). e.g. in the dummy data above
d
for the (4,4) pixel is 8 because the pixel is 8 by 8 on the blue grid.– Alexis
Nov 26 '18 at 14:54
What I mean is, e.g. the first pixel is centered at (4,4), but what is it's
d
value? 16 I suppose? So do you have an array ofd
values for each pixel?– ImportanceOfBeingErnest
Nov 26 '18 at 14:56
1
I'm sorry, I had swapped two values in
D
, which explains what is shown on your figure I believe (I edited my post). I triple-checked everything else and found no inconsistency. The formula is correct but perhaps we misunderstood each other? The formula you gave are the positions of the corners of a pixel. The one I gave were the positions of the centers of the 4 pixels that are obtained by splitting a pixel. Thanks for the time you've been spending on this.– Alexis
Nov 26 '18 at 15:52