inspirit / jsfeat

JavaScript Computer Vision library.
MIT License
2.74k stars 372 forks source link

Execution time static image processing vs webcam example #70

Open Evertvdw opened 7 years ago

Evertvdw commented 7 years ago

Hello,

I'm running the grayscale function on some data of (500*500) and using the same profiler as the examples I get different results.

This is the code I use. imageData contains imageData taken from a canvas with getImageData. I copied all this from this demo: https://inspirit.github.io/jsfeat/sample_orb.html

var stat = profiler()

img_u8 = new jsfeat.matrix_t(500, 500, jsfeat.U8_t | jsfeat.C1_t);
stat.start('grayscale')
jsfeat.imgproc.grayscale(imageData.data, 500, 500, img_u8);
stat.stop('grayscale')

I'm doing this for a static image in my case, but the performance is like a factor 6 worse than in the example. Grayscale takes ~1ms there and blur ~6ms, but for me it shows ~6ms and ~36ms, what is the cause of this? Is this some startup effect because I use a single image? The profiler I also copied from the example, so everything should be similar.

I'm experimenting with static images but in the end I would like to be able to do all the operations on a webcam/camera feed.

Can anyone explain this?

Thanks in advance!