Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Given a graph of a formula, how can I find its formula?
Do I need some OCR or something like that?
In general you need:
detect the graph position (bounding box) in image
you are usually looking for rectangle outlined (usually in black) area
extract/input graph scales
either input them by user or read via OCR (as you suggested). The scale values and units are usually along the x,y axises of the graph bounding box. You need to find at least 2 separate points per axis to form transformation from pixels to units. In case of non linear scales you need to have more points to detect log,etc scales ...
extract graph points
the graph curve is usually in different color or stroke width so it should be relatively easy to extract all points. Form a list of points (in case of function sorted by x).
apply curve fitting on the points from #3
there are many approaches ... can use piecewise interpolation, piecewise approximation BEZIER/SPLINE, interpolation polynomials (Lagrange...) or FFT/DCT (sin waves). For non complicated shapes approximation search minimizing distance between points and computed polynomial will be enough. This step mainly depends on what precision, output function form, runtime you need.
Hard to be more specific as you did not provide any details what so ever.
Finding the mathematical algorithm to which matches an input and output together might help a bit.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am looking for a library or other source code that will help me display non-intersecting spheres or spheroids, not necessarily a bin packing issue, but it could be. Each of these spheres can also contain a further set of much smaller spheres within. I would then like to take a slice, i.e. two parallel planes a distance apart or a cuboid, through this "world", and calculate how many larger as well as smaller spheres are "captured" by the given slice, and to generate a 3D graphic.
Although I have plenty of experience in programming, etc. 3D spaces are new to me, and my geometry a bit rusty. I've looked into the rgl package for R+ as well as D3.js, but don't see an obvious solution. I've searched through StackOverflow and there is the "Cube sphere intersection test?" post, but it doesn't quite get me what I'm looking for. Not sure if this falls under a "collision" problem or more of a stereology problem perhaps, but the CRAN package StereoMorph also didn't yield any answers.
Any suggestions as to where I should look are welcome. I'm also not wed to any particular computer language.
Thanks!
A sphere is defined as:
[centerX,centerY,centerZ,radius]
and a plane is defined as
[normalVectorX,normalVectorY,normalVectorZ,distance]
Distance is the distance from the origin to the plane if you were to travel along the direction of the normal vector. In other words, if you multiply each component of the normal vector by distance you will have a point somewhere on the plane.
To test if a sphere is on one side of the plane or the other:
Project the sphere center onto the plane normal, add the radius of the sphere, and if that sum is less than the plane distance, then it has not intersected.
CENTER = [centerX,centerY,centerZ]
NORMAL = [normalVectorX,normalVectorY,normalVectorZ]
isBelowHighPlane = dotProduct(CENTER,NORMAL)+radius < distance
For the other plane, lets say the "lower" plane, subtract the radius and test if the sum is greater:
isAboveLowPlane = dotProduct(CENTER,NORMAL)-radius > distance
Therefore, if both the above tests are true the sphere is contained.
NOTE: If your plane is defined some other way, for example by three points in space A,B,C, you can find the normal by taking the cross product of any two sides:
normalVector = normalize(crossProduct((B-A),(B-C)))
And once you have that normal vector, you can find the distance by projecting the vector from the origin to any of those points onto the normal:
distance = dotProduct(B,normalVector)
Note, distance may be negative.
So the 3d functions you need in whatever language you choose are:
dotProduct(), crossProduct(), and normalize()
If you have some connection from small spheres to their containing big sphere, and that big sphere is either completely in or completely out, then you can instantly know the state of all the small spheres. However, to test if a big sphere is completely out, you'll need extra variations on the test:
isAboveHighPlane = dotProduct(CENTER,NORMAL)-radius > distance
isBelowLowPlane = dotProduct(CENTER,NORMAL)+radius < distance
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I would realize the papercraft of a geodesic sphere like THIS .
Is the dual of the one discussed in THIS OTHER QUESTION .
Where can I find the printable nets, or the online resources to create them?
In the other discussion I learned that there are 3 classes of possible tessellations.
One of these classes needs less pentagons to tessellate the sphere?
I don't exactly know how much faces I need, indicatively between 100 and 200.
Which chord factors I should consider?
Thanks to all
genna,
The link that I provided in the former discussion...
http://thomson.phy.syr.edu/thomsonapplet.php
...provides for display of a dual. Unfortunately, the java applet will only export a data set for the geodesic triangular tessellation; not the dual.
The dual can be constructed from the triangular tessellation, by importing the vertex (point) data set (from the java applet) into a 3D-graphics program, and then following the rules of the definition of a dual. (Each pent/hex face will use the triangular vertex point as the centerpoint of a circle, being equidistant from the sphere center and normal to the central vector. The intersections of these circles will produce the linear edges of the dual faces.)
All tessellated duals, based on the icosahedron, will have the same number of pentagonal faces (12), regardless of how many hex faces are produced.
-Taff
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a sequence of points ( not vertices's ) which makes a open shape but they are randomly arranged in a array, but to effectively recognize the shape what I need to do is to arrange the points in order the shape was made.
Is there any way in which I can recognize which is the start and end point?
Edit: The points are in a 2D plane and I have the boundingbox. The points are obtained from a image processing algorithm which gives me the points from top to bottom (not in the order shape was made) as the image is processed pixel by pixel.
Given a set of points, there are various ways to reconstruct a shape from them. If you only take the distance between two points into account, then this basically boils down to a classical traveling salesman problem: you're looking for a tour through all points which minimizes the length of said tour. You could add one mor atrificial point which has the same distance to all points in the plane. That would turn a cyclic tour into a linear one: the point after that artificial point would be the starting point, and the point just before it would be the end point. There might be TSP approximation algorithms out there which can do non-cyclic tours out of the box.
Only considering distance ignores any inertia inherent to the motion of the painting device. So I don't claim that this is the best possible model. But for most models, I would still think about a way to determine the order all the points, which automatically results in identifying the start and end point. I can't think of a way to reliably identify these two without a way to order all points in between as well.
EDIT: Seems like you want to implement image segmentation instead:
Paper
Scroll down to page 28 for the mathematical description. This will give you the contours. Does that get you to where you want to be?
What you are trying to do is implement
OCR
without the use of an external library. I wouldn't recommend it for production purposes, but think it would be a great problem to tackle.
My suggestion would be to build a simple Artificial Neural Network with the image surface providing the input signals. A feed-forward, backpropagation ANN is quite easy to code, but extremely tricky to get the results you want.
You are, after all, tackling a problem that has no perfect solution yet despite many attempts. I wish you the best of luck and please keep us updated with your progress!
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I tried to improve trilateration accuracy by doing least square method. For initial estimation, I get the average value of the cluster points. This value is then increased until the distance to the next estimation is small enough. The increment value is calculated using this formula,
My question is, why most of the times the final answer diverts quite significant from what it should be? The initial estimation is even better, although not that accurate.
Do I miss something here?
Edit
The formula is as explained here. I hope this picture explains better,
See the final point is even outside the intersection area.
I think I have a clear enough idea of the problem to offer an answer.
Basically the three-cornered region's interior consists entirely of points that undershoot the three estimated distances (inaccurate circle radii). So it is not surprising that an iterative improvement to the solution, seeking a minimum squared error approximation, will move the point outside that three-cornered region.
More about why the points inside the region give distances that are below the given estimates: These points are exactly those that are inside all three circles (if such an arrangement holds). Therefore the three distances from such a point to the circles' centers are all below their respective radii.
Using the average of the three corner points (is this what is meant by cluster points in the question?) is probably a pretty good way to start. If there is a simple place to improve the calculation, it might lie in using a weighted least squares criterion rather than an absolute least squares criterion.
What I mean by this is that if one radius is 10 yards, and the other two radii are much larger (say 200 and 300 yards for the sake of discussion), it probably doesn't make sense to assume the estimated distances all have errors of about equal size (which is what an absolute least squares fit looks for). Instead assuming the error in the estimated distances is roughly proportion to each distance (a relative error criterion) is more likely to produce a better solution, e.g. giving a greater weight to the shorter distance (because a proportional error in that would be less in absolute magnitude than the proportional error in the longer distances).
This is just a sketch of one idea you might want to incorporate in your solution. I take you have only the three data to work with (locations known to fairly good accuracy as centers of circles, greater uncertainty in the three radii). So it doesn't make sense to try and apply methods that are sophisticated in respect of accuracy, but rather to prefer methods that give a robust solution. I think the relative error criterion would move you in that direction.
Least squares minimizes the overall square of the errors, but it says nothing about how close an individual point will be to the true value. The coefficients are affected by all the points, not just a few.
This question already has answers here:
Equation of a helix parametrized by arc length between two points in space
(2 answers)
Closed 3 years ago.
Given two points say (1,2,3) and (4,7,8). The endpoint tangents at these points are also given as inputs say pi/4 and -pi/2 respectively. How to fit a helix of arc length 2 between these points?
How to implement this in Matlab?
I'm not sure what toolboxes you have access to, but you should check the documentation for these two:
Curve Fitting toolbox
Spline toolbox
I think there may be a number of different ways you could approach the problem (i.e. different types of curves to use to match an arbitrary set of points and tangents).