Yes your approach seems valid and will probably work.
For using OpenCV on the web, you will need to use the javascript interface, which is pretty new. There is not that many functionality wrapped so you might hit some bumps there.
And you will always have to wait to reshape until a user stopped drawing, else you will have an endless moving shape.