Trace arc from two points and center in Python - python

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.

Related

Corner detection: getting rid of unwanted corners

I'd like to find the corners of the following box
However, as you can see I'm detecting a lot of corners I don't want to find. I'm completly stuck on this one. No matter what I try, I always seem to find corners in the dots on the box. I used the function goodFeaturesToTrack() but I also tried cornerHarris()
The most important thing to me is to find the coordinates of the corner pixels so I can draw a wire frame.
Kind regards, Schweini
Edit:
To draw the wire frame onto the image, following process can be thinkable.
When extracting outline of the black box region, the outline consists with 6 straight line segments.
Therefore, you'll able to find at least 6 corners of the box as the intersection of each two adjacent line segments.
Additionally, it looks like that, outline of 6 surfaces of the box will be able to coarsely estimated from each adjacent line segment pairs. (with assuming parallelogram)
This means estimating the positions of the remaining two corners (to draw the wire frame).
Furthermore, if you want, comparing the estimation result with your examination (corner detecition) result will be able to refine the coordinates of one corner.

python draw ellipse on maps and extract near points by using two focus

Hi I have one set of two stations coordinates and several points of wells.
I want to extract points of wells which are in the ellipse area around the two stations as focus.
I draw this as below.
The black dots in the ellipse are location of stations.
The blue dots in the ellipse are the locations of wells what I want to extract.
The grey dots outside of ellipse are what I do not want to extract.
So what I know are..
Two points (e.g. [128.xx, 30.xx] and [128.xy, 30.xy] of stations which will become focus of ellipse.
Coordinate locations of points of wells.
What I want to do is..
Draw the ellipse around the two focus. (Which would be better on basemap based but it is okay without using it)
Extract the points of wells (name or coordinates whatever) which are located in the ellipse.
So could you please let me know the code or the way to do those?
p.s.
I know I can use Ellipse of matplotlib.patches but keep failed.. I do not know the reason because it does not appear on map without error..

How to draw lines perpendiculr to the circular arcs in OpenCV

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:

Detecting center of image from parabolic mirror?

I have a panoramic one shot lens from here: http://www.0-360.com/ and I wrote a script using the python image library to "unwrap" the image into a panorama. I want to automate this process though, as currently I have to specify the center of the image. Also, getting the radius of the circle would be good too. The input image looks like this:
And the "unwrapped" image looks like this:
So far I have been trying the Hough Circle detection. The issues I have is selecting the correct values to use. Also, sometimes, dark objects near the center circle seem to throw it off.
Other Ideas I had:
Hough Line detection of the unwrapped image. Basically, choose center pixel as center, then unwrap and see if the lines on the top and bottom are straight or "curvy". If not straight, then keep trying with different centers.
Moments/blob detection. Maybe I can find the center blob and find the center of that. The problem is sometimes I get a bright ring in the center of the dark disk as seen in the image above. Also, the issue with dark objects near the center.
Paint the top bevel of the mirror a distinct color like green to make circle detection easier? If I use green and only use the green channel, would the detection be easier?
Whats the best method I should try and use to get the center of this image and possibly the radius of the outer and inner rings.
As your image have multiple circle with common centre you can move that way, like
Detect circle with Hough circle and consider circle with common centre.
Now check the ratio for co-centred circle, as your image keep that ratio constant.
I guess don't make it too fancy. The black center is at the center of the image, right? Cut a square ROI close to the image center and look for 'black' region there. Store all the 'black' pixel locations and find their center. You may consider using CMYK color space for detecting the black region.

Perform spherical projection of image in python

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.

Categories

Resources