ora1, ora2 progress
This commit is contained in:
5
ora1/Makefile
Normal file
5
ora1/Makefile
Normal 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
BIN
ora1/Tokyo_Pink.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1015 KiB |
BIN
ora1/kep.jpg
Normal file
BIN
ora1/kep.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
34
ora1/main.cpp
Normal file
34
ora1/main.cpp
Normal 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
BIN
ora1/main2
Executable file
Binary file not shown.
37
ora1/main2.cpp
Normal file
37
ora1/main2.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user