# Tag Info

2

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}]]; line = InverseRadon[point, {400, 400}]; pixel = PixelValuePositions[line, White, 1]; {h, w} = {100., 360.}; norm = 400; d = Rescale[x, {0, h}, {norm/Sqrt[2.], ...

1

Given that the formatting of the text seems consistent, it might suffice to partition the text by periods (".") and remove newlines ("\n" and "\r"). text = StringSplit[StringDelete[Import["mypdf.pdf", "Plaintext"], {"\n", "\r"}], "."]; Then, you can simply make a list of all the words you have: words = Flatten[StringDrop[StringCases[#, ___ ~~ "["], -2] &...

2

This is fairly straightforward if the features are of similar size and non-overlapping. For illustration, I made this image with red and green spots. The co-localized spots are almost, but not exactly, coincident. (Something resembling red and green channels from a DNA microarray, maybe.) Here are the red and green channels: {r, g} = ColorSeparate[img][[...

3

Perhaps this can help. img1 = Import["https://i.stack.imgur.com/agPud.jpg"]; img2 = Import["https://i.stack.imgur.com/dCNCz.jpg"]; aligned = RemoveAlphaChannel@ImageAlign[img2, img1]; img2 - aligned // ImageAdjust // RemoveBackground All the white pixels are the pixels that are the same in both images. Usually, for these types of images, just subtraction ...

2

Since most of the points in your two data sets coincide and none of them has a nearest neighbor that is very far away when the total scale of the two plots is taken into consideration, I recommend visualizing the spacial relation between the points by plotting the points of one dataset and showing the offset of the nearest point in the other by color. Like ...

2

distance = DistanceMatrix[seq1, seq2] points = Position[distance, x_ /; x < 0.1] ListPlot[{seq1[[First /@ points]], seq2[[Last /@ points]]}]

3

First, let's split this image into three channels: hue, saturation, and brightness. img = Import["https://i.stack.imgur.com/qwwmp.jpg"]; {h, s, b} = ColorSeparate[img, "HSB"] It turns out that the leave has a much higher saturation than the black and white background. By using Binarize, we can create a white mask for the region that the leave covers. And ...

3

If you used HighlightImage, then you should be able to extract the points directly. Using the first example in HighlightImage (and the more robust code from @kglr): points = Cases[HighlightImage[i, ImageCorners[i, 1, .001, 5]], Point[x_]:>x (* {{84.5, 75.5}, {116.5, 68.5}, {141.5, 112.5}, {104.5, 86.5}, {154.5, 87.5}, {79.5, 61.5}, {157.5, 78.5}, {...

8

A severe problem is that Table generates an unpacked array, a thing that is often very annoying. When converting to an image, it is packed automatically (one can check that, e.g., with DeveloperPackedArrayQ[ImageData[Image[dat]]]). And because many functions work faster on packed arrays than on unpacked ones, this increases the performance. A vectorized ...

10

Is there any faster way available? There is, if you're willing to to use a different definition of "local maximum". If a local maximum is any value at least as high as any value in a 11x11 neighborhood, then you can use UnitStep[dat - Dilation[dat, 5]], which is about 16 times faster for your data: RepeatedTiming[MaxDetect[dat];][[1]] 0.016 ...

9

Why is MaxDetect so much slower when Chop is applied? Because Chop returns exact zeros what prevents packing of the matrix attempted by MaxDetect. You can detect an attempt to pack the array with Trace: Trace[MaxDetect[{{1.}}], DeveloperToPackedArray] // Flatten Applying N after Chop gives almost the same speed as without Chop because now the matrix can ...

6

A little bit faster than @kglr 's tricky answer is Position[dat, Max[dat]]

2

image=Import["https://i.stack.imgur.com/GZcUT.jpg"] c=1/2; ImageForwardTransformation[image, Through[{Re,Im}[((#[[1]]+I #[[2]])-c)/(Conjugate[c]*(#[[1]]+I #[[2]])-1)]]&, Background->1,DataRange->{{-1,1},{-1,1}},PlotRange->{{-1,1},{-1,1}}]//AbsoluteTiming Compile transformation function expr=ReIm[((#[[1]]+I #[[2]])-c)/(Conjugate[c]*(#[[...

Top 50 recent answers are included