Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert .tiff image stack to unit8 format

import cv2 
import numpy as np
import os
import imageio

#Import data
ret, img_stack = cv2.imreadmulti(file_import,[],cv2.IMREAD_GRAYSCALE) 
#Convert to real binary
img_stack_u8 = []
for i in range(0,len(img_stack)):
    img_u8 = img_stack[i].astype(np.uint8)
    img_stack_u8.append(img_u8)
#Export data
imageio.mimwrite(file_export,img_stack_u8, format = 'tif')
 
PREVIOUS NEXT
Tagged: #convert #image #stack #format
ADD COMMENT
Topic
Name
7+7 =