Tag Info

Hot answers tagged

14

Here is my attempt to imagine Lena in a fog img = ExampleData[{"TestImage", "Lena"}]; r = 200; r0 = 2; ker = Table[1/(i^2 + j^2 + r0^2), {i, 0. - r, r}, {j, 0. - r, r}]; ker = ker/Total[ker, 2]; foggy = ImageConvolve[img, ker] I think Lorentzian kernel is quite good for the fog: it has a sharp peak and broad tails Plot3D[1/(i^2 + j^2 + r0^2), {i, -10 ...


10

There is a one-liner (if you have wide enough screen) Histogram@ComponentMeasurements[#, "Area"][[;; , 2]] &@ WatershedComponents@DistanceTransform@Import@"http://i.stack.imgur.com/k0EUJ.png"


10

Does this work for you? (otherwise I'll delete it and let the imaging experts handle this) img = ExampleData[{"TestImage", "Lena"}]; Then: res = ImageConvolve[img, BoxMatrix[8]/289.]; ImageAssemble[{img, res}]


8

Here is a quick-and dirty solution that takes the image as the first argument and an optional tolerance within which colors are assumed to be equal to the background: removeBackground[im_, tol_: .3] := Module[{color, r = If[ImageColorSpace[im] != "RGB", ColorConvert[im, "RGB"], im, im]}, color = ImageData[r][[2, 2]]; SetAlphaChannel[r, ...


8

This uses Radon/InverseRadon transforms adding to Mathematica in version 8. The core of the logic is in this line: ImageAdjust@InverseRadon[Radon[img, {n, n}, Method -> method], "Filter" -> inverseMethod, "CutoffFrequency" -> cutOffFrequency] By controlling the cutoff frequency, methods used, and applying your own custom backprojection ...


6

In Version 9, the second part of your question can be done using the FrontEnd ImageEditor tools which includes a Lasso Selection Tool. img = ExampleData[{"TestImage", "Lena"}] Copy the selected part: and Paste in new cell: You can also use the GetCoordinates tool available on the right-click menu: Ctrl+V to paste:


5

I think you are asking for a rather sophisticated project in this question, and it is probably too broad. However, here's one way to approach the highlighting of lines. im = EdgeDetect[ExampleData[{"TestImage", "Lena"}], 5]; imm = MorphologicalComponents[im]; trans[{x_, y_}] := {Max[1, Min[n, Floor[n - y] + 1]], Max[1, Min[m, Floor@x + 1]]}; rep[mat_, ...


5

A clunky way of doing this, and I can't resolve the smaller cells, but here it goes. Taking from my answer here img = Import["http://i.stack.imgur.com/5ni1u.jpg"]; imgd = ImageData@ImageAdjust@ColorConvert[img, "GrayScale"]; imgp = Flatten[ Table[{x, y, imgd[[x, y]]}, {x, 1, 346}, {y, 1, 462}], {2, 1}]; imgbg = Table[imgd[[x, y]] - nlm[x, y], {x, 346}, ...


5

something like this? ImageApply[ If[ # < .5, {1, 0, 0}, {0, 1, 0}] &, ExampleData[{"TestImage", "Gray21"}] ] another example, looking again I guess you want to leave gray outside the specified ranges. ImageApply[Piecewise[{ {{1, 0, 0}, .1 < # < .3}, {{0, 0, 1}, .6 < # < .7}, {{#, #, #}, True}}] &, ...


3

The issue here is a subtle issue: one must be careful when choosing plot ranges in order to make sure that one is getting a good picture of what the data looks like. For starters, let's take a look at the initial masks data: ApertureSize = {300, 300}; DiscRadius = 20; PhaseDisc0 = 10; Disc1 = {50, 150}; PhaseDisc1 = 10; Disc2 = {150, 150}; PhaseDisc2 = ...


3

I'm sure you know that a line will almost never run through exact pixel positions. Therefore, you have two choices. First, you interpolate your image matrix and then you can sample as many points along the line as you like. In this case, I probably wouldn't recommend it because the values depend on the interpolation itself. Another, very easy way is to use ...


3

I believe that you should use a high-pass filter. The built-in HighpassFilter seems very slow and produces artifacts. Here is an approximate method that is faster and appears to yield a better result: hp[img_Image, w_Integer] := Image[0.5 + Subtract @@ ImageData /@ {img, Blur[img, w]}] Application: img = Import["http://i.stack.imgur.com/5ni1u.jpg"]; ...


3

I think the key is Binarize but I couldn't figure out a good way to overlay colored parts on a grayscale image so this is rather hackish. At least it is quite a bit faster than your method: colorize2[image_, α_, β_, γ_, θ_] := ColorCombine[{ ImageSubtract[ImageAdd[img, #1], #2], ImageSubtract[ImageAdd[img, #2], #1], ImageSubtract[img, ##]}] ...


2

The first step in debugging is always to narrow down the problem. To do this, you can make ncurve global: DynamicModule[{(* ncurve = {} *) }, EventHandler[ ... Then, you can click on the image and evaluate ncurve in a separate cell: Length[ncurve] 248652 (You can and should put ncurve in a DynamicModule once you're done, of course. But for ...


2

We can try like this: Parallelize[MapThread[ImageSubtract, {{image1,image2}, {fond1,fond2}}]] or ParallelTry[imageSubtract, {{imag1, fond1}, {imag2, fond2}}, 2] While imageSubtract[{image_,fond_}]:=Module[{},( Image[(ImageData[image1]-ImageData[fond1]+1)/2] )] We can use also ParallelMap[] ParallelMap[imageSubtract, {{imag1, fond1}, {imag2, ...


2

Here is a first pass at this problem. img = Import["http://i.stack.imgur.com/wwHZe.jpg"]; getHue = First[DominantColors[#, 1][[1]] ~ToColor~ Hue] &; hues = Map[getHue, ImagePartition[img, 40], {2}]; plot = Map[Hue, hues, {2}] // ArrayPlot I tried to use ClusteringComponents to further quantize these hues but I got a bad result. Edit: After a ...


1

Updated Attempt When playing with the first attempt, mentioned below, I tried to work with the "messy" parts of the images, namely the first and last columns. In so doing, I think I found a somewhat general method that provides strings that should be relatively easy to proof and edit. The key component of this solution is EdgeDetect followed by a way to ...


1

Here's my attempt. It's not entirely satisfying, but maybe it will help. I've only tried it on one of the fuzzier pages: i = Import["mL27rU9.jpg"] First, let us identify connected components: mc = MorphologicalComponents[Binarize@i, Method -> "Nested"]; Colorize @ mc Next we shall extract all the bounding boxes: bb = Round[Last /@ ...


1

This function can be used to generate the contour points in the clockwise order. The starting point is fixed as the left point having the same y as the centroid of the contour. ContourBasedFeature[silhouette_] := Module[{centroid, startpoint, positions, contourPoints, order, clockwiseorder}, ( centroid = ComponentMeasurements[silhouette, ...


1

I guess it depends on exactly what you are looking for, but here is one way to approach this: smooth with a RangeFilter and then Binarize. img = Import["http://i.stack.imgur.com/5ni1u.jpg"]; Binarize[RangeFilter[img, 1], 0.1]


1

See DialogInput > Possible Issues as a possible explanation of the freeze issue. It is also a good idea to be aware of PreserveImageOptions which may also disconnect the control from the content. So using the combination PreserveImageOptions->False for ArrayPlot and SynchronousUpdating -> True for Manipulate seems to fix the issue: img = ...


1

Detect cells: cellEdges = GradientFilter[ImageAdjust[img], 2] // ImageAdjust // Binarize cells = Closing[cellEdges, 10] Separate detected cells: MorphologicalComponents[cells] // Colorize



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