এই প্রোগ্রামে, আমরা পিলো লাইব্রেরি ব্যবহার করে প্রতিটি চ্যানেলের সমস্ত পিক্সেলের বৈচিত্র্য গণনা করব। একটি ছবিতে মোট তিনটি চ্যানেল রয়েছে এবং তাই, আমরা তিনটি মানের একটি তালিকা পাব৷
৷মূল ছবি

অ্যালগরিদম
Step 1: Import the Image and ImageStat libraries. Step 2: Open the image. Step 3: Pass the image to the stat function of the imagestat class. Step 4: Print the variance of the pixels.
উদাহরণ কোড
from PIL import Image, ImageStat
im = Image.open('image_test.jpg')
stat = ImageStat.Stat(im)
print(stat.var) আউটপুট
[5221.066590958682, 4388.697801428673, 4291.257706548981]