render_bokeh | R Documentation |
Takes an image and a depth map to render the image with depth of field (i.e. similar to "Portrait Mode" in an iPhone). User can specify a custom bokeh shape, or use one of the built-in bokeh types.
render_bokeh( image, depthmap, focus = 0.5, focallength = 100, fstop = 4, filename = NULL, preview = TRUE, preview_focus = FALSE, bokehshape = "circle", bokehintensity = 1, bokehlimit = 0.8, rotation = 0, aberration = 0, gamma_correction = TRUE, progress = interactive(), ... )
image |
Image filename or 3-layer RGB array. |
depthmap |
Depth map filename or 1d array. |
focus |
Defaults |
focallength |
Default |
fstop |
Default |
filename |
Default |
preview |
Default |
preview_focus |
Default |
bokehshape |
Default |
bokehintensity |
Default |
bokehlimit |
Default |
rotation |
Default |
aberration |
Default |
gamma_correction |
Default |
progress |
Default |
... |
Additional arguments to pass to |
3-layer RGB array of the processed image.
if(rayimage:::run_documentation()){ #Plot the dragon plot_image(dragon) } if(rayimage:::run_documentation()){ #Plot the depth map graphics::image(dragondepth, asp = 1, col = grDevices::heat.colors(256)) } if(rayimage:::run_documentation()){ #Preview the focal plane: render_bokeh(dragon, dragondepth, focus=950, preview_focus = TRUE) } if(rayimage:::run_documentation()){ #Change the focal length: render_bokeh(dragon, dragondepth, focus=950, focallength=300) } if(rayimage:::run_documentation()){ #Add chromatic aberration: render_bokeh(dragon, dragondepth, focus=950, focallength=300, aberration = 0.5) } if(rayimage:::run_documentation()){ #Change the focal distance: render_bokeh(dragon, dragondepth, focus=600, focallength=300) render_bokeh(dragon, dragondepth, focus=1300, focallength=300) } if(rayimage:::run_documentation()){ #Change the bokeh shape to a hexagon: render_bokeh(dragon, dragondepth, bokehshape = "hex", focallength=300, focus=600) } if(rayimage:::run_documentation()){ #Change the bokeh intensity: render_bokeh(dragon, dragondepth, focallength=400, focus=900, bokehintensity = 1) render_bokeh(dragon, dragondepth, focallength=400, focus=900, bokehintensity = 3) } if(rayimage:::run_documentation()){ #Rotate the hexagonal shape: render_bokeh(dragon, dragondepth, bokehshape = "hex", rotation=15, focallength=300, focus=600) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.