Open ghost opened 11 years ago
hi can u rewrite it a bit and get use of jsfeat cache sys? so u wont need to allocate buffers
The problem is that I want to initialize the new buffer with the data contained in the src, taking advantage of the fast memory copy allowed by slice: I don't see how I could do that with the existing jsfeat buffer types.
ahh i see now. yeah probably better to use matrix_t copy to data_t from cache. so it will work in IE also since kernel is known size i dont see the reason to use loop there. it can be optimized to inplace check for surrounding values
it can be optimized to inplace check for surrounding values
Could you elaborate on that ? I'd be happy to remove one full copy if I can ...
well u still need to create a copy of src matrix if it === dst to make that u get the buffer from cache and use copy_to method. the second thing i was talking about is that u use loop for checking values around current position. as far as we know all offsets at start and kernel is fixed size we can remove the loop and put all the checks instead, that might be faster than using 3d loop there
Got it. I will post an updated patch.
@inspirit this discussion above looks good. why was this not merged yet?
Added the dilate function (applyKernel) manually since this still does not seem merged. Works great! Rounding it off with findContours and approxPolyDP functions would give a good chunk of what most CV projects would need without the overhead of the massive OpenCV JS port.
@krhoyt Do you have a repository with the merged changes available?
Hi,
I have added two morphology functions based on a partial Open CV port to Javascript located here: http://code.google.com/p/js-handtracking/
I have allowed in place modifications of data_t by allocating a temporary array buffer copied from the source using the ArrayBuffer.slice method.
You may want to change that to use a matrix_t/data_t 'slice' method that would hide the fact that ArrayBuffer.slice is not supported in IE.
Cheers
David