Hi Community,
I’m working on a project, where I’m trying to convert my image into openCV blob using dnn library of openCV, but I’m getting unusual blob from the function.
#include <opencv2/opencv.hpp>
#include <opencv2/dnn.hpp>
int main(){
cv::Mat img = cv::imread("/home/vimal/Edge_ai/Vstream/includes/test.jpeg");
if(img.channels() == 3)
std::cout << "channels are good" << std::endl;
cv::Mat blob;
cv::dnn::blobFromImage(img, blob, 1./255., cv::Size(640, 640), cv::Scalar(), true, false);
std::cout << blob.channels() << std::endl;
std::cout << blob.rows << std::endl;
std::cout << blob.cols << std::endl;
return 0;
}
but i’m getting the output as,
channels are good
1
-1
-1
kindly help me in this