Remove White Background from an Image and Make It Transparent

后端 未结 9 965
一向
一向 2020-11-29 16:01

We\'re trying to do the following in Mathematica - RMagick remove white background from image and make it transparent.

But with actual photos it ends up looking lous

9条回答
  •  清酒与你
    2020-11-29 16:26

    I am completely new to image processing but here is what I get after some playing with new morphological image processing functions of version 8:

    mask = DeleteSmallComponents[
       ColorNegate@
        Image[MorphologicalComponents[ColorNegate@img, .062, 
          Method -> "Convex"], "Bit"], 10000];
    Show[Graphics[Rectangle[], Background -> Red, 
      PlotRangePadding -> None], SetAlphaChannel[img, ColorNegate@mask]]
    

    image

提交回复
热议问题