ora1, ora2 progress

This commit is contained in:
2025-09-18 16:42:22 +02:00
commit 57380d3b55
16 changed files with 145 additions and 0 deletions

5
ora1/Makefile Normal file
View File

@@ -0,0 +1,5 @@
CFLAGS = `pkg-config --cflags opencv4`
LIBS = `pkg-config --libs opencv4`
% : %.cpp
g++ $(CFLAGS) $(LIBS) -o $@ $<

BIN
ora1/Tokyo_Pink.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 KiB

BIN
ora1/kep.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
ora1/main Executable file

Binary file not shown.

34
ora1/main.cpp Normal file
View File

@@ -0,0 +1,34 @@
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
int main(){
Mat img = imread("kep.jpg", IMREAD_UNCHANGED);
if(img.empty()){
std::cout << "Missing picture" << std::endl;
exit(-1);
}
std::cout << "sor: " << img.rows << std::endl;
std::cout << "oszlop: " << img.cols << std::endl;
std::cout << "csatornak: " << img.channels() << std::endl;
int t = img.type();
if(t == CV_8UC1){ //8bit u->unsigned c1 -> 1 channel
std::cout << "szurkeskala (8 bit)" << std::endl;
}else if (t == CV_8UC3){
std::cout << "szineskep (24 bit)" << std::endl;
}else{
std::cout << "egyik sem" << std::endl;
}
imshow("Ablak", img);
waitKey();
return 0;
}

BIN
ora1/main2 Executable file

Binary file not shown.

37
ora1/main2.cpp Normal file
View File

@@ -0,0 +1,37 @@
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
int main(){
Mat img = imread("kep.jpg", IMREAD_UNCHANGED);
Mat img2(200, 50, CV_8UC1);
Mat img3(200, 50, CV_8UC3);
Mat img4(200, 50, CV_8UC3);
img4.setTo(Scalar(0,0, 255)); //szinezes
Mat img5(img.rows, img.cols, img.type());
Mat mask(img.rows, img.cols, CV_8UC1);
Mat mask2 = Mat::zeros(img.size(), CV_8UC1); //kinullazot (fekete) mask (vagy barmi mas kep)
//masolat
Mat copy = img.clone(); //deepcopy
//copy.setTo(Scalar(255,0,0)); //shallow copy -> changes original
imshow("img", img);
imshow("copy", copy);
//imshow("Ablak", img2);
//imshow("Ablak2", img3);
//imshow("Ablak3", img4);
//imshow("Ablak3", img5);
//imshow("Ablak4", mask);
//imshow("Ablak6", mask2);
waitKey();
return 0;
}

5
ora2/Makefile Normal file
View File

@@ -0,0 +1,5 @@
CFLAGS = `pkg-config --cflags opencv4`
LIBS = `pkg-config --libs opencv4`
% : %.cpp
g++ $(CFLAGS) $(LIBS) -o $@ $<

BIN
ora2/background.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
ora2/background2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
ora2/kurama.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
ora2/main Executable file

Binary file not shown.

25
ora2/main.cpp Normal file
View File

@@ -0,0 +1,25 @@
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
int main(){
Mat img = imread("kurama.jpg", IMREAD_COLOR);
//imshow("kurama", img);
//imshow("k2", img - 100); //fakobb
//imshow("k3", img + 100); //sotetebb
//
Mat d = Scalar(255, 255, 255) - img; //invertalas //bgr formatum
imshow("k", d);
waitKey();
return 0;
}

BIN
ora2/main2 Executable file

Binary file not shown.

39
ora2/main2.cpp Normal file
View File

@@ -0,0 +1,39 @@
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
int main(){
Mat img(400, 600, CV_8UC3);
img.setTo(Scalar(0,0,255));
Rect r(0,0,600, 200);
img(r).setTo(Scalar(0,255,255));
//imshow("img", img);
Mat kurama = imread("kurama.jpg", IMREAD_COLOR);
/*int pad = 50;
Rect r2(pad, pad, kurama.cols - 2 * pad, kurama.rows - 2 * pad);
Mat small = kurama(r2);
imwrite("small_kurama.png", small);*/ //cutting 50px off the pic
resize(kurama, kurama, Size(200, 200));
Rect r3(img.cols/2-100, img.rows/2-100, kurama.cols, kurama.rows);
kurama.copyTo(img(r3)); //copy kurama image over the yellow and red rects
imshow("img2", img);
waitKey();
return 0;
}

BIN
ora2/small_kurama.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 KiB