Hi,
I was wondering whether some basic operators like erode or dilate exist for raster processing? These operators enable opening and closing operation on raster, operations that are very useful.
Thanks for your answer,
Florian
Hi,
I was wondering whether some basic operators like erode or dilate exist for raster processing? These operators enable opening and closing operation on raster, operations that are very useful.
Thanks for your answer,
Florian
FME does not offer those options out of the box but depending on what you want to do the RasterExpressionEvaluator (for example) could be useful. I doubt it'll be able to do erode and dilate though.
Pinging @dmitribagh as he might have some suggestions for you.
Sadly FME does not offer any focal analysis tools for raster. I use the command line of ImageMagick
What I do is write a temporary raster (FeatureWriter), use the SystemCaller to run the ImageMagick command(s) and then read the processed file back in with a FeatureReader.
Sadly FME does not offer any focal analysis tools for raster. I use the command line of ImageMagick
What I do is write a temporary raster (FeatureWriter), use the SystemCaller to run the ImageMagick command(s) and then read the processed file back in with a FeatureReader.
Thanks jdh for your answer. As I am controlling the whole process with Python scripts I was about to make a workaround using OpenCV python library.
However, I will take a look at ImageMagick if the upper library is not fast enough.
Concerning the georeferencing, it could be a problem in case the erosion and/or dilation add pixel at the top or left borders, thus changing the world file. I am now not clear about how the dilating algorithm works in openCV and maybe one can specify to keep number of row and column.
Is the Orfeo Toolbox a ImageMagick plugin/derivate ?
Thanks jdh for your answer. As I am controlling the whole process with Python scripts I was about to make a workaround using OpenCV python library.
However, I will take a look at ImageMagick if the upper library is not fast enough.
Concerning the georeferencing, it could be a problem in case the erosion and/or dilation add pixel at the top or left borders, thus changing the world file. I am now not clear about how the dilating algorithm works in openCV and maybe one can specify to keep number of row and column.
Is the Orfeo Toolbox a ImageMagick plugin/derivate ?
Orefeo Toolbox is a completely unrelated software, it's an open source library for remote sensing imagery processing, and has a command line interface, so can also be integrated into fme.
https://www.orfeo-toolbox.org/
It's an interesting challenge. If the raster is a binary image, it may not be so difficult to define a workflow to perform eroding/dilating. The attachment is a prototype with 8-connectivity: raster-erode-dilate-prototype.zip
Left: Erode <-- Center: Original --> Right: Dilate
Sorry I can't completely open this workflow as I am running FME 2015...
In my case, I need to close (dilate --> erode) a Digital Terrain Model. So I need to complete holes in the terrain model.
But now that it is said, I think I might be able to close my terrain with: rastercellCoercer to points and then using a SurfaceModeller transformer.
Nevertheless, erode and dilate are operators that could be useful :)
I don't see an enhancement request in our database specifically for erosion and dilation functionality. But I do see this:
PR#24574: RasterExpressionEvaluator: lens processing - modify cell values based on surrounding values - kernel or focal functionsWould that help in this case? If so I can add your request there (it's already set to the top priority level, so I can't increase it any further!).
Failing that, I don't know how it could be done right now - unless you convert from raster to vector and use a Bufferer tool there - so I'll ask @dmitribagh to chime in.
Sorry I can't completely open this workflow as I am running FME 2015...
In my case, I need to close (dilate --> erode) a Digital Terrain Model. So I need to complete holes in the terrain model.
But now that it is said, I think I might be able to close my terrain with: rastercellCoercer to points and then using a SurfaceModeller transformer.
Nevertheless, erode and dilate are operators that could be useful :)
I don't see an enhancement request in our database specifically for erosion and dilation functionality. But I do see this:
PR#24574: RasterExpressionEvaluator: lens processing - modify cell values based on surrounding values - kernel or focal functionsWould that help in this case? If so I can add your request there (it's already set to the top priority level, so I can't increase it any further!).
Failing that, I don't know how it could be done right now - unless you convert from raster to vector and use a Bufferer tool there - so I'll ask @dmitribagh to chime in.
Sorry I can't completely open this workflow as I am running FME 2015...
In my case, I need to close (dilate --> erode) a Digital Terrain Model. So I need to complete holes in the terrain model.
But now that it is said, I think I might be able to close my terrain with: rastercellCoercer to points and then using a SurfaceModeller transformer.
Nevertheless, erode and dilate are operators that could be useful :)
--> PointCloudCombiner
--> PointCloudCoercer
--> SurfaceModeller (take TINsurface in output)
--> RasterDEMGenerator
--> Clip the raster using a buffered envelop
At first approach I thought raster closing was the solution, but the surfaceModeller performs fine for this case.
Thanks for all your response
Florian
As a work around: a binary raster dilate can be achieved by using (4) Affiners to create copies of the original image offset one pixel to the cardinal directions. The RasterMosaicker can be used to merge the resulting dilated image. Erode can be achieved by switching the data/no-data using a RasterExpressionEvaluator and then dilating the no-data region. Note be sure to set the image no-data value to the off-bit. if you are dealing with terrains an not binary images, you might try to stack the Affined copies into new bands of the original image and then use the RasterExpressionEvaluator to do raster math... min,max,average etc..
@florian67 I'm happy to report that we implemented support for raster lens processing in FME 2018.1 and 2019.0 with the new RasterConvolver transformer.
For more info see these articles:
https://blog.safe.com/2018/07/fme-and-convolution-evangelist176/
https://knowledge.safe.com/articles/74523/neighborhood-functions.html
https://knowledge.safe.com/articles/72616/edge-detection-with-the-rasterconvolver.html
https://knowledge.safe.com/articles/72505/raster-slope-calculations-as-a-rasterconvolver-exa.html
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.