Friday, July 26, 2019

Interactive Maps and D3 and others


References:
[1] Image to map by Deep Learning https://ai.facebook.com/blog/mapping-roads-through-deep-learning-and-weakly-supervised-training/

Resources

[1] Just a map https://codepen.io/manishgolcha/post/world-map-using-d3-js
[2] Datamaps http://datamaps.github.io/
     Tutorial https://github.com/markmarkoh/datamaps/blob/master/README.md#getting-started

[3] Worldmap by cuntry tooltip http://bl.ocks.org/micahstubbs/8e15870eb432a21f0bc4d3d527b2d14f
[4] d3-zoom https://github.com/d3/d3-zoom


Free geocode
[1] Works using open street map https://opencagedata.com/api
      https://api.opencagedata.com/geocode/v1/json?q=São Paulo&key=8c0e3ccc191e41f38dd211fe50fb9eab

[2] Limited https://developer.here.com/documentation/maps/dev_guide/topics/quick-start.html

[3] Google not recommended https://developers.google.com/maps/documentation/geocoding/intro


Testing
https://blockbuilder.org/Ayumix01/984d70d411ea1d29f48b3963881a5618
 https://medium.com/@ttemplier/map-visualization-of-open-data-with-d3-part3-db98e8b346b3
http://datawanderings.com/2018/10/28/making-a-map-in-d3-js-v-5/
https://github.com/ivan-ha/d3-hk-map



Avatar Lectures

Resources:

[1] Avatar SDK https://avatarsdk.com/
     https://webdemo.avatarsdk.com/
[2] https://neurohive.io/en/state-of-the-art/realistic-3d-avatars-from-a-single-image/
[3] https://neurohive.io/en/computer-vision/head-reconstruction-from-internet-photos/
[4] https://neurohive.io/en/state-of-the-art/learning-3d-face-morphable-model-out-of-2d-images/
[5] https://neurohive.io/en/state-of-the-art/method-for-automatic-forensic-facial-reconstruction/
[6] https://sketchfab.com/
[7] https://www.loomai.com/

Wednesday, July 24, 2019

Fluid Simulation:Compile SPlisHSPlasH



Source code
https://github.com/InteractiveComputerGraphics/SPlisHSPlasH




sudo apt-get install freeglut3
sudo apt-get install git
sudo apt-get install libeigen3-dev
sudo apt-get install libglew-dev
sudo apt-get install libxmu-dev libxi-dev #GLUT_Xmu_LIBRARY (ADVANCED)

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-6 g++-6

sudo ln -s /usr/bin/gcc-6 /usr/bin/cc
sudo ln -s /usr/bin/g++-6 /usr/bin/c++

sudo apt install libomp-dev



#Add into two file lines for call openmp
Demos/DynamicBoundaryDemo/CMakeLists.txt
Demos/StaticBoundaryDemo/CMakeLists.txt

find_package(OpenMP)
if (OPENMP_FOUND)
  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif(OPENMP_FOUND)


Demos changed by Simulators (2019), after find_package(OpenGL REQUIRED)


 vi ../Simulators/DynamicBoundaryDemo/CMakeLists.txt
 vi ../Simulators/StaticBoundarySimulator/CMakeLists.txt


Sunday, July 21, 2019

Fluid Simulation Lectures

Software:
[1] https://google.github.io/liquidfun/
[2] http://www.palabos.org/software/download
[3] Games https://github.com/gameprogcpp/code

References:
[1] NVidia FLIP
http://www.cemyuksel.com/research/papers/fast_fluid_simulations_with_sparse_volumes_on_the_gpu.pdf
https://link.springer.com/article/10.1007/s40722-016-0062-6
https://ascelibrary.org/doi/abs/10.1061/%28ASCE%29HY.1943-7900.0001132?src=recsys
http://www.danenglesson.com/images/portfolio/FLIP/rapport.pdf
http://www.cs.jhu.edu/~misha/MyPapers/ToG13.pdf

Resources:
[1] https://blog.yiningkarlli.com/2014/02/flip-meshing-pipeline.html
[2] https://www.yiningkarlli.com/projects/arielflip.html
https://www.lancemore.jp/ls-dyna/index_en.html
https://www.lancemore.jp/ls-dyna/example_471.html
https://cfd.direct/openfoam/user-guide/v6-dambreak/
https://books.google.com.br/books?id=G-d1DwAAQBAJ&pg=PA779&lpg=PA779&dq=dam+break+simulation+code
 https://www.youtube.com/watch?v=GQvOlkQqRk0
 https://dual.sphysics.org/2ndusersworkshop/2016/Dominguez_Fourtakas_PPT_2ndUsersWorshop_161205_GF.pdf

Friday, July 19, 2019

OpenFoam



https://unicfd.ru/en/training-tracks/learning-how-to-use-free-surface-flows-in-openfoam-4-1/
https://www.scribd.com/document/44776293/OpenFoam-Examples

Monday, July 01, 2019

Video file to gif animation

ffmpeg can create gif from mp4/mpeg file, but create low quality, for resolve this we need to create a palette for increase quality.

Create palette colors
$ffmpeg -i file.mpeg -vf fps=15,scale=-1:-1:flags=lanczos,palettegen  palette.png

Use palette for create gif from complete mp4 file
$ffmpeg -i file.mp4 -i palette.png -filter_complex "fps=15,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" out_full.gif

Use palette for create gif from mp4 file (from 0:55 and 9seconds)
$ffmpeg -ss 0:55 -t 9 -i file.mp4 -i palette.png -filter_complex "fps=15,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" out_fraction.gif

Without palette
$ffmpeg -i imagebind.mp4  -r 10 -f image2pipe -vcodec ppm - | convert -delay 5 -loop 0 - imagebind.gif


Convert png files list to mp4 (two ways)

$avconv -r 20 -i buffer/plot%d.png -b:v 4000k animation_h1.mp4

$ffmpeg -i buffer/plot%d.png -r 20 -b 4M animation_h2.mp4

Convert jpg files into mp4
$ffmpeg -framerate 1 -i frames/f%d.jpg -r 2 -pix_fmt yuv420p video.mp4
$ffmpeg -framerate 10 -i Dragon.%04d.png -r 2 -pix_fmt yuv420p video.mp4



Cut/Extract video fraction same quality no filter/codec
$ffmpeg -ss 3:19 -t 4 -i Moana_WaterFX.mp4 -vcodec copy -acodec copy Moana_f3.mp4

Convert mp4 to gif using palette and resizing
$ffmpeg -i psplat2_4k.mp4 -i palette_psplat2_4k.png -filter_complex "fps=15,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" -s 346x264 psplat2_4k.gif

$ffmpeg -i fluidhoudini.mp4 -i palette.png -filter_complex "fps=15,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" -s 640x480 fluidhoudini_palette_640.gif



Crop image video
To crop a 528×336 section, starting from position (264, 30):

ffmpeg -i first_256.mp4 -filter:v "crop=528:336:264:30" -c:a copy first_256_crop.mp4 
#ffmpeg -i in.mp4 -filter:v "crop=out_w:out_h:x:y" out.mp4
 

Error on Image Magick (convert) 

convert-im6.q16: cache resources exhausted

open file /etc/ImageMagick-6/policy.xml and change

<policy domain="resource" name="disk" value="1GiB"/>

To

<policy domain="resource" name="disk" value="8GB"/>
 
Or
 
<!-- disable ghostscript format types -->
<policy domain="coder" rights="none" pattern="PS" />
<policy domain="coder" rights="none" pattern="EPS" />
<policy domain="coder" rights="none" pattern="PDF" /> <------- Here!!
<policy domain="coder" rights="none" pattern="XPS" />

To

<policy domain="coder" rights="read | write" pattern="PDF" /> 

#Change by code

sed -i -E 's/name="memory" value=".+"/name="memory" value="1GiB"/g' /etc/ImageMagick-6/policy.xml
sed -i -E 's/name="map" value=".+"/name="map" value="1GiB"/g' /etc/ImageMagick-6/policy.xml
sed -i -E 's/name="area" value=".+"/name="area" value="1GiB"/g' /etc/ImageMagick-6/policy.xml
sed -i -E 's/name="disk" value=".+"/name="disk" value="4GiB"/g' /etc/ImageMagick-6/policy.xml

Recommended resolution & aspect ratios

For the default 16:9 aspect ratio, encode at these resolutions:

  • 2160p: 3840x2160
  • 1440p: 2560x1440
  • 1080p: 1920x1080
  • 720p: 1280x720
  • 480p: 854x480
  • 360p: 640x360
  • 240p: 426x240
 
Online tools
[1] Crop gifs https://ezgif.com
 
 
 
 
 

OpenVDB Installation

OpenVDB Codes
[0] OpenVDB Code Examples https://www.openvdb.org/documentation/doxygen/codeExamples.html

[1] pyopenvdb volume codes https://www.openvdb.org/documentation/doxygen/python.html

[3] https://python.hotexamples.com/examples/pyopenvdb/-/createLinearTransform/python-createlineartransform-function-examples.html

More:
[1] Light, Sound modeling http://gamma.web.unc.edu/software/
[2] OpenVDB Slices to VDB https://github.com/tody411/OpenVDB-Samples
 

Resources:

[0] OpenVDB https://github.com/AcademySoftwareFoundation/openvdb

For Enable pyOpenVDB (main CMakeLists.txt)

option(OPENVDB_BUILD_PYTHON_MODULE "Build the pyopenvdb Python module" ON)
 

For Enable Viewer

cmd/CMakeLists.txt
option(OPENVDB_BUILD_VDB_VIEW "Build vdb_view" ON)
#Others
option(OPENVDB_BUILD_VDB_PRINT "Build vdb_print" ON)
option(OPENVDB_BUILD_VDB_LOD "Build vdb_lod" ON)
option(OPENVDB_BUILD_VDB_RENDER "Build vdb_render" ON)
 
OpenVDBGLFW3Setup.cmake:130

set(_GLFW3_ROOT_SEARCH_DIR "") 
set(_GLFW3_ROOT_SEARCH_DIR "/usr/lib/x86_64-linux-gnu") 

For Enable Polygonization(grid.convertToPolygons) in python module, change  openvdb/openvdb/python/CMakeLists.txt

option(USE_NUMPY "Build the python library with numpy support." ON)

or you will get next error

NotImplementedError: this module was built without NumPy support




Dependences: 

[1] OpenExr https://github.com/AcademySoftwareFoundation/openexr

[2] Intel(R) Threading Building Blocks https://github.com/wjakob/tbb

Minimum required is "2017.0" for both above.
 

[3] Boost https://sourceforge.net/projects/boost/files/boost/

$./bootstrap.sh --prefix=/usr/

$./b2

$sudo ./b2 install

#Preference to Boost 1.7 with python3 support, it enable cmds tools

https://melhorum.blogspot.com/2020/10/boost-17-on-ubuntu16.html

Or Compile Viewer Manually on openvdb/openvdb/openvdb/cmd


Ubuntu16

$g++-6 openvdb_view.cc ../viewer/Camera.cc ../viewer/ClipBox.cc ../viewer/Font.cc ../viewer/RenderMo
dules.cc ../viewer/Viewer.cc -lopenvdb -ltbb -lglfw -lGL -lGLU -lHalf -lpthread -DGL_GLEXT_PROTOTYPES

Ubuntu18

g++ openvdb_view.cc ../viewer/Camera.cc ../viewer/ClipBox.cc ../viewer/Font.cc ../viewer/RenderModules.cc ../viewer/Viewer.cc -lopenvdb -ltbb -lglfw -DGL_GLEXT_PROTOTYPES -DOPENVDB_USE_GLFW_3 -I ../viewer/ -lHalf -lpthread -o openvdb_view -lboost_thread -lboost_system -lGL -lGLU 



Firefox open multiple private window

    /opt/firefox/firefox-bin --profile $(mktemp -d) --private-window www.google.com www.bing.com