I'm trying to use Meshlab for my degree, and I have to describe how the "colorize curvature (APSS)" filter works. I'm not very able in this kind of programs, and I can't understand what the different parameters changes in this filter.
Any advice? Thank you!
I would recommend to read about that in a book. For example, chapter 3 of the book "Polygon Mesh Processing", by Mario Botsch et al, year 2010.
Related
I am using Tensorflow Probability to build a VAE which includes image pixels as well as some other variables. The output of the VAE:
tfp.distributions.Independent(tfp.distributions.Bernoulli(logits), 2, name="decoder-dist")
I am trying to understand how to form other conditional distributions based on this which I can use with the inference methods (MCMC or VI). Say the output above was P(A,B,C | Z), how would I take that distribution to form a posterior P(A|B, C, Z) that I could perform inference on? I have been trying to read through the docs but I am having some trouble grasping them.
The answer to your question depends very much on the nature of the joint model within which you'd like to do the conditioning. Much has been written about the topic, and in short it's a very hard problem in general :). Without knowing a bit more about the particulars of your problem, it's near impossible to recommend a useful generic inference procedure. However, we do have a bunch of examples (scripts and jupyter/colab notebooks) in the TFP repo here: https://github.com/tensorflow/probability/tree/master/tensorflow_probability/examples
In particular, there's
The Hierarchical Linear Model example, which is a sort of Rosetta stone showing how to do posterior inference using Hamiltonian Monte Carlo (an MCMC technique) in TFP, R, and Stan,
The Linear Mixed Effects Model example, showing how you might use VI to solve a standard LME problem,
among many others. You can click the "Run in Google Colab" link at the top of any of these notebooks to open and run on them on https://colab.research.google.com.
Please feel free, also, to reach out on to us via email at tfprobability#tensorflow.org. This is a public Google Group where users can engage with the team that builds TFP directly. If you provide us some more info there on what you'd like to do, we're happy to provide guidance on modeling and inference with TFP.
Hope this is gives at least a start in the right direction!
I have been gaining interest in data visualization lately. I especially enjoy articles with narrative driven data-viz like the ones in http://polygraph.cool/ for example.
What would be a great 'hello world' project to learn about conveying information effective through data viz? I'm not sure where to start.
Thanks!
Two subreddits come to mind. Here you can find some nice applications of data visualizations, and here you can keep up to date datasets that get published. Put those two together and you can come up with some novel ideas. Looking forward to seeing your stuff in /r/dataisbeautiful!
How about starting with a data density app?
If you search on my name and "data density" you'll find some routines on the web, but that would be cheating. The way the system works is to take reciprocal of squared distance plus a fudge factor to prevent 1/d when the sample pixel point is very close to a data point. So you get the density of a 2D scatterplot.
You then need a nice visual representation of a linear scale, using colours to represent value changes. I'll give you those, I have several colour palettes at
http://www.malcolmmclean.site11.com/www/datadensity/colourschemes.c
http://www.malcolmmclean.site11.com/www/datadensity/colourschemes.h
I want to calculate the surface area of a 3D body (binarized: 1=inside, 0=outside so it's "voxelated") using Paraview. I found the filter "integrate variable" that gives me a value and it's reasonable. But I want to know what's the algorithm implemented into Paraview to compute it! It's an open-source software so everything should be open but I cannot find the reference.
Any idea?
Pretty simple: this filter computes the area of each polygon and sums them up. There are quite a few types of polygons supported, so the details of computing the area of each vary. Please consult http://www.paraview.org/gitweb?p=ParaView.git;a=blob;f=ParaViewCore/VTKExtensions/Default/vtkIntegrateAttributes.cxx;h=352155009780b7a45d5b4c00a75178de0f724675;hb=HEAD for details.
Recently I get a triangle mesh, but the normal directions of triangles on the mesh is
not consistent. Is there any algorithm to convert the normals consistent?
From one book,it says
"Usually the orientation of the normals is propagated
along a minimum spanning tree between neighboring patches either in
a preprocessing step or implicitly during traversal of the input [Hoppe
et al. 92].
Does it mean that making the normals consistent is not easy?
Regards
Jogging
It is not easy business indeed. There are numerous papers on the subject. The original paper from which it all began is this:
H. Hoppe, T. DeRose, T. Duchamp, J. McDonald and W. Stuetzle, "Suface reconstruction from unorganized points," in SIGGRAPH, 1992.
The method itself is realized in VCG (Meshlab) and PCL libraries.
One of the more recent papers:
J. Liu, J. Cao, X. Liu, J. Wang, X. Wang and X. Shi, "Mendable consistent orientation of point clouds," Computer-Aided Design, vol. 55, pp. 26-36, 2014
http://jjcao.weebly.com/uploads/4/5/3/4/4534726/cad14.pdf
The authors of the paper provide a Matlab code:
http://jjcao-orientation.googlecode.com/svn/trunk/Code/
The code is much slower than the original Hoppe algorithm but gives much nicer results, especially in hard cases when the mesh contains sharp corners and non-smooth edges.
Also, a good review of general ideas is this one: http://vmv09.tu-bs.de/downloads/papers/koe09.pdf
If you know that the point cloud was obtained from a particular point (say, from a Kinect or a laser scanner), you can make the direction of the normals to be consistent with the viewpoint by flipping them if needed. But if you deal with a model of an entire object which, then some normal propagation algorithm is required.
In case somebody doesn't know: A cartogram is a type of map where some country/region-dependent numeric property scales the respective regions so that that property's density is (close to) constant. An example is
from worldmapper.org. In this example, countries are scaled according to their population, resulting in near-constant population density.
Needless to say, this is really cool. Does anyone know of a Matplotlib-based library for drawing such maps? The method used at worldmapper.org is described in (1), so it would surprise me if no one has implemented this yet...
I'm also interested in hearing about other cartogram libraries, even if they're not made for Matplotlib.
(1) Michael T. Gastner and M. E. J. Newman,
Diffusion-based method for producing density-equalizing maps,
Proc. Nat. Acad. Sci. USA, 101, 7499-7504 (2004). Available at arXiv.
There's this, though it's based and a different algorithm (and though it's on the ESRI site, it doesn't require ArcGIS). Of course, once you have the cartogram you can plot it in matplotlib.
Here is a Javascript plugin to make cartograms using D3. It is a good, simple solution if you are not too concerned about the regions being sized accurately. If accuracy is important, there are other options available that give you more freedom to play with the algorithm's parameters to get to a more accurate result.
Here are two great standalone programs I know of:
Scapetoad
Carto3F
Scapetoad is very easy to use. Just give it a shapefile, tell it which attribute to use for the scaling, and set a few accuracy parameters. If there is any doubt, this post describes the process.
Carto3F is more complex and allows for greater accuracy, though it is a bit trickier to figure out - lots of parameter settings without much documentation explaining them.
There is also a QGIS cartogram plugin, written in Python. Though I have not been able to get it to work, so cannot comment on that one.
In short, no. But Newman has an excellent little implementation of his and Gastner's method on his website. Installing it is easy and it works from the command line. Here's an example of a workflow using this software that worked for me.
Compute a grid of density estimates over some region, e.g. in Python. Store it as a matrix of numbers.
Run the cart program with your density matrix as input from the command line or from as subprocess in Python.
The program returns a list of new coordinates for each grid point.
Pipe your shapefile points through the interp program and into a new shapefile to get the transformed map.
There are nice instructions on the main page.
The geoplot.cartogram function in
Geoplot: geospatial data visualization — geoplot 0.2.0
says it is a high-level Python geospatial plotting library, and an extension to cartopy and matplotlib.
Try this library if you are using geopandas, it is quick and doesnt require much customization. https://github.com/mthh/cartogram_geopandas