예제 #1
0
void ImageAnalysis::genFrontMask(){
	m_areaGrid = Scalar(255/*0*/);
	Rect roi = m_pSettingKinect->m_kinectProp.roi;
	Mat agRoi(m_areaGrid,roi);
	Mat dfRoi(m_depthf,roi);
	Mat tmp(dfRoi.size(),dfRoi.type());
//	Mat newAreaGrid = Mat(Size(roi.width,roi.height), CV_8UC1);
	int nFrames = 10;
	for(int i=0;i<nFrames; i++){
		m_pdevice->getDepth8UC1(dfRoi, roi,
				m_pSettingKinect->m_kinectProp.minDepth,m_pSettingKinect->m_kinectProp.maxDepth);
		Mat Kernel(Size(9, 9), CV_8UC1); Kernel.setTo(Scalar(1));
		Mat Kernel2(Size(7, 7), CV_8UC1); Kernel2.setTo(Scalar(1));
		dilate(dfRoi, tmp, Kernel); 
		erode(tmp, tmp, Kernel2); 
		//threshold(dfRoi, dfRoi,255-m_pSettingKinect->m_kinectProp.marginFront,255,THRESH_BINARY);
		//agRoi = min/*max*/(agRoi,dfRoi);
		threshold(tmp, tmp,255-m_pSettingKinect->m_kinectProp.marginFront,1,THRESH_BINARY_INV);
		agRoi -= tmp;
	}
	/* convert agRoi back to 0-255-Img */
	threshold(agRoi, agRoi,255-(2*nFrames/3+1),255,THRESH_BINARY);

  m_maskFront_ok = true;
}
예제 #2
0
void fcuda2(int g_graph_mask_addr, int g_updating_graph_mask_addr, int g_graph_visited_addr, int g_over_addr, int no_of_nodes, dim3 gridDim, dim3 blockDim, DATATYPE * memport_core0_p2)
{
#pragma HLS INTERFACE ap_none register port=g_graph_mask_addr 
#pragma HLS RESOURCE core=AXI4LiteS variable=g_graph_mask_addr 
#pragma HLS INTERFACE ap_none register port=g_updating_graph_mask_addr 
#pragma HLS RESOURCE core=AXI4LiteS variable=g_updating_graph_mask_addr 
#pragma HLS INTERFACE ap_none register port=g_graph_visited_addr 
#pragma HLS RESOURCE core=AXI4LiteS variable=g_graph_visited_addr 
#pragma HLS INTERFACE ap_none register port=g_over_addr 
#pragma HLS RESOURCE core=AXI4LiteS variable=g_over_addr 
#pragma HLS INTERFACE ap_none register port=no_of_nodes 
#pragma HLS RESOURCE core=AXI4LiteS variable=no_of_nodes 
#pragma HLS INTERFACE ap_none register port=gridDim 
#pragma HLS RESOURCE core=AXI4LiteS variable=gridDim 
#pragma HLS INTERFACE ap_none register port=blockDim 
#pragma HLS RESOURCE core=AXI4LiteS variable=blockDim 
#pragma HLS RESOURCE core=AXI4LiteS variable=return 
#pragma HLS interface ap_bus port=memport_core0_p2 
#pragma HLS RESOURCE variable=memport_core0_p2 core=AXI4M 
DATATYPE * g_updating_graph_mask_core0;
DATATYPE * g_graph_visited_core0;
DATATYPE * g_over_core0;
DATATYPE * g_graph_mask_core0;
g_over_core0=( & memport_core0_p2[g_over_addr]);
g_graph_visited_core0=( & memport_core0_p2[g_graph_visited_addr]);
g_updating_graph_mask_core0=( & memport_core0_p2[g_updating_graph_mask_addr]);
g_graph_mask_core0=( & memport_core0_p2[g_graph_mask_addr]);
Kernel2(g_graph_mask_core0, g_updating_graph_mask_core0, g_graph_visited_core0, g_over_core0, no_of_nodes, gridDim, blockDim, 1, 0);
}