Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.6)
cmake_minimum_required(VERSION 3.5)
project(licpy)

add_compile_options(
Expand Down
2 changes: 2 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ To understand how the LicPy library is to be used, one can take a look at the :p

The :py:func:`runlic` function does most of the heavy-lifting. It takes as arguments the x- and y-component of the velocity at each pixel position, and the lenght L of the stream along with to convolute, and the result is returned as a grey-scale texture, which can then be saved into an image file using the :py:func:`grey_save` function.

`runlic` can generate a random background grid to distort with the LIC algorithm, or the background grid can be specified with the `tex=` kwarg.

References
------------

Expand Down
13 changes: 9 additions & 4 deletions licpy/lic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import numpy as np
import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

from licpy.pixelize import pixelize

from .pixelize import pixelize

INF = 1e10

Expand Down Expand Up @@ -297,11 +299,14 @@ def runlic_resample(N, M, x, y, vx, vy, L, magnitude=True):
return runlic(vx, vy, L, magnitude)


def runlic(vx, vy, L, magnitude=True):
def runlic(vx, vy, L, tex=None, magnitude=True):
assert vx.shape == vy.shape
N, M = vx.shape
np.random.seed(13)
tex = np.random.rand(N, M)
if tex is None:
tex = np.random.rand(N, M)
else:
assert tex.shape == vx.shape

tex_ = tf.placeholder(tf.float64, [N, M])
vx_ = tf.placeholder(tf.float64, [N, M])
Expand Down
2 changes: 1 addition & 1 deletion licpy/pixelize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from licpy.resample import resample_s, resample_endpoints_s
from .resample import resample_s, resample_endpoints_s


def interpol(v, i, j, sx, sy):
Expand Down