Reputation
12,933
Next privilege 15,000 Rep.
Protect questions
Badges
2 31 64
Newest
 Nice Answer
Impact
~153k people reached

8h
comment Draw a vector with mathematica
Do you mean Arrow[{{1,1,1},{1,-1,2}}]?
9h
comment Curvature Application
@amr: Not yet. I'll think about it ;-)
9h
comment Curvature Application
@David: Yes, t is the arc length. s would have probably been a better variable name. I've added a few paragraphs explaining tTotal at the end
Jun
13
comment How to do automatic differentiation?
Is there a reason why you want source code transformation instead of operator overloading (which is straightforward to do in MMA, I think)?
May
25
comment What kind of algorithm can be used to map image coordinates to cylinder coordinates
@ChongVera: IIRC, I started with a simple 2nd order polynomial in X direction and 1st order polynomial in Y direction. Then I kept adding terms that didn't break FindMinimum and seemed to improve the result image visually. So, basically, by trial and error.
May
17
comment Compute a hessian matrix on a image?
@SURF: Of course, just pack the whole thing in a function that takes the scale parameter (second parameter to GaussianFilter) as a parameter and call that with a range of values (using Table or Array). Or use Manipulate to see the effect of scale interactively.
May
16
comment Compute a hessian matrix on a image?
@SURF: Sure, you could use e.g. minEigenvalue = MapThread[Min, imgEigenvalues, 2]; to calculate the per-pixel min of the two eigenvalues, then binarize the result that.
May
16
comment Compute a hessian matrix on a image?
@Histograms: As far as I understand the documentation, GradientFilter basically uses GaussianFilter, and it can only calculate the 1st derivative. You could use DerivativeFilter, of course. I generally start with GaussianFilter, as it's in some sense the most "natural" kernel and has (at least theoretically) certain unique advantages, especially if you calculate multiple scales. (The reasoning is too long for a comment, and honestly, I'd have to look most of it up myself, but I can give references if you're interested.)
May
11
comment How to construct a kernel from a function?
Are you looking for Array or Table? Those evaluate a function resp. an expression for every cell in a matrix
Apr
15
comment Efficient way to perform local Otsu thresholding on image
as a workaround, you could calculate thresholds for every nth pixel, and interpolate in between.
Apr
7
comment Looping within linear programming
Also, // does not start a comment in Mathematica code!
Apr
7
comment Looping within linear programming
This question would be much clearer if you posted the code that actually takes too much time. I've tried your first two code blocks, and neither takes more than a few milliseconds. Without that, the only tip that comes to mind is use FindMinimum instead of Minimize. Minimize tries to solve the problem symbolically, which is in general more expensive. FindMinimum uses local optimization, which is usually fastest, and for an LP is guaranteed to find the global minimum.
Apr
5
comment Is association in mathematica ordered or not?
@Nasser: It's not the most frequent use case, but sometimes you want to aggregate data in an Association, then later process the key/value pairs in the order they were discovered. And I often find it handy that BarChart, ListPlot&friends don't jumble association data I pass them. So I'm glad Wolfram made them ordered.
Apr
5
comment Ordered associations
Not exactly a reference, but Sort and KeySort return sorted associations (and that's documented behavior). That wouldn't make any sense if associations were unordered.
Mar
24
comment Extracting road curves from an image
@P.Fonseca: I tried, but exported as gif the animation was ~30 MB... (swf and qt were both between 1-2 MB)
Mar
24
comment Extracting road curves from an image
@Pickett: Weird. The documentation doesn't say that this syntax is new, and I could have sworn I've used it like this since v8. OTOH, the speed difference isn't that large (in this case) so I'll change it to your version.
Mar
24
comment Extracting road curves from an image
@Pickett: Weird. I've just executed the code in a fresh MMA session, and except for the Show-problem Zviovich mentioned, it worked fine. Does whitePixels contain a list of 2d coordinates in your session? Or maybe -> Automatic syntax is newer than your MMA version?
Mar
24
comment Extracting road curves from an image
@Zviovich: I've used bgnd=Image[bgnd], to make my experiments with colorDist faster. I didn't realize this changed the behavior of Show. I've updated my answer. Regarding the title: Maybe something like "Extracting road graphs from an image"?
Mar
9
comment Can I solve this graph theory problem with Mathematica?
I see. The solution got lost in translation...
Mar
9
comment Can I solve this graph theory problem with Mathematica?
Which number is which? Could you maybe draw one of them in a graph? I thought they were top-to-bottom, left-to-right, but then 4,5 in the first example would be neighbors.