New answers tagged

10

Here's an idea that could work: The "Ferrite" areas have a border that's slightly darker than the background, while the area in between has a border that's slightly brighter than its neighborhood. So a filter that compares each pixel with the average brightness in the neighborhood, like an LoG filter should be a good start: img = ...


9

There are two distinctions to be made here. Both Row and List will resize graphics objects if they are above a certain threshold size, and that threshold size is different. List List will resize a graphics object when its width is larger than 180 pixels, and then further reduce its size if the width is over 360 Manipulate[Labeled[ {RandomImage[1, ...


14

Here's my solution. Change CompilationTarget -> "C" to CompilationTarget -> "WVM" if you don't have a C compiler available. cf = Compile[{{v, _Real}, {kernel, _Real, 2}}, v*kernel, RuntimeAttributes -> {Listable}, Parallelization -> True, CompilationTarget -> "C", RuntimeOptions -> "Speed" ]; shapedPixels[img_, kernel_] ...


12

Another approach: pic = Import@"http://i.stack.imgur.com/qzMGE.jpg" Image @ ArrayFlatten @ Map[ Map[Function[x, x #], DiskMatrix[5], {2}]&, ImageData@ImageResize[pic, {Automatic, 50}], {2} ] I'm not taking care about preserving image size, it is governed by Resize and DiskMatrix size. just put e.g. DiamondMatrix[5] or ...


12

You need to: Rescale the image to a smaller size, ImageResize Extract the pixel values, ImageData Convert the triplets to RGBColor directive, and build a Graphics with appropriately coloured Disks inside. I found MapIndexed convenient for this. Code: img = ExampleData[{"TestImage", "Sailboat"}]; pixels = Transpose@ImageData[ImageResize[img, 50], ...


17

Load image img = Import["http://i.stack.imgur.com/qzMGE.jpg"] ImagePartition and DominantColors Make an array of Disk of the DominantColors in each part of ImagePartition. Rotate[ Graphics@MapIndexed[ {First@DominantColors[#1, 1], Disk[#2, 1/2]} & , ImagePartition[img, 10], {2} ] , -π/2] ImageResize and ImageData But I find the ...


4

Image3D is great, but if you want to have fine-tuned control over the opacity then you need to go to DensityPlot3D, or, in this case, ListDensityPlot3D. These are new functions in version 10.2. In the absence of OP's data, we'll have to invent some data. OP has a set of slices that together make up a 3D object. We can mimic this using Image3DSlices, and ...


2

training set trainingSet = { Import["http://i.stack.imgur.com/oJnVl.png"] -> x, Import["http://i.stack.imgur.com/yrNij.png"] -> x, Import["http://i.stack.imgur.com/pINOj.png"] -> x, Import["http://i.stack.imgur.com/B1OUt.png"] -> x, Import["http://i.stack.imgur.com/4g9x3.png"] -> x, Import["http://i.stack.imgur.com/7rWxi.png"] -> x, ...


4

There are several ways to reduce the size of the image. Perhaps the simplest is to reduce the number of pixels when it is generated. For example, if you do: test = Image3D[Table[Sin[x + y + z], {x, 1, 100, 3}, {y, 1, 100, 3}, {z, 1, 100, 3}]] Then you get an image that looks much the same and the memory is 0.3 MB ByteCount[test]/1024/1024 ...


15

In this case (distinguishing x's from o's), it is also pretty easy to design your own classifier. Begin by binarizing, and then calculate the EulerNumber for each. The Eulernumber for x's will be zero, while the o's will have a component with Eulernumber 1 (The Euler number is the number of encircled regions). The erosion will help to make it a little more ...


27

Use the Classify[] function to train your own classification function (name it c) on a list of example photos of X's and O's (see reference pages on handwritten digits classification and the particular section in Classify) Note that Classify is special algorithm that programs itself (it uses an artificial intelligence pattern recognition algorithm to ...


3

One way to approach this is to use a Watershed algorithm to segment the image. Each of the watersheds contains one of the symbols. i = Import["http://i.stack.imgur.com/tTeBU.png"]; waterI = WatershedComponents[i]; waterI // Colorize You can then separate out the three symbols {m1, m2, m3, m4} = ComponentMeasurements[waterI, "Mask"]; ...


6

Here's one way: img=Import["http://i.stack.imgur.com/LBVmD.jpg"] Dilation[EdgeDetect[img], 2]


4

Framed[i = Import["http://i.stack.imgur.com/tTeBU.png"]] ib = ColorNegate@Binarize@i; sc = SelectComponents[ib, "Count", -1]; bb = ComponentMeasurements[sc, "BoundingBox"]; bs = Reverse[Sort /@ {#[[1]], Last@ImageDimensions@sc - #[[2]]} &@ Transpose[bb[[1, 2]]]]; it = ImageTake[sc, Sequence @@ bs]; it1 = ImageTake[i, Sequence @@ bs]; eps = ...


9

With Frame -> All, the automatic Spacings are weird. The automatic BaselinePosition is bad either way. It seems to be a good idea to include substitutes for as many of those options which are Automatic by default as possible: pic2 = ImageResize[ImageCrop@Rasterize@Graphics@Disk[], {Automatic, 40}]; Grid[{{pic2}}, Alignment -> {Center, Center}, ...


3

I'm not sure that I fully understand what you need, but perhaps the following will help you get started. First, import the picture: img = Import["http://vignette4.wikia.nocookie.net/rickandmorty/images/d/dd/Rick.png/revision/latest?cb=20131230003659"] Then find the outer edge: edge = EdgeDetect@ColorQuantize[img, 1] Finally, find the position of ...


0

emptyImage = Image[Table[0, {i, 1, 300}, {j, 1, 400}]] coordList=RandomInteger[{100,200},300,2]; Manipulate[ReplacePixelValue[emptyImage, coordList[[1 ;; i]] -> 1], {i, 1, Length[coordList], 1}]


4

To answer your question "how can I control the parameter to attach the texture to the ring?" - well it takes a bit of trial and error. There is some documentation on the TextureCoordinateFunction, and we can work the rest out ourselves. We want the horizontal and vertical directions of the image to go with the z axis and the angular coordinate. These ...


6

Here is the answer from Wolfram Technical Support 12-bit TIFF files are not currently supported by Mathematica. Our developers are interested in supporting this format, however, and I have filed a suggestion on your behalf. I have also included your contact information so that you can be notified if this gets implemented.



Top 50 recent answers are included