サーチ…


前書き

このドキュメントでは、外部の画像をOpenCVの出力画像とどのように比較して比較できるかを説明しています。たとえば、2つのぼやけた画像を比較し、両方が同じかどうかをテストするには、外部ソフトウェア(私はWiT Image Processingソフトウェアを使用)で元の画像をぼかすか、ぼやけた画像をダウンロードするだけです。 Visual StudioでWin32 OpenCVプロジェクトを作成します。元画像をOpenCVの入力として読み込みます。 OpenCVで元の画像をぼかして、output1と比較します。

画像を読み込んで比較するOpenCVコード

#include <opencv2 / opencv.hpp> #include

名前空間cvを使用します。名前空間stdを使用します。

int main(int argc、char ** argv){マット画像。 image = imread( "C:¥Users¥Development¥Documents¥Visual Studio 2013¥Projects¥ImageIn.bmp"、CV_LOAD_IMAGE_GRAYSCALE); //ファイルを読み込む

if (!image.data)                              // Check for invalid input
{
    cout << "Could not open or find the image" << std::endl;
    return -1;
}



Mat witout = imread("C:\\Users\\Development\\Documents\\Visual Studio 2013\\Projects\\ImageWitOut.bmp", CV_LOAD_IMAGE_GRAYSCALE);;
Mat cvout = Mat(image.size(), image.type(), Scalar(255));

imshow("witout", witout);
imshow("cvout", cvout);

Mat diff = (witout == cvout);

namedWindow("Difference", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Difference", diff);                   // Show our image inside it.

waitKey(0);                                          // Wait for a keystroke in the window
return 0;

}



Modified text is an extract of the original Stack Overflow Documentation
ライセンスを受けた CC BY-SA 3.0
所属していない Stack Overflow