Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I enter an image and in the suggestions bar under the image, one of the suggestions is "Edge detect". I click on it and a nice cell with all the options comes up. How do I get the code for all of what Mathematica returns? Clicking "Done" merely returns the value of the variables on the sliders.

share|improve this question
There should be a button called "roll up inputs". Clicking on that should give you the code. – R. M. Jan 2 '14 at 1:21

After you get the image (or the data) the way you want it, choose the "roll up" icon and it writes the Mathematica code for you.

enter image description here

The roll-up icon is the little squiggle just to the right of the word "more". If you want to roll your own, you can do it easily using Manipulate

Manipulate[EdgeDetect[img, r, t, Method -> meth], {r, 1, 5}, {t, 0, 1}, 
          {meth, {"ShenCastan", "Sobel", "Canny"}}]

where img is the name of the image you are processing.

share|improve this answer
Right, if I wanted all of the variables fixed that would do. In this case I want exactly what Mathematica has generated with manipulate and the tree main EdgeDetecors in place. That is if I hit Done it fixes the variables and I loose the ability to Manipulate everything. I'm wanting the code that Mathematica generated. Any way to get that? – EdgyTector Jan 2 '14 at 2:26
Learning to use Manipulate is a surefire way to be able to get this kind of thing, and then you can customize and have exactly the controls you want. It's not that hard and there are lots of examples in the documentation and at the wolfram demonstration site. – bill s Jan 2 '14 at 2:41
Exactly my point. The original question was, What are the min and max ranges for EdgeDetect. The answer was off. As examples of it in the documentation have values going as high is 6, 7 and more. So a range between 0 and 1 is not the correct answer. I used the Suggestion EdgeDetect and It came back with all of the variables in Manipulate form. Exactly what I am looking for. I can use Manipulate as long as I have the ranges. Mathematica generated them for the result but I don't know how to get it to generate all of the code insted of making me chose fixed variables from its sliders. – EdgyTector Jan 2 '14 at 3:36
The range can be as large as you are willing to wait (it's how big the blocks are that are processed simultaneously). To be explicit, you can use values larger than 5. The threshold is between 0 and 1. These are clearly stated in the documentation. – bill s Jan 2 '14 at 3:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.