0

当使用 dlibs load_image_dataset 加载一组图像时:

//------------
command_line_parser parser; 
parser.parse(argc, argv); //inputs argc, argv as defined by main where argv is an .xml containing all file locations

dlib::array<array2d<rgb_pixel> > images;
std::vector<std::vector<rectangle> > object_locations, ignore;

cout << "Loading image dataset from metadata file " << parser[1] << endl;
ignore = load_image_dataset(images, object_locations, parser[1]);
cout << "Number of images loaded: " << images.size() << endl;
//---------------

我收到以下错误:

"dlib::array2d<T, mem_manager> &dlib::array2d<T, mem_manager>::operator=(dlib::array2d<T, mem_manager> &) [with T=dlib::rgb_pixel, mem_manager=dlib::default_memory_manager]" (declared at line 320 of "C:\..path-to-dlib...\dlib-18.16\dlib\..\dlib/image_processing/../image_processing/../matrix/../array2d/array2d_kernel.h") is inaccessible

如果我尝试从“图像”中存储单个图像:

//--------
array2d<rgb_pixel> img;
img = images[i];
//-----------

但如果我只是显示它没有错误:

//------
image_window image_i(images[i], "Image i");
//---------

发生了什么,我该如何解决?

4

1 回答 1

1

array2d 在设计上是不可复制的,因为复制图像很昂贵并且几乎总是不必要的。如果要移动图像,请使用 swap()。如果您确实需要复制图像,则可以使用 assign_image() 函数,也可以使用矩阵对象(可复制)代替 array2d 来表示图像。

但实际上,不要不必要地复制图像。

于 2015-06-20T12:51:51.287 回答