An open API service indexing awesome lists of open source software.

https://github.com/paithiov909/aznyan

Image effects for R, ported from https://github.com/5PB-3-4/AviUtl_OpenCV_Scripts
https://github.com/paithiov909/aznyan

Last synced: 6 months ago
JSON representation

Image effects for R, ported from https://github.com/5PB-3-4/AviUtl_OpenCV_Scripts

Awesome Lists containing this project

README

          

# aznyan

[![aznyan status
badge](https://paithiov909.r-universe.dev/aznyan/badges/version)](https://paithiov909.r-universe.dev/aznyan)

aznyan is a collection of image effects for R that wraps
[OpenCV](https://opencv.org/), ported from
[5PB-3-4/AviUtl_OpenCV_Scripts](https://github.com/5PB-3-4/AviUtl_OpenCV_Scripts).

Still in development. It will probably work, but documentation is scant.

## Usage

aznyan provides functions that take a `raw` vector of image data as
their first argument and return a `raw` vector of PNG format image after
applying the effect.

You can simply read a PNG image into a raw vector using `readBin()` and
save those return values as a PNG image using `writeBin()`.

``` r
pkgload::load_all(export_all = FALSE)
#> ℹ Loading aznyan

png <- readBin(
system.file("images/sample-256x256-4ch.png", package = "aznyan"),
what = "raw",
n = file.info(system.file("images/sample-256x256-4ch.png", package = "aznyan"))$size
)
```

The original image `png` above looks like this:

![original image](inst/images/sample-256x256-4ch.png)

### Blur

``` r
median_blur(png, ksize = 8) |>
png::readPNG(native = TRUE) |>
grid::grid.raster(interpolate = FALSE)
```

### Diffusion Filter (拡散フィルタ)

``` r
diffusion_filter(png, factor = 8) |>
png::readPNG(native = TRUE) |>
grid::grid.raster(interpolate = FALSE)
```