Grayshade image into 3d array

I have this code, where I’m trying to apply a filter to an image based on another one. img is an rgb image and joint_image is a grayshade image, I need to make the grayshade image into a 3d array, that’s why I’m using channelview, but when applied to a grayscale image it does not change.
‘’’
I = float.(channelview(img))
if joint_image !== nothing
J = float.(channelview(joint_image))
if size(I, 2) !== size(J, 2) || size(I, 3) !== size(J, 3)
error(“Input and joint images must have equal width and height.”)
end
else
J = I
end
‘’’