This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mat operadoresPrewitt(Mat img){ | |
Mat imgResultante = img.clone(); | |
int gx,gy; | |
for(int i=0; i< img.rows; i++){ | |
for(int j=0; j < img.cols; j++){ | |
gx = (img.at<uchar>(i-1,j+1) + img.at<uchar>(i,j+1) + img.at<uchar>(i+1,j+1)) - | |
(img.at<uchar>(i-1, j-1) + img.at<uchar>(i, j-1) + img.at<uchar>(i+1, j-1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mat operadorRobert(Mat img){ | |
Mat imgResultante = img.clone(); | |
int gx,gy; | |
for (int i=0; i < img.rows; i++) { | |
for(int j=0; j < img.cols; j++){ | |
gx = img.at<uchar>(i,j) - img.at<uchar>(i+1,j+1); | |
gy = img.at<uchar>(i+1,j) - img.at<uchar>(i,j+1); | |
imgResultante.at<uchar>(i,j) = sqrt(pow(gx,2) + pow(gy,2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/opencv.hpp> | |
Mat convoluirGenerica(Mat& img, float **masc, int M, int N){ | |
float output=0; | |
Mat resp = img.clone(); | |
int m=(M-1)/2; | |
int n=(N-1)/2; | |
for (int x=0; x<img.rows;x++){ |
NewerOlder