Open 5av10 opened 3 years ago
Using my mapper repo you can use the following code to get the world points of the detected blobs:
import mapper
depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_img, alpha=255/clipping_distance), cv2.COLORMAP_JET)
g = cv2.cvtColor(dept_colormap,cv2.COLOR_BGR2GRAY)
detector = cv2.SimpleBlobDetector_create(params)
points = detector.detect(g)
for point in points:
""" Get depth x, y points of detected blobs """
depth_x, depth_y = point.pt[0], point.pt[1]
""" Get world points of your depth x, y """
world_x, world_y, world_z = mapper.depth_point_2_world_point(kinect, _DepthSpacePoint, [depth_x, depth_y])
blank=np.zeros((1,1,1))
blobs=cv2.drawKeypoints(g,points,np.array([]),(0,255,0),cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
Using my mapper repo you can use the following code to get the world points of the detected blobs:
import mapper depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_img, alpha=255/clipping_distance), cv2.COLORMAP_JET) g = cv2.cvtColor(dept_colormap,cv2.COLOR_BGR2GRAY) detector = cv2.SimpleBlobDetector_create(params) points = detector.detect(g) for point in points: """ Get depth x, y points of detected blobs """ depth_x, depth_y = point.pt[0], point.pt[1] """ Get world points of your depth x, y """ world_x, world_y, world_z = mapper.depth_point_2_world_point(kinect, _DepthSpacePoint, [depth_x, depth_y]) blank=np.zeros((1,1,1)) blobs=cv2.drawKeypoints(g,points,np.array([]),(0,255,0),cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
The z coordinate is not changing
How do I extract the real time X,Y,Z coordinates of a detected blob? I am using opencv with cv2.SimpleBlobDetector_create() to detect and track the ball in the dept video but cannot manage to sample a point from the detected blob and get its x,y,z coordinates the code is: