Resample point source to image data in ParaView - visualization

How to resample a polygonal mesh containing just points (in one cell -> Point Source) to an image data set in ParaView. I am using the Resample to Image filter from the upcoming ParaView version 5.2.
All resampled data arrays have a range of [0,0] instead of their expected values.

To sample a point source to vtkImageData, use the Point Interpolation Filters instead. Point Volume Interpolator is what you want.

Related

How to convert a MATLAB plot in 3d to a binary image?

I use trisurf for plotting a convex hull. I need to convert it to binary image for using "Geometric measures in 2D/3D images" for calculating "Minkowski functionals" but I don't know how to convert.
Create regular grid with the right scale using meshgrid and then use one of the already written codes to check if the points you generated are in the convex hull such as inchull or inhull

shapefile mask for georaster in MATLAB

I am trying to make a mask for a georaster (netCDN file) using a shp file. This is similar to what is described in this thread (How to limit the raster processing extent using a spatial mask?), but since my georaster is not an image I do not have an R variable, so the solution presented there does not work for me.
I first load my shapefile into MATLAB:
S1 = shaperead('Export_Output_3.shp');
The data has a Lambert Conformal Conical projection and the units is meters.
Then I load the netCDF file and extract the first slice of data. I get a matrixx with one valu for each cell. It also has a Lambert Conformal Conic projection with the same parameter values, but the data is in “degrees north” and “degrees east”.
So how can I put this data together? I tried the utm2deg function for converting the units of the shapefile from meters to degrees, but I do not know the UTM zone, so I got stuck with that.
I think that I first need to have both datasets in the same units and then to convert the shapefile into a matrix with the same resolution as the netCDF. I am unable to perform any of these steps.
Can anyone help?

Generate 3D surface from scattered or data points

Can anyone tell me how to generate a 3D surface model like CAD in Matlab ?
1.Input: Input is a collection of points with (x,y,z) where surface is present for an object(I'm using this for a 3D scanner where my inputs are (x,y,z) of surface)
2.Points should be displayed as a surface using some smooth interpolation.
3.More like surface generation from data points.
Thanks you.
In order to plot surfaces, you can use patch function. However, you need along with the points the faces information. In patch a surface consists of polygons that is specified using 3 point, which is the face information.
1
Since it seems like you will be inputting discrete points located on the surface of the object, you will first want to create a Nonconvex Polygon based on the data using Matlab's boundary function.
https://www.mathworks.com/help/matlab/ref/boundary.html
You can then use the trimesh function to create the figure
This question shows the input data and what was produced using this method: How do I create a 3D polygon/mesh over data points?

Matlab: apply projection correction to an image subset

Following the question I posted here, I need to apply a projective transformation to an image given 4 points.
Say I successfully segmented the QR code from an image:
and I have stored in an array of points the coordinates of the QR vertices. In this case I would only need a rotation in order oto obtain the rectified image but in here:
I need to apply a projective correction to the image.
Is there a way of making these transformations knowing the coordinates of the said vertices?
EDIT
I solved it using #Xiang's suggestion and using HSV components of the image.
If I understand the question correctly you have the 4 corner points and you want to know to which coordinates to map them in the transformed image. Well, this is up to you. You know this is a square so just choose an arbitrary height or calculate based on some measurement from the original image and generate the coordinates:
(0,0)
(0, size)
(size, 0)
(size, size)
Now you can compute the transform and apply it to the original image using maketform.
From Matlab docs http://www.mathworks.com/help/images/ref/maketform.html:
T = maketform('projective',U,X)
To apply the transform use imtransform and set the fields UData, VData, XData, YData to specify your source coordinate system and the new sampling coordinates you wish to transform to.

Laser data line extract use hough transform in matlab

I have a set of laser range finder data, after transform it to global frame, it has negative and floating point data, for example the x-y coordinate are:
x=[1.1 -2.2 3.45]
y=[0 4.67 -5.6]
how to use matlab hough transform to extract line?
it seems the input must be an image.
You don't need the Hough transform.
Instead, find the best line using the Least Squares method:
p = polyfit(x,y,1);
figure();
scatter(x,y);
hold on;
plot(x,polyval(p,x));
You can read about least squares here:
http://en.wikipedia.org/wiki/Linear_least_squares_%28mathematics%29
I am currently facing a similar problem. One of the methods you could use to extract features is RANSAC.
With this you could match some lines and then extract features from the line intersections. Obviously this method is better with a large dataset. And with most Laser range finders you get several hundred points.