-
Notifications
You must be signed in to change notification settings - Fork 0
/
Float_Array_Concat.cc
68 lines (31 loc) · 1 KB
/
Float_Array_Concat.cc
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
int main(){
cv::Mat im1 = cv::imread("test.jpg", 1);
cv::Mat im2 = cv::imread("test.jpg", 1);
int h = im1.size().height;
int w = im1.size().width;
cv::Mat im11(h, w, CV_32FC3);
cv::Mat im22(h, w, CV_32FC3);
im1.convertTo(im11, CV_32FC3, 1 / 255.0);
im2.convertTo(im22, CV_32FC3, 1 / 255.0);
float *ftotal = new float [h * w * im1.channels() * 2];
float *fim1 = (float *)im11.data;
float *fim2 = (float *)im22.data;
int s = h * w * im1.channels();
cout << "1" << endl;
// copy from
copy(fim1, fim1 + s, ftotal + 0 * s);
copy(fim2, fim2 + s, ftotal + 1 * s);
cout << "2" << endl;
float *fsplit1 = new float [h * w * im1.channels() * 1];
float *fsplit2 = new float [h * w * im1.channels() * 1];
//
cout << s << endl;
copy(ftotal + 0 * s, ftotal + 1 * s, fsplit1);
copy(ftotal + 1 * s, ftotal + 2 * s, fsplit2);
cv::Mat oim(h, w, CV_32FC3, fsplit1);
cv::imshow("output", oim);
cv::waitKey(0);
}