Hi,
I am implementing gabor filter for cifar10 data but getting this error
error: OpenCV(4.5.1) /tmp/pip-req-build-7m_g9lbm/opencv/modules/imgproc/src/color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function ‘cv::impl::{anonymous}::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::impl::{anonymous}::Set<3, 4>; VDcn = cv::impl::{anonymous}::Set<1>; VDepth = cv::impl::{anonymous}::Set<0, 2, 5>; cv::impl::{anonymous}::SizePolicy sizePolicy = cv::impl::::NONE; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]’

Invalid number of channels in input image:
‘VScn::contains(scn)’
where
‘scn’ is 1

This is the part of the code showing the error, the error specifically in this line
‘x = cv2.cvtColor(np.float32(x), cv2.COLOR_BGR2GRAY)’
#Gabor bank
num = 0
for batch_idx, (x, t) in enumerate(cifar_trainset):
current_batch_size = x.data.size()[0]
x, t = x.to(device), t.to(device)
x = cv2.cvtColor(np.float32(x), cv2.COLOR_BGR2GRAY)
#generating the gabor filtered images and saving them
num = 0
for i in range (5):
    kernel = cv2.getGaborKernel((10, 10), result_sigma[i],
    result_theta[i], result_lambdaa[i],result_gamma[i], result_psi[i], ktype=cv2.CV_32F)
    gabor_label = str(num)  


    fimg = cv2.filter2D(np.float32(x), cv2.CV_8UC3, kernel)
    img_resized = cv2.resize (fimg, (32,32))
    img_tensor = torch.from_numpy(img_resized).long()

    torch.save (img_tensor,'/home/mzidane/gabor_filtered_cifar10/gfiltered_images/gabor_filtered_images'+ str(gabor_label)+'.pt')

            
    print(gabor_label, ': theta=', result_theta[i], ': sigma=',result_sigma[i],
    ': lamda=', result_lambdaa[i], ': gamma=', result_gamma[i], ': psi=', result_psi[i])
            
    num += 1

Could you help in that?