Präsentation herunterladen
Die Präsentation wird geladen. Bitte warten
1
Ultrakurzeinführung OpenCV
(und ein bisschen Bildverarbeitung)
2
cv::Mat Enthält Daten verschiedener Formate (z.B float32, double64, uchar8 etc.) Kann mehrere Kanäle enthalten -> RGB-Bilder als 3-kanalige Matrix
3
Bild einlesen cv::Mat bild = cv::imread(file.path, cv::IMREAD_ANYDEPTH | cv::IMREAD_ANYCOLOR) cv::IMREAD_ANYDEPTH -> erlaubt 16-bit cv::IMREAD_ANYCOLOR -> erlaubt Graubilder
4
Operationen pro Pixel Grauwertbilder (z.B. Tiefenbild)
bild.at<float>(y, x) = 5; float wert = bild.at<float>(y, x); Farbbilder bild.at<cv::Vec3b>(y, x)[0] = 5; //1. Kanal (B) bild.at<cv::Vec3b>(y, x)[1] = 5; //2. Kanal (G) bild.at<cv::Vec3b>(y, x)[2] = 5; //3. Kanal (R) bild.at<cv::Vec3b>(y, x) = cv::Vec3b(0, 255, 0) int wert = bild.at<cv::Vec3b>(y, x)[0];
5
Operationen (ganzes Bild)
for (int idxX = 0; idxX < bild.cols; idxX++) { for (int idxY = 0; idxY < bild.rows; idxY++) if(bild.at<float>(idxY, idxX) > threshVal) bild.at<float>(idxY, idxX) = 0; } cv::threshold(bild, threshBild, threshVal, 1, cv::THRESH_TOZERO_INV);
8
Operationen (ganzes Bild)
cv::Mat kernel = cv::Mat::ones(3, 3, CV_32FC1); kernel = kernel / 9; cv::Mat filteredMat; cv::filter2D(bild, filteredMat, -1, kernel); cv::Laplacian(bild, filteredMat, -1);
Ähnliche Präsentationen
© 2024 SlidePlayer.org Inc.
All rights reserved.