C_and_CPP 板


LINE

开发平台(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 的路径有加入专案设定 --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 220.132.89.186
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1457662555.A.DAB.html
1F:→ TeaEEE: 要有相对应的.pdb档才能trace 03/11 10:47
2F:→ hardman1110: 所以除非我自己用source build出lib&dll不然不会有 03/11 10:53
3F:→ hardman1110: 相对应的.pdb噜? 03/11 10:53







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:iOS站内搜寻

TOP