在MatOfInt上使用中位数模糊时的故障结果

时间:2019-05-04 18:00:28

标签: java opencv

我正在尝试在Imgproc.medianBlur上使用MatOfInt

Imgproc.medianBlur(src, dst, i);

结果是随机的,有时会直接返回src Mat的值,有时会返回非常大的数字列表。我尝试过

  • blur()
  • GaussianBlur()
  • medianBlur()
  • bilateralFilter()

只有blur()适用于我的数组。

以下是一些回报:

-2560,1220905800,-651259,-1786033921,-2560,278235464,1224736758,-167209589,-1991704577,-649067,277694719,607945537,1686980608,-1152843740,0,0,1104412481,187,-612020992,-1957950860,-46947,335495679,-963950192,541494089,-259684024,1241513958,-1153316981,0,1960543565,-1651815414,-184,-1877737663,1104120649,1207975811,44429,-1152843776,0,0,1221852993,-435124855,-1153302529,0,1960543565,-1651815414,-184,-1877737663,277187400,1224736742,-1958164341,280641792,-12357911,-1958170544,-1048491827,-4720,-1870296760,1107296237,187,-612020992,-1957950860,-46947,335495679,-980727664,-309328568,-1958150145,-1207613243,1224736744,-309295773,-2054553601,-5960,-1803197624,-1979711507,-1524603,-980727553,-390593208,-1991704577,-1695611,269480959,5,1510994688,286257856,-1650555,12272127,1291845632,175430533,1218284364,1107296255,1217401855,-434074229,267583487,-422542064,267583487,267569168,51546,5371,849,5390,851,5393,856,5398,858,5403,858,5406,858,5411,858,5417,858,5420,858,5420,858,5435,863,5454,865,5457,870,5462,872,5467,872,5470,872,5475,872,5481,872,5484,872,5484,872,5499,877,5518,879,5521,884,5526,886,5531,886,5534,886,5539,886,5545,886,5548,886,5548,886,5563,891,5582,893,5585,898,5590,900,5595,900,5598,900,5603,900,5609,900,5612,900,5612,900,5627,905,5646,907,5649,912,5654,914,5659,914,5662,914,5667,914,5673,914,5676,914,5676,360,0,524420569,-2147482290,921,5713,926,5718,928,5723,928,5726,928,5731,928,5737,928,5740,928,5740,928,5755,933,5774,935,5777,940,5782,942,5787,942,5790,942,5795,942,5801,942,5804,942,5804,942,5819,947,5838,949,5841,949,5846,954,5849,954,5849,954,5854,961,5883,961,5886,963,5899,963,5939,963,5942,963,5945,963,5945,963,5970,968,5996,968,5998,973,6004,973,6011,975,6018,975,6021,975,6034,975,6038,975,6040,975,6050,975,6053,975,6056,1185,6058,1185,6058,1186,6103,1188,6108,1188,6134,1188,6137,1188,6142,1188,6145,1188,6145,1193,6163,1194,6193,1199,6198,1199,6224,1199,6227,1199,6232,1199,6235,1199,6235,1204,6251,1204,6270,1209,6275,1209,6275,1210,6320,1212,6325,1212,6351,1212,6354,1212,6359,1212,6362,1212,6362,1217,6379,1218,6409,1223,6414,1223,6440,1223,6443,1223,6448,1223,6451,1223,6451,1228,6467,1228,6486,1233,6491,1233,6491,1234,6536,1236,6541,1236,6567,1236,6570,1236,6575,1236,6578,1236,6578,1241,6595,1242,6625,1247,6630,1247,6656,1247,6659,1247,6664,1247,6667,1247,6667,1252,6683,1252,6702,1257,6707,1257,6707,1258,6752,1260,6757,1260,6783,1260,6786,1260,6791,1260,6794,1260,6794,1265,6811,1266,6841,1271,6846,1271,6872,1271,6875,1271,6880,1271,6883,1271,6883,1276,6899,1276,6918,1281,6923,1281,6923,1282,6968,1284,6973,1284,6999,1284,7002,1284,7007,1284,7010,1284,7010,1289,7027,1290,7057,1295,7062,1295,7088,1295,7091,1295,7096,1295,7099,1295,7099,1300,7115,1300,7134,1305,7139,1305,7139,1306,7184,1308,7189,1308,7215,1308,7218,1308,7223,1308,7226,1308,7226,1313,7243,1314,7273,1319,7278,1319,7304,1319,7307,1319,7312,1319,7315,1319,7315,1324,7331,1324,7350,1329,7355,1329,7355,1330,7400,1332,7405,1332,7431,1332,7434,1332,7439,1332,7442,1332,7442,1337,7459,1338,7489,1343,7494,1343,7520,1343,7523,1343,7528,1343,7531,1343,7531,1348,7547,1348,7566,1353,7571,1353,7571,1354,7616,1356,7621,1356,7647,1356,7650,1356,7655,1356,7658,1356,7658,1361,7675,1362,7705,1367,7710,1367,7736,1367,7739,1367,7744,1367,7747,1367,7747,1372,7763,1372,7782,1377,7787,1377,7787,1378,7832,1380,7837,1380,7863,1380,7866,1380,7871,1380,7874,1380,7874,1385,7891,1386,7921,1391,7926,1391,7952,1391,7955,1391,7960,1391,7963,1391,7963,1396,7979,1396,7998,1401,8003,1401,8003,1402,8048,1404,8053,1404,8079,1404,8082,1404,8087,1404,8090,1404,8090,1409,8107,1410,8137,1415,8142,1415,8168,1415,8171,1415,8176,1415,8179,1415,8179,1420,8195,1420,8214,1425,8219,1425,8219,1426,8264,1428,8269,1428,8295,1428,8298,1428,8303,1428,8306,1428,8306,1433,8323,1434,8353,1439,8358,1439,8384,1439,8387,1439,8392,1439,8395,1439,8395,1444,8411,1444,8430,1449,8435,1449,8435,1450,8480,1452,8485,1452,8511,1452,8514,1452,8519,1452,8522,1452,8522,1457,8539,1458,8569,1463,8574,1463,8600,1463,8603,1463,8608,1463,8611,1463,8611,1468,8627,1468,8646,1473,8651,1473,8651,1474,8696,1476,8701,1476,8727,1476,8730,1476,8735,1476,8738,1476,8738,1481,8755,1482,8785,1487,8790,1487,8816,1487,8819,1487,8824,1487,8827,1487,8827,1492,8843,1492,8862,1497,8867,1497,8867,1498,8912,1500,8917,1500,8943,1500,8946,1500,8951,1500,8954,1500,8954,1505,8971,1506,9001,1511,9006,1511,9032,1511,9035,1511,9040,1511,9043,1511,9043,1516,9059,1516,9078,1521,9083,1521,9083,1522,9128,1524,9133,1524,9159,1524,9162,1524,9167,1524,9170,1524,9170,1529,9187,1530,9217,1535,9222,1535,9248,1535,9251,1535,9256,1535,9259,1535,9259,1540,9275,1540,9294,1545,9299,1545,9299,1546,9344,1548,9349,1548,9375,1548,9378,1548,9383,1548,9386,1548,9386,1553,9403,1554,9433,1559,9438,1559,9464,1559,9467,1559,9472,1559,9475,1559,9475,1564,9491,1564,9510,1569,9515,1569,9515,1570,9560,1572,9565,1572,9591,1572,9594,1572,9599,1572,9602,1572,9602,1577,9619,1578,9649,1583,9654,1583,9680,1583,9683,1583,9688,1583,9691,1583,9691,1588,9707,1588,9726,1593,9731,1593,9731,1594,9776,1599,9781,1599,9807,1599,9810,1599,9815,1599,9818,1599,9818,1604,9835,1605,9858,1606,9886,1606,9912,1606,9915,1606,9918,1606,9918,1606,9938,1613,9964,1614,9974,1614,10007,1614,10010,1614,10013,1614,10013,1619,10027,1619,10046,1624,10051,1624,10051,1625,10096,1630,10101,1630,10127,1630,10130,1630,10135,1630,10138,1630,10138,1635,10155,1636,10178,1637,10206,1637,10232,1637,10235,1637,10238,1637,10238,1637,10258,1644,10284,1645,10294,1645,10327,1645,10330,1645,10333,1645,10333,1650,10347,1650,10366,1655,10371,1655,10371,1656,10416,1661,10421,1661,10447,1661,10450,1661,10455,1661,10458,1661,10458,1666,10475,1667,10498,1668,10526,1668,10552,1668,10555,1668,10558,1668,10558,1668,10578,1675,10604,1676,10614,1676,10647,1676,10650,1676,10653,1676,10653,1681,10667,1681,

有时候是:

0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,260,0,464224351,-2147479808,0,2612,2616,2704,2954,2960,2992,3023,3024,3056,3707,3712,3744,3759,3760,3792,4194,4200,4240,4424,4424,4448,6489,6496,6704,7028,7032,7056,8155,8160,8176,8507,8512,8544,8678,8680,8704,8839,8840,8864,8999,9000,9024,9166,9168,9184,9368,9368,9392,9718,9720,9744,10883,10888,10912,11236,11240,11264,11458,11464,11488,11927,11928,11968,13603,13608,13632,13980,13984,14000,14179,14184,14208,15468,15472,15536,15678,15680,15696,15968,15968,15984,16511,16512,16528,16670,16672,16688,16830,16832,16848,16994,17000,17024,22146,22152,22352,23286,23288,23360,23502,23504,23520,23535,23536,23568,23621,23624,23648,23857,23864,23904,26649,26656,26768,26873,26880,26896,27425,27432,27456,29855,29856,29920,30090,30096,30112,30127,30128,30160,32772,32776,32864,33114,33120,33152,33183,33184,33216,33914,33920,33968,37922,37928,38080,38222,38224,38240,39619,39624,39648,41203,41208,41232,41402,41408,41424,

输入数组的值相当连续。通常范围是500-1200

我想知道medianBlur的输入Mat是否有其他要求?

我的函数在下面,它在Unity中,所以它是C#。

private List<long> SmoothDistanceCurve(List<long> croppedDistances, int smoothKernelSize)
{
    //TODO:
    MatOfInt oMat = new MatOfInt(croppedDistances.Select(i => (int)i).ToArray());
    MatOfInt dstMat = new MatOfInt();
    Imgproc.medianBlur(oMat, dstMat, smoothKernelSize);
    var returnList = dstMat.toList().Select(i => (long)i);
    return returnList.ToList();
}

0 个答案:

没有答案