openCV と画像処理に精通している人がすぐに助けてくれることを願っています。
私は openCV と VC++ はまったく初めてで、今週で 3 回目です。エラー LNK2019 に遭遇しました。
このエラーは、指定された関数を含む .lib ファイルがプロジェクトにリンクされておらず、適切なヘッダー ファイルがコードの先頭に含まれていないことを意味します。しかし、今回はこのWebページ
に
基づいて、cvSmoothが含まれている機能であることを収集したので、この.libをとして追加し、次の行を書きました opencv_imgproc243d.lib
Additional Dependencies
#include "opencv2\imgproc\imgproc.hpp"
私のコードの一番上にあるが、エラー
error LNK2019: unresolved external symbol cvSmooth referenced in function "void __cdecl example2_4(struct _IplImage *)"
変わらず、そのままです。
めっちゃ迷った????
必要に応じて、編集済みのセクションとしてコードを質問に追加するように教えてください。
それは間違っていて、cvSmooth
別の .lib ファイルに属していますか?
h3nowの提案に基づいて私の質問のセクションを編集しました
私のコードは次のとおりです。
#include "stdafx.h"
#include "opencv\cv.h"
#include "opencv\highgui.h"
#include "opencv2\core\core.hpp"
#include "opencv2\imgproc\imgproc.hpp"
void example2_4( IplImage* image )
{
// Create some windows to show the input
// and output images in.
//
cvNamedWindow( "Example4-in",CV_WINDOW_AUTOSIZE );
cvNamedWindow( "Example4-out",CV_WINDOW_AUTOSIZE );
// Create a window to show our input image
//
cvShowImage( "Example4-in", image );
// Create an image to hold the smoothed output
//
IplImage* out = cvCreateImage(cvGetSize(image),IPL_DEPTH_8U,3);
// Do the smoothing
//
// Do the smoothing
//
cvSmooth( image, out, CV_GAUSSIAN, 3, 3 );
// Show the smoothed image in the output window
//
cvShowImage( "Example4-out", out );
// Be tidy
//
cvReleaseImage( &out );
// Wait for the user to hit a key, then clean up the windows
//
cvWaitKey( 0 );
cvDestroyWindow( "Example4-in" );
cvDestroyWindow( "Example4-out" );
}
int main(int argc, char* argv[])
{
IplImage* img = cvLoadImage(argv[1]);
example2_4( img );
cvReleaseImage( &img );
system("pause");
return 0;
}
たとえば、関数を右クリックしてcore_c.h という名前のファイルcvCreateImage
を選択すると、開かれます。Go To Definition
したがって、この関数のプロトタイプは core_c.h に含まれていることを理解してください。
このため、コードの先頭に#include "opencv2\core\core.hpp"
or #include "opencv2\core\core_c.h"
(2 つのコードのいずれを使用しても違いはないと思います) を記述し、関数を使用するプロジェクトにリンクopency_core243d.lib
cvCreateImage
するcvSmooth
Go To Definition
必要があることを理解しています。 @ h3now
が提案した解決策は、すべての機能で機能しますか?
cvShowImage を右クリックしても何も起こらないからです。