Skip to main content
Solved

Blur raster image within polygon feature


joshuadamron
Contributor
Forum|alt.badge.img+7

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??

Best answer by david_r

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).

View original
Did this help you find an answer to your question?

5 replies

david_r
Evangelist
  • Best Answer
  • July 24, 2019

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).


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • July 24, 2019

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'.

joshuadamron
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • October 2, 2019
david_r wrote:

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!


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • October 2, 2019
joshuadamron wrote:

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/


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • October 8, 2019

@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)


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings