How to find optical flow only inside bounding box? - python

I'm using the Lucas-Kanade sparse optical flow method where I'm finding feature points using the Shi-Tomasi corner detector Good Features to Track.
How do I detect feature points only inside the bounding box?

How about cropping the BB from the image, and running the Shi-Tomasi on the cropped image, then adding the offset of the BB (upper left corner coords) to the key-points.

Related

Center of bounding box Yolo

I tried palm counting with Yolov7. The detection result is below. I would now like to get the coordinates of the center of the bounding box and use that to determine the gps position of each palm tree. I tried to use the coordinates of the upper left corner as a reference but the result obtained is not good the points do not end up in the center of the box when I draw them simultaneously. Can you help me ?
enter image description here

Take the image inside a contour and place the irregular contour at a specific location on another image

I have a rotated object (clips for wires for a motherboard)
which I have then used Thresholding and findContours to get the contour of the region of interest (in green). It is an irregular shape which may not always be a rectangle. I know the coordinates I was to place the center of this image on within the section of the motherboard
but do not know how to do this without using bg[y:y+obj_h, x:x+obj_w] = obj, which would assume rectangular shape and would introduce a large noise perimeter surrounding the rotated image. I have tried using transparency around the object, which does not work with cv2. The target goal is this
Any help would be appreciated.

Lucas Kanade Feature Tracking, problem with bounding box and template update

I am implementing a Lucas Kanade Pyramidal Tracker in python based on affine transforms of the neighborhood of features chosen with Shi-Tomasi corner detector(as described here) for a video with 600 frames.
The algorithm works good, finds corners in the given Bounding Box in the first frame, and tracks those corners correctly, but there are to problems.
Some of the corners that I detect in the bounding box are not on the object that I want to track but on the background.
I need to transform de Bounding Box accordingly with the movement of the features tracked, but as the frames advance some features get lost and the bounding box starts growing instead of following the object.
To move the bounding box I am estimating a similarity transform between the previous and current corners and multiplying this transform with the corners of the boundingbox
How could I fix these problems?
Thank you very much!

scikit image contour completion

I am working with the following image.
My aim is to get the curvature of the outermost circle in the central part of the image.
AFTER CANNY EDGE FILITER
My focus is the concentric circles in the center of the image.
I need to be able to get the radius of curvature of the outermost circle.
I have tried find_contours, but it produces thousands of colored disconnected contours.
Regards,
Richard Madson

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.

Categories

Resources