Solved

Blur raster image within polygon feature

  • 24 July 2019
  • 5 replies
  • 15 views

Badge +6

My agency flew high resolution drone aerial imagery and need to blur certain areas of the image, for example certain members of the public have asked that their backyards be blurred for privacy reasons. My rasters are very large GeoTiffs.

If it were only a few locations I would simply use GIMP/photoshop, however its looking to be a significant number of locations that need to be blurred.

I have created polygon features around the regions that are to be blurred, I am assuming that FME can blur the raster areas contained within the polygons without me having to clip those areas out, blur them, and then mosaic them back over the original image? Clipping & re-mosaicing would take a long time since the images I'm working with are >100GB.

Searching the documentation references to the RasterConvolver however I don't see how I can apply that only to the areas within the polygons.

Is there a good method to achieve my goals with FME or should I stick to GIMP/Photoshop??

icon

Best answer by david_r 24 July 2019, 08:36

View original

5 replies

Userlevel 4

Maybe there is a more efficient method, but my first idea would be to use the Clipper to isolate the parts of the rasterts to blur, then merge the blurred parts back onto the complete raster using the RasterMosaicker (tip: see the Overlapping Values setting, you probably want to set it to Last and make sure the blurred rasters are input after the original rasters).

Badge +22

I'm not convinced that clipper->convolver-> mosaicker is a bad idea, it could well be the fastest method.

 

 

The only alternative I can think of would be to blur the entire image, add an uint8 band (background value 0), assign the polygons a z value of 255 and overlay them on the new band, coerce band to alpha8. Add an alpha band to the original image with a background value of 255 and mosaic the two images with 'Composite using alpha band'.
Badge +6

Maybe there is a more efficient method, but my first idea would be to use the Clipper to isolate the parts of the rasterts to blur, then merge the blurred parts back onto the complete raster using the RasterMosaicker (tip: see the Overlapping Values setting, you probably want to set it to Last and make sure the blurred rasters are input after the original rasters).

Thank you for the insights, I followed these steps and was successful... except that I came to realize that my workstation lacks the hardware to re-mosaic the image back together, so I ended up clipping & blurring then sending the geoTiff outputs to a consultant with the necessary hardware.

Here is the workflow I constructed:

C2_DroneImageBlur_Processing_tiff_geodatabase_file2geotiff_Shared_.fmw

Below is an example of the resulting image with a property's backyard blurred:

 

An issue that I had along the way was that I wasn't able to tweak the parameters of the RasterConvolver to gain the heavy blurring I desired. I concluded that this was due to the small cell spacing of the imagery I was working with (cell spacing: 0.02830526434487336,0.02830526434487336). To get things working I used the RasterResampler to bump the cell size up (to 0.07,0.07) and then ran it through the Raster Convolver to achieve the blurring I needed.

I mention this because in the "So You Say You Want a Convolution?" article there's an example image that is heavily blurred (https://cdn.safe.com/wp-content/uploads/2018/06/05141257/Convolution10.png) so I had expected to be able to achieve that "out of the box".

If someone can explain what settings I needed to just use the Convolver I'd be interested to learn.

Thank you again for the assistance!

Badge +22

Thank you for the insights, I followed these steps and was successful... except that I came to realize that my workstation lacks the hardware to re-mosaic the image back together, so I ended up clipping & blurring then sending the geoTiff outputs to a consultant with the necessary hardware.

Here is the workflow I constructed:

C2_DroneImageBlur_Processing_tiff_geodatabase_file2geotiff_Shared_.fmw

Below is an example of the resulting image with a property's backyard blurred:

 

An issue that I had along the way was that I wasn't able to tweak the parameters of the RasterConvolver to gain the heavy blurring I desired. I concluded that this was due to the small cell spacing of the imagery I was working with (cell spacing: 0.02830526434487336,0.02830526434487336). To get things working I used the RasterResampler to bump the cell size up (to 0.07,0.07) and then ran it through the Raster Convolver to achieve the blurring I needed.

I mention this because in the "So You Say You Want a Convolution?" article there's an example image that is heavily blurred (https://cdn.safe.com/wp-content/uploads/2018/06/05141257/Convolution10.png) so I had expected to be able to achieve that "out of the box".

If someone can explain what settings I needed to just use the Convolver I'd be interested to learn.

Thank you again for the assistance!

The amount of blurring should be related to the kernel size in the raster convolver, not anything to do with the resolution of the pixel.

If you want a gaussian blur with more than 5x5 (or larger sigma) you can use custom weights up to 11x11.

The values to enter into the kernel weight can be calculated at http://dev.theomader.com/gaussian-kernel-calculator/

Badge +3

@david_r @joshuadamron

 

for the phyton lovers.

Create a mask of all objects to be blurred. BLUR and BLEND with original

 

 

 

and

BLEND:

 

(webbroser and PIL are in standard install)

Webbrowser is used for viewing (as show is somewhat bugged)

Reply