Tag Info

Hot answers tagged

12

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


6

You only need one more line for evaluation of the coverage of the colors: coverage = DominantColors[yourImageBlackWhite, 2, "Coverage"] {0.762952, 0.213876} - Edit: To answer your comment (posted as an answer), I want to add this: You can show the number of covered pixels as well as the coverage. Using the command: DominantColors[yourImageBlackWhite, ...


6

pic = Import["http://i.stack.imgur.com/TPxVj.png"] alpha = Composition[ GaussianFilter[#, 10] &, Image, BoxMatrix[#/2 - 5, #] &, Reverse, ][ ImageDimensions@pic] SetAlphaChannel[pic, alpha]


5

Please take a look at the file image_external.c. that you can find in your installation with the command FileNames["image_external.c", {$InstallationDirectory}, Infinity] Therein, everything you want to know is described. When it comes down to compiling, then you need to ensure you have the development files for opencv and libraw installed and you know ...


4

Change a bit code, also are you sure <|"Apple" -> negative, "None" -> positive|> or did I misunderstood the problem? Anyways this seems logical (works same efficiently without ConformImages but I just wanted to feature it): dir =(*path to dir containing unzipped folders*); ndir = FileNameJoin[{dir, "negative"}]; pdir = FileNameJoin[{dir, ...


4

You could use the mean distance from the boundary, which for a long thin object is about 1/4th of its width. image = Import["http://i.stack.imgur.com/2G491.png"]; m = MorphologicalComponents[image]; d = DistanceTransform[image]; widths = ComponentMeasurements[{m, d}, "Mean"] (* {1 -> 2.40336, 2 -> 5.08581, 3 -> 2.7668, ... } *) Here are the ...


4

What you can do is, you mimic the behaviour of Blend by creating a function that interpolates linearly between colours. What you change with your parameters are the values where the color transitions take place. Let me give you a simplified example: I use 3 colours. In the compiled function, I only work with their {r,g,b} values. As result, I want a ...


3

This is what I get in Mathematica 10.0.2: In[1]:= img= Import["http://i.stack.imgur.com/natsI.png"]; bin=Binarize[img,0.18]; AbsoluteTiming[pos=PixelValuePositions[bin,1];] AbsoluteTiming[resultImage=ReplacePixelValue[bin,pos->Red];] Out[3]= {0.004004,Null} Out[4]= {2.661534,Null} The performance of ReplacePixelValue and ...


3

Using ND is not necessary, as Mathematica makes it easy to construct InterpolatingFunction objects, which can then be formally differentiated using Derivative. First, a sample image: data = Import[ "http://41.media.tumblr.com/bece7ed81870c8e9b904290700451eb2/tumblr_\ mv8m2sE2FW1slvzano1_400.jpg"] Convert to grayscale, and then convert the resulting ...


2

Here is a version of your code that produces an image: axes[x_, y_, z_, a_] := Graphics3D[ Join[{Red, Arrowheads[a], Arrow[Tube[#, 0.015]]} & /@ {{{-x, 0, 0}, {x, 0, 0}}, {{0, -y, 0}, {0, y, 0}}, {{0, 0, -z}, {0, 0, z}}}, {Text[ Style["\!\(\*SubscriptBox[\(S\), \(x\)]\)", 18, Bold, Black], {1.1*x, 0.1*y, 0.1*z}], ...


2

For an alternative approach to counting the number of black pixels in the binarised image you could try getting the image data and counting how many zeroes it has: Count[Flatten@ImageData@yourBinaryImage,0]


1

Get rid of FaceForm[] and it is straight forward: coords[{{x1_, y1_}, {x2_, y2_}}] := {{x1, y1}, {x1, y2}, {x2, y2}, {x2, y1}}; Dynamic[image = CurrentImage[]; faces = coords[First@FindFaces[image]]; Column[{ faces, Show[{image, Graphics[{EdgeForm[{Red, Thick}], Texture[(you will have to insert your image HERE)], ...


1

You can get the values of the pixel intensities directly using the built-in functions PixelValue and/or ImageValue. For example, using DumpsterDoofus's image, the RGB pixel values at location {100,100} are easy to find, and their mean is (roughly) the intensity. data = ...


1

While not as fast as halirutan's compiled function, Mr.Wizard's renderImage function (from this question) can be used here with reasonable performance: renderImage[array_?MatrixQ, cf_, opts : OptionsPattern[Image]] := Module[{tbl}, tbl = List @@@ Array[cf[#/2047`] &, 2048, 0] // N // Developer`ToPackedArray; Image[tbl[[# + 1]] & /@ Round[2047 ...


1

The above is an excellent answer to the specific question posed. Reading the documentation info on "ImageApply[]" and "Masking" provides another mechanism for performing image processing operations selectively on image regions. Complex masks for ImageApply[] can be generated offline and Imported as mask images using software such as GIMP or Photoshop, ...



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