Tag Info

New answers tagged

3

Under the "Properties & Relations" on the Documentation page for ImageAdjust we read: ImageAdjust[image] is equivalent to ImageAdjust[image,{0,0,1},{min,max},{0,1}] where {min,max} is the channel-wise pixel ranges in image: ImageAdjust[img] == ImageAdjust[img, {0, 0, 1}, ImageMeasurements[img, {"Min", "Max"}], {0, 1}] True So ...


2

This is interesting. I have two comments that grew too long for the comment box, so I'll post them here instead. Is it possible that the discrepancy in your point (2) is only due to roundoff error? After all the difference is less than $MachineEpsilon. I made the following weird discovery: if you calculate the result of the ImageMeasurements expression, ...


18

Maybe you can transform this into an easier problem: If you were instead looking for lines that are at any point perpendicular to your vector field: (that's easy, it's just a coordinate transformation) and if your (transformed) vector field were the gradient of a scalar field (yes, big if), then this would be really easy: These lines are simply the level ...


8

The following is far from perfect, just a kickstart: image = ColorConvert[Rasterize[8, ImageSize -> 40], "Grayscale"] {dx, dy} = Table[ImageAdjust@ GaussianFilter[ image, {6, 3}, δ], {δ, {{1, 0}, {0, 1}}}]; data = Reverse /@ Transpose[2 ImageData /@ {dx, dy} - 1, {3, 2, 1}]; p = ListStreamPlot[data, StreamPoints -> {400, .2, 10}, Frame -> ...


8

This works for version 9 (November 20, 2012). Make a Delaunay triangulation of random points laid down in the image, find the incircles of the triangles, and colour them by the underlying image. Placing more points results in smaller disks. Graphics`Mesh`MeshInit[] (* {"PacletManager`", "QuantityUnits`", "WebServices`", "System`","Global`", ...


7

img = ExampleData[{"TestImage", "Lena"}]; Rotate[Graphics@ Join[ MapIndexed[ {RGBColor[#1], Disk[4 Most@#2 + RandomReal[{-1, 1}, 2], 4]} &, ParallelTable[ Table[ Take[ SortBy[Tally[ Flatten[Map[Round[#, 0.01] &, ImageData[im], {2}], 1]], Last], -1][[All, 1]] , {im, iml}] , {iml, ...


7

Here is a look at the default behavior of ImageAdjust on a color image: img = ExampleData[{"TestImage", "Lena"}]; adj = ImageAdjust@img; Column[ Table[ inout = Transpose@(Flatten[ImageData@ColorSeparate[#][[channel]], 1] & /@ {img, adj}); fit = LinearModelFit[ inout , x , x]; Row[{fit, Show[{Plot[fit[x], {x, 0, 1}, ...


10

Here's one way to go about it. First choose an image (the view outside Van Gogh's asylum). Define some auxiliary functions: img = Import["http://i.stack.imgur.com/eMced.jpg"]; aspImg[im_] := ImageDimensions[im][[2]]/ImageDimensions[im][[1]]; imgSpheres[im_, diam_, numSphere_] := Module[{r1, r2}, colorfun = BSplineFunction[ImageData[im], ...


4

Assuming all your images are the same size and channel depth you can create a per pixel, per channel scale factor base on what ImageAdjust has done and multiply each image by it. adjustImages[keyImage_, images_] := With[{scaleFactor = Flatten@ImageData@ImageAdjust@keyImage/Flatten@ImageData@keyImage}, Image@ArrayReshape[scaleFactor Flatten@ImageData@#, ...


3

I started with ciao's code, but I didn't like the way the gray level values were obtained, so I re-worked his code to this: img = Image @ Graphics[ {Disk[], Disk[{4, 4}, 1.5], Disk[{-4, 5}, 2], Disk[{0, -6}, 4]}, PlotRange -> 11] With[{m = MorphologicalComponents[ColorNegate @ Binarize @ img]}, Module[{items, n, areas, lvls}, ...


4

You can use ArrayPlot ArrayPlot[MorphologicalComponents[ColorNegate[i]]] or you can use a ColorFunction. Here is a version for the second input image with the smaller regions using darker colors. mimg = MorphologicalComponents[Import["http://i.stack.imgur.com/w4FkO.png"]]; map = Thread[ Ordering@ComponentMeasurements[mimg, "Area"][[All, 2]] -> ...


12

It will only be good for a rough estimate, but you can segment the image using WatershedComponents and then visualize the results img = ColorConvert[Import["http://i.stack.imgur.com/t3u7G.jpg"], "Grayscale"]; seg = WatershedComponents[img, Method -> {"MinimumSaliency", 0.5}]; seg // Colorize Now you can use ComponentMeasurements to get the area of ...


12

Van Gogh Museum Here is the same for the tiles structure of the Van Gogh Museum at @bills' request. Note that the structure is completely different. I preserved the same resolution convention: vanInTheSkyWithLucy[catalog_, res_] := Module[{i, df, zooms, c, maxXY, t}, i = Import["http://www.vangoghmuseum.nl/en/collection/" <> catalog, ...


5

ImageAdd does some scaling/truncating, so cant be used directly for this purpose. Try this, note for testing I'm averaging three copies of the same image and expect to recover the same image. i0 = ExampleData[{"TestImage", "Boat"}]; imgs = {i0, i0, i0}; Image[Fold[ImageData[#2] + #1 &, 0 ImageData[i0] , imgs]/Length[imgs]] here is the resuly of ...


17

MoMA res= {1,2,3..} is the resolution.Use res = -1 for the max available resolution, but beware of a shipload of lawyers, middle managers, telephone sanitisers and hairdressers that may try to prosecute you if you use a value greater than 1, moma[catalogueNumber_, res_] := Module[{m = "http://www.moma.org", src, sj, rep, exp, a}, rep = {"]" -> "}", ...


8

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


9

If you don't care about the algorithm and only want to sample points with density according to image brightness, you could just use RandomChoice: using a test image that looks a little bit like a PDF: img = Image[ Rescale[Array[ Sin[#1^2]*Cos[#2 + Sin[#1/5]] + Exp[-(#1^2 + #2^2)/2] &, {512, 512}, {{-2., 4.}, {-3., 3.}}]]]; I can then ...


8

In a "natural" image, you'd look at each edge pixel in, use some approximation (e.g. 2nd order polynomial) of the gradients above/below that pixel and calculate the sub-pixel position of the steepest gradient. But in your case, all EdgeDetect gets to work on is a binary image, and any the potential anti aliasing sub-pixel information is lost. So the best ...


6

Note: The following needs a properly color quantized image as input. Color quantization for general images is a problem on its own that depends on many factors and is not addressed below. First we will go step by step, then wrapping up all of it in a function: Import some discrete-colored image: ii = Import["http://i.stack.imgur.com/9vdgV.png"] Then ...


6

Here is some code I used, which may partially answer your question. The key is to calculate efficiently points near the border of the Mandelbrot set. These points have large iteration counts which, when iterated, produce the Buddhabrot form. The algorithm linked to in the question uses an adaptive mesh of squares to locate border points. The alternate code ...


9

Do you see an error message in the Messages window? When this happens (the result of an evaluation is more or less the expression you entered), it's usually because it can't be evaluated, e.g. because image2 is not actually an image. If I Import the image from your post, ColorReplace accepts it as an argument, but since the blue you're trying to replace ...



Top 50 recent answers are included