Example #1
0
 void image_filter(AXI_STREAM& input, AXI_STREAM& output, int rows, int cols) {
     //Create AXI streaming interfaces for the core
 #pragma HLS RESOURCE variable=input core=AXIS metadata="-bus_bundle INPUT_STREAM"
 #pragma HLS RESOURCE variable=output core=AXIS metadata="-bus_bundle OUTPUT_STREAM"

 #pragma HLS RESOURCE core=AXI_SLAVE variable=rows metadata="-bus_bundle CONTROL_BUS"
 #pragma HLS RESOURCE core=AXI_SLAVE variable=cols metadata="-bus_bundle CONTROL_BUS"
 #pragma HLS RESOURCE core=AXI_SLAVE variable=return metadata="-bus_bundle CONTROL_BUS"

 #pragma HLS INTERFACE ap_stable port=rows
 #pragma HLS INTERFACE ap_stable port=cols

     GRAY_IMAGE img_0(rows, cols);
     GRAY_IMAGE img_1(rows, cols);
     GRAY_IMAGE img_2(rows, cols);

 #pragma HLS dataflow
     hls::AXIvideo2Mat(input, img_0);
     hls::Sobel<1,0,3>(img_0, img_1);
     hls::Sobel<0,1,3>(img_1, img_2);
     hls::Mat2AXIvideo(img_2, output);
 }
void image_filter(AXI_STREAM& INPUT_STREAM, AXI_STREAM& OUTPUT_STREAM, int rows, int
cols) {
	//Create AXI streaming interfaces for the core
	RGB_IMAGE img_0(rows, cols);
	RGB_IMAGE img_1(rows, cols);
	RGB_IMAGE img_2(rows, cols);
	RGB_IMAGE img_3(rows, cols);

	RGB_IMAGE img_4(rows, cols);
	RGB_IMAGE img_5(rows, cols);
	RGB_PIXEL pix(50, 50, 50);

	// Convert AXI4 Stream data to hls::mat format
	hls::AXIvideo2Mat(INPUT_STREAM, img_0);

	// Execute the video pipelines
	hls::Sobel<1,0,3>(img_0, img_1);
	hls::SubS(img_1, pix, img_2);
	hls::Scale(img_2, img_3, 2, 0);
	hls::Erode(img_3, img_4);
	hls::Dilate(img_4, img_5);
	// Convert the hls::mat format to AXI4 Stream format
	hls::Mat2AXIvideo(img_5, OUTPUT_STREAM);
}
Example #3
0
void Pictures() {
	//VideoCapture cap1;
	//cap1.open(0);

	VideoCapture cap2;
	//cap2.open("rtsp://*****:*****@192.168.1.65/Streaming/Channels/1");	//摄像头1
	//cap2.open("rtsp://*****:*****@192.168.1.141:554/axis-media/media.amp");	//摄像头2
	//cap2.open("rtsp://*****:*****@10.153.26.11/h264/ch1/main/av_stream");
	//capture.open("rtsp://service:@10.153.33.11/?line=1$camera");
	cap2.open("rtsp://*****:*****@10.153.25.4/?line=1$camera");		//服务器
	cap2.open(0);

	int temp1 = 300, temp2 = 300, temp3 = 10, temp4 = 10;

	while (true) {
		Mat img_1;
		Mat img_2;
		//cap1 >> img_1;
		//cap1.read(img_1);

		cap2 >> img_2;
		cap2.read(img_2);

		//Mat img_1 = imread("fisheye3.jpg");
		//Mat img_2 = imread("roi1.bmp");

		img_1 = fisheye2pano2(img_2);

		//Mat img_3 = imread("fisheye3.jpg");
		//Mat img_4 = imread("fisheye3.jpg");

		//截取
		//Rect rect_3(0, 0, 300, 300);
		Rect rect_3(20, 20, temp1, temp2);
		//temp1 += 1; temp2 += 1;

		Mat img_3 = img_1(rect_3);
		//Rect rect_4(10, 10, 300, 300);
		Rect rect_4(temp3, temp4, 300, 300);
		//temp3 += 1; //temp4 += 1;
		Mat img_4 = img_1(rect_4);

		Mat dst;
		vector<Mat> manyimgV;
		manyimgV.push_back(img_1);
		manyimgV.push_back(img_2);
		manyimgV.push_back(img_3);
		manyimgV.push_back(img_4);

		//thread t1(ManyImages, manyimgV, dst, 2);
		//t1.join();
		ManyImages(manyimgV, dst, 2);

		//namedWindow("ManyImagesInWindow", CV_WINDOW_AUTOSIZE);
		imshow("ManyImagesInWindow", dst);
		//waitKey(0);

		if (cv::waitKey(3) == 'q')
		{
			break;
		}
		//continue;
	}

	cv::destroyAllWindows();
	//cap1.release();
	cap2.release();

	system("pause");
	//备注:运行速度:约960ms,95%时间用在resize上
}