I have an image showing a circle (shown) with a mix of different modes of perturbation imposed on it. It is inconvenient to "unwrap" this circle into Cartesian coordinates to perform FFT on account of some other additional features. Is it possible to use FFT on the circle - can I pass FFT an object or a binary matrix with 1s inside the shape, 0s outside to obtain the power spectrum on that surface?
Related
I have a 2D shape (a circle) that I want to extrude along a 3D curve to create a 3D tube mesh.
Currently the way I generate cross-sections along the curve (which form the basis of the resulting mesh) is to take every control point along the curve, create a 3D transform matrix for it, then multiply the 2D points of my circle by those curve-point matrices to determine their location in 3D space along the curve.
To create the matrix (from 3 vectors), I use the tangent on the curve as the up vector, world-up ([0,1,0]) as the forward vector, and the cross product of the up/forward vectors as the right vector. All three vectors are also orthogonalized during the process to create the final matrix.
The problem comes when my curve tangent is identical to the world-up axis. Ie, my tangent vector is [0,1,0] and the world-up is [0,1,0]....since the cross product of two parallel vectors is not explicit....the resulting extruded mesh has artifacts along those areas of the curve (pinching, twisting, etc).
I thought a potential solution would be to use the dot product of the curve tangent and the world-up as an interpolation value to shift my forward vector from world-up to world-right...in other words, as a curve tangent approaches [0,1,0], my forward vector approaches [1,0,0]...but that results in unwanted twisting along the final mesh as well.
How can I extrude my shape along a curve in a consistent manner that has no flipping/artifacts/twisting? I know it's possible since various off-the-shelf 3D applications can do it...I'm just not sure how.
One way I would approach this is to consider my tangent vector to the 3D curve as actually being a normal vector of the plane I am interested into.
Let's say, the tangent vector is
All you need now is two other vectors that are othoghonal to it, so let's.
Let's construct v like so:
(rotating the coordinates). Because v is the result of the cross product of u and something else, you know that v is orthogonal to u.
(This method will not work if u have equal x,y,z coordinates, in that case, construct the other vector by adding random numbers to at least two variables, rince&repeat).
Then you can simply construct w like before:
normalize and go.
I am given site co-ordinate systems having the following parameters:
Projection Type (usually Transverse Mercator)
Ellipsoid/Datum (usually GRS80/GDA94)
Central Meridian
Central Scale Factor
False Easting
False Northing
and then need to programmatically convert a large number of points from ECEF into the site co-ordinate system, so ideally I'd like to use a transform matrix.
Wikipedia gives the formula for this transform matrix as:
http://upload.wikimedia.org/math/6/c/5/6c5e10c1708acc1663d618c2f3fecc98.png
But how do I calculate the parameters needed for this formula from the site mapping parameters I have been given?
The usual way to do this conversion is to first convert from ECEF to geodetic coordinates (latitude,longitude,height), and then to convert these to map coordinates (northing,easting,height). Each of these transforms is non-linear. However if the site is not too large and your accuracy requirements not too stringent, you could carry out the above transforms on a few dozen (say) points round the perimeter of the site, and then use these points and the original to find an affine transform that best approximates the map coordinates from the ECEF coordinates.
I've played around with this a bit and it appears that while it is possible to get the eastings and northings with fair accuracy (eg a couple of centimetres over a site within a circle of radius 10km and a 20m height variation over the site; but if the height variation is 200m the accuracy drops to 2 decimetres), it is not possible to get even fair accuracy on the height -- in the example the height could be ~8m in error. This is unavoidable, as a line of constant height in site coordinates will be close to a circular arc, and if you compute the greatest distance of the chord from the arc for an arc of length 20km and a circle of radius earth radius you get ~16m.
I have an SVG image (a site plan) with width w, height h, which I would like to view on a map background.
To superimpose it at the right place on the map, I would like to stretch it to four arbitrary corners: x1,y1, x2,y2, x3,y3, x4,y4.
I figure I might be able to do this with a combination of SVG transforms (scale, rotate, skew, translate) but my maths is nowhere near up to the job. Any clues?
Rotation and translation can describe Euclidean (i.e. length-preserving) transformations. With isotropic scaling added in you obtain similarity transformations, and with anisotropic scaling and skewing you even get affine transformations. So that is the kind of transformation your operations can express.
But an affine transformation is already uniquely defined by three points and their images. Which means the fourth corner will end up in a location determined by the other three. To arbitrarily position four corners, you need a projective transformation.
See also this post about hwo to compute a projective transformation, how to apply it, and how to use it in JavaScript, if the browser supports projective transformations in 3D.
I have large matrix (image) and a small template. I would like to convolve the small matrix with the larger matrix. For example, the blue region is the section that I want to be used for convolution. In other words, I can use the convolution for all of the image, but since the CPU time is increased, therefore, I would like to just focus on the desired blue part.
Is there any command in MATLAB that can be used for this convolution? Or, how I can force the convolution function to just use that specific irregular section for convolution.
I doubt you can do an irregular shape (fast convolution is done with 2D FFT, which would require a square region). You could optimize it by finding the shape's bounding box and thus discarding the empty border.
#Nicole i would go for the fft2(im).*fft(smallIm) which is the equivalent for conv2(im,smallIm).
as far as recognizing the irregular shape you can use edge detection like canny and find the values of the most (left,right,top,bottom) dots, since canny returns a binary (1,0) image and prepare a bounding box, using the values. however this will take some time to create. and i'm not sure about how much faster will this be.
I am trying to implement the method of Dalal and Triggs. I could implement the first stage compute gradients on an image, and I could create the code who walk across the image in cells, but I don't understand the logic behind this stage.
I know is necessary identify first between a signed (0-360 degrees) or unsigned (0-180 degrees) gradients.
I know I must create a data structure to store each cell histogram, whit n bins. I know what is a histogram, hence I understand I must visit each pixel, but I I don't fully understand about the method for classify each pixel, get the gradient orientation of this pixel and build the histogram with this data.
In short HOG is nothing but a dense representation of gradient orientations weighted by their strengths over a overlapped local neighbourhoods.
You asked what is the significance of finding each pixel gradient orientation. In an image the gradient orientation at each pixel indicates the direction of the boundary(edge between two textures) of the object at that location with respect to X and Y axis. So if you group the orientations of a patch or block or part of an object it represents the distribution of edge directions of object at that region in a very strong way or unique way... Now let us take a simple example, a circle if you plot the gradient orientations of a circle as a histogram you will get a straight line (Don't imagine HOG just a simple plot of gradient orientations) because the orientations of edges of circle ranges from 0 degrees to 360 degrees if u sampled at 360 consecutive locations, For a different object it is different, HOG also do the same thing but in a more sophisticated manner by dividing image into overlapping blocks and dividing each block into cells and making the histogram weighted by the strengths of the local gradients...
Hope it is useful ...