Skip to content

Commit 3dbb06f

Browse files
committed
Increase chapel-webcam demo performance.
1 parent 67c707d commit 3dbb06f

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

demos/video/chapel-webcam/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
# make clean && make libsmol && make main && ./main
22
-include lib/Makefile.smol
33

44

demos/video/chapel-webcam/main.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@
77

88

99
cv::Mat new_frame(cv::Mat &frame) {
10-
cv::Mat rgb_uchar_frame;
11-
cv::cvtColor(frame, rgb_uchar_frame, cv::COLOR_BGR2RGB);
10+
// cv::Mat rgb_uchar_frame;
11+
// cv::cvtColor(frame, rgb_uchar_frame, cv::COLOR_BGR2RGB);
12+
13+
// cv::Mat rgb_float_frame;
14+
// rgb_uchar_frame.convertTo(rgb_float_frame, CV_32FC3, 1.0f/255.0f);
15+
1216

1317
cv::Mat rgb_float_frame;
14-
rgb_uchar_frame.convertTo(rgb_float_frame, CV_32FC3, 1.0f/255.0f);
18+
cv::cvtColor(frame, rgb_float_frame, cv::COLOR_BGR2RGB);
19+
rgb_float_frame.convertTo(rgb_float_frame, CV_32FC3, 1.0f/255.0f);
1520

1621
// cv::MatSize size = rgb_frame.size;
1722
// std::cout << "x " << size[0] << " y " << size[1] << " channels " << rgb_frame.dims << std::endl;

demos/video/chapel-webcam/smol.chpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export proc getNewFrame(ref frame: [] real(32),height: int, width: int,channels:
2929
// return [x in frame] m;
3030

3131
const shape = (height,width,channels);
32-
forall (i,color) in zip(0..<frame.size,frame) {
32+
forall i in 0..<frame.size {
3333
const idx = utils.indexAt(i,(...shape));
3434
const (h,w,c) = idx;
3535
// const color = frame[i];

0 commit comments

Comments
 (0)