/// <summary> /// 上传图像显示刷新 /// </summary> /// <param name="imageInfo"></param> public void OnUpSpotImageData(stSpliceImageData spotImageData) { try { if (this == Form.ActiveForm) { if (this.InvokeRequired) { this.BeginInvoke(new GlobalDataInterface.SpotImageDataEventHandler(OnUpSpotImageData), spotImageData); } else { if (spotImageData.imageInfo.nRouteId != m_FlawCurrentIPM_ID) { return; } byte[] imagedata; if (spotImageData.imageInfo.width == 0 && spotImageData.imageInfo.height == 0) //2015.9.30 ivycc { return; } //获取图片 //if (Commonfunction.ChanelInIPMIndex(m_ChanelIDList[m_CurrentFlawChannelIndex]) == 0) //{ // imagedata = new byte[(3 * BackgroundLength + (spotImageData.spotImageInfo.nBottom[0] - spotImageData.spotImageInfo.nTop[0]) * 2) * spotImageData.spotImageInfo.width * 2]; // m_flawimageRGB = new byte[(3 * BackgroundLength + (spotImageData.spotImageInfo.nBottom[0] - spotImageData.spotImageInfo.nTop[0]) * 2) * spotImageData.spotImageInfo.width * 4]; // Array.Copy(spotImageData.imagedataC, spotImageData.spotImageInfo.nTop[0] * spotImageData.spotImageInfo.width * 2, imagedata, BackgroundLength * spotImageData.spotImageInfo.width * 2, spotImageData.spotImageInfo.width * (spotImageData.spotImageInfo.nBottom[0] - spotImageData.spotImageInfo.nTop[0]) * 2); // if (spotImageData.imagedataIR.Length > 0) // { // Array.Copy(spotImageData.imagedataIR, spotImageData.spotImageInfo.nTop[0] * spotImageData.spotImageInfo.width * 2, imagedata, (2 * BackgroundLength + (spotImageData.spotImageInfo.nBottom[0] - spotImageData.spotImageInfo.nTop[0])) * spotImageData.spotImageInfo.width * 2, spotImageData.spotImageInfo.width * (spotImageData.spotImageInfo.nBottom[0] - spotImageData.spotImageInfo.nTop[0]) * 2); // } // Commonfunction.YUV422ChangeToRGB(imagedata, ref m_flawimageRGB, spotImageData.spotImageInfo.width, 3 * BackgroundLength + (spotImageData.spotImageInfo.nBottom[0] - spotImageData.spotImageInfo.nTop[0]) * 2); // this.FlawAreatextBox.Text = spotImageData.spotImageInfo.unFlawArea[0].ToString(); // this.FlawNumtextBox.Text = spotImageData.spotImageInfo.unFlawNum[0].ToString(); // m_height = 3 * BackgroundLength + (spotImageData.spotImageInfo.nBottom[0] - spotImageData.spotImageInfo.nTop[0]) * 2; //} //else //{ // imagedata = new byte[(3 * BackgroundLength + (spotImageData.spotImageInfo.nBottom[1] - spotImageData.spotImageInfo.nTop[1]) * 2) * spotImageData.spotImageInfo.width * 2]; // m_flawimageRGB = new byte[(3 * BackgroundLength + (spotImageData.spotImageInfo.nBottom[1] - spotImageData.spotImageInfo.nTop[1]) * 2) * spotImageData.spotImageInfo.width * 4]; // Array.Copy(spotImageData.imagedataC, spotImageData.spotImageInfo.nTop[1] * spotImageData.spotImageInfo.width * 2, imagedata, BackgroundLength * spotImageData.spotImageInfo.width * 2, spotImageData.spotImageInfo.width * (spotImageData.spotImageInfo.nBottom[1] - spotImageData.spotImageInfo.nTop[1]) * 2); // if (spotImageData.imagedataIR.Length > 0) // { // Array.Copy(spotImageData.imagedataIR, spotImageData.spotImageInfo.nTop[1] * spotImageData.spotImageInfo.width * 2, imagedata, (2 * BackgroundLength + (spotImageData.spotImageInfo.nBottom[1] - spotImageData.spotImageInfo.nTop[1])) * spotImageData.spotImageInfo.width * 2, spotImageData.spotImageInfo.width * (spotImageData.spotImageInfo.nBottom[1] - spotImageData.spotImageInfo.nTop[1]) * 2); // } // Commonfunction.YUV422ChangeToRGB(imagedata, ref m_flawimageRGB, spotImageData.spotImageInfo.width, 3 * BackgroundLength + (spotImageData.spotImageInfo.nBottom[1] - spotImageData.spotImageInfo.nTop[1]) * 2); // this.FlawAreatextBox.Text = spotImageData.spotImageInfo.unFlawArea[1].ToString(); // this.FlawNumtextBox.Text = spotImageData.spotImageInfo.unFlawNum[1].ToString(); // m_height = 3 * BackgroundLength + (spotImageData.spotImageInfo.nBottom[1] - spotImageData.spotImageInfo.nTop[1]) * 2; //} m_flawimageRGB = new byte[(3 * BackgroundLength + spotImageData.imageInfo.height) * spotImageData.imageInfo.width * 3]; imagedata = new byte[(3 * BackgroundLength + spotImageData.imageInfo.height) * spotImageData.imageInfo.width * 2]; Array.Copy(spotImageData.imagedataC, 0, imagedata, BackgroundLength * spotImageData.imageInfo.width * 2, spotImageData.imageInfo.width * spotImageData.imageInfo.height * 2); Commonfunction.YUV422ChangeToRGB24(imagedata, ref m_flawimageRGB, spotImageData.imageInfo.width, 3 * BackgroundLength + spotImageData.imageInfo.height); m_height = 3 * BackgroundLength + spotImageData.imageInfo.height; //if (m_cameraIndex == 0) //{ // imagedata = new byte[(3 * BackgroundLength + spotImageData.imageInfo.height) * spotImageData.imageInfo.width * 2]; // Array.Copy(spotImageData.imagedataC, 0, imagedata, BackgroundLength * spotImageData.imageInfo.width * 2, spotImageData.imageInfo.width * spotImageData.imageInfo.height * 2); // //if (spotImageData.imagedataIR.Length > 0) // //{ // // Array.Copy(spotImageData.imagedataIR, 0, imagedata, (2 * BackgroundLength + spotImageData.imageInfo.height) * spotImageData.imageInfo.width * 2, spotImageData.imageInfo.width * spotImageData.imageInfo.height * 2); // //} // Commonfunction.YUV422ChangeToRGB24(imagedata, ref m_flawimageRGB, spotImageData.imageInfo.width, 3 * BackgroundLength + spotImageData.imageInfo.height); // m_height = 3 * BackgroundLength + spotImageData.imageInfo.height; //} //else //{ // imagedata = new byte[(3 * BackgroundLength + spotImageData.imageInfo.height) * spotImageData.imageInfo.width]; // Array.Copy(spotImageData.imagedataC, 0, imagedata, BackgroundLength * spotImageData.imageInfo.width * 2, spotImageData.imageInfo.width * spotImageData.imageInfo.height); // //if (spotImageData.imagedataIR.Length > 0) // //{ // // Array.Copy(spotImageData.imagedataIR, 0, imagedata, (2 * BackgroundLength + spotImageData.imageInfo.height) * spotImageData.imageInfo.width * 2, spotImageData.imageInfo.width * spotImageData.imageInfo.height); // //} // Commonfunction.YUV422GrayChangeToRGB24(imagedata, ref m_flawimageRGB, spotImageData.imageInfo.width, 3 * BackgroundLength + spotImageData.imageInfo.height); // m_height = 3 * BackgroundLength + spotImageData.imageInfo.height; //} this.FlawAreatextBox.Text = spotImageData.imageInfo.unFlawArea.ToString(); this.FlawNumtextBox.Text = spotImageData.imageInfo.unFlawNum.ToString(); m_width = spotImageData.imageInfo.width; // Graphics graphics = this.FlawpictureBox.CreateGraphics();//创建画板 //Image image; m_FlawDrawImage = true; this.FlawpictureBox.Invalidate(); } } } catch (Exception ex) { Trace.WriteLine("QualityParamSetForm-FlawSeFormt中函数OnUpimageInfo出错" + ex); #if REALEASE GlobalDataInterface.WriteErrorInfo("QualityParamSetForm-FlawSeFormt中函数OnUpimageInfo出错" + ex); #endif } }