before ora4
This commit is contained in:
@@ -15,7 +15,7 @@ int main(){
|
||||
Mat d = Scalar(255, 255, 255) - img; //invertalas //bgr formatum
|
||||
imshow("k", d);
|
||||
|
||||
|
||||
//ha egy kepnek modositani akarom a fejlecet akkor referenciakent kell atadni a fv-nek
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
ora2/main3
Executable file
BIN
ora2/main3
Executable file
Binary file not shown.
32
ora2/main3.cpp
Normal file
32
ora2/main3.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <iostream>
|
||||
|
||||
using namespace cv;
|
||||
|
||||
int main(){
|
||||
Mat bg = imread("background.jpg", IMREAD_COLOR);
|
||||
Mat fg = imread("kurama.jpg", IMREAD_COLOR);
|
||||
|
||||
if(bg.empty() || fg.empty()){
|
||||
std::cout << "az egyik kep ures" << std::endl;
|
||||
}
|
||||
|
||||
resize(bg, bg, fg.size()); //bg atmeretezese az fg meretere
|
||||
Mat u = fg.clone();
|
||||
namedWindow("u", WINDOW_NORMAL);
|
||||
imshow("u", u);
|
||||
|
||||
int value = 50;
|
||||
createTrackbar("alfa", "u", &value, 100);
|
||||
|
||||
while(waitKey(1) != 'q'){
|
||||
double a = value / 100.0; //0.5; //alpha, eloter vagy hatter latszodjon jobban
|
||||
Mat u = a * bg + (1-a) * fg;
|
||||
imshow("u", u);
|
||||
}
|
||||
|
||||
waitKey();
|
||||
return 0;
|
||||
}
|
||||
BIN
ora2/main4
Executable file
BIN
ora2/main4
Executable file
Binary file not shown.
47
ora2/main4.cpp
Normal file
47
ora2/main4.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include <algorithm>
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <iostream>
|
||||
|
||||
using namespace cv;
|
||||
|
||||
int main(){
|
||||
Mat_<Vec3b> img = imread("kurama.jpg", IMREAD_COLOR); //ha itt meg van adva a templatebe a tipus akkor kesobb nem kella
|
||||
|
||||
//feher pontokat feketere:
|
||||
//grayscale
|
||||
/*for(int i = 0; i < img.rows; i++){
|
||||
for(int j = 0; j < img.cols; j++){
|
||||
if(img.at<uchar>(i,j) > 230){
|
||||
img.at<uchar>(i,j) = 0;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
Vec3b white(255,255,255);
|
||||
Vec3b black(0,0,0);
|
||||
|
||||
for(int i = 0; i < img.rows; i++){
|
||||
for(int j = 0; j < img.cols; j++){
|
||||
/*if(img.at<Vec3b>(i,j)[0] > 230){ //[] melyik szin csatorna (bgr)
|
||||
img.at<Vec3b>(i,j) = black;
|
||||
}*/
|
||||
//if(img(i,j)[0] > 230){
|
||||
// img(i,j) = black;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
for(auto &p : img){
|
||||
//csak akkor kell referencia ha modositani akarjuk
|
||||
if(p[0] > 230){
|
||||
p = black;
|
||||
}
|
||||
}
|
||||
|
||||
imshow("img", img);
|
||||
|
||||
waitKey();
|
||||
return 0;
|
||||
}
|
||||
BIN
ora2/main5
Executable file
BIN
ora2/main5
Executable file
Binary file not shown.
25
ora2/main5.cpp
Normal file
25
ora2/main5.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <algorithm>
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <iostream>
|
||||
|
||||
using namespace cv;
|
||||
|
||||
int main(){
|
||||
Mat_<Vec3b> orange = imread("orange1.jpg", IMREAD_COLOR);
|
||||
|
||||
Vec3b black = Vec3b(0,0,0);
|
||||
for(int i = 0; i < orange.rows; i++){
|
||||
for(int j = 0; j < orange.cols; j++){
|
||||
if(orange(i,j)[2] < 164 && !(orange(i,j)[1] < orange(i,j)[2])){
|
||||
orange(i,j) = black;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
imshow("img", orange);
|
||||
|
||||
waitKey();
|
||||
return 0;
|
||||
}
|
||||
BIN
ora2/orange1.jpg
Normal file
BIN
ora2/orange1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Reference in New Issue
Block a user