-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
40 lines (34 loc) · 893 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
// main.cpp
// LineIntegralConvolution
//
// Created by xyz on 2017/2/2.
// Copyright © 2017年 xyz. All rights reserved.
//
#include <iostream>
using namespace std;
#include <opencv2/opencv.hpp>
using namespace cv;
#include "lic.hpp"
Mat syntheszSaddle(int row, int col);
int main(int argc, const char * argv[]) {
// insert code here...
Lic lic;
Mat pVect = syntheszSaddle(400, 300);
Mat result = lic.showLIC(pVect);
imwrite("res.jpg", result);
return 0;
}
Mat syntheszSaddle(int row, int col) {
Mat pVect(row, col, CV_32FC2);
float vecX = 0.0f, vecY = 0.0f;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
vecX = -(float)i / row + 0.5f;
vecY = (float)j / col - 0.5f;
pVect.at<Vec2f>(i, j)[0] = vecX;
pVect.at<Vec2f>(i, j)[1] = vecY;
}
}
return pVect;
}