0
$\begingroup$

The whole question is about a simplified algorithm for tracking a single solid object which has no joint, with assumption that i have full control on adding some markers in real world to it.

For example i want to find full coordinates (Center of orange Coordinate system and direction of each orange axis) of the car in the following image: enter image description here Assume i have control over adding as many markers(Stars) with required features(Shape, color, position) to my object(dreamy car) in real world.

Notice i am looking for some algorithms which mainly rely on finding position of my markers, which could be detected very fast by some simple color threshold.

$\endgroup$

1 Answer 1

1
$\begingroup$

Fast way could be to convert your image to HSV format and then apply color thresholding as you have mentioned. Here is a short snippet which could get you started quickly.

import cv2 as cv2
import numpy as np

fn = 'image_or_videoframe'
# OpenCV reads image with BGR format
img = cv2.imread(fn)
# Convert to HSV format
img_hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)

# Choose the values based on the color on the point/mark
lower_red = np.array([0, 50, 50])
upper_red = np.array([10, 255, 255])
mask = cv2.inRange(img_hsv, lower_red, upper_red)

# Bitwise-AND mask and original image
masked_red = cv2.bitwise_and(img, img, mask=mask)

in this case, the red is filtered in the image and masked_red would contain only the red pixels in the image.

After the filtering, depending on the requirement you can use houghlines to detect the lines. It is not trivial but it is definitely doable.

Hope this helps and all the best :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.