nikie
Reputation
20,449
Next privilege 25,000 Rep.
 Apr 25 comment Problem with ComponentMeasurements and property “Centroid” Are you looking for IntensityCentroid instead of Centroid? Not everyone has images where intensity-weighted mean makes sense - think RGB images. Apr 23 comment Fitting Stradivari's scroll I thought the "oscillation" was because I missed the actual center point... Apr 22 comment Fitting Stradivari's scroll I've added a linear fit. No idea if this can be constructed using ruler and compass. Apr 18 comment Why is inpainting worse in grayscale than in RGB image? I hate it when people change the point of their question after they get an answer... Short version: You probably can't get the same result with a grayscale image that you get from and RGB image, because the color similarity information is lost. Apr 18 comment Why is inpainting worse in grayscale than in RGB image? Actually, it says "Inpaint operates separately on each color channel, except with the setting Method->"TextureSynthesis"." Apr 14 comment Graphical Representation of Derivatives I think what you're looking for is the en.wikipedia.org/wiki/Taylor_series Apr 12 comment Transforming part of an image to a square Apr 12 comment Transforming part of an image to a square FindGeometricTransform / ImagePerspectiveTransformation? Apr 10 comment How to apply GradientFilter locally to an image? +1. Suggestions: You could use Graphics to create the mask, instead of array manipulations. That way, you don't need the bounds checks and it's easier to change the mask shape (e.g Graphics[Disk[pt, radius], PlotRange -> Transpose[{{0, 0}, ImageDimensions[img]}], ImageSize -> ImageDimensions[img], Antialiasing -> False]). Also: Why not use LocatorPane? Apr 7 comment Differing answers when comparing Wolfram Alpha and Mathematica v.10.2 Pure speculation: Maybe WA evaluates a^b as Exp[Log[a]*b]. That would give complex numbers in intermediate calculations, where the imaginary part doesn't perfectly cancel out due to numerical inaccuracy. Compare: Sum[Exp[Log[(-1.)]*(n + 1)]/n, {n, 1, 100000}] in Mathematica gives a complex result, too (though not the same...) Mar 23 comment How can I optimize the search between two lists, one that is changing length? If you really want to find out about n=6, get a book like "Hackers Delight", translate the transpose/reverse operations to bit-twiddling operations, and learn C. Back-of-the envelope calculation suggests that it should be possible to run this for n=6 in hours. But that it something you'd have to do yourself ;-) Mar 23 comment How to define a set of two random orthogonal unit vectors? n[k_]:= defines a function of k. If you call it 3 times with the same argument, it gets evaluated 3 times and you get 3 different random vectors Mar 23 comment How can I optimize the search between two lists, one that is changing length? If you're going to use Association, you should probably read the documentation and tutorials in MMA. Anything else will only lead to frustration. That said, you probably want Export[... Keys[uniqueArray] ...] Mar 23 comment How can I optimize the search between two lists, one that is changing length? Try this: open a new notebook, restart the kernel, copy&paste your code from the start up to (and including) m[1]; // AbsoluteTiming and run. I get a lot of warnings then, apparently on the second call to m. Maybe some cleanup is missing from m Mar 22 comment How can I optimize the search between two lists, one that is changing length? FWIW, I'd try to replace AppendTo with an Association, which should make insertion faster Mar 22 comment How can I optimize the search between two lists, one that is changing length? How large would you like n to get? Even if you'd optimize the Table calculation to do one iteration per nanosecond, n=8 would take over 500 years. 2^n^2 simply grows very fast. Unless you come up with a different algorithm, anything above n=5 or maybe n=6 will take a very long time. Mar 18 comment How to Flatten and stack Efficiently 50000 Images Like I said, you can avoid the memory cost, but there's not much you can do to improve Import's speed without rewriting the functionality. Mar 18 comment ImageData reverses the order of the row of an Image But indices still start at 1, coordinates at 0. Plus, rotating the whole image just to get one pixel is horribly inefficient. I'd prefer with GetPixelValue... Mar 18 comment Total and partial derivatives Maybe what you want is: ff = f[x, y]; Dt[ff, x] - (D[ff, x] + D[ff, y] Dt[y, x]) Mar 18 comment Total and partial derivatives D is applying the chain rule. What else would you expect? If y were e.g. Sqrt or Sin, would you expect D[f[x, Sin[x]], x] == f'[x, Sin[x]]?