[英]Compare two image in real time with predefined image with real time capture image in Opencv c++
我正在做一個自動織物缺陷檢測項目。 在這方面,我使用 [FFT][1](快速傅立葉變換)開發了算法,並且它在我的 Ubuntu 14.04 opencv c++
。 但是現在我想將其開發為實時,我必須每 2 秒捕獲一次圖像,並且必須使用我開發的算法處理該圖像。 我需要關於如何在opencv c++
使用網絡攝像頭捕獲圖像並使用正在捕獲的相同圖像進行處理的想法。 如果有人知道這一點,請幫助我。 先感謝您。
您可以遵循 OpenCV 提供的指導 - 他們提供了足夠的示例,例如以下示例代碼。 以下代碼由 OpenCV 開發團隊提供作為示例。
#include "opencv2/opencv.hpp"
using namespace cv;
int main(int, char**)
{
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
Mat edges;
namedWindow("edges",1);
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
cvtColor(frame, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
Canny(edges, edges, 0, 30, 3);
imshow("edges", edges);
if(waitKey(30) >= 0) break;
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.