如何计算上图中标记之间的距离作为 wolfram mathematica 上的像素?
How do I calculate the distance between the marks on the picture above as pixels on wolfram mathematica?
如何在 wolfram mathematica 上计算上图中标记之间的距离作为像素?
pts = x /. Solve[{Sin[x] == 0, 10 <= x <= 20}, x];
plot = Show[Plot[Sin[x], {x, 10, 20}],
ListPlot[Transpose[{pts, ConstantArray[0, Length[pts]]}],
PlotStyle -> {Red, PointSize[0.01]}]];
partitions = Partition[Union[Last /@
Position[ImageData[plot], {1., 0., 0., 1.}, Infinity]], 2, 1];
xpos = Append[First /@ Select[partitions, #[[2]] - #[[1]] > 1 &],
partitions[[-1, -1]]];
Differences[xpos]
{103, 104}
第一对点相距 103 像素,下一对相距 104 像素。
如何在 wolfram mathematica 上计算上图中标记之间的距离作为像素?
pts = x /. Solve[{Sin[x] == 0, 10 <= x <= 20}, x];
plot = Show[Plot[Sin[x], {x, 10, 20}],
ListPlot[Transpose[{pts, ConstantArray[0, Length[pts]]}],
PlotStyle -> {Red, PointSize[0.01]}]];
partitions = Partition[Union[Last /@
Position[ImageData[plot], {1., 0., 0., 1.}, Infinity]], 2, 1];
xpos = Append[First /@ Select[partitions, #[[2]] - #[[1]] > 1 &],
partitions[[-1, -1]]];
Differences[xpos]
{103, 104}
第一对点相距 103 像素,下一对相距 104 像素。