How to get my midpoint from a array of white pixel coord

asked 2018-01-11 20:48:50 -0500

NirvanaDon gravatar image

I've got this image which im trying to get the midpoint , ends points.

image description

I'm using this code to get the coords of all the white pixel from this image

npImg = np.asarray(ske)

coordList = np.argwhere( npImg == 255 )

coordList = np.fliplr(coordList)

numWhitePoints = len( coordList )

print (coordList)

print ("Found {0} points".format( numWhitePoints ))

this is the output of array i got

[[17 12] [16 13] [16 14] [15 15] [14 16] [13 17] [13 18] [12 19] [12 20] [12 21] [11 22] [11 23] [11 24] [11 25] [11 26] [11 27] [10 28] [10 29] [11 30] [11 31] [11 32] [11 33] [12 34] [12 35] [12 36] [13 37] [13 38] [14 39] [15 40] [16 41] [17 42] [17 43] [18 44] [19 45] [20 46] [21 47] [22 47] [23 48] [24 49] [25 49] [26 50] [27 50] [28 50] [29 51] [30 51] [31 52] [32 52] [33 53] [34 53] [35 53] [36 54] [37 54] [38 54] [39 54] [40 54] [41 55] [42 55] [43 55] [44 56] [45 56] [46 56] [47 56] [48 56] [49 56] [50 57] [51 57] [52 57] [53 57] [54 58] [55 58] [56 59] [57 59] [58 59] [59 60] [60 60] [61 60] [62 61] [63 61] [64 61] [65 62] [66 62] [67 63] [68 63] [69 64] [70 64] [71 65] [72 65] [73 66] [74 66] [75 67] [76 68] [77 68] [78 69] [79 69] [80 70] [81 70] [82 71] [83 72] [84 73] [85 74] [86 75] [87 76] [88 77] [89 78] [90 78] [91 79] [92 80] [93 81] [94 82] [95 83] [96 84] [97 85] [98 86] [99 87]]

I'm want to know if theres a code for me to automatic use this arrays to get the midpoint , endpoints of this image and draw a circle on it. Thanks

edit retag flag offensive close merge delete

Comments

Duplicate post ?

LBerger gravatar imageLBerger ( 2018-01-12 02:09:43 -0500 )edit