ee.Image.cast
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ส่งผ่านบางแบนด์หรือทั้งหมดของรูปภาพไปยังประเภทที่ระบุ
การใช้งาน | การคืนสินค้า |
---|
Image.cast(bandTypes, bandOrder) | รูปภาพ |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ image | รูปภาพ | รูปภาพที่จะแคสต์ |
bandTypes | พจนานุกรม | พจนานุกรมจากชื่อวงดนตรีไปยังประเภทวงดนตรี ประเภทอาจเป็น PixelTypes หรือสตริง สตริงที่ใช้ได้คือ "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "byte", "short", "int", "long", "float" และ "double" หาก bandTypes มีแถบที่ไม่ได้อยู่ในรูปภาพอินพุต ระบบจะเพิ่มแถบเหล่านั้นลงในรูปภาพเป็นแถบโปร่งใส หากไม่ได้ระบุ bandOrder ด้วย ระบบจะผนวกแถบใหม่ตามลำดับตัวอักษร |
bandOrder | รายการ (ค่าเริ่มต้น: null) | รายการที่ระบุลำดับของแถบในผลลัพธ์ หากระบุ ต้องตรงกับรายชื่อวงดนตรีทั้งหมดในผลการค้นหา |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eCasts image bands to specified data types like 'int8', 'float', etc., allowing for data type conversions within an image.\u003c/p\u003e\n"],["\u003cp\u003eAccepts a dictionary mapping band names to desired types, enabling selective casting for individual bands.\u003c/p\u003e\n"],["\u003cp\u003eCan introduce new bands with specified types, appending them to the image with optional ordering using the \u003ccode\u003ebandOrder\u003c/code\u003e parameter.\u003c/p\u003e\n"],["\u003cp\u003eReturns a new Image with the converted bands, preserving the original image unchanged.\u003c/p\u003e\n"]]],["The `Image.cast` function modifies an image by changing the data type of its bands. It takes a dictionary, `bandTypes`, mapping band names to new data types (PixelTypes or strings like 'int8', 'float'). If a specified band is not present in the original image, a transparent band of that type is added. An optional `bandOrder` list defines the sequence of the resulting bands. The function returns the modified `Image`.\n"],null,["# ee.Image.cast\n\nCasts some or all bands of an image to the specified types.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------------------------------|---------|\n| Image.cast`(bandTypes, `*bandOrder*`)` | Image |\n\n| Argument | Type | Details |\n|---------------|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `image` | Image | The image to cast. |\n| `bandTypes` | Dictionary | A dictionary from band name to band types. Types can be PixelTypes or strings. The valid strings are: 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'byte', 'short', 'int', 'long', 'float', and 'double'. If bandTypes includes bands that are not already in the input image, they will be added to the image as transparent bands. If bandOrder isn't also specified, new bands will be appended in alphabetical order. |\n| `bandOrder` | List, default: null | A list specifying the order of the bands in the result. If specified, must match the full list of bands in the result. |"]]