Tag Info

Hot answers tagged

16

The simplest thing that can work is to search white blobs instead of black blobs, and ignore the ones that have low circularity (calculated from the area/perimeter^2 ratio): img = Import["http://i.stack.imgur.com/LaMAg.jpg"] img = ColorConvert[img, "Grayscale"]; components = ComponentMeasurements[ MorphologicalBinarize[Closing[img, DiskMatrix[5]]], ...


12

If you got V10.1 you can test it yourself. Make sure ImageIdentify got it's data after say 1st execution and then it can work offline. But use it online from time to time because it is a learning function and it becomes better with time, needs updated data. To understand better the workings, implications and applications of this function take a look also at ...


11

Approach As halirutan suggested in question 71310 we can create a custom, compiled color function and apply it using the trick Image[colorFunction@ImageData@img] on my computer with my custom avocado color function this is more than eight times faster than Colorize, taking only 0.035 seconds. How to create a fast custom color function In order to ...


8

The function domCol below is about 100 times faster than DominantColors. Basic plan: Create enough color bins throughout the color space occupied by the image; count the number of pixels in each bin; return the sorted colors. The function works in the LAB color space so we can use EuclideanDistance for the distance between colors. The centers of the bins ...


7

It is also pretty straightforward to create your own color map. For example, the following code reads in the image, and multiplies each of the color channels by an appropriate factor, then recombines the three into a single color image. It is very fast. Change the constants (in this case, 0, 1, and 0) at will. img = ...


5

Use of ColorQuantize Much faster. Not exactly the same, but close and for an art project is OK I think. i = ExampleData[{"TestImage", "Lena"}]; QuaCol[i_, n_] := RGBColor /@ Union[Flatten[ImageData[ColorQuantize[i, n]], 1]]


5

The problem is not with DominantColors Try varying the number of colours selected by running this snippet. I vary the number of selected colours from 1 to 10, and measure the time to calculate DominantColours ten times: Table[ First@AbsoluteTiming@ Table[DominantColors[p, i], {p, RandomChoice[pieces, 10]}] , {i, 10}] (* {6.544491, 7.658153, ...


5

I normally use something like this: img = ExampleData[{"TestImage", "Airport"}]; {h[xx], h[xy], h[yy]} = GaussianFilter[ImageData[img], 5, #] & /@ {{0, 2}, {1, 1}, {2, 0}}; (Note: This line can be written much more tersely. But this way it should be clear what's going on: We're applying a Gaussian derivative filter, to get the 2nd order ...


5

I'll use my own pictures as test cases (click on them to get the full images). These pictures were taken with a D3300 and MICRO-NIKKOR 40mm 2.8G; settings were f/3.2, 1/6 and 1/800 shutter, ISO 100 and 12800, auto WB. In-focus (desired image) Autofocus locked on to the surface texture of the laptop here. At this wide aperture the depth-of-field is ...


3

Just sample your function over a 2D window with a Table. f[x_,y_]:= 1-2*Sinc[2(x^2 + y^2)] step = .2; kern = Table[f[x,y], {x, -3, 3, step}, {y, -3, 3, step}]; The dimensions of the kernel can be returned with Dimensions[kern]. Experiment with values of step and window sizes. Now just do an ImageConvolve[img,kern] and optionally use ImageAdjust to ...


3

Here's how I arrived at this (admittedly, quite ugly) mapping function: The "right" function to map points from cylinder coordinates to image coordinates in a pinhole camera model is the one MarcoB linked to in his comment. In a nutshell: {Sin[u],Cos[u],v,1} converts from cylinder coordinates u,v to (homogeneous) 3d coordinates which you then multiply by ...


2

Preprocess like this: ClusteringComponents[ Erosion[Binarize[mySpheres, {.5, .98}], DiskMatrix[1]]] // Colorize


2

I will show a way to find the cells and the nucleusus with LaplacianGaussianFilter. Nucleouses To find the nucleuses there many ways to define the regions, the idea here is to find local maxima, rather then absolute maxima, which the threshold does. This finds the centers of the nucleuses. nucleouscenter=Binarize[ImageMultiply[MaxDetect[#], #] &@ ...


2

The problem is caused by padding that is added around the Graphics scene by default. You can disable it by setting PlotRangePadding to 0 or None: mask = Graphics[{Black, Rectangle[{0, 0}, {256, 256}], White, Disk[Abs[{0, 256} - pos], 7]}, PlotRangePadding -> 0]


2

The most powerful tensor package suit for MMA (and arguably for any CAS) is xAct. It uses the full machinery of diff geometry (fiber bundles, connections, forms, ect) and a powerful canonicalization algorithm, both symbolically and numerically. Obviouly you can use just a fraction of this power. I am the developer of xPrint, the GUI interface to xAct. With ...



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