-5

In this example of edge detection:

http://www.mathworks.com/help/images/edge-detection.html#buh9ylp-13

How would I remove the gray background in the grayscale image at the beginning?

J.Doe
  • 15
  • 8

1 Answers1

1

Removing the background befor you apply an edge detector makes no sense as the more or less homogeneous low frequency background will result in a zero gradient anyway. It won't improve the results of your edgedetection.

If you only want to cut out the coins to put them on a different background simply apply a global threshold

original image

threshold

Remove thos tiny speckles with some morphological operators and blur the mask so you won't have fringed coin edges

cleanup

Apply some logical operations to mask the original image

masked image

Piglet
  • 27,501
  • 3
  • 20
  • 43
  • What function does the thresholding? – J.Doe Jul 07 '16 at 14:32
  • 1
    Applying a threshold is just using comparison operator (like `<`) and a threshold value. –  Jul 07 '16 at 15:07
  • Still not sure what to do, I can read in the image with imread, but what do i replace the values with so that they disappear? I can just change the grayscale saturation it looks like. – J.Doe Jul 07 '16 at 15:15
  • 1
    @J.Doe do yourself a favour and read a book on image processing fundamentals. you will have a very hard time if you don't have at least some knowledge. knowing how to use google also helps! http://de.mathworks.com/discovery/image-thresholding.html – Piglet Jul 07 '16 at 16:21