-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLaneProcessing.cpp
More file actions
78 lines (72 loc) · 2.17 KB
/
LaneProcessing.cpp
File metadata and controls
78 lines (72 loc) · 2.17 KB
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
69
70
71
72
73
74
75
76
77
78
#include "opencv2/opencv.hpp"
#include <iostream>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/core/core.hpp>
#include <opencv2/videoio.hpp>
#include <cmath>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "rt_nonfinite.h"
#include "rtwtypes.h"
#include "processedout.h"
#include "processedout_emxAPI.h"
#include "processedout_types.h"
#include "processedout_initialize.h"
#include "processa.h"
#include "processb.h"
using namespace std;
using namespace cv;
void processinga_frame(Mat& src, Mat& resize, Mat& dst);
void processingb_frame(Mat& frame, Mat& src, double PointsA[720], double PointsB[720], double AlertSide, double center_data[], Mat& dst);
int main(int argc, char *argv[])
{
setenv("DISPLAY", ":0", 0);
VideoCapture cap("openv.avi");
if (!cap.isOpened())
{
cout << "Error opening video stream or file" << endl;
return -1;
}
while (1)
{
Mat frame, cudaout_frame, frame_out;
Mat process_framein, process_frame, process_frameout, resize_frame;
int Width;
int Height;
Width = 640;
Height = 360;
double AlertSide;
double center_data[1];
int center_size[1];
double left_curvature;
double right_curveature;
static int iv0[2] = { Height, Width };
emxArray_uint8_T *imageInput;
imageInput = emxCreateND_uint8_T(2, *(int(*)[2])&iv0[0]);
processedout_initialize();
double PointsA[720];
double PointsB[720];
/*VideoWriter video("/pathtoproject/Debug/videoin.avi", CV_FOURCC('P','I','M','1'), 25, Size(1280, 720), true);*/
for (;;)
{
cap >> frame;
if (frame.empty())
break;
processinga_frame(frame, resize_frame, process_frame);
int i, j;
for (i = 0; i < Width; i++)
for (j = 0; j < Height; j++)
imageInput->data[i*Height+ j] = (uint8_T)process_frame.data[i+ Width * j];
processedout(imageInput, PointsA, PointsB, &AlertSide, center_data, center_size, &left_curvature, &right_curveature);
processingb_frame(process_frame, resize_frame, PointsA, PointsB, AlertSide, center_data, process_frameout);
/*video.write(frame);*/
imshow("FrameL", process_frameout);
if (waitKey(27) >= 0)break;
}
cap.release();
destroyAllWindows();
return 2;
}
}