Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use blobFromImages in c++

##### System information (version)

  • OpenCV => :3.4.5
  • Operating System / Platform => windows 7 windows 10:
  • Compiler => :microsoft vs2019:
  • C++
    Detailed description

I am using dnn module very successfuly with yolo v3 and ssd mobilenet, with single image process - blobFromImage I want to process few images in parallel using blobFromImages. I wrote: (yolov3 net) frame1 = imread("img1.jpg"); frame2 = imread("img2.jpg"); std::vector<cv::mat> inputs; inputs.push_back(frame1); inputs.push_back(frame2); blobFromImages(inputs, blob, 1 / 255.F, inpSize, mean, true, false); std::vector<mat> outs; net.forward(outs, getOutputsNames(net)); postprocess(frame, outs, net);

When I am loading only the one image it works fine. When I am lodaing 2 images the outs matrices are empty. Waht am I doing wrong?

Steps to reproduce

click to hide/show revision 2
None

updated 2019-10-10 07:20:24 -0600

berak gravatar image

How to use blobFromImages in c++

#####

System information (version)

(version)
  • OpenCV => :3.4.5
  • Operating System / Platform => windows 7 windows 10:
  • Compiler => :microsoft vs2019:
  • C++
    Detailed description

I am using dnn module very successfuly with yolo v3 and ssd mobilenet, with single image process - blobFromImage I want to process few images in parallel using blobFromImages. I wrote: (yolov3 net)

frame1 = imread("img1.jpg");
frame2 = imread("img2.jpg");
std::vector<cv::mat> std::vector<cv::Mat> inputs;
inputs.push_back(frame1);
inputs.push_back(frame2);
blobFromImages(inputs, blob, 1 / 255.F, inpSize, mean, true, false);
std::vector<mat> std::vector<Mat> outs;
net.forward(outs, getOutputsNames(net));
postprocess(frame, outs, net);

net);

When I am loading only the one image it works fine. When I am lodaing 2 images the outs matrices are empty. Waht am I doing wrong?

Steps to reproduce