AstonJ
April 17, 2023, 7:00pm
1
Made a cool Livebook you want to share? Please do so in this thread
4 Likes
Creating rainbow using Vix
Creating Rainbow. Quick introduction to working with complex numbers and its operations, mapim
, buildlut
.
There is non-interactive blog post version of the same here: Creating Rainbow using Vix š - *scratch*
I am thinking of writing few livebooks to showcase few core libvips operations that are powerful but lack discoverability or difficult to get the intuition. This is first in the direction. Iām writing as Iām trying to better understand concepts myself, so corrections or any type of feedbacks are welcome.
8 Likes
Auto correct document rotation using Vix
Using image processing techniques such as Fourier Transformation, Complex Planes.
# Auto Correct Document Rotation
```elixir
Mix.install(
[
{:vix, "~> 0.17.0"},
{:kino, "~> 0.9.2"}
],
# pre-built binaries does not support fourier transform operations
# since these operations depend on an additional library.
#
# Usually the platform/OS provided libvips comes with these additional library
# so we are telling vix to use the libvips provided by the platform
# and compile NIF for that. Follow platform specific libvips
# installation guide
system_env: [
{"VIX_COMPILATION_MODE", "PLATFORM_PROVIDED_LIBVIPS"}
]
)
```
This file has been truncated. show original
5 Likes
Video Streaming Server Using FFmpeg
An example showcasing streaming input and output with external program, which is ffmpeg
in this case.
# Video Streaming Server Using FFmpeg
```elixir
Mix.install([
{:req, "~> 0.4.5"},
{:ex_cmd, "~> 0.10.0"},
{:plug, "~> 1.15"},
{:kino, "~> 0.11.3"},
{:bandit, "~> 1.1"}
])
```
## Introduction
Elixir and Erlang provide [`Port`](https://hexdocs.pm/elixir/Port.html) a Port for running external programs. However, communicating with these programs over stdio can lead to various issues. [`ExCmd`](https://hexdocs.pm/ex_cmd/readme.html) and [`Exile`](https://hexdocs.pm/exile/readme.html) libraries address these concerns. Along with that they provide beloved streaming capabilities. In otherwords they let you stream input, output _all the way down_.
Let's take an example to illustrate the streaming capabilities. Here, we'll create an HTTP server to watermark a video.
The server should perform the following:
This file has been truncated. show original
4 Likes