Giffary
Giffary

Reputation: 3128

Opencv (JS) select finger area from image

I'm coding ionic app that allow user to take finger photo and upload to server.

My objective is I would like to find any solution to select area of finger and cut it of from background (please see image below).

enter image description here

I found that opencv can do that (https://gigadom.in/2011/10/) but I would like to find the way to to with javascript or NodeJS.

Any idea for this.

Upvotes: 0

Views: 478

Answers (2)

Rafael Piemontez
Rafael Piemontez

Reputation: 11

Background removal is a generic concept in computer vision, usually associated with removing areas that are not moving.

Perhaps what you are looking for is something related to object detection, and as a result, removing everything that is not the detected object.

Try to research something like that: "Finger Object Detection"

Or if the application is in a controlled location, perhaps the other solution discussed here, with the solution of removing everything that is not of a certain color, united with morphology, will have some result.

Anyway, I believe this solution should be applied on the server side. Applying this solution on the frontend will require a lot of performance-related care.

Anyway², look at how opencv's background removal works on a moving video.

OpenCV-Flow BGRemove Sample

App Link: https://online.opencvflow.org/

Project Link: https://opencvflow.org/

Upvotes: 0

Peter Stenger
Peter Stenger

Reputation: 175

OpenCV has a JS library: https://docs.opencv.org/3.4/d0/d84/tutorial_js_usage.html

This means you can take many of the python implementations of this logic and port it to JS.

Technique 1 to remove the background using color thresholding: How to remove the background of an object using OpenCV (Python)

Technique 2 to remove background using contours: Removing Background Around Contour

Your use case may require a combination of these techniques and some fine tuning.

Upvotes: 1

Related Questions