distance

Calculating the shortest path between two points in a bitmap in python

ぃ、小莉子 提交于 2020-07-17 06:41:26
问题 I have a black and white bitmap image shown here: The image size is 200,158. I want to pick two points that fall on the white path and calculate the shortest distance between those two points following only the white pixels. I am not sure how to approach this problem. I want to create a function that I call with 2 sets of x,y coordinates and it returns the number of pixels following the shortest route along the white pixels only. Any pointers would be greatly appreciated. 回答1: As stated in

Calculating the shortest path between two points in a bitmap in python

↘锁芯ラ 提交于 2020-07-17 06:41:16
问题 I have a black and white bitmap image shown here: The image size is 200,158. I want to pick two points that fall on the white path and calculate the shortest distance between those two points following only the white pixels. I am not sure how to approach this problem. I want to create a function that I call with 2 sets of x,y coordinates and it returns the number of pixels following the shortest route along the white pixels only. Any pointers would be greatly appreciated. 回答1: As stated in