Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

Finding corresponding pixel coordinate of a single point before and after cv2.remap

$
0
0
Let's begin by saying that i have a static image, called it `leftFrame.` This frame is passed to method `cv2.remap(leftFrame, map1, map2, cv2.INTER_LANCZ0S4,0)`, so that every pixel from original image (`leftFrame`) is reallocated to a new position. Given that `map1` and `map2` are output from `cv2.initUndistortRectifyMap(MLS, dLS, RL, PL,imgShape,cv2.CV_16SC2)`, with MLS, dLS, RL, PL had been calculated before. Things are done well, HOWEVER, now I just want to get the corresponding pixel coordinate of a single point in the new frame, given the original pixel coordinate of that point in the initial, original frame (`leftFrame`). How can I achieve it? The code is simplified to be like this: Left_Stereo_Map = cv2.initUndistortRectifyMap(MLS, dLS, RL, PL,imgShape,cv2.CV_16SC2) leftCap = cv2.VideoCapture(PORT) while (True): # Collect image continously ret1, leftFrame = leftCap.read() Left_nice = cv2.remap(leftFrame, Left_Stereo_Map[0], Left_Stereo_Map[1], cv2.INTER_LANCZOS4, cv2.BORDER_CONSTANT, 0) original_x = PREDEFINED_X original_y = PREDEFINED_Y x_after = ? y_after = ? cv2.waitkey(1) Thanks everyone for spending your time reading this question. Wish you safe in this time!

Viewing all articles
Browse latest Browse all 2088

Trending Articles