I started to implement the Canny edge detector for rosettacode.org.
http://rosettacode.org/wiki/Canny_edge_detector
The j sentences to create filtering matrices and to then convolve them
with the image them with images is direct with ;. (cut).  This is j701
code.  After any step step you can look at current result using
viewmat THE_ARRAY


require'bmp viewmat'
NB. use your own path...
TOUCAN=: readbmp'/usr/local/j64-701/addons/graphics/bmp/toucan.bmp' 

IMAGE =: TOUCAN

rSquared =: [: +/&.:*:/~ i:
gaussianMatrix =: ^@:((% _2 * *:)~ rSquared) NB. SIGMA gaussianMatrix R
normalize =: % +/@:,
ngm =: normalize@:gaussianMatrix
assert ( 9 11  9 , 11 19 11 ,:  9 11  9 ) -: (<. 0.5 + 100 * 1 ngm 1)
assert (1 1 $ 1) -: 1 ngm 0

FilterArray =: adverb def '(1 1,:$m) m&(+/@:,@:*);._3 ]'
SOBELY =:  (, 0 ,: -)1 2 1
SOBELX =: |: SOBELY

FILTEREDIMAGE =: (1 ngm 4) FilterArray IMAGE
COMPLEXIMAGE =: (SOBELX FilterArray j. SOBELY FilterArray) FILTEREDIMAGE
CANNY_EDGE_DETECTOR_STEP_2 =: |COMPLEXIMAGE

ORIENTATION =: 12 o. COMPLEXIMAGE  NB. circle function 12 is the angle
of the complex number


NB.xxxxxxxxxxxxxxxxx
NB.TAU =: 2p1 NB. http://tauday.com/
NB.(1 2 3%8)I.ORIENTATION (((] | +) -:) % ]) TAU NB. 0 to 0.5



On Wed, 2013-04-24 at 12:00 +0000, [email protected]
wrote:
> Date: Wed, 24 Apr 2013 13:23:16 +0200
> From: Sarah Arnold <[email protected]>
> To: [email protected]
> Subject: [Jchat] J for Image Processing
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Hi
> 
> I'm new to J (and virtually to programming in general). I have just 
> finished reading the J Primer. For my PHD I need to do some image 
> processing. I was wondering whether J was a good choice for image 
> processing, since the language works so fine with arrays. At the
> moment, 
> I'm mostly using Wolfram Mathematica, which I like a lot, but it is
> also 
> very slow.
> 
> Is J fast? Does there already exist a library for image processing
> tasks?
> 
> Any help is appreciated!
> Sarah


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to