alemart / speedy-vision

GPU-accelerated Computer Vision for JavaScript.
Apache License 2.0
175 stars 28 forks source link

mask construction #23

Closed under-score closed 3 years ago

under-score commented 3 years ago

How can I mask pure black & white pixel from being included in feature tracking?

alemart commented 3 years ago

Median filter? Can you add more detail and expand the question, so that I can have a better understanding of it?

under-score commented 3 years ago

Yes, median filter, need some kind of keypoint filter based on intensity. While the placement of keypoints in your demo apps at the sharpest edges is useful, it is useless in my project where I am indexing the content of image panels.

Take for example the image taken from @PLOSONE. I have clustered here the ORB keypoints but would like to get rid of all keypoints at borders eg 7,8,18,16 ... and also of text eg 2,6,3,4... 14,23... 15.

Is that possible in speedy-vision-js? Thank you.

alemart commented 3 years ago

Thank you for your reply.

You can use the latest version of the library to apply a median filter before detecting the keypoints. First, convert the image to greyscale and then apply the median filter. Next, use that result as the input of a keypoint detector. If you need help to set up the pipeline, I can assist you if you provide me a sample image.

Speedy doesn't include text removal capabilities at the moment, but you may be able to get rid of the text by preprocessing the images in a third-party software such as GIMP, using a technique called image inpainting.

alemart commented 3 years ago

Also, are you using multiple images, or a single image? (multiple images combined into one?)

under-score commented 3 years ago

Thank you - just updated to the new pipeline.

Unfortunately ORB keypoint detection is no more working now as const detector = Speedy.Keypoint.Detector.ORB(); produces a uncaught (in promise) TypeError: Speedy.Keypoint.Detector.ORB is not a function at window.onload

Anyway -- I always start with multi image panels (whole page screenshots see the link above) -- no need for any impainting -- only quick keypoint detection...

As suggested, I tried now the FAST detector after the median filter but could also not mask/exclude black and and white pixel positions. So what about the idea of looking up lets say the 5x5 kernel of each keypoint if it includes several black and white pixel?

alemart commented 3 years ago

Hi. Thank you for your reply.

Please use Speedy.Keypoint.Descriptor.ORB() instead. My ORB demo has a fully working pipeline that may be of help. There was a error in my README, where it said detector instead of descriptor. I have just fixed it.

Anyway -- I always start with multi image panels (whole page screenshots see the link above) -- no need for any impainting -- only quick keypoint detection...

If you use an image like the one below, you'll be getting corners at 7,8,16,18... due to the very nature of the corner detector. It's designed to catch that sort of thing. My suggestion is that you crop your image and apply the keypoint detector only in the relevant parts of it. Instead of working with whole page screenshots, work with the individual images of the cells separately.

139379541-89ea9ec0-5575-4f7b-b188-dad8dc12ec2b

under-score commented 3 years ago

Sure, there is nothing bad with detecting corners ;-) IMHO cropping/segmentation by a realtime JS pipeline does not work out of the box as with C++ or Python. Thank you again for your thoughts.