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.

  • 1
    $\begingroup$ There should be a button called "roll up inputs". Clicking on that should give you the code. $\endgroup$
    – rm -rf
    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.

  • $\begingroup$ 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? $\endgroup$
    – EdgyTector
    Jan 2 '14 at 2:26
  • $\begingroup$ 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. $\endgroup$
    – bill s
    Jan 2 '14 at 2:41
  • $\begingroup$ 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. $\endgroup$
    – EdgyTector
    Jan 2 '14 at 3:36
  • $\begingroup$ 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. $\endgroup$
    – bill s
    Jan 2 '14 at 3:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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