Closed moruofan11 closed 2 months ago
u may went gradient way. i.e. calculate sum of colors in roi in image in compare with white pixel. then check real distance and fix that gradient with real distance.
import cv2; import numpy as np
img = cv2.imread(frame, cv2.IMREAD_GRAYSCALE)
cv2.rectangle(img, (600, 330), (600+90, 330+70), [255, 0, 0], 2) #the center olf image for example
roi = img[330:330+70,600:600+90]
white = (255)
roi_diff=np.sum(cv2.absdiff(roi, white))
For an .onnx project, if the output from the model is a relative depth map or pseudo-RGB image, what operations are required to obtain a depth map representing actual distances? There should also be a relationship with the intrinsic parameters of a monocular camera; how should these parameters be reflected?