I'm trying to get the tangent of a polygonal curve I got using approxPolyDP(), I have tried Hough lines and some mathematical formulas for gradient but none of them worked.
I want to get the tangent in the red marks in the image.
Related
How do I find the equation of a curved line from an image? Blood Pressure
I don't know how I compute it in python.
I am working on a detection problem and I have found the mask of the object using cv2.findContours(). However, the found contour has a lot of noise and isn't smooth while the requirement is that it has to be smooth so we can use that smooth contour for our next step.
The obtained mask
The curve I want (the red line)
I have tried cv2.approxPolyDP() to reduce the noise but it is no longer a curve. I was asked to find a smooth curve.
The curve after using cv2.approxPolyDP()
Is there any way to do it?
I want to draw dotted curve between the boundaries. For eg, consider the following image:
From the image, I have the dark outline - what I want is the dotted part through code. As of now, I have the following algorithm:
For each point say A, find it's two nearest points
Form these two points, find it's slope, and then the slope of the line perpendicular to it.
The using the perpendicular slope and point A, determine the line and also where it intersects the parallel point, say B
Draw a point half way between A and B on this perpendicular line.
This method is like Brute force. I think using numpy, opencv or plotting libraries, this might be a trivial thing. Do you have any suggestions?
Thank you
I have a figure that I get contour lines from a picture of face use by opencv (image below). I need to determine most curvature points of this contour in python (in the image, I need to define the red dots on right of the red line). How can I do it ?
Just find contour and compute curvature then find maximums: curvature
This article also may be useful: article
How can I extract the boundary curve of an image region enumerated by measure.regionprops?
By boundary curve, I mean a list of border pixels of the region in, say, clockwise direction around the region's perimeter, such that I can, for example, represent the region with a polygon. Note that I want the exact coordinates of all border pixels, not a convex hull approximation.
I've read the docs and googled, and I have the impression its done somewhere under the hood, but I just cannot find the function.