Answers for "how to process an image in knime with a Python script node?"

0

how to process an image in knime with a Python script node?

from KNIPImage import KNIPImage
from scipy import ndimage
  
# Copy structure of incoming KNIME table
output_table = input_table.copy()
  
# Create empty output_column
output_column = []
  
# Loop over every cell in the 'Img' column
for index,input_cell in input_table['Img'].iteritems():
  
    # get image from cell
    image = input_cell.array
  
    # apply some operation of image, here a Gaussian filtering
    filtered = ndimage.gaussian_filter(image, 3)
  
    # Write result back into a KNIPImage
    output_cell = KNIPImage(filtered)
  
    # Append output_cell to output array
    output_column.append(output_cell)
  
# Set output_column in output_table
output_table['Img'] = output_column
Posted by: Guest on July-30-2021

Code answers related to "how to process an image in knime with a Python script node?"

Python Answers by Framework

Browse Popular Code Answers by Language