Skip to content

Commit 81f9530

Browse files
committed
Fix height/width issue with example.
1 parent e374272 commit 81f9530

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

demos/video/chapel-webcam/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ cv::Mat new_frame(cv::Mat &frame) {
3030
rgb_float_frame_data_ptr = chpl_make_external_array_ptr(rgb_float_frame.data,size);
3131

3232
chpl_external_array
33-
rgb_float_output_frame_array = getNewFrame(&rgb_float_frame_data_ptr, width, height, channels);
33+
rgb_float_output_frame_array = getNewFrame(&rgb_float_frame_data_ptr, height, width, channels);
3434

3535
chpl_free_external_array(rgb_float_frame_data_ptr);
3636

demos/video/chapel-webcam/smol.chpl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,19 @@ export proc getNewFrame(ref frame: [] real(32),height: int, width: int,channels:
3535

3636
const t = getTime() - startTime;
3737
const shape = (height,width,channels);
38+
writeln(shape);
3839
forall i in 0..<frame.size {
3940
const idx = utils.indexAt(i,(...shape));
4041
const (h,w,c) = idx;
4142
const (u,v) = (h:real(64)/height,w:real(64)/width);
42-
const color = frame[i];
43+
ref color = frame[i];
4344
// if h < width {
4445
// frame[utils.linearIdx(shape,(h,w,c))] = frame[utils.linearIdx(shape,(h,w,c-1))];
4546
// }
46-
if h < width {
47-
frame[utils.linearIdx(shape,(h,w,0))] *= Math.sin(2.0*t + 5.0 * u) : real(32);
48-
}
47+
// if h < width {
48+
// frame[utils.linearIdx(shape,(h,w,0))] *= Math.sin(2.0*t + 5.0 * u) : real(32);
49+
// }
50+
color *= (Math.abs(Math.sin(2.0*t + 5.0 * v)) * Math.abs(Math.sin(2.0*t + 5.0 * u))) : real(32);
4951
}
5052
return frame;
5153
}

0 commit comments

Comments
 (0)