2015-12-30 139 views
0

我正在應用與opencv的對比。 我跟着the docs,使對比度變換有:使用IplImage執行與Mat.convertTo相同的方法? OpenCV

for(int y = 0; y < image.rows; y++) { 
    for(int x = 0; x < image.cols; x++) { 
    for(int c = 0; c < 3; c++) { 
     new_image.at<Vec3b>(y,x)[c] = 
     saturate_cast<uchar>(alpha*(image.at<Vec3b>(y,x)[c]) + beta); 
    } 
    } 
} 

但這種方法適用於對比度不是一個我想要的。 所以後來我發現this tutorial它使用:

Mat dst; 
int iBrightness = iSliderValue1 - 50; 
double dContrast = iSliderValue2/50.0; 
src.convertTo(dst, -1, dContrast, iBrightness); 

但這種使用墊子和對於m工作我doind的IplImage。 我怎麼能用IplImage做到這一點?我試過cvConvert,但它似乎不這樣做。

+1

任何東西做**不**使用IplImages。 c-api是deadbeef – berak

+0

看到第二個答案http://stackoverflow.com/questions/4664187/converting-cvmat-to-iplimage –

+0

我用作我的教授帶領我saind IPIImages比墊更快,我的工作將是真實的時間 – schirrel

回答

-2

您可以簡單地使用

IplImage* img = new IplImage(srcImage);//where srcImage is cv::Mat.