[英]Convert binary image into RGB in OpenCV
我正在使用OpenCV 2.4.3進行前景檢測。 我想將二進制的結果前景轉換為RGB圖像。 我的代碼是這樣的:
cv::VideoCapture cap;
cap.open ( "test.avi " );
cv::Mat img;
cv::Mat finalForeground;
cv::Mat element( 3, 3, CV_8U, cv::Scalar(1) );
cv::gpu::GMG_GPU gmgGpu
gmgGpu.initialize ( cv::Size ( 1600, 1200 ) );
cv::gpu::GpuMat gpuForeground;
cv::Mat rgbForeground;
for ( int i = 0; i < 500; i ++ )
{
cap >> img;
cv::gpu::GpuMat gpuImg ( img );
gmgGpu.operator()(gpuImg, gpuForeground);
gpuForeground.download ( finalForeground);
cv::morphologyEx ( finalForeground, finalForeground, CV::MORPH_CLOSE, element );
cvCvtColor ( finalForeground, rgbForeground, CV_GRAY2BGR );
}
然后我收到這樣的錯誤:
錯誤C2664:'cvCvtColor':無法將參數2從'cv :: Mat'轉換為'CvArr *'
沒有可用於執行此轉換的用戶定義轉換運算符,或者無法調用運算符
有人可以提出任何處理此錯誤的建議嗎? 謝謝。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.