ee.Kernel.rotate

יוצר Kernel.

שימושהחזרות
Kernel.rotate(rotations)ליבה
ארגומנטסוגפרטים
זה: kernelליבההגרעין שיש לסובב.
rotationsמספר שלםמספר הסיבובים של 90 מעלות שצריך לבצע. מספרים שליליים מסתובבים נגד כיוון השעון.

דוגמאות

עורך הקוד (JavaScript)

// A kernel to be rotated.
var sobelKernel = ee.Kernel.sobel();
print(sobelKernel);

/**
 * Output weights matrix
 *
 * [-1, 0, 1]
 * [-2, 0, 2]
 * [-1, 0, 1]
 */

print('One 90 degree clockwise rotation', sobelKernel.rotate(1));

/**
 * [-1, -2, -1]
 * [ 0,  0,  0]
 * [ 1,  2,  1]
 */

print('Two 90 degree counterclockwise rotations', sobelKernel.rotate(-2));

/**
 * [1, 0, -1]
 * [2, 0, -2]
 * [1, 0, -1]
 */

הגדרת Python

מידע על Python API ועל שימוש ב-geemap לפיתוח אינטראקטיבי מופיע בדף Python Environment.

import ee
import geemap.core as geemap

Colab (Python)

from pprint import pprint

# A kernel to be rotated.
sobel_kernel = ee.Kernel.sobel()
pprint(sobel_kernel.getInfo())

#  Output weights matrix

#  [-1, 0, 1]
#  [-2, 0, 2]
#  [-1, 0, 1]

print('One 90 degree clockwise rotation:')
pprint(sobel_kernel.rotate(1).getInfo())

#  [-1, -2, -1]
#  [ 0,  0,  0]
#  [ 1,  2,  1]

print('Two 90 degree counterclockwise rotations:')
pprint(sobel_kernel.rotate(-2).getInfo())

#  [1, 0, -1]
#  [2, 0, -2]
#  [1, 0, -1]