Tag Info

61

Needs["PolyhedronOperations`"] poly = Geodesate[PolyhedronData["Dodecahedron", "Faces"], 4]; amplitude = 0.15; twist = 4; verts = poly[[1]]; faces = poly[[2]]; phases = RandomReal[2 Pi, Length[verts]]; newverts[t_] := MapIndexed[{Sequence @@ (RotationMatrix[twist Last[#1]].Most[#1]), Last[#1]} (1 + amplitude Sin[t + phases[[First@#2]]]) &, ...

54

An extended comment follows. Mondrian, in the late work referenced by the OP and characterized by primary colored rectangles separated by black lines, employed an extraordinarily sophisticated understanding of perception, color, and light. As background to understand what Mondrian does, I recommend The Interaction on Color, by Joseph Albers and Alfred C. ...

54

PLEASE NOTE There is a reason why watermarks are there in the first place - to prevent unauthorised reuse of images. For more information on the issues around removing watermarks from images, this Wikimedia article is just one of many useful resources. The answer below is intended as an exercise in automatically removing text from an image ...

44

Obtain the image: i = Import["http://i.stack.imgur.com/iab6u.png"]; Compute the distance transform: k = DistanceTransform[ColorNegate[i]] // ImageAdjust; ReliefPlot[Reverse@ImageData[k]] (* To illustrate *) Identify the "peaks," which must bound the Voronoi cells: l = ColorNegate[Binarize[ColorNegate[LaplacianGaussianFilter[k, 2] // ImageAdjust]]]; ...

44

TUTORIAL Import Image img = Import["https://i.stack.imgur.com/xzcUg.jpg"] Split into Components Using this approach (credit: nikie): m = MorphologicalComponents[Binarize@ColorNegate[ColorConvert[img, "Grayscale"]]]; Colorize[m] components = ComponentMeasurements[{m, img}, {"Area", "BoundingBox"}, #1 > 100 &]; trim = ImageTrim[img, #] & /@ ...

43

Basically, you want to fit a shape to a set of points with outliers. One common algorithm to do this is RANSAC (random sample consensus). The basic outline of this algorithm is: Select N points at random (where N is the minimum number of points required for fitting the shape, i.e. 2 for a line, 3 for a circle and so on) Fit the shape to these points Repeat ...

43

This is a similar idea to ybeltukov's, iteratively splitting rectangles into two smaller rectangles. I've used an integer grid to avoid getting small offsets between adjacent blocks, and a weighted random choice to decide whether to split horizontally or vertically or do nothing. The idea is that long thin rectangles should preferentially be split along the ...

38

Here is my attempt to be Piet Mondrian colors = {RGBColor[0.9, 0.9, 0.9], RGBColor[0.05, 0.05, 0.05], RGBColor[0.8, 0.1, 0.1], RGBColor[0.1, 0.1, 0.5], RGBColor[0.9, 0.7, 0.1]}; split = # /. d : Rectangle[{x1_, y1_}, {x2_, y2_}] :> With[{t = RandomReal@BetaDistribution[10, 10], r = Random[]}, Which[ r < 0.3 (x2 - x1)/(y2 - y1), ...

33

==== Method 1 === Here is a way to get a graph from an image. MorphologicalGraph can get you started. img = Import["http://i.stack.imgur.com/9HXZ5.png"]; g = MorphologicalGraph[img] And here is your KirchhoffMatrix of the graph. Please note that MatrixPlot averages values for the best visual representation, - actual plot would be too detailed to be a good ...

32

img = Import["ExampleData/lena.tif"]; Image[img, ImageSize -> 300] data = ImageData[img];(*get data*) {nRow, nCol, nChannel} = Dimensions[data]; d = data[[All, All, 2]]; d = d*(-1)^Table[i + j, {i, nRow}, {j, nCol}]; fw = Fourier[d, FourierParameters -> {1, 1}]; (*adjust for better viewing as needed*) fudgeFactor = 100; abs = fudgeFactor*Log[1 + Abs@...

32

As was correctly noted in comments, out-of-focus images cannot been correctly detected by a simple gradient filter since out-of-focus images can have sharp edges. I propose another simple idea to detect such images. Introduction Roughly speaking, the brightness of a defocused image $B(x,y)$ is a convolution of a focused image $B_0(x',y')$ with some kernel $... 32 Without claiming much generality, I made the following. I'm using a slightly more complex image than your proposed one. i = Binarize@Import@"http://i.stack.imgur.com/qDby8.png"; idi = ImageDimensions@i; vertexI = SelectComponents[i, "Count", 5 < # < 100 &]; disk = 20 (*use some heuristics to ensure a ... 32 Another starting point, where the objects being more or less fixed size disks is used ad hoc to measure their centroids as components after some mangling, and those which are close enough to each other are connected in the graph if out of sample of four hundred points along the edge at most four are not "white." Image is in the variable img and plenty of ... 31 radon = Radon[ColorNegate@ColorConvert[img, "Grayscale"]] {w, h} = ImageDimensions[radon]; lhalf = Table[N@Sin[π i/h], {i, 0, h - 1}, {j, 0, w - 1}]; inverseDualRadon = Image@Chop@InverseFourier[lhalf Fourier[ImageData[radon]]]; k = 50; lines = ImageApply[ With[{p = Clip[k #, {0, 1}]}, RandomChoice[{1 - p, p} -> {0, 1}]] &, inverseDualRadon] ... 30 Here's a reorganization of GaussianRandomField[] that works for any valid dimension, without the use of casework: GaussianRandomField[size : (_Integer?Positive) : 256, dim : (_Integer?Positive) : 2, Pk_: Function[k, k^-3]] := Module[{Pkn, fftIndgen, noise, amplitude, s2}, Pkn = Compile[{{vec, _Real, 1}}, With[{nrm = Norm[vec]}, ... 30 I think the essence of the problem here is that width needs to be counted orthogonally to some best fit line going through the elongated shape. Even naked eye would estimate some non-zero slope. We need to make line completely horizontal on average. We could use ImageLines (see this compact example) but I suggest optimization approach. Import image: i = ... 28 Preload all chemical data: ChemicalData[All, "Preload"]; RebuildPacletData[]; (* the latter should not really be necessary *) Get all names: cd = ChemicalData[]; Get their molecular formulae: l = ChemicalData[#, "MolecularFormulaString"] & /@ cd; By counting the Cs, Os and Hs in the tattooed diagram we know we have to find$\rm{C_{19}H_{28}O_{2}}$. ... 27 This is more of an add-on to Vitaliy's excellent answer, than a completely new approach. I wanted to try to simulate some of the image distortion that would be seen at the jar walls. A simple (though utterly wrong in a physics sense) way to do this is to make the demagnification vary according to the jar image intensity. Load a picture and the jar image, ... 27 ================= UPDATE ====================== Due to @halirutan comment I'll add a note on realism. First of all pure water and clouds are not the best subject to simulate reflecations because they have fractal structure - meaning they tend to appear the same on different magnification scales. So it is hard to give impression to a human eye of refraction ... 27 Well, I suspect this question will get closed because it is a bit broad, but I've played around with image tracking and thought I'd show what I've done in case it's helpful. I was interested in learning some physics, and have the following video: To do the tracking, I smoothed out the images and converted them to black and white, which allows for the ... 27 i = Import@"http://i.stack.imgur.com/8I3B1.jpg"; f[{{tmin_, tmax_}, {rmin_, rmax_}}, ___] := Module[{l = Join[{{0, 0}}, Table[{Cos@t, Sin@t}, {t, tmin, tmax, (tmax-tmin)/100}]]}, {Texture[i], EdgeForm[], Polygon[l, VertexTextureCoordinates -> 1/2 Transpose[Transpose[l] + {1, 1}]]}] Framed@PieChart[{1, 2, 3, 4, 5, 6}, ChartElementFunction -> f] ... 26 Here a quick hack for PNG images. As its Wikipedia page shows the format works with coded chunks and you can make up and insert chunk types yourself. I'm not sure how safe it is to add beyond the official end of file marker as Simon Woods suggests in his answer. It seems like a breach of the standard to me. The following code, which more closely seems to ... 25 The technique is mentioned in one of Wolfram CDF virtual conference talks (See the course: Developing Real-World CDF Applications), as well as being used in a lot of CDF examples (for instance, the slideshow at the beginning of this example) but I will repeat it here, with some improvement. Recompressing images with better compression (Note: While writing ... 25 This version of generation code is originally posted at wolfram community. I guess a story-telling type post would attract more upvotes and probably give some insight about how to 'solve problems' using Mathematica, so I would go into details and try to explain not only the code but also how I figured out how to write them. How this works? In fact, this ... 25 Update 2: The function projectToWalls does not work in version 12.0 because the function PlotRange no longer works. To fix the issue, replace PlotRange with plotRange where plotRange = PlotRange/.AbsoluteOptions[#, PlotRange] &; in the definition of projectToWalls. Original answer: You can post-process a Graphics3D object to project the lines to the ... 24 One standard way to detect circular shapes is to binarize the image and apply a distance transform: The maxima locations of the distance transform are the centers of the circles. To make this work on your ellipses, I first have to stretch them to be (roughly) circular, as @Rahul Narain suggested in a comment: img = ColorConvert[Import["http://i.imgur.com/... 23 When thinking about graphics formats that can be displayed in web browsers and also in Word, the first thing that comes to mind is a rasterized image. However, there is one alternative that makes including comments a complete no-brainer: SVG (scalable vector graphics). The way you do it is similar to what cormullion suggested for EPS, except that EPS of ... 23 Tricky. But with a bit of creative cheating, I can get close: First, load the image and binarize it: img = Import["http://i.imgur.com/qAZBdFb.jpg"]; bin = MorphologicalBinarize[ColorNegate@img, {.1, .5}] I invert the image for two reasons: First, MorphologicalBinarize takes a lower and an upper threshold, i.e. it assumes bright blobs on dark ... 23 One simple way of "filtering" your data is to treat the points as a graph, and search for the shortest path from left to right: xScale = 10.; xy = Transpose[{N[Range[Length[data]]]*(xScale/Length[data]), data}]; start = {-xScale, Mean[data]}; finish = {2*xScale, Mean[data]}; graph = NearestNeighborGraph[Join[{start}, xy, {finish}], 25]; graph = ... 22 If the power spectrum is always of the form$1/k^p$there are some optimisations you can make. The first is to compile a function to generate the reciprocal of the spectrum:$k^p$. This can be very fast since you don't need to check for the$k=0$point (the reciprocal spectrum is well behaved at$k=0\ \$). We can then use ReplacePart to temporarily set the ...

Only top voted, non community-wiki answers of a minimum length are eligible