I have a 6 bands image (Red, Grean, Blue, Near infra red, Red edge and height) that neads segmentation to detect apple Trees. I found a hard time trying to do this task using skimage. an example of a problem that I face is when I run my code:
import skimage
from skimage import io, color
import cv2
import numpy as np
from matplotlib import pyplot as plt
#read the image
trees= io.imread('ortho/OrthoRGBReNirCHM_Clip1.tif')
#seperate the 6 bands
R,G,B,Re,N,C=cv2.split(trees)
#crop a small part of the image to test
C_cropped=C[0:1500,0:1500]
#apply median filter
from skimage import filters
trees_denoised=filters.median(C_cropped, out=None, mode='nearest', cval=0.0, behavior='ndimage')
#save the image
io.imsave("ortho/denoised.TIF", trees_denoised)'
The final image is completly ruined, it looks nothing like the original tree. Is it a problem with the split command? or am I doing something wrong?