In our camera systems, images are collected for operators to examine the surfaces on our parts.
In this example, we need to examine the interior surface of a cone where the images are taken for every rotation of certain degrees.
We want to find the center of this big ring or fan area to further determine the region of interest.
Then we'd like to first draw two lines perpendicular to the circular arcs to find the center of the cone.
How could we draw such lines.
Raw sample image:
Related
I am trying to clean this figure that I've produced with python and matplotlib - I would like for each pair of red points on the same cicle be connected by an arc (or partial circle). However, I have only managed to plot the entirety of the circles.
The end goal is to get a clean offset of my convex shape (black outline), in a continuous dashed red line.
I know the coordinates of the center of each circle, and the coordinates of each red dot. Does anyone know how I could go about this? Also, each circle has the same diameter.
Try https://matplotlib.org/stable/api/_as_gen/matplotlib.patches.Arc.html with the same width and height.
I am trying to transform a picture with OpenCV in python.
Therefore I have points in a grid placed on the image that I can also move.
I then split each grid rectangle into two triangles and I have their coordinates:
where they were at the beginning and
where they are after i moved some points around
Now I want to transform the image so it fits the new mesh but without seeing lines on the edges of the triangles or image pieces getting ripped by transforming differently.
Help!
I am trying to come up with a method of converting pixel coordinates to real-world distances and I'm having trouble coming up with the math to "undo" the perspective effects.
My physical setup is a camera facing towards a plate from maybe 2 feet away. The image that the camera would see is diagrammed in the image:
So the overall square is the bounds of the picture, the dotted lines finding the image centre marked with an X (this will be the origin of my pixel coordinate grid). The plate has markings at 5 locations which describe a circle and its centre. These locations are visible to the camera (marked P1, P2, P3, P4, Pin) and the radius of the circle they describe is known and labelled as R. There is no guarantee that Pin will be overlaid on top of X, and it's quite likely that they won't be aligned perfectly, so I drew it with an offset. I will be assuming that the optical axis is perpendicular to the plate. The dot marked A is a position on the real-world plate (that is also visible to the camera) with an unknown position. I am trying to determine its radius r from the centre point, Pin.
I am able to extract the 5 points' pixel coordinates from the image with ease, as well as from point A, but the transformation from pixel to real-world coordinate is the part that's being troublesome.
I theorized that I would be able to ignore perspective and just find out the pixel distances between say P1 and P3, equal that to 2R, then get a scaling factor between pixels and real-world distances. This may give alright results, but I want to design the algorithm to be able to handle perspective issues where locations further away from the optical axis will appear smaller than those in the centre of the image.
If useful, I am able to design a calibration test where Pin is centred over X, the distance between the plate and the camera is measured, and then using the P points and R determine the angle to pixel relationship of the camera.
Would anyone be able to help me develop this algorithm or point me to some resources that may help? I have discovered Projection matrices used in 3D rendering, but I am needing to go the other direction, and none of the resources deal with points on a plane like I have.
I will likely be writing this in python but that isn't required just yet.
I have an algorithm which generates from three to six points of intersection between a plane and the edges of a cube which contains that plane. For drawing the plane (which gets drawn a polygon) OpenGL needs the vertex to be ordered as in the following picture:
If the vertex are unordered, this result may be drawn:
Edit: I found this question but I don't know how to code it in Python and that's not exactly what I need
If points were built as intersections between a plane and the edges of a cube, then they form convex polygon.
To properly order vertices of this polygon, make projection onto some plane - or onto section plane, or onto one of OXY, OXZ, OYZ planes - just choose one not normal to section plane and make corresponding component zero.
Then choose the leftmost point in that plane as base and sort other points by polar angle relative to base.
I am writing a program using PyGTK that displays a gtk.Image. The desktop is projected onto the inside of a spherical dome. If the image displayed is rectangular on the screen, once projected onto a sphere it gets distorted.
To help picture this: The desktop itself is square. The center pixel of the desktop projects to the zenith and a circle inscribed inside the square desktop becomes the horizon (0 degrees elevation in polar coordinates). Everything outside that (in the corners of the desktop) is not displayed.
I would like to somehow modify the gtk.Image such that it still appears rectangular on the spherical surface. I'm sure there are lots of details in how this projection could be done, but very simplistically I have to convert the rectangular image into a curved trapezoid. Converting to a range of polar coordinates (e.g., map this rectangle to the area between two azimuth and two elevation angles) would be a good first approximation, though you can imagine if the elevation angles are 0 and 90, the resulting image will be a wedge of the sphere and not look rectangular at all.
How can I apply transformations like this to a gtk.Image (or its underlying Pixbuf)? Is there a package already that can do this? If not, how should I go about writing it from scratch? Presumably I would have to pull out the pixel values, map them to some new grid, and replace the original image. I just don't want to reinvent something that has already been done.