Commit 75de1885 张士柳

1 个父辈 cde6cc7d
...@@ -449,7 +449,7 @@ static int Otsu(int hist[]) ...@@ -449,7 +449,7 @@ static int Otsu(int hist[])
// The float casting here is to avoid compiler warning about loss of precision and // The float casting here is to avoid compiler warning about loss of precision and
// will prevent overflow in the case of large saturated images // will prevent overflow in the case of large saturated images
denom = (double)(N1) * (N - N1); // Maximum value of denom is (N^2)/4 = approx. 3E10 denom = (double)(N1)* (N - N1); // Maximum value of denom is (N^2)/4 = approx. 3E10
if (denom != 0) { if (denom != 0) {
// Float here is to avoid loss of precision when dividing // Float here is to avoid loss of precision when dividing
...@@ -1368,7 +1368,7 @@ int eyemCountObject(EyemImage tpImage, EyemRect tpRoi, const char *fileName, int ...@@ -1368,7 +1368,7 @@ int eyemCountObject(EyemImage tpImage, EyemRect tpRoi, const char *fileName, int
//更新元件间角度 //更新元件间角度
partDist = (2 * asin(dChordL / (2 * trackRadius))) * 180 / PI; partDist = (2 * asin(dChordL / (2 * trackRadius))) * 180 / PI;
//判断是否结束 //判断是否结束
if ((mac.iPartSize < sinPartSize / 4) || (trackMat.at<uchar>((cvRound(trackCenter.y)), (cvRound(trackCenter.x))) == 255) || (mac.iLimit / 255) > (rect.size.area() / 4) || (sinParts.at<uchar>((cvRound(trackCenter.y)), (cvRound(trackCenter.x))) == 0)) if ((mac.iPartSize < sinPartSize / 4) || (trackMat.at<uchar>((cvRound(trackCenter.y)), (cvRound(trackCenter.x))) == 255) || (mac.iLimit / 255) >(rect.size.area() / 4) || (sinParts.at<uchar>((cvRound(trackCenter.y)), (cvRound(trackCenter.x))) == 0))
{ {
found = false; found = false;
//for (int j = 0; j < 4; j++) //for (int j = 0; j < 4; j++)
...@@ -2253,7 +2253,7 @@ int eyemCountObjectIrregularParts(EyemImage tpImage, EyemRect tpRoi, const char ...@@ -2253,7 +2253,7 @@ int eyemCountObjectIrregularParts(EyemImage tpImage, EyemRect tpRoi, const char
cv::Rect _rLimits = cv::Rect(cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().tl().x - tDist), cv::Rect _rLimits = cv::Rect(cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().tl().x - tDist),
cvRound((float)ta.RBox.boundingRect2f().tl().y - tDist)), cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().br().x + tDist), cvRound((float)ta.RBox.boundingRect2f().tl().y - tDist)), cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().br().x + tDist),
cvRound((float)ta.RBox.boundingRect2f().br().y + tDist)) cvRound((float)ta.RBox.boundingRect2f().br().y + tDist))
)&cv::Rect(0, 0, X, Y); )&cv::Rect(0, 0, X, Y);
//确定元件位置根据旋转后的位置确定(前提是料盘中心定位的准确) //确定元件位置根据旋转后的位置确定(前提是料盘中心定位的准确)
double t = atan2((double)startCenter.y - reelCenter.y, (double)startCenter.x - reelCenter.x) * 180.0 / PI; double t = atan2((double)startCenter.y - reelCenter.y, (double)startCenter.x - reelCenter.x) * 180.0 / PI;
...@@ -3345,7 +3345,7 @@ int eyemCountObjectIrregularParts(EyemImage tpImage, EyemRect tpRoi, const char ...@@ -3345,7 +3345,7 @@ int eyemCountObjectIrregularParts(EyemImage tpImage, EyemRect tpRoi, const char
cv::Rect _rLimits = cv::Rect(cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().tl().x - tDist), cv::Rect _rLimits = cv::Rect(cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().tl().x - tDist),
cvRound((float)ta.RBox.boundingRect2f().tl().y - tDist)), cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().br().x + tDist), cvRound((float)ta.RBox.boundingRect2f().tl().y - tDist)), cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().br().x + tDist),
cvRound((float)ta.RBox.boundingRect2f().br().y + tDist)) cvRound((float)ta.RBox.boundingRect2f().br().y + tDist))
)&cv::Rect(0, 0, X, Y); )&cv::Rect(0, 0, X, Y);
//确定元件位置根据旋转后的位置确定(前提是料盘中心定位的准确) //确定元件位置根据旋转后的位置确定(前提是料盘中心定位的准确)
double t = atan2((double)startCenter.y - reelCenter.y, (double)startCenter.x - reelCenter.x) * 180.0 / PI; double t = atan2((double)startCenter.y - reelCenter.y, (double)startCenter.x - reelCenter.x) * 180.0 / PI;
...@@ -4474,7 +4474,7 @@ int eyemCountObjectIrregularParts(EyemImage tpImage, EyemRect tpRoi, const char ...@@ -4474,7 +4474,7 @@ int eyemCountObjectIrregularParts(EyemImage tpImage, EyemRect tpRoi, const char
{ {
//面积过滤 //面积过滤
if (stats.ptr<int>(j)[cv::CC_STAT_AREA] > 2) { if (stats.ptr<int>(j)[cv::CC_STAT_AREA] > 2) {
binary.at<uchar>(cv::Point(cvRound((float)dpCent[(0) + (j) * 2]), cvRound((float)dpCent[(1) + (j) * 2]))) = 255; binary.at<uchar>(cv::Point(cvRound((float)dpCent[(0) + (j)* 2]), cvRound((float)dpCent[(1) + (j)* 2]))) = 255;
} }
} }
} }
...@@ -5051,7 +5051,7 @@ int eyemCountObjectE(EyemImage tpImage, EyemRect tpRoi, const char *fileName, in ...@@ -5051,7 +5051,7 @@ int eyemCountObjectE(EyemImage tpImage, EyemRect tpRoi, const char *fileName, in
cv::Rect _rLimits = cv::Rect(cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().tl().x - tDist), cv::Rect _rLimits = cv::Rect(cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().tl().x - tDist),
cvRound((float)ta.RBox.boundingRect2f().tl().y - tDist)), cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().br().x + tDist), cvRound((float)ta.RBox.boundingRect2f().tl().y - tDist)), cv::Point2i(cvRound((float)ta.RBox.boundingRect2f().br().x + tDist),
cvRound((float)ta.RBox.boundingRect2f().br().y + tDist)) cvRound((float)ta.RBox.boundingRect2f().br().y + tDist))
)&cv::Rect(0, 0, X, Y); )&cv::Rect(0, 0, X, Y);
//确定元件位置根据旋转后的位置确定(前提是料盘中心定位的准确) //确定元件位置根据旋转后的位置确定(前提是料盘中心定位的准确)
double t = atan2((double)startCenter.y - reelCenter.y, (double)startCenter.x - reelCenter.x) * 180.0 / PI; double t = atan2((double)startCenter.y - reelCenter.y, (double)startCenter.x - reelCenter.x) * 180.0 / PI;
...@@ -7953,7 +7953,6 @@ int eyemLibImpl(EyemImage tpImage, EyemHSVModel tpHSVModel, EyemImage *tpDstImg) ...@@ -7953,7 +7953,6 @@ int eyemLibImpl(EyemImage tpImage, EyemHSVModel tpHSVModel, EyemImage *tpDstImg)
(tpHSVModel.dpRangeUExt[0] + tpHSVModel.dpRangeUExt[1] + tpHSVModel.dpRangeUExt[2]) != 0) { (tpHSVModel.dpRangeUExt[0] + tpHSVModel.dpRangeUExt[1] + tpHSVModel.dpRangeUExt[2]) != 0) {
std::cout << "红色" << std::endl; std::cout << "红色" << std::endl;
} }
return FUNC_OK; return FUNC_OK;
//shape_based_matching GM; // object to implent geometric matching //shape_based_matching GM; // object to implent geometric matching
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!