Canny edge detector: Difference between revisions

Line 678:
 
convolve =: 4 : 'x apply (($x) partition y)'
 
partition =: 4 : '2 0 3 1 |: ((1{x) ([+\]) (2 0 1|: ((0{x) ([+\]) y)))'
apply =: 4 : '+/"1 (+/"2 (x *"2 y))'
max3x3 =: 3 : '(1{1{y>0) * (>./,y)'"2
 
partition=: 2 1 3 0 |: {:@[ ]\ 2 1 0 |: {.@[ ]\ ]
apply=: [: +/ [: +/ *
max3x3 =: 3 : '(0<1{1{y) * (>./>./y)'
 
addborder =: (0&,@|:@|.)^:4
normalize =: ]%+/@,
Line 693 ⟶ 687:
connect =: 3 : 'attach^:_ unique y'
 
NB. on low memory devices, cropping or resampling of high-resolution images may be required
crop =: 4 : 0
'h w h0 w0' =: x
Line 699 ⟶ 693:
)
resample =: 4 : '|: (1{-x)(+/%#)\ |: (0{-x)(+/%#)\ y'
NB. on smalle. screeng. devicessmartphones, image may need to be expanded for viewing
inflate1 =: 4 : 0
'h w' =: $y