GraphView实现测量工具

news2025/1/15 13:42:47

效果演示:
在这里插入图片描述
主模块代码:

MeasureGraphView::MeasureGraphView(QWidget *parent)
    : QWidget(parent)
{
    ui.setupUi(this);
    m_measureType = NoType;
    m_bll = BllData::getInstance();
    m_scene = new GraphicsScene;
   connect(m_bll, &BllData::pressMeasurePosSignal, this, &MeasureGraphView::pressMeasurePosSlot);
   connect(m_bll, &BllData::returnDeletePosSignal, this, &MeasureGraphView::returnDeletePosSlot);
    // 隐藏水平/竖直滚动条
    ui.graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    ui.graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    // 设置场景范围
    ui.graphicsView->setSceneRect(INT_MIN / 2, INT_MIN / 2, INT_MAX, INT_MAX);
    // 反锯齿
    ui.graphicsView->setRenderHints(QPainter::Antialiasing);
    m_scene->setBackgroundBrush(Qt::gray);
    ui.graphicsView->setScene(m_scene);
}
MeasureGraphView::~MeasureGraphView()
{
}
void MeasureGraphView::on_disBtn_clicked() {
    m_measureType = DistanceType;
    m_bll->setMeasureEnable(m_measureType);
}
void MeasureGraphView::on_agBtn_clicked() {
    m_measureType = AngleType;
    m_bll->setMeasureEnable(m_measureType);
}
void MeasureGraphView::on_plineBtn_clicked() {
    m_measureType = PToLineType;
    m_bll->setMeasureEnable(m_measureType);
}
void MeasureGraphView::on_deleteBtn_clicked() {
    m_bll->deleteShapeEnable();
}
void MeasureGraphView::on_clearBtn_clicked() {
    m_scene->clear();
}
void MeasureGraphView::pressMeasurePosSlot(QPointF pos, PointType type) {
    if (m_measureType == DistanceType) {
        if (type == TopLeft) {
            MeasureBase* disMeasure = new MeasureBase(DistanceType);
            m_shapeList.append(disMeasure);
            m_scene->addItem(disMeasure);
            disMeasure->appendPoint(pos, TopLeft);
        }
        else if (type == BottomRight) {
            m_shapeList[m_shapeList.size() - 1]->appendPoint(pos, BottomRight);
            m_measureType = NoType;
        }
    }
    else if (m_measureType == AngleType) {
        if (type == FPoint) {
            MeasureBase* agMeasure = new MeasureBase(AngleType);
            m_shapeList.append(agMeasure);
            m_scene->addItem(agMeasure);
            agMeasure->appendPoint(pos, FPoint);
        }
        else if (type == AnglePoint) {
            m_shapeList[m_shapeList.size() - 1]->appendPoint(pos, AnglePoint);
        }
        else {
            m_shapeList[m_shapeList.size() - 1]->appendPoint(pos, EdgePoint);
            m_measureType = NoType;
        }
    }
    else if (m_measureType == PToLineType) {
        if (type == FPoint) {
            MeasureBase* pl = new MeasureBase(PToLineType);
            m_shapeList.append(pl);
            m_scene->addItem(pl);
            pl->appendPoint(pos, FPoint);
        }
        else if (type == EdgePoint) {
            m_shapeList[m_shapeList.size() - 1]->appendPoint(pos, EdgePoint);
        }
        else {
            m_shapeList[m_shapeList.size() - 1]->appendPoint(pos, PPoint);
            m_measureType = NoType;
        }
    }
}
void MeasureGraphView::returnDeletePosSlot(QPointF pos) {
    for (int i = 0; i < m_scene->items().size(); i++) {
        MeasureBase* item = (MeasureBase*)m_scene->items()[i];
        QPointF lt = item->getTopLeft();
        if (pos == lt) {
            qDebug() << "index: " << i;
            m_scene->removeItem(item);
            break;
        }
    }
    m_scene->update();
}

Scene代码:

GraphicsScene::GraphicsScene(QObject *parent)
	: QGraphicsScene(parent)
{
	m_enable = false;
	m_bll = BllData::getInstance();
	connect(m_bll, &BllData::setMeasureEnableSignal, this, &GraphicsScene::setMeasureEnableSlot);
}
GraphicsScene::~GraphicsScene()
{}
void GraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent* event) {
	if (m_enable) {
		m_clickCnt++;
		if (m_type == DistanceType) {
			if (m_clickCnt == 1) {
				m_bll->pressMeasurePos(event->scenePos(), TopLeft);
			}
			else if (m_clickCnt == 2) {
				m_enable = false;
				m_bll->pressMeasurePos(event->scenePos(), BottomRight);
			}
		}
		else if (m_type == AngleType) {
			if (m_clickCnt == 1) {
				m_bll->pressMeasurePos(event->scenePos(), FPoint);
			}
			else if (m_clickCnt == 2) {
				m_bll->pressMeasurePos(event->scenePos(), AnglePoint);
			}
			else if (m_clickCnt == 3) {
				m_enable = false;
				m_bll->pressMeasurePos(event->scenePos(), EdgePoint);
			}
		}
		else if (m_type == PToLineType) {
			if (m_clickCnt == 1) {
				m_bll->pressMeasurePos(event->scenePos(), FPoint);
			}
			else if (m_clickCnt == 2) {
				m_bll->pressMeasurePos(event->scenePos(), EdgePoint);
			}
			else if (m_clickCnt == 3) {
				m_enable = false;
				m_bll->pressMeasurePos(event->scenePos(), PPoint);
			}
		}
	}
	else {
		QGraphicsScene::mousePressEvent(event);
	}
}
void GraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event) {
	QGraphicsScene::mouseMoveEvent(event);
}
void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) {
	QGraphicsScene::mouseReleaseEvent(event);
}
void GraphicsScene::setMeasureEnableSlot(MeasureType type) {
	m_type = type;
	m_enable = true;
	m_clickCnt = 0;
}

MeasureShape代码:

MeasureBase::MeasureBase(MeasureType type)
{
	m_type = type;
	m_deleteEnable = false;
	m_bll = BllData::getInstance();
	connect(m_bll, &BllData::deleteShapeEnableSignal, this, &MeasureBase::deleteShapeEnableSlot);
	m_pen_noSelected.setColor(QColor(0, 160, 230));
	m_pen_noSelected.setWidth(2);
	m_pen_isSelected.setColor(QColor(255, 0, 255));
	m_pen_isSelected.setWidth(2);
	this->setPen(m_pen_noSelected);
	this->setFlags(QGraphicsItem::ItemIsSelectable |
		QGraphicsItem::ItemIsMovable |
		QGraphicsItem::ItemIsFocusable);
}

MeasureBase::~MeasureBase()
{
}
QRectF MeasureBase::boundingRect() const {
	int w = abs(m_tl.x() - m_br.x());
	int h = abs(m_tl.y() - m_br.y());
	int x0 = m_tl.x() < m_br.x() ? m_tl.x() : m_br.x();
	int y0 = m_tl.y() < m_br.y() ? m_tl.y() : m_br.y();
	QPointF center(x0 + w / 2, y0 + h / 2);
	w = w > 100 ? w : 100;
	h = h > 50 ? h : 50;
	int xx0 = center.x() - w / 2;
	int yy0 = center.y() - h / 2;
	QRectF rect(xx0, yy0, w, h);
	return rect;
}
void MeasureBase::focusInEvent(QFocusEvent* event) {
	Q_UNUSED(event);
	this->setPen(m_pen_isSelected);
}
void MeasureBase::focusOutEvent(QFocusEvent* event) {
	Q_UNUSED(event);
	this->setPen(m_pen_noSelected);
}
void MeasureBase::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
	Q_UNUSED(option);
	Q_UNUSED(widget);
	painter->setPen(this->pen());
	painter->setBrush(this->brush());
	int w = abs(m_tl.x() - m_br.x());
	int h = abs(m_tl.y() - m_br.y());
	int x0 = m_tl.x() < m_br.x() ? m_tl.x() : m_br.x();
	int y0 = m_tl.y() < m_br.y() ? m_tl.y() : m_br.y();
	if (m_type == DistanceType) {
		double dis = sqrt(pow(m_tl.x() - m_br.x(), 2) + pow(m_tl.y() - m_br.y(), 2));
		//dis = qRound(dis * 100) * 0.01;
		painter->drawLine(m_tl, m_br);
		if (dis > 5) {
			painter->setPen(QPen(QColor(255, 64, 64)));
			QPointF center(x0 + w / 2, y0 + h / 2);
			QString disStr = QString::number((int)dis).append(" pix");
			painter->drawText(center, disStr);
		}
	}
	else if (m_type == AngleType) {
		if (m_list.size() == 3) {
			calAg();
			QLineF line1(m_list[0], m_list[1]);
			QLineF line2(m_list[1], m_list[2]);
			painter->drawLine(line1);
			painter->drawLine(line2);
			painter->setPen(QPen(Qt::darkRed, 2, Qt::SolidLine));
			QRectF rect(m_list[1].x() - 16, m_list[1].y() - 16, 32, 32);
			painter->drawPie(rect, m_ags * 16, m_agr * 16);
			QString strag = "";
			m_agr = qRound(m_agr * 100) * 0.01;
			strag.append(QString::number(abs(m_agr))).append("°");
			painter->drawText(m_center.x()- m_radius/3, m_center.y(), strag);
		}
	}
	else if (m_type == PToLineType) {
		if (m_list.size() == 3) {
			//qDebug() << "m_type == PToLineType  ----------";
			calData();
			QLineF line1(m_list[0], m_list[1]);
			QLineF line2(m_list[2], m_intersectionP);
			painter->drawLine(line1);
			painter->setPen(QPen(Qt::darkGreen, 2, Qt::DashLine));
			painter->drawLine(line2);
			painter->setPen(QPen(QBrush(QColor(255, 106, 106)), 2, Qt::SolidLine));
			QString strldis = "LDis: ";
			strldis.append(QString::number(m_disH)).append(" pix");
			painter->drawText(m_center.x() -m_radius+10, m_center.y() -m_radius/2, strldis);
			QString strlvdis = "LVDis: ";
			strlvdis.append(QString::number(m_disV)).append(" pix");
			painter->drawText(m_center.x() - m_radius+10, m_center.y() - m_radius / 2+20, strlvdis);
		}
	}
	this->update();
}
void MeasureBase::calData() {
	int x1 = m_list[0].x();
	int y1 = m_list[0].y();
	int x2 = m_list[1].x();
	int y2 = m_list[1].y();
	int x3 = m_list[2].x();
	int y3 = m_list[2].y();
	if (x2 - x1 != 0) {
		double k = (double)(y2 - y1) / (x2 - x1);
		if (k != 0) {
			double b = (double)(y1 - k * x1);
			double vk = -1 / k;
			double vb = (double)(y3 - vk * x3);
			double x = (vb - b) / (k - vk);
			double y = k * x + b;
			m_intersectionP.setX(x);
			m_intersectionP.setY(y);
		}
		else {
			qDebug() << "x1==x2";
			m_intersectionP.setX(x3);
			m_intersectionP.setY(y1);
		}
	}
	else {
		m_intersectionP.setX(x1);
		m_intersectionP.setY(y3);
	}
	double DD = (y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1);
	double D = sqrt(DD);
	m_disH = D;
	int x4 = m_intersectionP.x();
	int y4 = m_intersectionP.y();
	double ff = (y4 - y3) * (y4 - y3) + (x4 - x3) * (x4 - x3);
	double f = sqrt(ff);
	m_disV = f;
}
void MeasureBase::updatePosData(MeasureType type, QPointF org, QPointF pos) {
	//QList<QPointF> list;
	m_list.clear();
	for (int i = 0; i < m_pointList.size(); i++) {
		QPointF p = m_pointList[i]->getPoint();
		//qDebug() << " list index : " << i << " pos: " << p << " org: " << org;
		if ((abs(p.x() - org.x()) <= 2) && (abs(p.y() - org.y()) <= 2)) {
			//qDebug() << "find it------------------------";
			m_pointList[i]->setPoint(pos);
		}
		m_list.append(m_pointList[i]->getPoint());
	}
	m_center = getCentroid();
	getMaxLength();
	QRectF(m_center.x() - m_radius, m_center.y() - m_radius, m_radius * 2, m_radius * 2);
	m_tl = QPointF(m_center.x() - m_radius, m_center.y() - m_radius);
	m_br = QPointF(m_center.x() + m_radius, m_center.y() + m_radius);
	this->update();
	
}
void MeasureBase::calAg() {
	QPointF p0 = m_list[1];
	QPointF p1 = m_list[0];
	QPointF p2 = m_list[2];
	QPoint p3(p0.x() + 100, p0.y());
	QPoint p0p1;
	p0p1.setX(p1.x() - p0.x());
	p0p1.setY(p0.y() - p1.y());
	QPoint p0p2;
	p0p2.setX(p2.x() - p0.x());
	p0p2.setY(p0.y() - p2.y());
	QPoint p0p3;
	p0p3.setX(p3.x() - p0.x());
	p0p3.setY(p0.y() - p3.y());
	double cosp1p2_1 = p0p1.x() * p0p2.x() + p0p1.y() * p0p2.y();
	double cosp1p2_2 = sqrt(p0p1.x() * p0p1.x() + p0p1.y() * p0p1.y()) * sqrt(p0p2.x() * p0p2.x() + p0p2.y() * p0p2.y());
	double  cosp1p2 = cosp1p2_1 / cosp1p2_2;
	double agp1p2 = abs(acos(cosp1p2)) * 180 / 3.1415926;
	double cosp2p3_1 = p0p2.x() * p0p3.x() + p0p2.y() * p0p3.y();
	double cosp2p3_2 = sqrt(p0p2.x() * p0p2.x() + p0p2.y() * p0p2.y()) * sqrt(p0p3.x() * p0p3.x() + p0p3.y() * p0p3.y());
	double  cosp2p3 = cosp2p3_1 / cosp2p3_2;
	double agp2p3 = abs(acos(cosp2p3)) * 180 / 3.1415926;
	double d = p0p2.x() * p0p1.y() - p0p1.x() * p0p2.y();
	if (p2.y() > p0.y()) {
		agp2p3 = -agp2p3;
	}
	if (d < 0) {
		agp1p2 = -agp1p2;
	}
	m_ags = agp2p3;
	m_agr = agp1p2;
	this->update();
}
void MeasureBase::mousePressEvent(QGraphicsSceneMouseEvent* event) {
	if (m_deleteEnable) {
		m_deleteEnable = false;
		m_bll->returnDeletePos(m_tl);
	}
}
void MeasureBase::mouseMoveEvent(QGraphicsSceneMouseEvent* event) {
	qreal dx = event->scenePos().x() - event->lastScenePos().x();
	qreal dy = event->scenePos().y() - event->lastScenePos().y();
	this->moveBy(dx, dy);
	this->update();
}
void MeasureBase::setTopLeft(QPointF pos) {
	m_tl = pos;
}
QPointF MeasureBase::getTopLeft() {
	return m_tl;
}
void MeasureBase::setBottomRight(QPointF pos) {
	m_br = pos;
}
QPointF MeasureBase::getBottomRight() {
	return m_br;
}
void MeasureBase::setDot(QPointF pos) {
	m_dot = pos;
}
QPointF MeasureBase::getDot() {
	return m_dot;
}
void MeasureBase::appendPoint(QPointF pos, PointType type) {
	if (m_type == DistanceType) {
		if (type == TopLeft) {
			setTopLeft(pos);
			setBottomRight(pos);
			PointBase* p1 = new PointBase(DistanceType, TopLeft, pos);
			p1->setParentItem(this);
			p1->setBrush(QBrush(QColor(0, 255, 0)));
			m_pointList.append(p1);
		}
		else if (type == BottomRight) {
			setBottomRight(pos);
			PointBase* p2 = new PointBase(DistanceType, BottomRight, pos);
			p2->setParentItem(this);
			p2->setBrush(QBrush(QColor(0, 255, 0)));
			m_pointList.append(p2);
			this->update();
		}
	}
	else if (m_type == AngleType) {
		if (type == FPoint) {
			m_list.append(pos);
			setTopLeft(pos);
			setBottomRight(pos);
			PointBase* p1 = new PointBase(AngleType, FPoint, pos);
			p1->setParentItem(this);
			p1->setBrush(QBrush(QColor(0, 255, 0)));
			m_pointList.append(p1);
		}
		else if (type == AnglePoint) {
			m_list.append(pos);
			m_center = getCentroid();
			getMaxLength();
			QRectF(m_center.x() - m_radius, m_center.y() - m_radius, m_radius * 2, m_radius * 2);
			m_tl = QPointF(m_center.x() - m_radius, m_center.y() - m_radius);
			m_br = QPointF(m_center.x() + m_radius, m_center.y() + m_radius);
			PointBase* p = new PointBase(AngleType, AnglePoint,pos);
			p->setParentItem(this);
			p->setBrush(QBrush(QColor(255, 0, 0)));
			m_pointList.append(p);
		}
		else {
			m_list.append(pos);
			m_center = getCentroid();
			getMaxLength();
			QRectF(m_center.x() - m_radius, m_center.y() - m_radius, m_radius * 2, m_radius * 2);
			m_tl = QPointF(m_center.x() - m_radius, m_center.y() - m_radius);
			m_br = QPointF(m_center.x() + m_radius, m_center.y() + m_radius);
			PointBase* p = new PointBase(AngleType, EdgePoint, pos);
			p->setParentItem(this);
			p->setBrush(QBrush(QColor(0, 255, 0)));
			m_pointList.append(p);
		}
	}
	else if (m_type == PToLineType) {
		if (type == FPoint) {
			m_list.append(pos);
			setTopLeft(pos);
			setBottomRight(pos);
			PointBase* p1 = new PointBase(PToLineType, FPoint, pos);
			p1->setParentItem(this);
			p1->setBrush(QBrush(QColor(0, 255, 0)));
			m_pointList.append(p1);
		}
		else if (type == EdgePoint) {
			m_list.append(pos);
			m_center = getCentroid();
			getMaxLength();
			QRectF(m_center.x() - m_radius, m_center.y() - m_radius, m_radius * 2, m_radius * 2);
			m_tl = QPointF(m_center.x() - m_radius, m_center.y() - m_radius);
			m_br = QPointF(m_center.x() + m_radius, m_center.y() + m_radius);
			PointBase* p = new PointBase(PToLineType, EdgePoint, pos);
			p->setParentItem(this);
			p->setBrush(QBrush(QColor(0, 255, 0)));
			m_pointList.append(p);
		}
		else {
			m_list.append(pos);
			m_center = getCentroid();
			getMaxLength();
			QRectF(m_center.x() - m_radius, m_center.y() - m_radius, m_radius * 2, m_radius * 2);
			m_tl = QPointF(m_center.x() - m_radius, m_center.y() - m_radius);
			m_br = QPointF(m_center.x() + m_radius, m_center.y() + m_radius);
			PointBase* p = new PointBase(PToLineType, PPoint, pos);
			p->setParentItem(this);
			p->setBrush(QBrush(QColor(255, 0, 0)));
			m_pointList.append(p);
		}
	}
}
QPointF MeasureBase::getCentroid() {
	qreal x = 0;
	qreal y = 0;
	if (m_list.size() > 1) {
		for (int i = 0; i < m_list.size(); i++) {
			x += m_list[i].x();
			y += m_list[i].y();
		}
		x = x / m_list.size();
		y = y / m_list.size();
	}
	return QPointF(x, y);
}
void MeasureBase::getMaxLength() {
	QVector<qreal> vec;
	for (auto& temp : m_list)
	{
		qreal dis = sqrt(pow(m_center.x() - temp.x(), 2) + pow(m_center.y() - temp.y(), 2));
		vec.append(dis);
	}
	qreal ret = 0;
	for (auto& temp : vec)
	{
		if (temp > ret) {
			ret = temp;
		}
	}
	m_radius = ret;
}
void MeasureBase::deleteShapeEnableSlot() {
	m_deleteEnable = true;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1513821.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

力扣106 从中序与后续遍历序列构造二叉树

文章目录 题目描述解题思路代码 题目描述 给定两个整数数组 inorder 和 postorder &#xff0c;其中 inorder 是二叉树的中序遍历&#xff0c; postorder 是同一棵树的后序遍历&#xff0c;请你构造并返回这颗 二叉树 。 示例 1: 输入&#xff1a;inorder [9,3,15,20,7], …

【单片机毕业设计7-基于stm32c8t6的智能温室大棚系统】

【单片机毕业设计7-基于stm32c8t6的智能温室大棚系统】 前言一、功能介绍二、硬件部分三、软件部分总结 前言 &#x1f525;这里是小殷学长&#xff0c;单片机毕业设计篇7基于stm32的智能衣柜系统 &#x1f9ff;创作不易&#xff0c;拒绝白嫖可私 一、功能介绍 ---------------…

Sqllab第一关通关笔记

知识点&#xff1a; 明白数值注入和字符注入的区别 数值注入&#xff1a;通过数字运算判断&#xff0c;1/0 1/1 字符注入&#xff1a;通过引号进行判断&#xff0c;奇数个和偶数个单引号进行识别 联合查询&#xff1a;union 或者 union all 需要满足字段数一致&…

基础小白快速入门opencv-------C++ 在opencv的应用以及opencv的下载配置

啥是opencv&#xff1f; OpenCV&#xff08;开源计算机视觉库 Open Source Computer Vision Library&#xff09;是一个跨平台的计算机视觉库&#xff0c;最初由Intel开发&#xff0c;现在由一个跨国团队维护。它免费提供给学术和商业用途&#xff0c;并且是用C语言写成的&…

doit,一个非常实用的 Python 库!

更多Python学习内容&#xff1a;ipengtao.com 大家好&#xff0c;今天为大家分享一个非常实用的 Python 库 - doit。 Github地址&#xff1a;https://github.com/pydoit/doit 在软件开发和数据处理过程中&#xff0c;经常会遇到需要执行一系列任务的情况&#xff0c;这些任务可…

华为数通方向HCIP-DataCom H12-821题库(多选题:161-180)

第161题 以下关于IPv6优势的描述,正确的是哪些项? A、底层自身携带安全特性 B、加入了对自动配置地址的支持,能够无状态自动配置地址 C、路由表相比IPv4会更大,寻址更加精确 D、头部格式灵活,具有多个扩展头 【参考答案】ABD 【答案解析】 第162题 在OSPF视图下使用Filt…

做伦敦银要等怎样的价格与行情?

对于不同的伦敦银投资者来说&#xff0c;合适的入市价格和好的行情机会&#xff0c;标准可能并不一样&#xff0c;因为不同人有不同的交易策略、风险偏好和盈利目标。对于喜欢做趋势跟踪的投资者来说&#xff0c;一波明显而持续的上涨或下跌趋势&#xff0c;可能就是最好的行情…

yolov5-v6.0详细解读

yolov5-v6.0详细解读 一、yolov5版本介绍二、网络结构2.1 Backbone特征提取部分2.1.1 ConvBNSiLU模块2.1.2 C3模块2.1.2.1 BottleNeck模块 2.1.3 SPPF模块 2.2 Neck特征融合部分2.2.1 FPN2.2.2 PANet 2.3Head模块 三、目标框回归3.1 yolo标注格式3.2 yolov4目标回归框3.3 yolov…

数据结构-链表(二)

1.两两交换列表中的节点 给你一个链表&#xff0c;两两交换其中相邻的节点&#xff0c;并返回交换后链表的头节点。你必须在不修改节点内部的值的情况下完成本题&#xff08;即&#xff0c;只能进行节点交换&#xff09;。 输入&#xff1a;head [1,2,3,4] 输出&#xff1a;[2…

框架漏洞Shiroweblogicfastjson || 免杀思路

继续来讲一下我们的框架漏洞,先讲一下Shiro 1.Shiro反序列化 1.原理 Shiro的漏洞形成呢&#xff0c;就是因为存在了RememberMe这样的一个字段 Shiro 框架在处理 "rememberMe" 功能时使用了不安全的反序列化方法&#xff0c;攻击者可以构造恶意序列化数据&#xff0…

基于YOLOv8/YOLOv7/YOLOv6/YOLOv5的危险物品检测系统(深度学习模型+PySide6界面+训练数据集+Python代码)

摘要&#xff1a;本文深入介绍了一个采用深度学习技术的危险物品识别系统&#xff0c;该系统融合了最新的YOLOv8算法&#xff0c;并对比了YOLOv7、YOLOv6、YOLOv5等早期版本的性能。该系统在处理图像、视频、实时视频流及批量文件时&#xff0c;能够准确识别和分类各种危险物品…

9、组合模式(结构性模式)

组合模式又叫部分整体模式&#xff0c;它创建了对象组的树形结构&#xff0c;将对象组合成树状结构&#xff0c;以一致的方式处理叶子对象以及组合对象&#xff0c;不以层次高低定义类&#xff0c;都是结点类 一、传统组合模式 举例&#xff0c;大学、学院、系&#xff0c;它们…

勾八头歌之数据科学导论—数据预处理

第1关&#xff1a;引言-根深之树不怯风折&#xff0c;泉深之水不会涸竭 第2关&#xff1a;数据清理-查漏补缺 import numpy as np import pandas as pd import matplotlib.pyplot as pltdef student():# Load the CSV file and replace #NAME? with NaNtrain pd.read_csv(Tas…

人工智能的幽默“失误”

人工智能迷惑行为大赏 随着ChatGPT热度的攀升&#xff0c;越来越多的公司也相继推出了自己的AI大模型&#xff0c;如文心一言、通义千问等。各大应用也开始内置AI玩法&#xff0c;如抖音的AI特效&#xff5e;在使用过程中往往会遇到一些问题&#xff0c;让你不得不怀疑&#x…

反向传播 — 简单解释

一、说明 关于反向传播&#xff0c;我有一个精雕细刻的案例计划&#xff0c;但是实现了一半&#xff0c;目前没有顾得上继续充实&#xff0c;就拿论文的叙述这里先起个头&#xff0c;我后面将修改和促进此文的表述质量。 二、生物神经元 大脑是一个由大约100亿个神经元组成的复…

HD_VG_130M数据集预处理

数据集介绍 HD_VG_130M是文生视频常用数据集&#xff0c;其视频来源于油管&#xff0c;可通过该谷歌云盘链接下载官方文件&#xff0c;如下所示&#xff0c;其中metafiles中包含20个json文件&#xff0c;请先将其全部下载到本地&#xff0c;假设保存地址为"E:/HD_VG_130M…

Android Gradle 开发与应用 (六) : 创建buildSrc插件和使用命令行创建Gradle插件

1. 前言 前文中&#xff0c;我们介绍了在Android中&#xff0c;如何基于Gradle 8.2&#xff0c;创建Gradle插件。这篇文章&#xff0c;我们以buildSrc的方式来创建Gradle插件。此外&#xff0c;还介绍一种用Cmd命令行的方式&#xff0c;来创建独立的Gradle插件的方式。 1.1 本…

开源大数据集群部署(十五)Zookeeper集群部署

作者&#xff1a;櫰木 1、集群规划 主机版本角色系统用户hd1.dtstack.com3.7.1followerzookeeperhd2.dtstack.com3.7.1leaderzookeeperhd3.dtstack.com3.7.1followerzookeeper 2、zookeeper kerberos主体创建 在生产中zk服务端和客户端票据可以设置成不通名称或相同名称&am…

钉钉与实在智能达成战略合作,实在Agent助力钉钉AI助理成为“新质生产力”

3月12日&#xff0c;浙江实在智能科技有限公司&#xff08;简称“实在智能”&#xff09;与钉钉&#xff08;中国&#xff09;信息技术有限公司&#xff08;简称“钉钉”&#xff09;签署战略合作协议&#xff0c;达成战略合作伙伴关系。 未来&#xff0c;基于双方创新领先的技…

普乐蛙VR航天体验馆设备VR体验带你登陆月球

周末节假日这款设备人流量chao多&#xff01;景区&#xff1f;游乐场&#xff1f;电玩城爆滿&#xff0c;小编去了一次可是天天惦记着&#xff0c;学习/竞速/休闲/末日/kongbu&#xff0c;各种题材好过瘾&#xff01; 亲测不踩雷设备推荐&#xff01;华夏方舟——VR小白必玩的大…