2
$\begingroup$

I have the following image

enter image description here

and after thresholding it, I obtained this result:

enter image description here

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):

desired output

$\endgroup$
  • $\begingroup$ Please clarify your question, and replace the links with the actual images. Use images to explain what you're trying to accomplish. $\endgroup$ – Roronoa Zoro Feb 7 '12 at 0:36
  • $\begingroup$ @RoronoaZoro I have edited the question to inline the images. The edit needs to be approved though. In SO it is not possible to include images in question before gaining some minimal reputation--maybe same here. $\endgroup$ – Matthias Odisio Feb 7 '12 at 0:59
  • $\begingroup$ @Roronoa.there is two images ,original and resultant image,i didnt undestand you .what i need is only the veins in the original image as a white lines without any other white pixels ,any additional whitr pixel represent a noise for me. $\endgroup$ – ruaa Feb 7 '12 at 1:03
  • 1
    $\begingroup$ @ruaa Starting by thresholding might not be the best idea. As stated by the MatthiasOdisio, you should look into the link he provided, plus look into morphological operations as he suggested. I would like to add that you might want to try the watershed segmentation algorithm for this problem. $\endgroup$ – Roronoa Zoro Feb 7 '12 at 16:30
4
$\begingroup$

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]

enter image description here

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

$\endgroup$
  • $\begingroup$ i am so sorry , but my target is to remove the white pixels inside the borders , except the thick lines which represent the veins. $\endgroup$ – ruaa Feb 7 '12 at 1:07
  • $\begingroup$ It is not clear from the question what you want to do. Since you provide both the input and thresholded images, I assume you are not adverse to a solution which segments the veins using a different strategy, which is what I link to in my answer. Now if you want to remove the blobish areas inside the thresholded image using only the thresholded image (perhaps because it's a requirement), please say it explicitly and keep only the thresholded image in your question. $\endgroup$ – Matthias Odisio Feb 7 '12 at 3:11
  • $\begingroup$ only work on thresholded image and remove white pixels between veins line , which is not belong to veins.i posted the two image to compare between veins in both and remove the additional white pixels in the thresholded image.is it obvious , i cann't illustrate more.regards $\endgroup$ – ruaa Feb 7 '12 at 9:14
  • $\begingroup$ Thanks for the clarification. It may be obvious to you, but as written now the question is not clear at all. I have edited my answer. $\endgroup$ – Matthias Odisio Feb 7 '12 at 12:08
  • $\begingroup$ please inform me about how to make my question clear. what are the issues which are not clear.Regards $\endgroup$ – ruaa Feb 7 '12 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.