如何从一系列数字中获取最小和最大数字?

How to get the minimum and maxmum number from a series of numbers?

我很难使用 python 裁剪图像。我有一系列数字代表图像上的 x,y 坐标。我试图根据最小和最大坐标数从图像中裁剪出一个矩形部分。

例如,这里是 x,y 坐标: 1900,199 1500,155, 1200,120 1000,100

x 的最小值和最大值是 10001900,最小值和y 的最大值分别为 100199。我如何根据那个裁剪图像?

我是 python 的新手,不太确定这样做的正确方法是什么。 请帮忙!非常感谢!!

这里是x,y坐标的原始系列:

1653,146 1651,148 1642,148 1642,166 1640,169 1626,169 1624,166 1624,164 1603,164 1601,162 1601,148 1548,148 1546,151 44,515 1557 1544,166 1541,169 1539,169 1537,166 1471,166 1468,164 1468,157 1466,155 1464,155 1462,153 1372,153 1372,155 1370,157 1363,157 1363,164 1361,166 1297, 166 1295,169 1260,169 1256,164 1213,164 1210,166 1167,166 1165,164 1165,162 1162,159 1160,159 1158,157 1151,157 1149,155 1114,155 1112,153 1112,150 1110 ,148 1062,148 1057,153 1053,153 1050,155 1046,155 1046,194 1048,196 1048,196 1048,264 1094,264 1096,264 1096,267 1142,267 1142,267 1144,264 1151,2641151,264 11555,264 11555555555555,26411555555555,26411555555555555555,26411555555555555555,264115555555555太平洋表彰1167,292 1210,292 1210,264 1213,262 1215,262 1217,260 1256,260 1260,255 1263,255 1265,258 1329,258 1331,255 1366,255 1366,253 1368,251 1384,251 1391, 258 1393,258 1395,260 1452,260 1455,262 1477,262 1480,264 1480,276 1482,276 1482,276 1484,278 1535,278 1535,278 ,262 1697,262 1699,260 1701,260 1704,258 1706,258 1708,255 1708,217 1704,217 1701,214 1701,198 1699,196 1699 ,194 1701,191 1701,150 1697,146

s = "1653,146 1651,148 1642,148 1642,166 1640,169 1626,169 1624,166 1624,164 1603,164 1601,162 1601,148 1548,148 1546,150 1546,155 1544,157 1544,166 1541,169 1539,169 1537,166 1471,166 1468,164 1468,157 1466,155 1464,155 1462,153 1372,153 1372,155 1370,157 1363,157 1363,164 1361,166 1297,166 1295,169 1260,169 1256,164 1213,164 1210,166 1167,166 1165,164 1165,162 1162,159 1160,159 1158,157 1151,157 1149,155 1114,155 1112,153 1112,150 1110,148 1062,148 1057,153 1053,153 1050,155 1046,155 1046,194 1048,196 1048,264 1094,264 1096,267 1142,267 1144,264 1151,264 1155,260 1165,260 1167,262 1167,292 1210,292 1210,264 1213,262 1215,262 1217,260 1256,260 1260,255 1263,255 1265,258 1329,258 1331,255 1366,255 1366,253 1368,251 1384,251 1391,258 1393,258 1395,260 1452,260 1455,262 1477,262 1480,264 1480,276 1482,276 1484,278 1535,278 1537,276 1537,264 1539,262 1596,262 1599,260 1612,260 1615,262 1697,262 1699,260 1701,260 1704,258 1706,258 1708,255 1708,217 1704,217 1701,214 1701,198 1699,196 1699,194 1701,191 1701,150 1697,146"
s = s.split(' ')
s = [list(map(int, i.split(','))) for i in s]

x = [i[0] for i in s]
y = [i[1] for i in s]

max_X, min_X = max(x), min(x)
max_Y, min_Y = max(y), min(y)

print(max_X, min_X)
print(max_Y, min_Y)
# 1708 1046
# 292 146