Canny edge detector: Difference between revisions

Content added Content deleted
Line 689: Line 689:
addborder =: (0&,@|:@|.)^:4
addborder =: (0&,@|:@|.)^:4
normalize =: ]%+/@,
normalize =: ]%+/@,
resample =: 4 : '|: (1{-x)(+/%#)\ |: (0{-x)(+/%#)\ y'
attach =: 3 : 'max3x3 (3 3 partition (addborder y))'
attach =: 3 : 'max3x3 (3 3 partition (addborder y))'
unique =: 3 : 'y*i.$y'
unique =: 3 : 'y*i.$y'
connect =: 3 : 'attach^:_ unique y'
connect =: 3 : 'attach^:_ unique y'


NB. on low memory devices, cropping may be needed
NB. on low memory devices, cropping or resampling may be required
crop =: 4 : 0
crop =: 4 : 0
'h w h0 w0' =: x
'h w h0 w0' =: x
|: w{. w0}. |: h{. h0}. y
|: w{. w0}. |: h{. h0}. y
)
)
resample =: 4 : '|: (1{-x)(+/%#)\ |: (0{-x)(+/%#)\ y'
NB. on small screen devices, image may need to be expanded for viewing
NB. on small screen devices, image may need to be expanded for viewing
inflate1 =: 4 : 0
inflate1 =: 4 : 0