【Mathematica】怎么把Graphics转化为Image

2025-04-18 03:04:43

1、通过ArrayPlot得到一幅图片fig:

【Mathematica】怎么把Graphics转化为Image

2、直接对fig进行倍数运算是行不通的,因为fig是Graphics:

【Mathematica】怎么把Graphics转化为Image

3、把fig转化为Image格式的图片img:

【Mathematica】怎么把Graphics转化为Image

4、对img执行倍数运算:

【Mathematica】怎么把Graphics转化为Image

5、执行一个大倍数:

【Mathematica】怎么把Graphics转化为Image

6、申明一下,对图片进行倍数运算的一个作用。先看原图fig的边界图:1 - EdgeDetect[fig, 2, 0.001]

【Mathematica】怎么把Graphics转化为Image

7、再看img的边界图:1 - EdgeDetect[img, 2, 0.001]

【Mathematica】怎么把Graphics转化为Image

8、对比于img的大倍数:1 - EdgeDetect[img*2000, 2, 0.001]似乎没什么变化。

【Mathematica】怎么把Graphics转化为Image

9、需要对img的大倍数执行栅格化操作,磨消过大的亮度的影响:1 - EdgeDetect[Rasterize[img*2000, RasterSize -> 1000], 2, 0.001]看,边界变得很清晰了。

【Mathematica】怎么把Graphics转化为Image

10、不同的倍数,往往得到不同的边界:

【Mathematica】怎么把Graphics转化为Image
【Mathematica】怎么把Graphics转化为Image
【Mathematica】怎么把Graphics转化为Image
【Mathematica】怎么把Graphics转化为Image

11、小于1的倍数,需要调整检测边界的阈值,且与大倍数边界仍有很大差别:

【Mathematica】怎么把Graphics转化为Image
【Mathematica】怎么把Graphics转化为Image

12、把原图与边界图叠加到一起:

【Mathematica】怎么把Graphics转化为Image
【Mathematica】怎么把Graphics转化为Image
【Mathematica】怎么把Graphics转化为Image
【Mathematica】怎么把Graphics转化为Image
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢