I have the following image
and after thresholding it, I obtained this result:
How can I remove all white pixels which do not belong to the original image?
The desired output should look like this (I manually edited the image):
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.
Sign up to join this communityI have the following image
and after thresholding it, I obtained this result:
How can I remove all white pixels which do not belong to the original image?
The desired output should look like this (I manually edited the image):
Welcome to Image processing!
(See edit at the bottom)
If I understood you well, thresholding the image with a low threshold will provide a mask for the hand that you can use to remove the background pixels.
That's how it will look in Mathematica (ImagePad
here is just used to remove the extra white border on your images):
img = ColorConvert[Import["http://i.stack.imgur.com/krbMs.jpg"], "Grayscale"];
border = BorderDimensions[img];
img = ImagePad[img, -border]
hand = Binarize[img, 0.2]
thresholded = Binarize[ImagePad[Import["http://i.stack.imgur.com/ylo3B.jpg"], -border], 0.1]
You may want to check this other question for an alternative segmentation technique based on ridge filtering.
EDIT: Based on your comment, you would like to only work on the thresholded image and clean it up to leave only the components corresponding to veins. I would look at morphological operations (e.g. Opening, components selection based on shape properties). By the way I feel this is harder than working on a different vein segmentation algorithm (see one proposed above).