Hot answers tagged

26

Here's something to get the ball rolling: img = ColorConvert[Import["http://i.stack.imgur.com/FaE06.jpg"], "Grayscale"]; DelaunayMesh[ ImageCorners[img, 1, 70*^-6], MeshCellStyle -> {{2, All} -> White, {1, All} -> GrayLevel[0.5], {0, All} -> Black} ] I'm looking forward to better results :-)


20

(These solutions loosely adhere to OP's request in the question. They were mostly made because of similar art/solutions pointed in the comments.) "Delaunay raster" like Here is a solution related to "Delaunay raster" discussed in the question comments. It is based on the Mathematica documentation page "Create a Mesh Region from Image Data". I changed ...


18

Prologue Some five years ago I have asked exactly this question to the Wolfram support people. Below I have taken their respective answers (one sentence for each Method) but have added a lot of further reading. Finally, in an Add-On I demonstrate my own implementation of Rosenfeld's 1971 variant of a 2D thinning algorithm, in order to let you compare a few ...


14

This is not very automated but perhaps it will motivate experts: Copied the images Changing image to graphic and finding corresponding points: fun[img_] := With[{id = ImageDimensions[img]}, {Texture[img], Polygon[{{1, 1}, {id[[1]], 1}, id, {1, id[[2]]}}, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}] {ma, mb} = ...


14

Here is what I get. img = Import["http://i.stack.imgur.com/o3S3Q.jpg"]; red = Fold[ImageSubtract, #[[1]], Rest[#]] &@ColorSeparate[img] b = Binarize[red] pos = ComponentMeasurements[b, {"Centroid", "EquivalentDiskRadius"}]; Length[pos] 633 Fine Tuning Since the flowers in the top left corner are comparatively dull in colour, they are ...


13

Yesterday I showed how to locate a subimage inside a large image using ImageCorrelate. I will now show how to use the same approach to solve this problem. Start by importing the images that you want to compose: i1 = Import["http://i.stack.imgur.com/UjGAz.jpg"]; i2 = Import["http://i.stack.imgur.com/93kwm.jpg"]; GraphicsRow[{i1, i2}] Since the right ...


12

A function to subdivide the triangles based on their gray level: h[{v1_, v2_, v3_}] := With[{a = EuclideanDistance[v1, v2], b = EuclideanDistance[v1, v3], c = EuclideanDistance[v2, v3]}, With[{s = (a + b + c)/2}, (2 Sqrt[s (s - a) (s - b) (s - c)])/c ]] shadeTri[tri_, col_, f1_: 1, fc_: 1] := If[col > .8, tri, With[{v = tri[[1, ...


6

The most straightforward approach is ImageCorrelate. I'll show you an example. nikie wrote an excellent answer explaining this method here. large = ExampleData[{"TestImage", "Boat"}] smaller = ColorConvert[Import["http://i.stack.imgur.com/NAHqc.png"], "Grayscale"] corr = ImageCorrelate[large, smaller, EuclideanDistance]; ImageAdjust[corr] The ...


3

One possibility would be to apply a highpass filter, since what you want to remove is the slowly undulating background. img = Import["http://i.stack.imgur.com/rvRAc.png"]; imgHP = ImageAdjust[HighpassFilter[img, 0.05]] then binarize: Binarize[imgHP] To follow your original idea of locating the background and subtracting it -- this can be ...


3

This seems pretty fast (it takes roughly 0.08s on your set of images): images = Normal@Databin["dsNFr2og"]; Total[#, 2] & /@ ImageData /@ Binarize /@ images; % / (Times @@ ImageDimensions[images[[1]]]) // N; Extract[images, Position[%, p_ /; p < 0.5]] Adjust the 0.5 threshold to your liking to retain more or fewer images. (Thanks nikie for the ...


2

I am going to copy-paste Simon Wood's answer of How to create a new “person curve”? param[x_, m_, t_] := Module[{f, n = Length[x], nf}, f = Chop[Fourier[x]][[;; Ceiling[Length[x]/2]]]; nf = Length[f]; Total[Rationalize[2 Abs[f]/Sqrt[n] Sin[Pi/2 - Arg[f] + 2. Pi Range[0, nf - 1] t], .01][[;; Min[m, nf]]]]] tocurve[Line[data_], m_, t_] := ...


2

Where can the code be improved? First of all: Try to avoid loops (Do, For, While) where possible - they're usually much more verbose than functional alternatives. Second: Read the documentation. ComponentMeasurements can take a list of measurements, and will then return a list of values for each component. Third: Use functions to encapsulate units of ...


1

img = Import["http://i.stack.imgur.com/bkNTj.png"]; pos = ComponentMeasurements[img// Binarize, {"Centroid", "EquivalentDiskRadius"}][[All, 2, 1]]; Length[pos] Show[img, Graphics[{Red, Circle[#, 10]} & /@ pos]] 3 You might be interested in Count flowers in an image and Count Elements in Image. For your complete folder, SetDirectory[...


1

Here's my approach which returns each color component's percentage in a given bin. First, some preprocessing. This quantizes the colors using the Nearest function because by default Mathematica's ColorQuantize fails to properly quantize the image. i = Import["http://i.stack.imgur.com/otAao.jpg"]; ncolors = 4; dc = DominantColors[i, ncolors]; dcl = dc /. ...


1

There's a few steps in solving this problem: Separate colors completely Partition the image Compute the correlation between neighbouring picture segments. To solve the first problem, I use ColorQuantize first in order to make similar colors the same to avoid noise. Then by using LinearSolve, I can change the three colors to R/G/B so that I can use ...



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