Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のimgオブジェクトがあります
img.shape = (480,640,3)
どうすればimgちょうどいい(480,640)(つまり、を失う,3)のですか?
img
(480,640)
,3
最初の 3 分の 1 が必要な場合は、
newimg = img[..., 0]
残りの 3 分の 2 を二度と必要としないが、最初の 3 分の 1 はしばらく残しておきたい場合は、
img = img[..., 0].copy()
そのため、配列の他の部分を保持しません。