examples.rst.txt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. Examples
  2. =====================================
  3. Some examples are already available into documentation. You can find here some others and results of use of IPFML package.
  4. All examples below will use this picture.
  5. .. image:: _static/nature.jpg
  6. Processing example
  7. --------------------
  8. .. code:: python
  9. from PIL import Image
  10. from ipfml.processing import transform
  11. img_path = 'path/to/image_nature.jpg'
  12. img = Image.open(img_path)
  13. low_bits_img = transform.rgb_to_grey_low_bits(img, 6)
  14. output = Image.fromarray(low_bits_img)
  15. output.show()
  16. Now we have picture information with only the 6 low bits values.
  17. .. image:: _static/nature_low_bits_6.png
  18. Noise filter example
  19. ---------------------
  20. .. code:: python
  21. from PIL import Image
  22. from ipfml.filters import noise as nf
  23. img_path = 'path/to/image_nature.jpg'
  24. img = Image.open(img_path)
  25. # set noise impact to 400
  26. # set same noise for each chanel
  27. noisy_image = nf.gaussian_noise(img, n=400, identical=True)
  28. output = Image.fromarray(noisy_image)
  29. output.show()
  30. Image result after applying gaussian noise on nature image.
  31. .. image:: _static/nature_gaussian_noise.png