tatsy / lime

lime (Library for Image Editing)
http://tatsy.github.io/lime
MIT License
51 stars 16 forks source link

Guidance on the use of calcVectorField #10

Closed helzich closed 3 years ago

helzich commented 3 years ago

Hi,

Many thanks for making lime available!

I am trying to get an ETF (Edge Tangent Flow) like here or as shown in many NPR papers. With the Python code below, the closest I get is the image added which is not quite the same, especially the dark parts are all dark and the light parts all light without any "stream limes".

What am I missing? I am using the library incorrectly? Do you have any pointers on how to use lime for this task?

Btw, I tried varying the kernel sizes, SST vs ETF, Sobel vs rotational, etc.

angle = lime.calcVectorField(img, ksize=5, method=lime.VEC_FIELD_SST, edge_type=lime.EDGE_DETECT_SOBEL)
tangent = np.ndarray((angle.shape[0], angle.shape[1], 2), dtype=np.float32)  
tangent[:,:,0] = np.cos(angle)  
tangent[:,:,1] = np.sin(angle)  
tmp = img.copy()  
out = lime.LIC(tmp, tangent, 5, lime.LIC_RUNGE_KUTTA) # Second-order line integration.

image

Many thanks for your help!

tatsy commented 3 years ago

Hi,

I think you should filter a noise image (not the grayscale image of the input) using the vector field calculated by the input image.

Best,

helzich commented 3 years ago

Of course! I somehow thought the noise image filtering was part of LIC, now I see the expected results. Many thanks for your quick reply!