2
$\begingroup$

I need the image to be totally blank, so the black must disappear

enter image description here

$\endgroup$
4

1 Answer 1

17
$\begingroup$

Remove the white lines in the S with a vertical opening

Opening[i, {{1}, {1}, {1}}]

enter image description here

Remove the small black lines with a closing

Closing[%, 4]

enter image description here

Create a mask by inverting the colors and shrinking inside the boundary of the S with a 1 pixel erosion

mask = Erosion[1 - %, 1]

enter image description here

Add the mask to the original image

i + mask
(* i + Erosion[1 - Closing[Opening[i, {{1}, {1}, {1}}], 4], 1] *)

enter image description here

$\endgroup$
10
  • $\begingroup$ Well done, very clever! $\endgroup$
    – Carl Lange
    Commented May 15, 2018 at 19:00
  • 3
    $\begingroup$ +1, That is what I though OP meant, but when I read the tittle again, op said clearly to BLANK ALL THE IMAGE :) I have feeling one needs to be extra psychic these days to answer questions at stackexchange. $\endgroup$
    – Nasser
    Commented May 15, 2018 at 19:11
  • $\begingroup$ Sorry Nasser, my english is bad, I use translator $\endgroup$ Commented May 16, 2018 at 0:39
  • $\begingroup$ @Batracos , hello, it's just what I need, but it throws me an error, (mathematical use 10.4) dropbox.com/s/7laz7ni8zw6kcl5/error.png?dl=0 $\endgroup$ Commented May 16, 2018 at 0:56
  • 1
    $\begingroup$ @juanmuñoz: MMA 10 didn't support arithmetic operators on images yet. You can convert the images to matrices, perform arithmetic on those, then convert back to image. So e.g. instead of img1 + img2 use Image[ImageData[img1]+ImageData[img2]] - or upgrade to MMA 11 $\endgroup$ Commented May 16, 2018 at 6:11

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