It appears Cliff's algorithm uses J's sort /:~ and I suppose that's where it spends most of its time. If you sort 169 small numbers 3072x4608 times in SAC you will have a lower limit of the time Cliff's algorithm requires, as compared to 47s in J (on my computer).
Ben ________________________________________ From: [email protected] [[email protected]] on behalf of Robert Bernecky [[email protected]] Sent: Wednesday, April 24, 2013 20:10 To: [email protected] Subject: Re: [Jchat] J for Image Processing Hi, Cliff, I'm looking to turn your medianf function into APL, but will have to relearn J in order to do so. Can you give me a quick translation into APLish of that? If that's not trivial, or if you're up to your butt in alligators, it's no big deal: I'll dig out the J books and figure it out. What I want to do is to compile the APL code into SAC, then compile that and see how well it works in both serial and parallel environments. Thanks, Bob On 13-04-24 11:01 AM, Cliff Reiter wrote: > In addition to my visualization book (OK fractals) you might look at > preprints of APL quote quad articles > http://webbox.lafayette.edu/~reiterc/j/withj/withj12_im_proc01_pp.pdf > http://webbox.lafayette.edu/~reiterc/j/withj/withj14_im_proc02_pp.pdf > and the vector paper > http://archive.vector.org.uk/art10500860 > and ask the forum (or me) if you have questions -- I tend to always be > a couple days out of date on the forum, but I do browse it. > Those books and articles are best used with J6 but I hope that in a > semester or two I will transition to J8. > Best, Cliff > > On 4/24/2013 10:32 AM, Sarah Arnold wrote: >> Hi Ben >> >> Yes, in mathematica it takes approximately 2 minutes to do the 13x13 >> medianfilter for a 2004 x 2006 picture... I usually use much bigger >> boxsizes (about 120x120), so I can pick up a coffee while the program >> is running. >> >> What you write about your use of J sounds promising to me. I ordered >> the book from Reiter in the library and will have a look at it. The >> tutorials you mentioned: are they somehow available? >> >> Thanks a lot for your answers! >> >> On 04/24/2013 04:14 PM, Ben Gorte - CITG wrote: >>> By the way, Cliff Reiter's median in J isn't slow at all, for >>> example compared to famous software like ImageMagick: >>> >>> $ time convert -median 3x3 p19.pgm m3.pgm >>> >>> real 0m11.961s >>> user 0m22.333s >>> sys 0m0.292s >>> $ >>> $ time convert -median 13x13 p19.pgm m13.pgm >>> >>> real 1m13.204s >>> user 2m22.517s >>> sys 0m0.352s >>> >>> Good old xv uses 10s resp. 5 minutes. >>> >>> Ben >>> >>> ________________________________________ >>> From: [email protected] >>> [[email protected]] on behalf of Ben Gorte - CITG >>> [[email protected]] >>> Sent: Wednesday, April 24, 2013 15:47 >>> To: [email protected] >>> Subject: Re: [Jchat] J for Image Processing >>> >>> 6!:2 'med3 =: 3 medianf p19' >>> 17.9526 >>> 6!:2 'med13 =: 13 medianf p19' >>> 47.2474 >>> $p19 >>> 3072 4608 >>> >>> (A median 3x3 median filter on a 3072x4608 image takes 18s, and a >>> 13x13 median takes 47s). >>> >>> This is on an Intel Core 2 Duo CPU at 2.00GHz , using the median >>> function from the already-mentioned book of Cliff Reiter "Fractals, >>> Visualization and J": >>> >>> medianf =: 1 : '(2#m) "_ (<.-:*:m)&{@:(/:~)@,;._3 ]' >>> >>> I have a C program doing the same in 0.7s resp. 1.2s, but when I >>> consider how much time it took me to write that one, I must compute >>> an awful lot of medians with it before earning back that time. >>> >>> Ben >>> ________________________________________ >>> From: [email protected] >>> [[email protected]] on behalf of Sarah Arnold >>> [[email protected]] >>> Sent: Wednesday, April 24, 2013 15:02 >>> To: [email protected] >>> Subject: Re: [Jchat] J for Image Processing >>> >>> Hi >>> I should have been a bit more precise: I'm into astronomy. I'm mostly >>> interested in noise reduction / signal enhancement and therefore apply >>> different filters to the image. Some of this operations, like for >>> example the MedianFilter[] function, take a lot of computation time. >>> >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
