ประกาศ : โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดที่ลงทะเบียนเพื่อใช้ Earth Engine ก่อนวันที่
15 เมษายน 2025 ต้อง
ยืนยันการมีสิทธิ์ที่ไม่ใช่เชิงพาณิชย์ เพื่อรักษาสิทธิ์เข้าถึง หากคุณไม่ยืนยันภายในวันที่ 26 กันยายน 2025 ระบบอาจระงับสิทธิ์เข้าถึงของคุณ
ส่งความคิดเห็น
ee.Image.subtract
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ลบค่าที่ 2 ออกจากค่าแรกสำหรับคู่แถบที่ตรงกันแต่ละคู่ใน image1 และ image2 หาก image1 หรือ image2 มีแถบเพียง 1 แถบ ระบบจะใช้แถบนั้นกับแถบทั้งหมดในรูปภาพอีกรูป หากรูปภาพมีจำนวนแถบเท่ากันแต่ชื่อไม่เหมือนกัน ระบบจะใช้รูปภาพเป็นคู่ตามลำดับธรรมชาติ โดยแถบเอาต์พุตจะตั้งชื่อตามอินพุตที่ยาวกว่า หรือหากอินพุตทั้ง 2 มีความยาวเท่ากัน ก็จะตั้งชื่อตามลำดับของ image1 ประเภทของพิกเซลเอาต์พุตคือการรวมประเภทอินพุต
การใช้งาน การคืนสินค้า Image. subtract (image2)
รูปภาพ
อาร์กิวเมนต์ ประเภท รายละเอียด ดังนี้ image1
รูปภาพ รูปภาพที่ใช้ดึงแถบตัวถูกดำเนินการด้านซ้าย image2
รูปภาพ รูปภาพที่ใช้ดึงแถบตัวถูกดำเนินการด้านขวา
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
// A Sentinel-2 surface reflectance image.
var img = ee . Image ( 'COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG' );
// Subset two image bands and display them on the map.
var swir1 = img . select ( 'B11' );
var swir2 = img . select ( 'B12' );
Map . setCenter ( - 122.276 , 37.456 , 12 );
Map . addLayer ( swir1 , { min : 0 , max : 3000 }, 'swir1' );
Map . addLayer ( swir2 , { min : 0 , max : 3000 }, 'swir2' );
// The following examples demonstrate ee.Image arithmetic methods using two
// single-band ee.Image inputs.
var addition = swir1 . add ( swir2 );
Map . addLayer ( addition , { min : 100 , max : 6000 }, 'addition' );
var subtraction = swir1 . subtract ( swir2 );
Map . addLayer ( subtraction , { min : 0 , max : 1500 }, 'subtraction' );
var multiplication = swir1 . multiply ( swir2 );
Map . addLayer ( multiplication , { min : 1.9e5 , max : 9.4e6 }, 'multiplication' );
var division = swir1 . divide ( swir2 );
Map . addLayer ( division , { min : 0 , max : 3 }, 'division' );
var remainder = swir1 . mod ( swir2 );
Map . addLayer ( remainder , { min : 0 , max : 1500 }, 'remainder' );
// If a number input is provided as the second argument, it will automatically
// be promoted to an ee.Image object, a convenient shorthand for constants.
var exponent = swir1 . pow ( 3 );
Map . addLayer ( exponent , { min : 0 , max : 2e10 }, 'exponent' );
การตั้งค่า Python
ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap
เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า
สภาพแวดล้อม Python
import ee
import geemap.core as geemap
Colab (Python)
# A Sentinel-2 surface reflectance image.
img = ee . Image ( 'COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG' )
# Subset two image bands and display them on the map.
swir_1 = img . select ( 'B11' )
swir_2 = img . select ( 'B12' )
m = geemap . Map ()
m . set_center ( - 122.276 , 37.456 , 12 )
m . add_layer ( swir_1 , { 'min' : 0 , 'max' : 3000 }, 'swir_1' )
m . add_layer ( swir_2 , { 'min' : 0 , 'max' : 3000 }, 'swir_2' )
# The following examples demonstrate ee.Image arithmetic methods using two
# single-band ee.Image inputs.
addition = swir_1 . add ( swir_2 )
m . add_layer ( addition , { 'min' : 100 , 'max' : 6000 }, 'addition' )
subtraction = swir_1 . subtract ( swir_2 )
m . add_layer ( subtraction , { 'min' : 0 , 'max' : 1500 }, 'subtraction' )
multiplication = swir_1 . multiply ( swir_2 )
m . add_layer ( multiplication , { 'min' : 1.9e5 , 'max' : 9.4e6 }, 'multiplication' )
division = swir_1 . divide ( swir_2 )
m . add_layer ( division , { 'min' : 0 , 'max' : 3 }, 'division' )
remainder = swir_1 . mod ( swir_2 )
m . add_layer ( remainder , { 'min' : 0 , 'max' : 1500 }, 'remainder' )
# If a number input is provided as the second argument, it will automatically
# be promoted to an ee.Image object, a convenient shorthand for constants.
exponent = swir_1 . pow ( 3 )
m . add_layer ( exponent , { 'min' : 0 , 'max' : 2e10 }, 'exponent' )
m
ส่งความคิดเห็น
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
หากต้องการบอกให้เราทราบเพิ่มเติม
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-26 UTC"],[],["The `subtract` method computes the difference between two images (`image1` and `image2`). It subtracts corresponding bands pairwise. If one image has a single band, it's subtracted from all bands of the other image. When images have different band names but the same count, they're matched in order. Output bands are named after the longer input's band names, with the pixel type as a union of the input types. The code also gives examples of usage with `add`, `multiply`, `divide`, `mod`, and `pow`.\n"]]