Skip to content

Commit d359193

Browse files
committed
Chapel webcam example working with NDArray module.
1 parent 5d8ad25 commit d359193

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

demos/video/chapel-webcam/smol.chpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ export proc getNewFrame(ref frame: [] real(32),height: int, width: int,channels:
3737
const t = getTime() - startTime;
3838
const shape = (height,width,channels);
3939
writeln(shape);
40+
41+
var ndframe = new ndarray(real(32),shape);
42+
ndframe.data = reshape(frame,ndframe.domain);
43+
44+
writeln(ndframe.max());
4045
forall i in 0..<frame.size {
4146
const idx = utils.indexAt(i,(...shape));
4247
const (h,w,c) = idx;

lib/NDArray.chpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ proc ndarray.min(): ndarray(1,eltType) {
693693
proc ndarray.max(): ndarray(1,eltType) {
694694
var me = new ndarray({0..<1},eltType);
695695
const myData = this.data;
696-
me.data[0] = Math.max reduce myData;
696+
me.data[0] = max reduce myData;
697697
return me;
698698
}
699699

0 commit comments

Comments
 (0)