[问题] 使用dll和lib时除错问题

楼主: hardman1110 (笨小孩)   2016-03-11 10:15:51
开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC2015
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
1. OpenCV3.0 (载图用)
2. ZBar条码函式库 http://zbar.sourceforge.net/download.html
安装完后加载其dll和lib档来使用
问题(Question):
想Trace ZBar 程式的流程是怎么跑的,但没有官方CMakelist.txt来产生VC专案
所以想在专案设定的Source Directories加入原始码路径以便追踪
喂入的资料(Input):
喂入图片
预期的正确结果(Expected Output):
可以用单步执行追完整个解码流程
错误结果(Wrong Output):
追到 scanner.scan(image)里面就进不了zbar_scan_image了
程式码(Code):(请善用置底文网页, 记得排版)
void DecodeByImage(void) {
char file[256] = "qr.png";
int width = 0;
int height = 0;
ImageScanner scanner;
Mat img, imgout;
uchar *raw = NULL;
scanner.set_config(ZBAR_NONE, ZBAR_CFG_ENABLE, 1);
// obtain image data
img = imread(file, 0);
cvtColor(img, imgout, CV_GRAY2RGB);
width = img.cols;
height = img.rows;
raw = (uchar *)img.data;
// wrap image data
Image image(width, height, "Y800", raw, width * height);
// scan the image for barcodes
int n = scanner.scan(image);
// extract results
for (Image::SymbolIterator symbol = image.symbol_begin();
symbol != image.symbol_end();
++symbol) {
vector<Point> vp;
// do something useful with results
cout << "decoded " << symbol->get_type_name()
<< " symbol \"" << symbol->get_data() << '"' << " " << endl;
int n = symbol->get_location_size();
for (int i = 0; i<n; i++) {
vp.push_back(Point(symbol->get_location_x(i),
symbol->get_location_y(i)));
}
RotatedRect r = minAreaRect(vp);
Point2f pts[4];
r.points(pts);
for (int i = 0; i<4; i++) {
line(imgout, pts[i], pts[(i + 1) % 4], Scalar(255, 0, 0), 3);
}
cout << "Angle: " << r.angle << endl;
}
imshow("imgout.jpg", imgout);
// clean up
image.set_data(NULL, 0);
waitKey();
}
补充说明(Supplement):
lib&dll跟专案放在一起 source 的路径有加入专案设定
作者: TeaEEE (爱不趴 不爱趴)   2016-03-11 10:47:00
要有相对应的.pdb档才能trace
楼主: hardman1110 (笨小孩)   2016-03-11 10:53:00
所以除非我自己用source build出lib&dll不然不会有相对应的.pdb噜?

Links booklink

Contact Us: admin [ a t ] ucptt.com