2013-03-26 33 views
0

您好我正在使用opencv在線檢測在IOS。這是我最後一年的項目。我想上傳ecg的圖像,然後從中提取這行,因爲我已經使用opencv和sucessfuly我已經提取了這一行,但現在我想保存行,並面臨很多問題,任何人都可以幫助我或任何教程?使用IOS的OpenCV線路檢測和提取

+0

你是什麼意思的「挽救」線? – 2013-03-26 09:05:19

+0

我認爲[this](http://docs.opencv.org/doc/tutorials/core/file_input_output_with_xml_yml/file_input_output_with_xml_yml.html)應該可以幫到你。它說如何讀取和寫入文件。您可以以您想要的格式存儲您的線路。 – Safir 2013-03-26 09:34:43

回答

0

我趕緊寫的東西,我認爲它可以幫助你:

void write_lines_to_file (string file_name, vector<vector<Point> > lines) 
{ 
    FileStorage fs (file_name, FileStorage::WRITE); 
    fs << "lines" << "["; 
    for (unsigned int i = 0; i < lines.size(); i++) 
    { 
     // I've assumed each line is a vector<Point>, in index [0] the head and index [1] the tail. 
     fs << "{:" << "x1" << lines[i].at (0).x << "y1" << lines[i].at (0).y << "x2" << lines[i].at (1).x << "y2" << lines[i].at (1).y << "}"; 
    } 
    fs.release(); 
} 

我沒有測試它,我做了我自己的假設,如果你想使用它,請謹慎考慮。