|
@@ -464,7 +464,7 @@ namespace OTSIncAReportApp
|
|
string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)ReportFun.resultFile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
|
|
string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)ReportFun.resultFile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
|
|
DataTable userLibraryData = new DataTable();
|
|
DataTable userLibraryData = new DataTable();
|
|
UserLibraryData userLibrary = new UserLibraryData(str_libraryName);
|
|
UserLibraryData userLibrary = new UserLibraryData(str_libraryName);
|
|
- if (userLibrary != null)
|
|
|
|
|
|
+ if (userLibrary.GetSqlHelper() != null)
|
|
{
|
|
{
|
|
userLibraryData = userLibrary.GetSubAttributeFromDatabase();
|
|
userLibraryData = userLibrary.GetSubAttributeFromDatabase();
|
|
}
|
|
}
|
|
@@ -841,15 +841,19 @@ namespace OTSIncAReportApp
|
|
int areaField = stats.At<int>(h, 4);
|
|
int areaField = stats.At<int>(h, 4);
|
|
keyValuePairs.Add(h, areaField);
|
|
keyValuePairs.Add(h, areaField);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ DrawRectangeForParticles(nonenum, stats, mat_dst, Scalar.White);
|
|
|
|
+
|
|
|
|
+
|
|
int Key = 0;//新颗粒序列
|
|
int Key = 0;//新颗粒序列
|
|
if (CB_HAND.Checked)//手动处理
|
|
if (CB_HAND.Checked)//手动处理
|
|
{
|
|
{
|
|
Mat srcWhite = new Mat(mat_dst.Height, mat_dst.Width, MatType.CV_8UC1, new Scalar(0));//黑色底图
|
|
Mat srcWhite = new Mat(mat_dst.Height, mat_dst.Width, MatType.CV_8UC1, new Scalar(0));//黑色底图
|
|
mat.CopyTo(srcWhite, mat_dst);
|
|
mat.CopyTo(srcWhite, mat_dst);
|
|
-
|
|
|
|
bgw_process.ReportProgress(0, OpenCvSharp.Extensions.BitmapConverter.ToBitmap(srcWhite));
|
|
bgw_process.ReportProgress(0, OpenCvSharp.Extensions.BitmapConverter.ToBitmap(srcWhite));
|
|
SetProgressMessage(table["str18"].ToString(), richTextBox_process);
|
|
SetProgressMessage(table["str18"].ToString(), richTextBox_process);
|
|
- GetKeyNo(labelMat, mat_dst.Width, mat_dst.Height, ref Key);
|
|
|
|
|
|
+ if(!GetKeyNo(labelMat, mat_dst.Width, mat_dst.Height, ref Key))
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
else//自动处理
|
|
else//自动处理
|
|
{
|
|
{
|
|
@@ -925,6 +929,20 @@ namespace OTSIncAReportApp
|
|
groupBox_param.Enabled = true;
|
|
groupBox_param.Enabled = true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ void DrawRectangeForParticles(int centroids,Mat stats,Mat mat_dst, Scalar Col)
|
|
|
|
+ {
|
|
|
|
+ for (int h = 1; h < centroids; h++)
|
|
|
|
+ {
|
|
|
|
+ //if (h > 10)
|
|
|
|
+ //{
|
|
|
|
+ // break;
|
|
|
|
+ //}
|
|
|
|
+ if (stats.At<int>(h, 0) == 0) continue; //box_site[0,...] 为背景图大小。
|
|
|
|
+ Cv2.Rectangle(mat_dst, new OpenCvSharp.Point(stats.At<int>(h, 0), stats.At<int>(h, 1)), new OpenCvSharp.Point(stats.At<int>(h, 0) + stats.At<int>(h, 2), stats.At<int>(h, 1) + stats.At<int>(h, 3)), Col, 1);
|
|
|
|
+ }
|
|
|
|
+ //Cv2.ImShow("biaoji", mat_dst);
|
|
|
|
+ //Cv2.WaitKey(1);
|
|
|
|
+ }
|
|
private void pictureBox_part_MouseDown(object sender, MouseEventArgs e)
|
|
private void pictureBox_part_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
{
|
|
if (CB_HAND.Checked && pictureBox_part.Image != null)
|
|
if (CB_HAND.Checked && pictureBox_part.Image != null)
|
|
@@ -970,21 +988,25 @@ namespace OTSIncAReportApp
|
|
/// <param name="width"></param>
|
|
/// <param name="width"></param>
|
|
/// <param name="height"></param>
|
|
/// <param name="height"></param>
|
|
/// <param name="key"></param>
|
|
/// <param name="key"></param>
|
|
- private void GetKeyNo(Mat labelMat, int width, int height, ref int key)
|
|
|
|
|
|
+ private bool GetKeyNo(Mat labelMat, int width, int height, ref int key)
|
|
{
|
|
{
|
|
|
|
+ bool rs = false;
|
|
handPoint = new Point(-1, -1);
|
|
handPoint = new Point(-1, -1);
|
|
Color color = groupBox_img.BackColor;
|
|
Color color = groupBox_img.BackColor;
|
|
while (key == 0 && stopFlag == false)
|
|
while (key == 0 && stopFlag == false)
|
|
{
|
|
{
|
|
|
|
+ BTN_YES.Enabled = false;
|
|
groupBox_img.BackColor = Color.Red;
|
|
groupBox_img.BackColor = Color.Red;
|
|
Thread.Sleep(1000);
|
|
Thread.Sleep(1000);
|
|
if (handPoint.X >= 0 && handPoint.X < width && handPoint.Y >= 0 && handPoint.Y < height)
|
|
if (handPoint.X >= 0 && handPoint.X < width && handPoint.Y >= 0 && handPoint.Y < height)
|
|
{
|
|
{
|
|
key = labelMat.Get<int>((int)handPoint.Y, (int)handPoint.X);
|
|
key = labelMat.Get<int>((int)handPoint.Y, (int)handPoint.X);
|
|
|
|
+ rs = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ BTN_YES.Enabled = true;
|
|
groupBox_img.BackColor = color;
|
|
groupBox_img.BackColor = color;
|
|
|
|
+ return rs;
|
|
}
|
|
}
|
|
|
|
|
|
private void dgV_ParticlesDevidePage_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
|
private void dgV_ParticlesDevidePage_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|