java图像白色提取 [英] java image white color extraction

查看:358
本文介绍了java图像白色提取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将每个白色图像提取到单独的部分中,如下所示?

how to extract each image with white color into separate sections as shown below?

从上面的图片中,提取后会有九个单独的部分

from the picture above, there will be nine separate section after the extract

我试过几个算法,比如fillgrid但不完全符合我的预期。

I have tried several algorithms such as fillgrid but not exactly what I expected.

以便我可以将每个部分作为多边形几何存储到PostGIS数据库中

我可以使用什么算法?
或者java或postgis库中是否有函数?

What algorithm can I use? or maybe there is a function in java or postgis library?

推荐答案

您需要对栅格数据进行多边形化进入向量。

You need to "polygonise" your raster data into vectors.

其中一个工具来自 GDAL ,使用最初在C ++中的方法,但也绑定到Java。

One such tool is from GDAL, with a method originally in C++, but also has bindings to Java.

  • Java bindings (search for "Polygonize")
  • C API description of parameters for GDALPolygonize

使用Polygonize方法的一些进一步提示是,您需要将栅格的值分类为NO DATA值,然后将剩余数据部分多边形化。生成的多边形可以放置在大多数地理空间矢量格式中,包括PostGIS数据库。

Some further hints on using the Polygonize method is that you will need to classify values of your raster as "NO DATA" values, then polygonise the remaining data portion. The resulting polygon can be placed in most geospatial vector formats, including a PostGIS database.

另一种解决方案是加载图像进入PostGIS栅格,然后使用 ST_Polygon ST_DumpAsPolygons 执行基本相同的任务作为GDALPolygonize,但选项较少。

Another solution is to load the image into PostGIS raster, then use either ST_Polygon or ST_DumpAsPolygons to do essentially the same task as GDALPolygonize, but with fewer options.

这篇关于java图像白色提取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆