zbar+opencv配合实现条码识别


1.安装opencv

2.安装zbar

3.注意程序中链接库配置

#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;
using namespace cv;
using namespace zbar;

int main(int argc, char **argv) {
    ImageScanner scanner;
    scanner.set_config(ZBAR_NONE, ZBAR_CFG_ENABLE, 1);
    cv::Mat frame, frame_grayscale;
    frame=imread(argv[1]);
    cout<tm_hour << ":" << current->tm_min << ":" << setw(2) << setfill('0') << current->tm_sec << "] " << " "
                    << "decoded " << symbol->get_type_name()
                    << " symbol \"" << symbol->get_data() << '"' << endl;
        }
    return 0;
}

CMakeLists.txt

cmake_minimum_required (VERSION 2.6)
project (ZBARCV)

set(CMAKE_MODULE_PATH ${ZBARCV_SOURCE_DIR})
find_package (OpenCV)
find_package (ZBar0)


add_executable (zbar_opencv main.cpp)
target_link_libraries (zbar_opencv ${OpenCV_LIBRARIES} ${ZBAR_LIBRARIES})

(注:只是个人笔记)



你可能感兴趣的:(linuxC/C++,opencv,zbar,条码识别)