[GOODIE] Matrix-raok
Richard A. O'Keefe
ok at cs.otago.ac.nz
Mon Nov 25 01:08:09 UTC 2002
Whoops. Slight coding error there, because I didn't understand what
Croquet.Matrix>>* does.
"Laplace filter"
lap := Matrix[3,3] fill: #(1 4 1 4 -20 4 1 4 1).
lap := Matrix new: 3 tabulate: [:r :c |
(#((1 4 1) (4 -20 4) (1 4 1)) at: r) at: c]
image := Matrix[50,50] fill: 1.
image := Matrix new: 50 element: 1. "in new version."
fImage := Matrix[50,50] define:[:i1 :i2|
(image[(i1-1 to: i1+1), (i2-1 to: i2+1)] * lap) sum sum].
fImage := Matrix rows: 50 columns: 50 tabulate: [:r :c |
! ((image atRows: r-1 to: r+1 columns: c-1 to: c+1) +* lap) sum]
Should read
fImage := Matrix rows: 50 columns: 50 tabulate: [:r :c |
! ((image atRows: r-1 to: r+1 columns: c-1 to: c+1) * lap) sum]
fImage := Matrix rows: 50 columns: 50 tabulate: [:r :c |
((image atRows: r-1 to: r+1 columns: c-1 to: c+1 ifInvalid: 0)
! +* lap) sum]
Should read
fImage := Matrix rows: 50 columns: 50 tabulate: [:r :c |
((image atRows: r-1 to: r+1 columns: c-1 to: c+1 ifInvalid: 0)
! * lap) sum]
image := Matrix new: 53: fill: 1.
fImage := Matrix new: 50 tabulate: [:r :c |
(r at c) printString displayAt: 0 at 0.
! ((image atRows: r to: r+2 columns: c to: c+2) * lap) sum]
Should read
image := Matrix new: 53: fill: 1.
fImage := Matrix new: 50 tabulate: [:r :c |
(r at c) printString displayAt: 0 at 0.
! ((image atRows: r to: r+2 columns: c to: c+2) * lap) sum]
! The examples above have been tested, but where retyped by hand, so may
! contain typos.
Should read
! The examples above have been tested, but where retyped by hand, so may
! contain typos, and are now known to contain thinkos.
More information about the Squeak-dev
mailing list
|