New answers tagged

2

"Fisheye projection" can mean multiple different things. The most common projection used by lenses is the equal-area one, for which you were using a formula: $$ r = 2f\sin(\theta/2) $$ Here $\theta$ is the angle under which a point is visible and $r$ is the distance of that point's projection from the optical axis on the image plane. Please see the link ...


1

This turned out to be pretty simple, using ClickPane to capture the clicks, and MousePosition so that you can see the current coordinates. After running the code below, and placing your mouse over the plot, the coordinates are displayed above the plot. After clicking, the coordinates you click are added to the list pts. This bypasses any interaction with ...


1

You might try to use Locatorfor this purpose. Try this: coord = {}; DynamicModule[{pt = ImageDimensions[im]/2 // N}, Column[{ Show[{ image, Graphics[Locator[Dynamic[pt]]] }], Dynamic[pt], Button["Get coordinates", Clear[coord]; coord = pt] }] ] where ´image` is the name of your image and coord is the global variable. You ...


15

This was a fun question to answer, even considering that I know nothing about general relativity. It's all a matter of translating the equations presented in this paper by Oliver James, Eugenie von Tunzelmann, Paul Franklin, and Kip Thorne into notebook expressions. Embedding Diagrams The paper gives some really cool figures to show the curvature of ...


6

Here is something I tried based on Simon's answer to How to create a new “person curve”? I am starting from a text. pic = Rasterize[Style["Captcha", FontFamily -> "Sans"], ImageSize -> 300] // Image Now introducing Simon functions param[x_, m_, t_] := Module[{f, n = Length[x], nf}, f = Chop[Fourier[x]][[;; Ceiling[Length[x]/2]]]; nf = ...


2

Just to save the solution for posterity: As nikie suggested in comments, you are looking for "IntensityCentroid" rather than the simple "Centroid" property to use in ComponentMeasurements. You can find it in the "Details" section of the documentation of the latter function, under "Spatial intensity measurements". In the help description ...


5

This isn't elegant, but I think it should work pretty reliably. Start with the base plot: plot = ParametricPlot[ Evaluate@BezierFunction[temPoint = RandomReal[{-50, 50}, {5, 2}]][ t], {t, 0, 1}, AxesOrigin -> {0, 0}] Create a version that has the point, but wrap the point in Annotation, with type "Region": plot2 = Show[plot, Epilog -> ...


15

Step 1: find the curve in the black and white image. For this, I will use a shortest path search, and to make sure it finds the path I'm looking for (instead of one of the short cuts through the labels), I will give it a few "path markers" along the way that the path should visit in order: First, load the image, get the black pixels: img = ...


12

I didn't get a good answer, but this is how I would do it and probably how I would evaluate the quality of an answer. Much of what I do below involves manual work, but it could be automated: First, we need some points along the curve. I selected them manually If I hadn't manually selected them, I would have used some image processing including a thinning ...


13

Here is an approach based on direct construction of Image3D from ImageData. The basic idea is taken from the subsection "Volume Creation" of the section "Scope" on the Documentation page for Image3D, some other ideas are from the answer by Kuba: moon = Import[ "https://upload.wikimedia.org/wikipedia/commons/f/f0/Full_Moon_as_Seen_From_Denmark.jpg"]; ...


1

I've always wished the moon was more habitable. Starting from the OPs picture: moon = ColorConvert[ Import["https://upload.wikimedia.org/wikipedia/commons/f/f0/Full_\ Moon_as_Seen_From_Denmark.jpg"], "Grayscale"]; ReliefPlot[ImageData[moon], ColorFunction -> "GreenBrownTerrain"]


14

moon = Import[ "https://upload.wikimedia.org/wikipedia/commons/f/f0/Full_Moon_as_\ Seen_From_Denmark.jpg"] Here are two ways to get something like that: with Texture or with ColorFunction Texture: pic = ImageCrop @ ImageResize[ColorConvert[moon, "Grayscale"], Scaled@.3] Worse quality than is possible with this image but I had to make it smaller ...


11

This is a fast and quite good way to create the mask of the spider: i = Import["http://i.stack.imgur.com/2Lz0A.jpg"]; mask = Dilation[ DeleteSmallComponents@ ColorNegate@ DeleteSmallComponents@ MorphologicalBinarize[i, .25], DiskMatrix[2]] Then, you can use Inpaint with the generated mask: Inpaint[i, mask] You will have to adjust the ...


2

You should first generate the mask, then you can apply Inpaint. Following is a demo, it can be further enhanced. flt = ColorNegate@MorphologicalBinarize[img, {0.4, 0.9}]; Inpaint[img, flt];


3

Here's a quick attempt using morphological image analysis on my own contour plot, since you did not provide yours: Generate a contour plot with some closed contours and style it more or less like yours: contour = ContourPlot[ Sin[2 x]^2 - Cos[2 y]^2, {x, y} ∈ Polygon[CirclePoints[{1, 90 Degree}, 6]], PlotPoints -> 75, Contours -> 4, ...


6

There's not much information about what "TextureSynthesis" does in the documentation, but it probably does something roughly like this: Look at the pixels at the border of each inpainting region. Look for nearby similar pixels. Generate a texture based on the pixels found in (2) Let's look at one region in detail: The border of the inpainting mask ...


2

According to the documentation Inpaint uses each color seperately, so a colored picture should be easier for Mathematica to process. Especially, since your original colored picture is considerably larger (288 kB) than the grayscale one (120 kB). So, I would say that better results for the former are to be expected. Now, you may use your colored picture and ...


1

Your image is not still good enough to work on. So I made one and show how to do it. Let say this is your picture XX = (# + RandomReal[{-.1, .1}]) & /@ Range[19]; XX = Join[{0}, XX, {20}]; YY = (# + RandomReal[{-.1, .1}]) & /@ Range[19]; YY = Join[{0}, YY, {20}]; img = ContourPlot[Evaluate[Join[(y == #) & /@ XX, (x == #) & /@ YY]], {x, ...


3

The process is quite complicated as you can see. The code creates a set of parametric equation which can give you set of discrete plots. You can choose few of them which might work (At least worked in this case). mess = 1; ParametricPlot[ Evaluate[tocurve[#, 25, t] & /@ lines[[1 ;; mess]]], {t, 0, 1}, Frame -> True, Axes -> False] gives ...


2

rowEl[n_, color_] := Rotate[Graphics@{color, Disk[{1, 1}, Offset[{10, 4}]]}, #] & /@ RandomReal[{0, Pi}, n]; GraphicsGrid[ rowEl @@@ Transpose@{ConstantArray[5, 5], RandomChoice[{Black, Gray}, 5]}] Alternatively, if you want to have finer control of distances between, you can avoid GraphicsGrid rowEl2[n_, y_, color_] := ...


3

Here's one way: dimensiontex = {400, 300}; nobj = 40; distanceobj = 5; greys = RandomReal[{0, 1}, nobj]; rotatemyobj[c_] := Rotate[Graphics[{GrayLevel[c], Disk[{1, 1}, Offset[{10, 4}]]}], RandomReal[{0, 2 Pi}]]; tab = Table[rotatemyobj[greys[[i]]], {i, 1, nobj, distanceobj}, {j, 1, nobj, distanceobj}]; GraphicsGrid[tab] Thanks to Rahul for more concise ...


3

In this case code below works, but it's sensitive to the second parameter of EdgeDetect: Module[{img, poly}, img = Import["http://i.stack.imgur.com/QF8Wk.jpg"]; poly = First@ MeshPrimitives[ ConvexHullMesh[ Cases[RegionIntersection @@@ Subsets[Line /@ ImageLines[EdgeDetect[img, 20], MaxFeatures -> 4], {2}], ...


2

Fortunately this is not so difficult with Mathematica. First, we detect the straight lines, surrounding square with ImageLines: img = Import["http://i.stack.imgur.com/QF8Wk.jpg"]; (* get image *) lines = ImageLines[EdgeDetect[img, 20]][[;; 4]]; (* get lines *) HighlightImage[img, {Green, Line /@ lines}] (* show lines *) First 4 found lines are those ...


1

Mathematica also has a builtin function called ImagePeriodogram that returns an Image representing the power spectrum of the image. This won't help with phase spectra or reconstructing images, however.


3

RemoveBackground + HighlightImage seem to work for the provided example. (Though HighlightImage does not seem to support Mouseover, so I insert it after the fact...) knee = Import["http://i.stack.imgur.com/hCC57.jpg"]; mask = Binarize[RemoveBackground[knee], 0]; HighlightImage[knee, mask] /. f_FilledCurve :> Tooltip[Mouseover[{EdgeForm[None], ...


7

I don't think you can change the compositing operator but you can dynamically change the appearance. A simple example: im = LinearGradientImage[]; DynamicModule[{pt = {10, 10}}, LocatorPane[Dynamic[pt], im, Appearance -> Graphics[{ Dynamic @ GrayLevel[1 - PixelValue[im, pt]], Disk[]}, ImageSize -> 20]]]


9

Here's an interactive version -- wherever you point the mouse, the gradient image is shown. Thanks to nikie for the improved mask (using Graphics instead of array manipulations). img = Import["http://i.stack.imgur.com/Na1fq.png"]; dims = ImageDimensions[img]; grad = GradientFilter[img, 2] // ImageAdjust; Manipulate[loc = MousePosition["GraphicsAbsolute", ...


8

I would do this in Mathematica by creating a mask and then applying the filter within that mask. To create a mask, click the image and select "Mask tool in the pop-up dialog". You can then use ImageFilter with the Mask option or you can do the Masking yourself. filtered = ImageAdjust@GradientFilter[originalImage, 4]; ImageCompose[originalImage, ...


15

I'm not 100% sure what you want. Loosely speaking, your images look like there are hills and valleys, with light coming from the left. And I think you're looking for the "valleys" in that landscape. A mathematical model for this would be: There's a "height" (or "depth") for every pixel, and the image you have is the gradient (in X-direction) of that height ...


4

This is kinda slow in my mac so before spending more time on it I rather have some comments from OP. The basic idea is that I want to amplify the gradient on the image and then separate the areas of constant value. img = Import["http://i.stack.imgur.com/LiQsY.jpg"] img2 = Import["http://i.stack.imgur.com/OO36H.jpg"] xx2 = Module[{im = ImageTake[img, ...



Top 50 recent answers are included