Skip to main content
Question

Calculate raster data to clip white/black border

  • October 5, 2018
  • 7 replies
  • 91 views

I have to generate dynamically an polygon to cut the border of my raster image.

i read this articel: https://knowledge.safe.com/articles/18764/setting-alpha-vs-nodata-color-and-numeric-data.html

Option #2 sounds good, but there is a static polygon (creator transformer) used.

i have to replace the creator and add something like a polygon generator based on my raster data.

this is a demo pic. the red polygon is the polygon mentioned that I would have to calculate.

I thought of something that compares the neighboring pixels and the strong deviation from this creates the line of the polygon. is there already a transformer? or is there another suitable solution for my problem?

sorry, i'm quite new with FME

edit: picture updated. the area with green lines should be removed

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

takashi
Celebrity
  • 7843 replies
  • October 5, 2018
As far as I see the image you posted, looks the clipping operation has been performed fine. Could you please elaborate what the problem is?

 

 


  • Author
  • 3 replies
  • October 6, 2018
As far as I see the image you posted, looks the clipping operation has been performed fine. Could you please elaborate what the problem is?

 

 

no there is nothing clipped. bad image but top and left of the image is a white border.

 

picture updated. area with green lines should be removed

 

 


takashi
Celebrity
  • 7843 replies
  • October 6, 2018

Hi @cloc91, try clipping the raster by the red polygon using the Clipper. Make sure that the "Preserve Clipee Extents" parameter in the Clipper is set to "No".


  • Author
  • 3 replies
  • October 6, 2018

Hi @cloc91, try clipping the raster by the red polygon using the Clipper. Make sure that the "Preserve Clipee Extents" parameter in the Clipper is set to "No".

I know, that i have to use the clipper. But first i have to generate the red polygon. This step is not clear how to generate the red polygon. The red polygon should be dynamic, because i have other tiles with different borders.

 

 


takashi
Celebrity
  • 7843 replies
  • October 6, 2018

Hi @cloc91, try clipping the raster by the red polygon using the Clipper. Make sure that the "Preserve Clipee Extents" parameter in the Clipper is set to "No".

If the raster has Nodate definition and the white area is filled with Nodata cells, you can use the RasterExtentsCoercer (Extents Type: Data MBR Extents) to create a rectangle polygon representing the bounding box of the data area, which can be used as the clipper to remove the unnecessary border area.

 

 


  • Author
  • 3 replies
  • October 8, 2018
If the raster has Nodate definition and the white area is filled with Nodata cells, you can use the RasterExtentsCoercer (Extents Type: Data MBR Extents) to create a rectangle polygon representing the bounding box of the data area, which can be used as the clipper to remove the unnecessary border area.

 

 

no, raster files has no NoData definition.

 

i think, i need something like the nearblack function from gdal https://www.gdal.org/nearblack.html

 

i can call it via batch or python, but is there a transformer, which does the same?

takashi
Celebrity
  • 7843 replies
  • October 8, 2018
If the raster has Nodate definition and the white area is filled with Nodata cells, you can use the RasterExtentsCoercer (Extents Type: Data MBR Extents) to create a rectangle polygon representing the bounding box of the data area, which can be used as the clipper to remove the unnecessary border area.

 

 

If you can consider the cell value in the white area as Nodata, you can set the Nodata (maybe 255?) to the raster with the RasterBandNodataSetter.