Consider the following image of a knee:

enter image description here

By default the background of this image is the black regions on the left and right sides of the image.

But is it possible to interactively define the foreground and background of this image or any image in general so that whenever I hover the mouse on a specific portion of the image the corresponding region will be considered as the foreground and the background will become transparent?

The idea is motivated from

Healthline Bodymap (http://www.healthline.com/human-body-maps/male) and

Brain Data Crawler (http://community.wolfram.com/groups/-/m/t/568284)

  • $\begingroup$ Isn't this basically the same question as you posed here: mathematica.stackexchange.com/questions/112164/… (but with "black background" instead of "gradient"?) $\endgroup$ – bill s Apr 11 '16 at 16:00
  • $\begingroup$ Yes, actually it's my updated question. Since, I've already accepted your answer, I thought probably that's why I'm not receiving any answer for my updated question. $\endgroup$ – Majis Apr 11 '16 at 16:03
  • $\begingroup$ Maybe you could try to use the previous answers to solve your updated question? $\endgroup$ – bill s Apr 11 '16 at 16:07
  • $\begingroup$ From your answer, I can get the gradient values near about the position of the mouse. Now I need to apply suitable segmentation scheme to segment the corresponding part of the knee. Yes, I'm trying it myself. But any direction will always be helpful. $\endgroup$ – Majis Apr 12 '16 at 9:14

RemoveBackground + HighlightImage seem to work for the provided example.

(Though HighlightImage does not seem to support Mouseover, so I insert it after the fact...)

knee = Import["http://i.stack.imgur.com/hCC57.jpg"];

mask = Binarize[RemoveBackground[knee], 0];

HighlightImage[knee, mask] /. f_FilledCurve :> 
  Tooltip[Mouseover[{EdgeForm[None], Opacity[0], f}, f], "Knee Joint"]

enter image description here

  • $\begingroup$ Thanks for your response. Now I need to implement suitable segmentation scheme to get the different masks for different parts of the knee. $\endgroup$ – Majis Apr 12 '16 at 9:09

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.