Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imgproc: Morphology erode and dilate #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented May 28, 2013

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

@inspirit
Copy link
Owner

hi
can u rewrite it a bit and get use of jsfeat cache sys? so u wont need to allocate buffers

@ghost
Copy link
Author

ghost commented May 29, 2013

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.

@inspirit
Copy link
Owner

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

@ghost
Copy link
Author

ghost commented May 29, 2013

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 ...

@inspirit
Copy link
Owner

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

@ghost
Copy link
Author

ghost commented May 29, 2013

Got it. I will post an updated patch.

@serapath
Copy link

@inspirit this discussion above looks good. why was this not merged yet?

@serapath serapath mentioned this pull request May 13, 2017
@krhoyt
Copy link

krhoyt commented Nov 21, 2017

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.

@sona1111
Copy link

@krhoyt Do you have a repository with the merged changes available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants