1. 程式人生 > >圖像處理(二)

圖像處理(二)

pan data spa jpg class int gpo UC top

opencv訪問圖像像素:

    Mat image = imread("C:\\Users\\Administrator\\Desktop\\image.jpg");
        ofstream out("log.txt");
        int rows = image.rows;
    int cols = image.cols;

    for (int i = 0; i < rows; i++)
    {
        uchar* data = (uchar*)image.data + i*image.step[0];
        for (int j = 0
; j < cols; j++) { out << (int)data[j*3] << "," << (int)data[j*3+1] << "," << (int)data[3*j+2] << " "; } cout << endl; }

圖像處理(二)