|
|
|
@ -112,10 +112,10 @@ bool CameraControl::readCameraConfig(QString filePath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
QJsonObject devicesObj = jsonObj.value("devices").toObject();
|
|
|
|
QJsonObject devicesObj = jsonObj.value("devices").toObject();
|
|
|
|
if (!devicesObj.isEmpty()) {
|
|
|
|
if (!devicesObj.isEmpty()) {
|
|
|
|
CameraInfo cameraInfo;
|
|
|
|
|
|
|
|
QStringList devicesLabelList = devicesObj.keys();
|
|
|
|
QStringList devicesLabelList = devicesObj.keys();
|
|
|
|
for each (QString deviceLabel in devicesLabelList)
|
|
|
|
for each (QString deviceLabel in devicesLabelList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
CameraInfo cameraInfo;
|
|
|
|
cameraInfo.cameraLabel = deviceLabel;
|
|
|
|
cameraInfo.cameraLabel = deviceLabel;
|
|
|
|
QStringList strList = deviceLabel.split(' ');
|
|
|
|
QStringList strList = deviceLabel.split(' ');
|
|
|
|
if (strList.length() != 2)
|
|
|
|
if (strList.length() != 2)
|
|
|
|
@ -133,11 +133,11 @@ bool CameraControl::readCameraConfig(QString filePath)
|
|
|
|
cameraInfo.imageHeight = deviceObj.value("height").toInt();
|
|
|
|
cameraInfo.imageHeight = deviceObj.value("height").toInt();
|
|
|
|
cameraInfo.imageWidth = deviceObj.value("width").toInt();
|
|
|
|
cameraInfo.imageWidth = deviceObj.value("width").toInt();
|
|
|
|
cameraInfo.saveImgSuffix = deviceObj.value("save_img_suffix").toString();
|
|
|
|
cameraInfo.saveImgSuffix = deviceObj.value("save_img_suffix").toString();
|
|
|
|
|
|
|
|
int id = deviceObj.value("id").toInt();
|
|
|
|
if (deviceObj.contains("rotation_angle"))
|
|
|
|
if (deviceObj.contains("rotation_angle"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cameraInfo.rotationAngle = deviceObj.value("rotation_angle").toInt();
|
|
|
|
cameraInfo.rotationAngle = deviceObj.value("rotation_angle").toInt();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int id = deviceObj.value("id").toInt();
|
|
|
|
|
|
|
|
if (id >= topStartId && id <= topEndId)
|
|
|
|
if (id >= topStartId && id <= topEndId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_mapIdCameraInfoTop[id] = cameraInfo;
|
|
|
|
m_mapIdCameraInfoTop[id] = cameraInfo;
|
|
|
|
@ -445,7 +445,7 @@ void CameraControl::capture(const QStringList& serialNumberList)
|
|
|
|
QString serialNumber = serialNumberList.at(i);
|
|
|
|
QString serialNumber = serialNumberList.at(i);
|
|
|
|
getSaveImgNameInfo(serialNumber, vecImageInfo[i].saveImgInfo);
|
|
|
|
getSaveImgNameInfo(serialNumber, vecImageInfo[i].saveImgInfo);
|
|
|
|
int id = vecImageInfo.at(i).saveImgInfo.strId.toInt();
|
|
|
|
int id = vecImageInfo.at(i).saveImgInfo.strId.toInt();
|
|
|
|
int rotationAngle;
|
|
|
|
int rotationAngle = 0;
|
|
|
|
if (m_mapIdCameraInfoTop.contains(id))
|
|
|
|
if (m_mapIdCameraInfoTop.contains(id))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rotationAngle = m_mapIdCameraInfoTop.value(id).rotationAngle;
|
|
|
|
rotationAngle = m_mapIdCameraInfoTop.value(id).rotationAngle;
|
|
|
|
@ -468,16 +468,20 @@ void CameraControl::flipImg(const cv::Mat& imgSrc, cv::Mat& imgDst, int rotation
|
|
|
|
case 90:
|
|
|
|
case 90:
|
|
|
|
cv::transpose(imgSrc, imgDst);
|
|
|
|
cv::transpose(imgSrc, imgDst);
|
|
|
|
cv::flip(imgDst, imgDst, 1);
|
|
|
|
cv::flip(imgDst, imgDst, 1);
|
|
|
|
|
|
|
|
qDebug() << " 旋转90度";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 180:
|
|
|
|
case 180:
|
|
|
|
cv::flip(imgSrc, imgDst, 0);
|
|
|
|
cv::flip(imgSrc, imgDst, 0);
|
|
|
|
|
|
|
|
qDebug() << " 旋转180度";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 270:
|
|
|
|
case 270:
|
|
|
|
cv::transpose(imgSrc, imgDst);
|
|
|
|
cv::transpose(imgSrc, imgDst);
|
|
|
|
cv::flip(imgDst, imgDst, 0);
|
|
|
|
cv::flip(imgDst, imgDst, 0);
|
|
|
|
|
|
|
|
qDebug() << " 旋转270度";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
imgDst = imgSrc;
|
|
|
|
imgDst = imgSrc;
|
|
|
|
|
|
|
|
qDebug() << " 不旋转";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|