2015-05-20 47 views
1

我有一個圖像,人眼清楚地包含了幾個(2個)重疊的「鞋帶」。 enter image description here圖像分析:分離相交的意大利麪

這源於對實驗的相當長的圖像分析。

紅點是包含在兩個向量px和py中的所有點,一個是紅色像素的x_position,另一個是y位置。

px= array([ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 
    2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 
    3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 
    5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 
    7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 
    9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 
    11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 
    13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 
    15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 
    16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 
    18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 
    20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 22, 22, 
    22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 
    24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 
    25, 25, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 
    27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 
    29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 31, 
    31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 
    32, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 
    34, 34, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 
    36, 36, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 
    38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 
    40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 42, 
    42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 
    44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 
    45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 
    46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 
    47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 
    48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 
    48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 
    49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 
    50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 
    51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 
    52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 
    52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 
    53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 
    54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 
    54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 
    55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 
    55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 
    56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 
    57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 
    57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, 58, 
    58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 
    58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 
    59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 
    59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 
    60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 
    61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 
    61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 62, 62, 62, 
    62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 
    62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 
    63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 
    63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 
    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 
    64, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 
    65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 
    66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 
    66, 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 
    67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 
    67, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 
    68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 
    68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69, 
    69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 
    69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 
    70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 
    71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 
    71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 
    72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 
    73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 
    73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, 
    74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, 
    75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 
    75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 
    76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 
    76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 
    77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 
    77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 
    77, 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 
    78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 
    78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 
    78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 
    79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 
    79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 
    79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 
    79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, 
    80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 
    80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 
    80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 
    80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 81, 
    81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 
    81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 
    81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 
    81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 
    81, 81, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 
    82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 
    82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 
    82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 
    82, 82, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 
    83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 
    83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 
    83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 
    83, 83, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 
    84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 
    84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 
    84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 
    84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 
    85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 
    85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, 
    86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 
    87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 89, 89, 89, 
    89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 91, 91, 91, 
    91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 93, 93, 
    93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 95, 95, 
    95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 97, 97, 97, 
    97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 99, 99, 99, 
    99, 99, 99, 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 
    101, 101, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103, 
    103, 104, 104, 104, 104, 104, 104, 105, 105, 105, 105, 105, 105, 
    106, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 
    108, 108, 108, 108, 108, 108, 108, 109, 109, 109, 109, 109, 109, 
    110, 110, 110, 110, 110, 110, 110, 111, 111, 111, 111, 111, 111, 
    112, 112, 112, 112, 112, 112, 113, 113, 113, 113, 113, 113, 114, 
    114, 114, 114, 114, 114, 115, 115, 115, 115, 115, 115, 116, 116, 
    116, 116, 116, 116, 117, 117, 117, 117, 117, 117, 117, 118, 118, 
    118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, 120, 120, 
    120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, 122, 122, 
    122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 123, 124, 124, 
    124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 126, 126, 
    126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 128, 128, 128, 
    128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 130, 130, 130, 
    130, 130, 130, 131, 131, 131, 131, 131, 131, 131, 132, 132, 132, 
    132, 132, 132, 133, 133, 133, 133, 133, 133, 133, 134, 134, 134, 
    134, 134, 134, 135, 135, 135, 135, 135, 135, 135, 136, 136, 136, 
    136, 136, 136, 137, 137, 137, 137, 137, 137, 138, 138, 138, 138, 
    138, 138, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 
    140, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 
    142, 143, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 
    144, 145, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 
    146, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 
    149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, 
    151, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 152, 153, 
    153, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 154, 155, 
    155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 157, 
    157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 159, 
    159, 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, 160, 160, 
    161, 161, 161, 161, 161, 161, 162, 162, 162, 162, 162, 162, 162, 
    163, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 
    164, 165, 165, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 
    166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 168, 168, 
    168, 168, 168, 168, 168, 169, 169, 169, 169, 169, 169, 169, 170, 
    170, 170, 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, 171, 
    172, 172, 172, 172, 172, 172, 172, 173, 173, 173, 173]) 

py=array([189, 190, 191, 192, 193, 194, 189, 190, 191, 192, 193, 194, 195, 
    190, 191, 192, 193, 194, 195, 196, 190, 191, 192, 193, 194, 195, 
    196, 191, 192, 193, 194, 195, 196, 197, 192, 193, 194, 195, 196, 
    197, 198, 193, 194, 195, 196, 197, 198, 199, 194, 195, 196, 197, 
    198, 199, 200, 194, 195, 196, 197, 198, 199, 200, 201, 195, 196, 
    197, 198, 199, 200, 201, 202, 196, 197, 198, 199, 200, 201, 202, 
    197, 198, 199, 200, 201, 202, 203, 198, 199, 200, 201, 202, 203, 
    199, 200, 201, 202, 203, 204, 199, 200, 201, 202, 203, 204, 205, 
    199, 200, 201, 202, 203, 204, 205, 206, 200, 201, 202, 203, 204, 
    205, 206, 207, 202, 203, 204, 205, 206, 207, 202, 203, 204, 205, 
    206, 207, 208, 203, 204, 205, 206, 207, 208, 209, 204, 205, 206, 
    207, 208, 209, 210, 205, 206, 207, 208, 209, 210, 211, 206, 207, 
    208, 209, 210, 211, 212, 206, 207, 208, 209, 210, 211, 212, 213, 
    207, 208, 209, 210, 211, 212, 213, 214, 208, 209, 210, 211, 212, 
    213, 214, 209, 210, 211, 212, 213, 214, 215, 210, 211, 212, 213, 
    214, 215, 216, 211, 212, 213, 214, 215, 216, 217, 211, 212, 213, 
    214, 215, 216, 217, 212, 213, 214, 215, 216, 217, 218, 219, 213, 
    214, 215, 216, 217, 218, 219, 220, 214, 215, 216, 217, 218, 219, 
    220, 215, 216, 217, 218, 219, 220, 221, 216, 217, 218, 219, 220, 
    221, 222, 217, 218, 219, 220, 221, 222, 223, 218, 219, 220, 221, 
    222, 223, 218, 219, 220, 221, 222, 223, 224, 219, 220, 221, 222, 
    223, 224, 225, 220, 221, 222, 223, 224, 225, 226, 221, 222, 223, 
    224, 225, 226, 227, 221, 222, 223, 224, 225, 226, 227, 228, 222, 
    223, 224, 225, 226, 227, 228, 223, 224, 225, 226, 227, 228, 229, 
    224, 225, 226, 227, 228, 229, 230, 311, 225, 226, 227, 228, 229, 
    230, 309, 310, 311, 312, 313, 225, 226, 227, 228, 229, 230, 231, 
    307, 308, 309, 310, 311, 312, 313, 314, 226, 227, 228, 229, 230, 
    231, 232, 306, 307, 308, 309, 310, 311, 312, 313, 314, 227, 228, 
    229, 230, 231, 232, 304, 305, 306, 307, 308, 309, 310, 311, 312, 
    313, 314, 228, 229, 230, 231, 232, 233, 302, 303, 304, 305, 306, 
    307, 308, 309, 310, 311, 312, 313, 228, 229, 230, 231, 232, 233, 
    234, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 
    312, 229, 230, 231, 232, 233, 234, 298, 299, 300, 301, 302, 303, 
    304, 305, 306, 307, 308, 309, 310, 230, 231, 232, 233, 234, 235, 
    296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 
    309, 230, 231, 232, 233, 234, 235, 236, 294, 295, 296, 297, 298, 
    299, 300, 301, 302, 303, 304, 305, 306, 231, 232, 233, 234, 235, 
    236, 237, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 
    302, 303, 304, 305, 232, 233, 234, 235, 236, 237, 238, 239, 288, 
    289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 
    302, 233, 234, 235, 236, 237, 238, 239, 240, 285, 286, 287, 288, 
    289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 
    234, 235, 236, 237, 238, 239, 240, 283, 284, 285, 286, 287, 288, 
    289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 235, 236, 237, 
    238, 239, 240, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 
    291, 292, 293, 294, 295, 296, 235, 236, 237, 238, 239, 240, 241, 
    278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 
    291, 292, 293, 236, 237, 238, 239, 240, 241, 242, 276, 277, 278, 
    279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 
    237, 238, 239, 240, 241, 242, 243, 273, 274, 275, 276, 277, 278, 
    279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 238, 239, 240, 
    241, 242, 243, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 
    279, 280, 281, 282, 283, 284, 285, 238, 239, 240, 241, 242, 243, 
    244, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 
    279, 280, 281, 282, 283, 239, 240, 241, 242, 243, 244, 265, 266, 
    267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 
    280, 240, 241, 242, 243, 244, 245, 261, 262, 263, 264, 265, 266, 
    267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 240, 241, 
    242, 243, 244, 245, 258, 259, 260, 261, 262, 263, 264, 265, 266, 
    267, 268, 269, 270, 271, 272, 273, 274, 241, 242, 243, 244, 245, 
    246, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 
    267, 268, 269, 270, 271, 272, 241, 242, 243, 244, 245, 246, 247, 
    252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 
    265, 266, 267, 268, 269, 242, 243, 244, 245, 246, 247, 249, 250, 
    251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 
    264, 265, 266, 267, 242, 243, 244, 245, 246, 247, 248, 249, 250, 
    251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 
    243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 
    256, 257, 258, 259, 260, 240, 241, 242, 243, 244, 245, 246, 247, 
    248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 235, 236, 237, 
    238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 
    251, 252, 253, 254, 231, 232, 233, 234, 235, 236, 237, 238, 239, 
    240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 227, 
    228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 
    241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 223, 224, 225, 
    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 
    239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 
    215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 
    228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 
    241, 242, 246, 247, 248, 249, 250, 251, 210, 211, 212, 213, 214, 
    215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 
    228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 246, 247, 
    248, 249, 250, 251, 189, 190, 191, 192, 193, 194, 195, 196, 197, 
    198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 
    211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 
    224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 247, 248, 
    249, 250, 251, 252, 183, 184, 185, 186, 187, 188, 189, 190, 191, 
    192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 
    205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 
    218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 
    247, 248, 249, 250, 251, 252, 172, 173, 174, 175, 176, 177, 178, 
    179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 
    192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 
    205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 
    218, 219, 220, 221, 222, 223, 224, 225, 226, 248, 249, 250, 251, 
    252, 253, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 
    179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 
    192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 
    205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 
    218, 219, 249, 250, 251, 252, 253, 254, 167, 168, 169, 170, 171, 
    172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 
    185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 
    198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 
    211, 212, 213, 249, 250, 251, 252, 253, 254, 167, 168, 169, 170, 
    171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 
    184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 
    197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 250, 251, 
    252, 253, 254, 255, 167, 168, 169, 170, 171, 172, 173, 174, 175, 
    176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 250, 251, 
    252, 253, 254, 255, 168, 169, 170, 171, 172, 173, 174, 175, 176, 
    177, 178, 179, 180, 250, 251, 252, 253, 254, 255, 256, 251, 252, 
    253, 254, 255, 256, 252, 253, 254, 255, 256, 257, 252, 253, 254, 
    255, 256, 257, 258, 253, 254, 255, 256, 257, 258, 253, 254, 255, 
    256, 257, 258, 259, 254, 255, 256, 257, 258, 259, 260, 254, 255, 
    256, 257, 258, 259, 260, 255, 256, 257, 258, 259, 260, 256, 257, 
    258, 259, 260, 261, 256, 257, 258, 259, 260, 261, 256, 257, 258, 
    259, 260, 261, 262, 257, 258, 259, 260, 261, 262, 258, 259, 260, 
    261, 262, 263, 258, 259, 260, 261, 262, 263, 259, 260, 261, 262, 
    263, 264, 259, 260, 261, 262, 263, 264, 260, 261, 262, 263, 264, 
    265, 260, 261, 262, 263, 264, 265, 261, 262, 263, 264, 265, 266, 
    261, 262, 263, 264, 265, 266, 267, 262, 263, 264, 265, 266, 267, 
    262, 263, 264, 265, 266, 267, 268, 263, 264, 265, 266, 267, 268, 
    263, 264, 265, 266, 267, 268, 269, 264, 265, 266, 267, 268, 269, 
    265, 266, 267, 268, 269, 270, 265, 266, 267, 268, 269, 270, 266, 
    267, 268, 269, 270, 271, 266, 267, 268, 269, 270, 271, 267, 268, 
    269, 270, 271, 272, 267, 268, 269, 270, 271, 272, 273, 268, 269, 
    270, 271, 272, 273, 268, 269, 270, 271, 272, 273, 274, 269, 270, 
    271, 272, 273, 274, 269, 270, 271, 272, 273, 274, 275, 270, 271, 
    272, 273, 274, 275, 270, 271, 272, 273, 274, 275, 276, 271, 272, 
    273, 274, 275, 276, 271, 272, 273, 274, 275, 276, 277, 272, 273, 
    274, 275, 276, 277, 273, 274, 275, 276, 277, 278, 273, 274, 275, 
    276, 277, 278, 273, 274, 275, 276, 277, 278, 279, 274, 275, 276, 
    277, 278, 279, 274, 275, 276, 277, 278, 279, 280, 275, 276, 277, 
    278, 279, 280, 275, 276, 277, 278, 279, 280, 281, 276, 277, 278, 
    279, 280, 281, 276, 277, 278, 279, 280, 281, 282, 277, 278, 279, 
    280, 281, 282, 278, 279, 280, 281, 282, 283, 278, 279, 280, 281, 
    282, 283, 279, 280, 281, 282, 283, 284, 279, 280, 281, 282, 283, 
    284, 279, 280, 281, 282, 283, 284, 285, 280, 281, 282, 283, 284, 
    285, 280, 281, 282, 283, 284, 285, 286, 281, 282, 283, 284, 285, 
    286, 281, 282, 283, 284, 285, 286, 287, 282, 283, 284, 285, 286, 
    287, 283, 284, 285, 286, 287, 288, 283, 284, 285, 286, 287, 288, 
    284, 285, 286, 287, 288, 289, 284, 285, 286, 287, 288, 289, 290, 
    285, 286, 287, 288, 289, 290, 286, 287, 288, 289, 290, 291, 286, 
    287, 288, 289, 290, 291, 292, 287, 288, 289, 290, 291, 292, 287, 
    288, 289, 290, 291, 292, 293, 288, 289, 290, 291, 292, 293, 289, 
    290, 291, 292, 293, 294, 289, 290, 291, 292, 293, 294, 295, 290, 
    291, 292, 293, 294, 295, 296, 291, 292, 293, 294, 295, 296, 297, 
    292, 293, 294, 295, 296, 297, 292, 293, 294, 295, 296, 297, 298, 
    293, 294, 295, 296, 297, 298, 299, 294, 295, 296, 297, 298, 299, 
    300, 294, 295, 296, 297, 298, 299, 300, 301, 295, 296, 297, 298, 
    299, 300, 301, 302, 296, 297, 298, 299, 300, 301, 302, 297, 298, 
    299, 300, 301, 302, 303, 298, 299, 300, 301, 302, 303, 304, 299, 
    300, 301, 302, 303, 304, 305, 300, 301, 302, 303, 304, 305, 306, 
    301, 302, 303, 304, 305, 306, 307, 302, 303, 304, 305]) 

要重現的圖像,這MWE應該夠用了,一旦你的數組作爲PX和PY複製粘貼到編輯器從本質上講,這些

import numpy as np 
plot_mtx = np.zeros((5120,5120)) 
px=... 
py=... 
window_size = max(px[-1]-px[0],[py[-1]-py[0]]) 
imshow(plot_mtx[min(px):min(px)+window_size,min(py):min(py)+window_size]) 

是兩條線,每條線寬度約爲6個像素。我想將它們分成兩個不同的行,這樣我就有px_1,py_1代表從上到下運行的代碼,而px_2,py_2代表從左到右運行的代碼。

我到目前爲止找不到合適的關鍵字來找到這樣的算法。我想要的是一個for循環,從一個極端開始,以這樣一種方式完成一個像素位置的列表,循環進行的方向不會超過某個角度,相對於前面的幾個步驟。這樣,該算法將始終採用通過交叉點平滑交叉的像素集。然後,這只是從數據中刪除新找到的行並重新開始。

你有什麼更好的建議嗎?

任何反饋理解

+0

次要評論 - 您的px和py的座標與生成的圖像不匹配。首先,你的'y'座標超過了175,但圖像停在了175. – rayryeng

+0

啊對不起。如果我想發佈他們,我不得不削減載體。無論如何,這兩個向量應該給出一個相對相似的圖像。 – Mathusalem

回答

0
  1. Skeletonize圖像。
  2. 由交叉點分割(它有2個以上的鄰居) - 給你4段。
  3. 將類似指向的對連接在一起 - 您會得到2條骨架線。
  4. 通過接近閾值將原始像素分配給每一行。
+0

非常感謝,我不知道骷髏。我會立即嘗試並回復給你 – Mathusalem

+0

@Mathusalem - 看一下'scikit-image'是一個不錯的開箱即用框架算法:http://scikit-image.org/docs/dev/auto_examples/plot_skeleton html的 – rayryeng