OpenCV 绘制十字Mark标

void DrawCross(cv::Mat & mat, cv::Point2i ptCenter, cv::Scalar color, double dFactor)
{
	double dAxisOffset = 12;
	double dAxisLen = 24 * 10 + 12 - dAxisOffset;

	// 坐标轴属性 0=Y+ 1=X+ 2=Y- 3=X-
	double dDirX[] = { 0, 1, 0, -1 };
	double dDirY[] = { -1, 0, 1, 0 };

	// 刻度属性
	int nLabelSize = 9 + 5;
	double dLabelStep[] = { 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 24, 24, 24, 24 };
	double dLabelHeight[] = { 12, 6, 12, 6, 12, 6, 12, 6, 12, 12, 12, 12, 12, 12 };

	// 字符属性
	int nIdx5 = 8;
	int nIdx10 = 13;
	double nCharOffset = 6;
	double dCharH = 0;
	double dCharW = 0;
	
	for (int i = 0; i < 4; i++)
	{
		cv::Point AxisPtS, AxisPtE;

		// 绘制轴
		AxisPtS.x = ptCenter.x + dAxisOffset / dFactor * dDirX[i];
		AxisPtS.y = ptCenter.y + dAxisOffset / dFactor * dDirY[i];
		AxisPtE.x = AxisPtS.x + dAxisLen / dFactor * dDirX[i];
		AxisPtE.y = AxisPtS.y + dAxisLen / dFactor * dDirY[i];
		cv::line(mat, AxisPtS, AxisPtE, color, 1);

		// 绘制刻度
		double nSumStep = 0;
		for (int j = 0; j <
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值