ee.Image.stratifiedSample
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ดึงตัวอย่างแบบสุ่มแบบแบ่งชั้นของจุดจากรูปภาพ ดึงตัวอย่างตามจำนวนที่ระบุสำหรับแต่ละค่าที่ไม่ซ้ำกันที่พบใน "classBand" แสดงผล FeatureCollection ของฟีเจอร์ 1 รายการต่อจุดที่ดึงออกมา โดยแต่ละฟีเจอร์จะมีพร็อพเพอร์ตี้ 1 รายการต่อแบนด์ในรูปภาพอินพุต หากมีตัวอย่างน้อยกว่าจำนวนที่ระบุสำหรับค่าคลาสที่กำหนด ระบบจะรวมจุดทั้งหมดสำหรับคลาสนั้น กำหนดให้ classBand มีค่าจำนวนเต็ม
การใช้งาน | การคืนสินค้า |
---|
Image.stratifiedSample(numPoints, classBand, region, scale, projection, seed, classValues, classPoints, dropNulls, tileScale, geometries) | FeatureCollection |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ image | รูปภาพ | รูปภาพที่จะสุ่มตัวอย่าง |
numPoints | จำนวนเต็ม | จำนวนจุดเริ่มต้นที่จะสุ่มในแต่ละคลาส สามารถลบล้างสำหรับชั้นเรียนที่เฉพาะเจาะจงได้โดยใช้พร็อพเพอร์ตี้ "classValues" และ "classPoints" |
classBand | สตริง ค่าเริ่มต้น: null | ชื่อของช่วงที่มีชั้นเรียนที่จะใช้ในการแบ่งชั้น หากไม่ได้ระบุ ระบบจะใช้แถบแรกของรูปภาพอินพุต |
region | เรขาคณิต ค่าเริ่มต้น: null | ภูมิภาคที่จะสุ่มตัวอย่าง หากไม่ได้ระบุ ระบบจะใช้ร่องรอยทั้งหมดของรูปภาพอินพุต |
scale | ลอย ค่าเริ่มต้น: null | มาตราส่วนที่ระบุเป็นเมตรของภาพฉายที่จะสุ่มตัวอย่าง ค่าเริ่มต้นคือขนาดของแถบแรกของรูปภาพอินพุต |
projection | การฉายภาพ ค่าเริ่มต้น: null | การฉายภาพที่จะสุ่มตัวอย่าง หากไม่ได้ระบุ ระบบจะใช้การฉายภาพของแถบแรกของรูปภาพอินพุต หากระบุเพิ่มเติมจากสเกล ระบบจะปรับขนาดใหม่เป็นสเกลที่ระบุ |
seed | จำนวนเต็ม ค่าเริ่มต้น: 0 | ค่าเริ่มต้นของการสุ่มที่จะใช้สำหรับการสุ่มตัวอย่างย่อย |
classValues | รายการ (ค่าเริ่มต้น: null) | รายการค่าคลาสที่จะลบล้างพารามิเตอร์ numPoints ต้องมีขนาดเท่ากับ classPoints หรือ null |
classPoints | รายการ (ค่าเริ่มต้น: null) | รายการจำนวนพิกเซลสูงสุดต่อคลาสที่จะสุ่มตัวอย่างสำหรับแต่ละคลาสในรายการ classValues ต้องมีขนาดเท่ากับ classValues หรือ null |
dropNulls | บูลีน ค่าเริ่มต้น: จริง | ข้ามพิกเซลที่มีการมาสก์แถบใดแถบหนึ่ง |
tileScale | Float, ค่าเริ่มต้น: 1 | ปัจจัยการปรับขนาดที่ใช้เพื่อลดขนาดไทล์การรวม การใช้ tileScale ที่ใหญ่ขึ้น (เช่น 2 หรือ 4) อาจเปิดใช้การคำนวณที่หน่วยความจำหมดด้วยค่าเริ่มต้น |
geometries | บูลีน ค่าเริ่มต้น: false | หากเป็นจริง ผลลัพธ์จะมีเรขาคณิตต่อพิกเซลที่สุ่มตัวอย่าง ไม่เช่นนั้น ระบบจะละเว้นรูปทรงเรขาคณิต (ประหยัดหน่วยความจำ) |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eExtracts a stratified random sample of points from an image based on distinct class values within a specified band.\u003c/p\u003e\n"],["\u003cp\u003eReturns a FeatureCollection containing one feature per sampled point, each with properties corresponding to the image bands.\u003c/p\u003e\n"],["\u003cp\u003eAllows customization of the number of samples per class, sampling region, scale, projection, and randomization.\u003c/p\u003e\n"],["\u003cp\u003eHandles cases with insufficient samples for a class by including all available points for that class.\u003c/p\u003e\n"],["\u003cp\u003eRequires the class band to contain integer values for proper stratification.\u003c/p\u003e\n"]]],[],null,["# ee.Image.stratifiedSample\n\nExtracts a stratified random sample of points from an image. Extracts the specified number of samples for each distinct value discovered within the 'classBand'. Returns a FeatureCollection of 1 Feature per extracted point, with each feature having 1 property per band in the input image. If there are less than the specified number of samples available for a given class value, then all of the points for that class will be included. Requires that the classBand contain integer values.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|\n| Image.stratifiedSample`(numPoints, `*classBand* `, `*region* `, `*scale* `, `*projection* `, `*seed* `, `*classValues* `, `*classPoints* `, `*dropNulls* `, `*tileScale* `, `*geometries*`)` | FeatureCollection |\n\n| Argument | Type | Details |\n|---------------|---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `image` | Image | The image to sample. |\n| `numPoints` | Integer | The default number of points to sample in each class. Can be overridden for specific classes using the 'classValues' and 'classPoints' properties. |\n| `classBand` | String, default: null | The name of the band containing the classes to use for stratification. If unspecified, the first band of the input image is used. |\n| `region` | Geometry, default: null | The region to sample from. If unspecified, the input image's whole footprint is used. |\n| `scale` | Float, default: null | A nominal scale in meters of the projection to sample in. Defaults to the scale of the first band of the input image. |\n| `projection` | Projection, default: null | The projection in which to sample. If unspecified, the projection of the input image's first band is used. If specified in addition to scale, rescaled to the specified scale. |\n| `seed` | Integer, default: 0 | A randomization seed to use for subsampling. |\n| `classValues` | List, default: null | A list of class values for which to override the numPoints parameter. Must be the same size as classPoints or null. |\n| `classPoints` | List, default: null | A list of the per-class maximum number of pixels to sample for each class in the classValues list. Must be the same size as classValues or null. |\n| `dropNulls` | Boolean, default: true | Skip pixels in which any band is masked. |\n| `tileScale` | Float, default: 1 | A scaling factor used to reduce aggregation tile size; using a larger tileScale (e.g., 2 or 4) may enable computations that run out of memory with the default. |\n| `geometries` | Boolean, default: false | If true, the results will include a geometry per sampled pixel. Otherwise, geometries will be omitted (saving memory). |"]]