Apr-16-2020, 10:35 AM
I have the following:
list_1 has 5 lines in total, where as the above list tells me there are 9. Not only that, 3 lines are individual lines and far apart where as 2 lines are near each other together.
So for example:
list_1=[[499, 943, 1447, 943], [356, 944, 1447, 944], [356, 1226, 1447, 1226], [357, 1228, 1446, 1228], [292, 1456, 1441, 1456], [293, 1457, 1440, 1457], [292, 1991, 1441, 1991], [292, 2096, 1440, 2096], [293, 2098, 1440, 2098]]The list is set out in [[x1,y1,x2,y2],......] format and it is based in ascending order based off y1 (it is mean't to go down the page). Every coordinate is mean't to represent a line when joined.
list_1 has 5 lines in total, where as the above list tells me there are 9. Not only that, 3 lines are individual lines and far apart where as 2 lines are near each other together.
So for example:
[499, 943, 1447, 943] & [356, 944, 1447, 944] = 1 line (approx coordinate could be = [356, 944, 1447, 944] ) [356, 1226, 1447, 1226]& [357, 1228, 1446, 1228]=1 line (approx coordinate could be =[356, 1226, 1447, 1226]) [292, 1456, 1441, 1456]& [293, 1457, 1440, 1457] =1 line (approx coordinate could be = [292, 1456, 1441, 1456]) [292, 1991, 1441, 1991] & **[292, 2096, 1440, 2096], [293, 2098, 1440, 2098]** = 2 lines (where the bold coordinates represent the same line) (approx coordinate could be = [292, 1991, 1441, 1991] and [292, 2096, 1440, 2096])How do I write a function that automatically filters those coordinates and returns the right amount of lines i.e 5 and gives an approximation of where that line is.