# Convert a point in the Radon Space to a line

I need a function point2line to convert a point in the Radon Transform Space to a straight line.

But I don't know the algorithm inside mathematica, I don't know what kind of transformation is.

For example, a point $$(42, 42)$$ in the $$100 \times 360$$ of the Radon Space, the inverse of the corresponding line can probably be measured as such:

point = Image[Normal@SparseArray[{{42, 42} -> 1}, {100, 360}]]
pixel = PixelValuePositions[line, White, 1];
f = LinearModelFit[pixel, x, x]
HalfLine@Round[{#, f[#]} & /@ {0, First[ImageDimensions@line]}]


I want to know if there are any formulas that can help me to do this.

point2line[{x,y},{w,h}] -> HalfLine[{{0, y1}, {x2, y2}}]

Here is my second attempt. With this code, I'm able to reproduce the result of InverseRadon up to a small offset:

{x, y} = {80, 330};
point = Image[Normal@SparseArray[{{x, y} -> 1}, {100, 360}]];
pixel = PixelValuePositions[line, White, 1];

{h, w} = {100., 360.};
norm = 400;

d = Rescale[x, {0, h}, {norm/Sqrt[2.], -norm/Sqrt[2.]}];
th = Rescale[y, {0, w}, {-Pi/2., Pi/2.}];
HighlightImage[
line, {
PointSize[Large], Red, Point[{norm, norm}/2.],
Line[{{norm, norm}/2, {norm, norm}/2 + d {Cos[th], Sin[th]}}],
InfiniteLine[{norm, norm}/2 + d {Cos[th], Sin[th]}, {Cos[Pi/2 + th],
Sin[Pi/2 + th]}]
}] • I have some minor problem. Can you run this test LineWebPainting/NextVer? This refactoring seems sometimes to be incorrect. – GalAster Oct 7 '19 at 4:15
• @GalAster You are right, it was wrong. My new attempt should be more correct. You can play with x and y for some values and see that there seems to be only a small constant offset. Where that offset comes from, I've yet to figure out. Note that I set the size of the output to 400 to avoid any errors coming from the algorithm itself determining the size of the output. – C. E. Oct 7 '19 at 19:20
• btw the $\sqrt{2}$ comes from the length from the center to one of the corners of a square: $d = \sqrt{2(x/2)^2} = x/\sqrt{2}$, so it assumes that the output is a square. – C. E. Oct 7 '19 at 19:28