Dr. belisarius
• Member for 10 years
• Last seen more than 4 years ago
• Argentina

Let's define a filtering chain: isolateTheSand[x_Image] := ColorNegate@ Dilation[Closing[EdgeDetect[EntropyFilter[x, 1], 10], 100], 30]; getBrightObjects[x_Image] := ...

# is a placeholder for an expression. If you want to define a function, $y(x)=x^2$, you just could do: f = #^2 & The & "pumps in" the expression into the # sign. That is important for ...

Let's do it Andy's way So you are Andy. Nice to meet you. And you never got those hands on a computer. It doesn't matter, I will show you! First you need to go to Marilyn's place. Don't worry, JF ...

I wanted to change only the color of the ball, leaving all other red objects untouched: getReds[x_Image] := First@ColorSeparate[x, "Hue"] isolateSphere[x_Image] := SelectComponents[Binarize[getReds[x]...

Breathing with occluded borders, per Toad's request: Run the following command to get the Mathematica code NotebookPut@ImportString[Uncompress@FromCharacterCode@Flatten@ImageData[ ...

The following method doesn't require parameters and discovers also oblique views. obl[transit_Image] := (SelectComponents[ MorphologicalComponents[ DeleteSmallComponents@...

A textbook-like animation turns = 10; aa = Table[Framed@ Show[ParametricPlot3D[ Piecewise[{{{1, x, 0}, x <= 0}, {{Cos[2 Pi turns x/r], x, Sin[2 Pi turns x/r]}, 0 ...

You may use the profiler included in the Wolfram Workbench

voronoi[pts_] := ListDensityPlot[Append[#, 0]&/@ pts, InterpolationOrder-> 0, Frame -> False] pts = RandomReal[{0, 256}, {20, 2}]; cp ...

Edited to make it a function. For the strange Exclusions specification I use below, see my answer here. Thanks to @Oleksandr and @JM for their great comments. plInters[{f1_, f2_}, {min_, max_}] := ...

The following is something I made while trying to solve another (similar) problem (*FindCurvedPath Replacement*) ClearAll[findCurvedPath2, findClosedPath2]; findClosedPath2[inptList_, cutoff_] := ...

I made a function that could be used for labeling plots interactively, adding labeled Bezier arrows, preserve your labels from session to session, and a few more goodies. Some snapshots follow: ...

Some function definitions first. AkimaInterpolation[] stolen from here: AkimaInterpolation[data_] := Module[{dy}, dy = #2/#1 & @@@ Differences[data]; Interpolation[Transpose[{List /@ data[[All, ...

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 ...

Here you have a toy to start playing with: Edit preventing the animation running at different speeds in different machines by using Clock[] and DynamicWrapper[] (due credit to @jVincent) n = 500; (*...

In this article the author solves the problem of tiling a rectangle by using pieces taken from a set of polyominoes, which are plane geometric figures formed by joining one or more equal squares edge ...

Without using the "ErrorBarPlots" Package dataX = Sort@RandomReal[1, 10]; dataY = RandomReal[{0.5, 1}, 10]; error = RandomReal[0.5, 10]; errorH = dataY + error; errorL = dataY - error; f[y_] := ...

lin[cam_, obj_][t_] := cam t + (1 - t) obj s[cam_, obj_] := First@Solve[lin[cam, obj][t][[3]] == 0, t]; tr[cam_, obj_] := lin[cam, obj][t] /. s[cam, obj] // FullSimplify And that's it: tr[ ] is your ...

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], ...

n = 100; (*number of points*) s = RandomSample@Range@n; (*the initial set*) (*some aux functions*) head[{x_, xs___}] := Select[{xs}, # <= x &]; tail[{x_, xs___}] := Select[{xs}, # > x &];...

Fitting an ellipse: i = Import["http://i.stack.imgur.com/W7HJk.jpg"]; lineByCenter[center_, semi_, angle_] := Rotate[Line[{#1 - #2, #1 + #2}], angle, #1]& ...

Here is a bare bones, non-robust, use at your own risk, etc. code39 reader (*get image *) i = Binarize[Import@"http://i.stack.imgur.com/Cx3JD.png", .7] (* Char encodings from Paul's article - See ...

After importing a free dice 3D model {pd, vd} = Import["c:\\dice.stl", #] & /@ {"PolygonData", "VertexData"}; g2 = Translate[GraphicsComplex[vd, Polygon /@ pd], {-10, -37.5, -10}]; rv = {{0, 0, -...

TextRecognize[] accepts an undocumented Option "SegmentationMode". The allowed values are: ?ImageExternalOCRDump`\$TextRecognizeSegmentationModes { {{3, "Fully automatic page segmentation, but no ...

The plan is first get the "external" contour and then use Green's theorem to find its area. r[t_] := {-9 Sin[2 t] - 5 Sin[3 t], 9 Cos[2 t] - 5 Cos[3 t], 0} (*find the intersections*) tr = Quiet@...

For example you may do something like f[i_] := {Red,Orange,Yellow}[[i]] Edit You can easily add some robustness: f[l_List, i_Integer ] := l[[i]] /; 1 <= i <= Length@l; ll = {Red, Orange, ...

The following is a little involved, but it calculates the "minimum displacement" evolution by choosing the least total displacement alternatives from the permutations generated by the "...