Dies ist ein Testprogramm mit opencv. Es soll nichts tun.opencv Namespaces und c, C++ Funktionen
#include <opencv2/opencv.hpp>
int main(){
cv::Mat src;
Mat dst; // <---- compile error (Mat not declared, suggested alternatives cv::)
cvNamedWindow("A", CV_WINDOW_AUTOSIZE);
cv::namedWindow("B", CV_WINDOW_AUTOSIZE);
medianBlur(src,dst,3);
imshow("A",src);
cv::imshow("B", src);
}
ich mit cmake kompilieren und
cmake_minimum_required(VERSION 2.8)
project(opencvtest)
find_package(OpenCV REQUIRED)
add_executable(opencvtest main.cpp)
target_link_libraries(opencvtest ${OpenCV_LIBS})
Cmake läuft richtig machen. Wie Sie aus dem Code sehen können, ist das Programm ohne die Mat dst
Deklaration in Ordnung. Jetzt ist cvNamedWindow
eine C-Funktion, daher ist kein Namespace erforderlich. imshow
auf der anderen Seite ist eine C++ - Funktion, so dass es eine Namespace-Deklaration erfordert. http://docs.opencv.org/2.4/modules/highgui/doc/user_interface.html#imshow Also warum imshow
ohne Namespace-Deklaration besteht die Kompilierung. Das Gleiche gilt mit medianBlur
dass nicht einmal ein c äquivalente Funktion http://docs.opencv.org/2.4/modules/imgproc/doc/filtering.html?highlight=medianblur#medianblur
Ich laufe auf 3.1.0 opencv Version hat und ubuntu 16.04