Calculate distance between center of the circle at Edge - python

How can i Calculate Distance between center of the circle and extreme edges.
Below is the sample image and the green line is the Distance which i want to calculate.
How can do this using Open CV?

Hints:
Not easy to make this reliably. In the first place, make sure that you take the picture in front, to avoid parallax errors.
Possibly find the central circle(s) by Hough. This gives you the center.
Now the hard par is to segment the blades. Possibly by thresholding on a luminance image or anything close to that cream color. Or using a general segmentation method.
Then figure out which blade is segmented most accurately, and find the longest distance from the center to any point of the blade (that gives you the tip).
If you don't care about accuracy, it is not impossible that Hough gives you the outer circle.

Related

The best fit triangle in cv2

TLDR: I am looking to fit a triangle to a boomerang-shaped object in order to detect its "head", potentially using python's opencv.
I have a collection of boomerang-shape objects (see image below), whose size and internal angles vary. Additionally, sometimes the "boomerangs" (unlike a real boomerang) can be asymmetric with one leg longer than the other, and can have defects and holes along their legs.
I can accurately extract the contours of these shapes, and now am trying to detect the direction the boomerang is facing (defined as the direction the "pointy" edge, the one marked by brown dots in the image below).
My plan so far was to use opencv's convex defects method to detect the internal angle, and from there detect the direction. However, my "boomerangs" are not perfect - they sometimes have holes and defects along their legs that confuse the convex defect algorithm.
My question is: is there a way to find the best-fit triangle (much like the best fit ellipse) that would fit the boomerang?

featuredetection and measurements in x-ray image of solder joint

I have a lot of pictures from a PCB taken with a X-Ray camera. I want to meassure the amount of solder in the holes. I thought about using python for that task as I am most familar with it. I have no idea where to start. I looked at openCV and scikit-image but am a little bit lost about how to approach my problem.
I attached a detail from one image where you can see one single joint. Every original picture has 8 of that joints. 1
I though about this workflow:
find the walls and upper/lower boundaries of the hole
fit a rectangle or even better a cylinder inside the boundaries
meassure the area of the rectangle/cylinder
find the solder in the hole
fit a rectangle or cylinder in the solder
meassure the area
I am already stuck at the first part of the job...My Problem is, that the edges are really sketchy. I tried some sort of prepocessing (changing the contrast and sharpness of the image) but it didn't help that much.
Does anyone has a tip where I can start to read about this type of feature detection?

Find homography knowing the "destination angles" and not locations of points

What I'm doing
I'm trying to process (badly taken) photos of receipts and I'm stuck at warping perspective. My first attempt was to find the corners of the receipt using contour which worked pretty well.
But then I have images like this which part of the receipt was not captured (perhaps blocked by another piece of paper, etc.) so using the corners would yield bad result.
What I tried
I then moved on to line detection using Hough transform. The idea is that receipts usually have a few horizontal lines across. This is what I have so far.
My first thought was to use findHomography using points on two sides as source. To calculate the y-coordinate of the destination points, I'd find the distance between that point and some reference line.
The problem
But then I realized that this is not the correct way, as a line that's exactly halfway between top and bottom in the real receipt wouldn't be half way in the warped image.
Question
So I don't know the locations of the "destination" points, but what I do know is that all these angles between the white and red lines should be 90 degrees. How do I find the transformation matrix in this case?

How to determine the distance in pixels between a circle and various obstacles

So I have a circle created in pygame as my main character, and I'm looking to find the shortest distance between its sides and the various surrounding obstacles. You can see what I mean in the picture. I have a left quadrant and a right quadrant, and I want to see what exists in these quadrants. Whatever is the closest obstacle pixel wise to the circle, that pixel count becomes the left and right values (ie. if in the right quadrant the closest obstacle was 40 pixels away, right = 40). I also have a front value, that will be scanning for things directly in front of the circle.
I've seen things for looking for collision with a circle (creating a circular field around the object as a whole) and I've also seen stuff that uses Pythagorean theorem to look for distances, but I'm not sure how to tackle it in a more "spotlight" scope, if that makes sense.
Any suggestions on how to go about this would be much appreciated! The overall goal is for the circle to move automatically around these obstacles by avoiding them, hence why I want it to scan in various areas to determine how to move about the space.
The entire space is enclosed with a wall, and all the obstacles are randomly placed squares within the wall.
The distance to a circle is the same as the distance to the center minus the radius.
Now, the distance from a rectangle to a point is found by considering the nine regions defined by the supporting lines of the sides.
Depending on the region, the shortest distance is axis-aligned (from a side to the point) or oblique (from a corner to the point) and the formulas are easy.
The discussion is even simpler for a rectangular hole or inner angle.

OpenCV - body contour artmpits detection

Good day.
I'm trying to analyze a human body contour using openCV. I already recognized head (topmost point of contour), left and right arms (leftmost and rightmost poitns), left and right legs (I split a body contour into two halves and found bottommost points). I also have shoulder points (topmost points between corresponding leg and foot).
But I also need to recognize armpits and I have no idea how to. Here's what I already have (red outline is my contour. I'm working with HSV image, if that even matters):
You must use findContour() and then convex hull here which could serve you better.

Categories