I have a 16 bit RGB tiff image and i wish to read in PIL in order to apply the filter BLUR and SHARPEN, but when i run the fuction to read the image i get the error message IOError: cannot identify image file 'C:\\cdraw\\test16bit.tiff'
from PIL import Image
myfile = 'C:\\cdraw\\test16bit.tiff'
myimage = Image.open(myfile)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Python27\lib\site-packages\PIL\Image.py", line 2330, in open
% (filename if filename else fp))
IOError: cannot identify image file 'C:\\cdraw\\test16bit.tiff'
I am able to import the RGB 16-bit TIFF image using s cikit-image: Image processing in Python but i am not able to convert the numpy.array in a PIL object if this is possible
from skimage import io
im = io.imread(myfile)
im.dtype
dtype('uint16')
im.shape
(4024L, 6024L, 3L)
It seems to be some issues with PIL and 16 bits tiffs. However you seem to want some very classical filters, that you can find in other libraries. What you can do is import with skimage (or matplotlib) and process your image with skimage or scipy.
you can find a lot of documentation here for scipy image processing : http://scipy-lectures.github.io/advanced/image_processing/#blurring-smoothing
and for skimage : http://scikit-image.org/docs/dev/auto_examples/applications/plot_rank_filters.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.