Example #1
0
void TrickEstimater::labelContour(unsigned int contour_id, unsigned int rv_size)
{
	LabelingBS	labeling;
	bool at_is_sort_size_order = false;//óÃàÊÇÃëÂÇ´Ç≥èáÇ…É\Å[ÉgǵǻǢ
	int at_delete_size = 0;    //è¡ãéÇ∑ÇÈè¨óÃàÊÇÃç≈ëÂÉTÉCÉY(int) - DZÇÍà»â∫ÇÃÉTÉCÉYÇÃóÃàÊÇè¡ãéÇ∑ÇÈ
	unsigned char *src = new unsigned char[rv_size];
	short *result = new short[rv_size];
    
	for (int i = 0; i < rv_size; i++){
		src[i] = (unsigned char)is_sharp_angle[contour_id][i];
	}
	labeling.Exec(src, result, rv_size, 1, at_is_sort_size_order, at_delete_size);
	label_index_max = labeling.GetNumOfResultRegions();
    
	for (int i = 0; i < rv_size; i++){
		is_sharp_angle[contour_id][i] = (unsigned short)result[i];
	}
	for (int i = 0; i < label_index_max; i++){
		label_index[contour_id][i] = (labeling.GetResultRegionInfo(i))->GetResult();
	}
    
	delete[] src;
	delete[] result;
    
}
Example #2
0
void OpenCVAdapter::LabelFrame(){
	LabelingBS	labeling;
	labeling.Exec(label,labeled,xnum,ynum,true,trackbarPosition2);
	int n = labeling.GetNumOfResultRegions();
	printf("%d region found\n",n);
	for(int i=0;i<n;i++){
		RegionInfoBS *ri;
		ri=labeling.GetResultRegionInfo(i);
		float x,y;
		ri->GetCenterOfGravity(x,y);
		int px=(int)x*winx/width;
		int py=(int)y*winy/height;
		plist.push_back(make_pair((int)px,(int)py));
	}
}