使用OpneCV去畸變

2021-10-25 00:07:44 字數 2402 閱讀 8832

// 不多嗶嗶,直接上**片

/** * @time: 2020.10,20

* */

#include

// opencv

// 其實用不到這麼多

#include

#include

// 檔案輸入輸出流

#include

#include

// boost format格式控制

#include

// setw() setfill

// 格式化輸出

#include

#include

using namespace std;

using namespace cv;

string dataset_path =

"/home/wang/ginger2020/dataset/bumblebee/01/image_0"

;void

readimg

(int &index,

string &datasetpath,

cv::mat &dataset)

;int main

( int argc, char** ar** )

cout <<

" img_file_index "

<< img_file_index << endl;

img_file_index++

;// 去畸變

cv::mat k_img(3

,3,cv_64f);

cv::mat coeff(5

,1,cv_64f);

k_img.at(0

,0)=

1644.7156613466043

;// fx

k_img.at(0

,1)=

0;k_img.at(0

,2)=

640.0

;// cx

k_img.at(1

,0)=

0;k_img.at(1

,1)=

1644.7156613466043

;// fy

k_img.at(1

,2)=

480.0

;// cy\

k_img.at(2

,0)=

0;k_img.at(2

,1)=

0;k_img.at(2

,2)=

1;coeff.at(0

,0)=

-0.54184704404293005

;// k1

coeff.at(1

,0)=

-1.1038602217192159

;// k2

coeff.at(2

,0)=

0.0;

// p1

coeff.at(3

,0)=

0.0;

// p2

coeff.at(4

,0)=

7.8578495299742874

;// p3

cv::mat newimage;

cv::mat new_matrix;

// ???

cv::undistort

(dataset, newimage, k_img, coeff, new_matrix)

;// 儲存去畸變後的影象

string imgfilename;

std:

:stringstream strstm;

//從右往左 剩下的用0填滿 一共填充5位 0 — ....

;// 迴圈,前邊寫入的會在流裡,clear一下

imgfilename.

clear()

;// 先拿10幅影象試試

if(index==10)

}return0;

}void

readimg

(int &index,

string &datasetpath,

cv::mat &dataset)

dataset = lab;

}

使用HTTPCLIENT去生成靜態HTML頁面

一般生成html頁時,都會用比如freemarker等去搞,但今天看到和學到乙個還應該 不錯的方法,是使用httpclient的get方法,去讀某個動態的url,然後把讀出的內容再儲存成html的,下面例子介紹一下 public class htmlparser 根據模版及引數產生靜態頁面 publ...

c 使用boost去讀寫json

這兩天剛好寫乙個小玩具需要用到讀寫配置檔案,趁機學習了c 的boost 讀寫庫 對於上面乙個位於 etc erverconfig結構簡單的json檔案,讀取的方式如下 include include boost property tree ptree root 建立乙個結構物件 boost prop...

iframe去邊框,無邊框,使用大全

src you page s url width 750 height 30 frameborder no border 0 marginwidth 0 marginheight 0 scrolling no allowtransparency yes iframe runat server 這個最...