إشعار: يجب
إثبات أهلية جميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إلى Earth Engine.
العمليات الشكلية
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تنفِّذ Earth Engine العمليات الشكلية كعمليات مركزية، وعلى وجه التحديد methods
focalMax()
وfocalMin()
وfocalMedian()
و
focalMode()
في فئة Image
. (هذه اختصارات
للإجراء العام reduceNeighborhood()
الذي يمكنه إدخال
وحدات البكسل في نواة إلى أيّ مُخفِّض يعرض نتيجة رقمية. يُرجى الاطّلاع على
هذه الصفحة للحصول على مزيد من المعلومات عن تقليل
عدد الأحياء). تكون عوامل المعالجة الشكلية مفيدة لإجراء عمليات مثل
التآكل والتمدد والفتح والإغلاق. على سبيل المثال، لتنفيذ
عملية فتح،
استخدِم focalMin()
متبوعًا بـ focalMax()
:
محرِّر الرموز البرمجية (JavaScript)
// Load a Landsat 8 image, select the NIR band, threshold, display.
var image = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318')
.select(4).gt(0.2);
Map.setCenter(-122.1899, 37.5010, 13);
Map.addLayer(image, {}, 'NIR threshold');
// Define a kernel.
var kernel = ee.Kernel.circle({radius: 1});
// Perform an erosion followed by a dilation, display.
var opened = image
.focalMin({kernel: kernel, iterations: 2})
.focalMax({kernel: kernel, iterations: 2});
Map.addLayer(opened, {}, 'opened');
يُرجى العلم أنّه في المثال السابق، يتم تقديم مَعلمة نواة إلى عامل المعالجة الصرفية. يتم استخدام البكسلات التي تغطيها عناصر غير صفرية من النواة في عملية حساب. تشير وسيطة التكرارات إلى عدد المرات التي سيتم فيها تطبيق المشغِّل.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eEarth Engine uses focal operations like \u003ccode\u003efocalMax()\u003c/code\u003e, \u003ccode\u003efocalMin()\u003c/code\u003e, \u003ccode\u003efocalMedian()\u003c/code\u003e, and \u003ccode\u003efocalMode()\u003c/code\u003e to implement morphological operations for image processing.\u003c/p\u003e\n"],["\u003cp\u003eMorphological operations, such as erosion, dilation, opening, and closing, can be performed using these focal operations to modify image structures.\u003c/p\u003e\n"],["\u003cp\u003eUsers can define kernels to specify the shape and size of the neighborhood used in the operations and control the number of times the operation is applied with the iterations argument.\u003c/p\u003e\n"],["\u003cp\u003eAn opening operation, for example, can be achieved by applying \u003ccode\u003efocalMin()\u003c/code\u003e followed by \u003ccode\u003efocalMax()\u003c/code\u003e with a defined kernel.\u003c/p\u003e\n"]]],["Earth Engine's `Image` class provides `focalMax()`, `focalMin()`, `focalMedian()`, and `focalMode()` for morphological operations like erosion, dilation, opening, and closing. These operations use a kernel to define the neighborhood of pixels. For example, the opening operation is achieved by applying `focalMin()` then `focalMax()`. A kernel argument defines the area for computation, and the iterations argument specifies the number of operator applications. The provided code demonstrates the opening operation on a Landsat 8 image using a circular kernel.\n"],null,["# Morphological Operations\n\nEarth Engine implements morphological operations as focal operations, specifically\n`focalMax()`, `focalMin()`, `focalMedian()`, and\n`focalMode()` instance methods in the `Image` class. (These are\nshortcuts for the more general `reduceNeighborhood()`, which can input the\npixels in a kernel to any reducer with a numeric output. See\n[this page](/earth-engine/guides/reducers_reduce_neighborhood) for more information on reducing\nneighborhoods). The morphological operators are useful for performing operations such\nas erosion, dilation, opening and closing. For example, to perform an\n[opening operation](http://en.wikipedia.org/wiki/Opening_(morphology)),\nuse `focalMin()` followed by `focalMax()`:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load a Landsat 8 image, select the NIR band, threshold, display.\nvar image = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318')\n .select(4).gt(0.2);\nMap.setCenter(-122.1899, 37.5010, 13);\nMap.addLayer(image, {}, 'NIR threshold');\n\n// Define a kernel.\nvar kernel = ee.Kernel.circle({radius: 1});\n\n// Perform an erosion followed by a dilation, display.\nvar opened = image\n .focalMin({kernel: kernel, iterations: 2})\n .focalMax({kernel: kernel, iterations: 2});\nMap.addLayer(opened, {}, 'opened');\n```\n\nNote that in the previous example, a kernel argument is provided to the morphological\noperator. The pixels covered by non-zero elements of the kernel are used in the\ncomputation. The iterations argument indicates how many times to apply the operator."]]