This commit is contained in:
2025-12-13 21:40:13 +01:00
parent 93c3d54483
commit 33608287aa
59 changed files with 1226 additions and 37 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
ora5/proj1/gray_stud.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
ora5/proj1/histo.o Normal file

Binary file not shown.

45
ora5/proj1/m2 Normal file
View File

@@ -0,0 +1,45 @@
#include "histo.h"
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
#include <vector>
using namespace cv;
int main(){
Mat img = imread("../madar.jpg", IMREAD_COLOR);
imshow("img", img);
Histo::showHisto(img, "histo", 1);
std::vector<Mat> chs;
split(img, chs);
/*imshow("r", chs[2]);
imshow("g", chs[1]);
imshow("b", chs[0]);*/
Mat dest1, dest2, dest3, dest4, mask;
//dest1 = img > 100;
//threshold(img, dest2, 100, 255, THRESH_BINARY);
//threshold(img, dest3, 100, 255, THRESH_OTSU);
//threshold(img, dest4, 100, 255, THRESH_TRIANGLE);
//medianBlur(dest1, dest1, 3);
threshold(chs[0], mask, 120, 255, THRESH_BINARY|cv::THRESH_OTSU);
img.copyTo(dest2, mask);
//imshow("dest1", dest1);
imshow("dest2", dest2);
//imshow("dest3", dest3);
//imshow("dest4", dest4);
while(waitKey(3) != 'q');
return 0;
}

BIN
ora5/proj1/main Executable file

Binary file not shown.

View File

@@ -1,45 +1,75 @@
#include "histo.h"
#include <iostream>
#include <vector>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
#include <vector>
using namespace std;
using namespace cv;
int main(){
Mat img = imread("../madar.jpg", IMREAD_COLOR);
imshow("img", img);
void kordetektalo1(const Mat& gray, vector<Vec3f>& circles) {
Histo::showHisto(img, "histo", 1);
std::vector<Mat> chs;
split(img, chs);
/*imshow("r", chs[2]);
imshow("g", chs[1]);
imshow("b", chs[0]);*/
Mat dest1, dest2, dest3, dest4, mask;
//dest1 = img > 100;
//threshold(img, dest2, 100, 255, THRESH_BINARY);
//threshold(img, dest3, 100, 255, THRESH_OTSU);
//threshold(img, dest4, 100, 255, THRESH_TRIANGLE);
//medianBlur(dest1, dest1, 3);
threshold(chs[0], mask, 120, 255, THRESH_BINARY|cv::THRESH_OTSU);
img.copyTo(dest2, mask);
//imshow("dest1", dest1);
imshow("dest2", dest2);
//imshow("dest3", dest3);
//imshow("dest4", dest4);
while(waitKey(3) != 'q');
return 0;
int cannyTh = 60;
int minPoints = 30;
int minR = 22; //K1: allitsd be
int maxR = 26; //K1: allitsd be
int d = 2;
int minDist = 10;
cv::HoughCircles(gray, circles, cv::HOUGH_GRADIENT, d, minDist, cannyTh, minPoints, minR, maxR);
}
int main(){
Mat img = imread("past.jpg", IMREAD_COLOR);
if(img.empty()){
return 1;
}
// 1. Konvertáld szürkeskálássá az img képet
Mat gray;
cvtColor(img, gray, COLOR_BGR2GRAY);
imwrite("gray_stud.png", gray);
vector<Vec3f> circles;
kordetektalo1(gray, circles);
// 2. Végezz mediánszűrés 11x11-es ablakmérettel.
Mat mb2;
medianBlur(img, mb2, 11);
imwrite("filtered_stud.png", mb2);
// 3. rajzold ki a detektált köröket az eredeti képre
// sugár: 6, szín: tiszta piros, vonalvastagság: FILLED
int radius = 6;
for (auto c : circles) {
int x = c[0];
int y = c[1];
circle(img, Point(x,y), radius, Scalar(0, 100, 100), 2, cv::LineTypes::FILLED);
}
imwrite("result_stud.png", img);
// 4. Határozd meg a körök középpontja alá eső pixelek
// KÉK komponensének átlagát a SZŰRT képen.
double mean_v = 0;
vector<Mat> chs;
split(circles, chs); //bgr
int count = 0;
for(auto c : circles){
int x = c[0];
int y = c[1];
mean_v += img.at<uchar>(y,x);
}
mean_v /= circles.size();
// Jelenitsd meg az atlagot a standard kimeneten.
// cout << mean_v << endl;
waitKey();
return 0;
}

BIN
ora5/proj1/main.o Normal file

Binary file not shown.

BIN
ora5/proj1/past.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
ora5/proj1/result_stud.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB