0

Now, I have a cropland map. It's only one band, 1=cropland,0=Non-cropland. So how to calculate how many pixels=1 in a 3*3 kernel? and then get a map of contain the numbers.

eg:

[1,0,1],  
[1,0,1],  
[1,1,0] 

stand for 9 pixels. how to get the number of '1' =6?

1

1 Answer 1

1

Probably just sum it. If you sum of 3x3 kernel, you will have how many ones you have.

1
  • Cool 🙇‍ You are amazing, I will continue to follow your blog
    – Hang zhao
    Commented Mar 2, 2022 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.