Created
April 1, 2014 08:21
-
-
Save YusukeSuzuki/9910030 to your computer and use it in GitHub Desktop.
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/core/core.hpp> | |
#include <opencv2/imgproc/imgproc.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <iostream> | |
int main(int argc, char* argv[]) | |
{ | |
using namespace std; | |
cv::namedWindow("gabor"); | |
int sigma_bar = 40; | |
cv::createTrackbar("sigma", "gabor", &sigma_bar, 1000, nullptr, nullptr); | |
int theta_bar = 0; | |
cv::createTrackbar("theta", "gabor", &theta_bar, 180, nullptr, nullptr); | |
int lambda_bar = 11; | |
cv::createTrackbar("lambda", "gabor", &lambda_bar, 100, nullptr, nullptr); | |
int gamma_bar = 100; | |
cv::createTrackbar("gamma", "gabor", &gamma_bar, 200, nullptr, nullptr); | |
int psi_bar = 90; | |
cv::createTrackbar("psi", "gabor", &psi_bar, 180, nullptr, nullptr); | |
const int kernel_size = 128; | |
for(;;) | |
{ | |
auto gabor_mat = cv::getGaborKernel( | |
cv::Size(kernel_size, kernel_size), | |
sigma_bar / 10., theta_bar / 180. * M_PI, | |
lambda_bar, gamma_bar / 100., psi_bar / 180. * M_PI); | |
cv::normalize(gabor_mat, gabor_mat, 1, 0, cv::NORM_MINMAX); | |
cv::Mat image; | |
cv::resize(gabor_mat, image, cv::Size(512, 512)); | |
cv::imshow("gabor", image); | |
int key = cv::waitKey(20); | |
if(key == 'q') | |
{ | |
break; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment