using PaintDotNet.Base; using PaintDotNet.Data.Param; using PaintDotNet.Processing; using System; using System.Collections.Generic; using System.Windows.Forms; namespace PaintDotNet.Menus { /// /// 图像处理菜单 /// internal sealed class ImageMenu : PdnMenuItem { private PdnMenuItem menuImageAdjust; private PdnMenuItem menuImageSharpen; private PdnMenuItem menuImageSmooth; private ToolStripSeparator menuImageSeparator1; private PdnMenuItem menuImageEdgeDetection; private PdnMenuItem menuImageInterOperation; private ToolStripSeparator menuImageSeparator2; private PdnMenuItem menuImageShift; private PdnMenuItem menuImageStitching; private PdnMenuItem menuImageDepthExtension; //反色 private PdnMenuItem menuImageReverseColor; //灰度化 private PdnMenuItem menuImageGrayscale; //白平衡 private PdnMenuItem menuImageWhiteBalance; //色彩平衡 private PdnMenuItem menuImageColorBalance; //阴影校正 private PdnMenuItem menuImageShadingCorrection; //色度/饱和度/亮度 private PdnMenuItem menuImageHSLAdjust; //亮度/对比度/伽马值 private PdnMenuItem menuImageBCGAdjust; //图像旋转 private PdnMenuItem menuImageRotate; //图像处理 private PdnMenuItem menuImageChange; //描绘 private PdnMenuItem menuImagePortray; //加强轮廓 private PdnMenuItem menuImageEnhanceContour; //虚化蒙版 private PdnMenuItem menuImageBlurMask; //西格玛 private PdnMenuItem menuImageSigma; //各向异性高斯滤波 private PdnMenuItem menuImageGaussianFiltering; //低通滤波 private PdnMenuItem menuImageLowPassFiltering; //中值滤波 private PdnMenuItem menuImageMedianFiltering; //高斯模糊 private PdnMenuItem menuImageGaussianBlur; //双边滤波 private PdnMenuItem menuImageBilateralFiltering; //小波降噪 private PdnMenuItem menuImageWaveletDenoising; //Log private PdnMenuItem menuImageLog; //Canny private PdnMenuItem menuImageCanny; //Sobel private PdnMenuItem menuImageSobel; //Kirsch private PdnMenuItem menuImageKirsch; //Prewitt private PdnMenuItem menuImagePrewitt; //Roberts private PdnMenuItem menuImageRoberts; //Laplace private PdnMenuItem menuImageLaplace; //增加 private PdnMenuItem menuImageAddition; //减去 private PdnMenuItem menuImageSubtraction; //乘以 private PdnMenuItem menuImageMultiplication; //除以 private PdnMenuItem menuImageDivision; //平均 private PdnMenuItem menuImageAverage; //平方 private PdnMenuItem menuImageSquare; //平方根 private PdnMenuItem menuImageSquareRoot; //对数 private PdnMenuItem menuImageLogarithm; //指数 private PdnMenuItem menuImageIndex; //最大值 private PdnMenuItem menuImageMax; //最小值 private PdnMenuItem menuImageMin; public ImageMenu(int menuId) { InitializeComponent(); this.MenuId = menuId; } private void InitializeComponent() { this.menuImageAdjust = new PdnMenuItem(ActionType.Adjust); this.menuImageSharpen = new PdnMenuItem(ActionType.Sharpen); this.menuImageSmooth = new PdnMenuItem(ActionType.Smooth); this.menuImageSeparator1 = new ToolStripSeparator(); this.menuImageEdgeDetection = new PdnMenuItem(ActionType.EdgeDetection); this.menuImageInterOperation = new PdnMenuItem(ActionType.InterImageOperation); this.menuImageSeparator2 = new ToolStripSeparator(); this.menuImageShift = new PdnMenuItem(ActionType.ActionImageOffset); this.menuImageStitching = new PdnMenuItem(ActionType.ActionImageStitching); this.menuImageStitching.AutomaticScript = false; this.menuImageDepthExtension = new PdnMenuItem(ActionType.ActionExtendedDepthOfFocus); this.menuImageDepthExtension.AutomaticScript = false; this.menuImageReverseColor = new PdnMenuItem(ActionType.ActionRevertColor); this.menuImageGrayscale = new PdnMenuItem(ActionType.ActionBgr2Gray); this.menuImageWhiteBalance = new PdnMenuItem(ActionType.ActionWhiteBalance); this.menuImageColorBalance = new PdnMenuItem(ActionType.ActionColorBalance); this.menuImageShadingCorrection = new PdnMenuItem(ActionType.ActionShadingCorrection); this.menuImageHSLAdjust = new PdnMenuItem(ActionType.ActionHSB); this.menuImageBCGAdjust = new PdnMenuItem(ActionType.ActionBCG); this.menuImageRotate = new PdnMenuItem(ActionType.ActionImageRotate); this.menuImageChange = new PdnMenuItem(ActionType.ImageChangeResolution); this.menuImagePortray = new PdnMenuItem(ActionType.ActionPortray); this.menuImageEnhanceContour = new PdnMenuItem(ActionType.ActionEnhanceContour); this.menuImageBlurMask = new PdnMenuItem(ActionType.ActionBlurMask); this.menuImageSigma = new PdnMenuItem(ActionType.Sigma); this.menuImageGaussianFiltering = new PdnMenuItem(ActionType.GaussianFiltering); this.menuImageLowPassFiltering = new PdnMenuItem(ActionType.LowPassFiltering); this.menuImageMedianFiltering = new PdnMenuItem(ActionType.MedianFiltering); this.menuImageGaussianBlur = new PdnMenuItem(ActionType.GaussianBlur); this.menuImageBilateralFiltering = new PdnMenuItem(ActionType.BilateralFiltering); this.menuImageWaveletDenoising = new PdnMenuItem(ActionType.WaveletDenoising); this.menuImageLog = new PdnMenuItem(ActionType.Log); this.menuImageCanny = new PdnMenuItem(ActionType.Canny); this.menuImageSobel = new PdnMenuItem(ActionType.Sobel); this.menuImageKirsch = new PdnMenuItem(ActionType.Kirsch); this.menuImagePrewitt = new PdnMenuItem(ActionType.Prewitt); this.menuImageRoberts = new PdnMenuItem(ActionType.Roberts); this.menuImageLaplace = new PdnMenuItem(ActionType.Laplace); this.menuImageAddition = new PdnMenuItem(ActionType.ActionImageAddition); this.menuImageAddition.AutomaticScript = false; this.menuImageSubtraction = new PdnMenuItem(ActionType.ActionImageSubtraction); this.menuImageSubtraction.AutomaticScript = false; this.menuImageMultiplication = new PdnMenuItem(ActionType.ActionImageMultiplication); this.menuImageMultiplication.AutomaticScript = false; this.menuImageDivision = new PdnMenuItem(ActionType.ActionImageDivision); this.menuImageDivision.AutomaticScript = false; this.menuImageAverage = new PdnMenuItem(ActionType.ActionImageAverage); this.menuImageAverage.AutomaticScript = false; this.menuImageSquare = new PdnMenuItem(ActionType.ActionImageSquare); //this.menuImageSquare.AutomaticScript = false; this.menuImageSquareRoot = new PdnMenuItem(ActionType.ActionImageSquareBoot); //this.menuImageSquareRoot.AutomaticScript = false; this.menuImageLogarithm = new PdnMenuItem(ActionType.ActionImageLogarithm); //this.menuImageLogarithm.AutomaticScript = false; this.menuImageIndex = new PdnMenuItem(ActionType.ActionImageIndex); //this.menuImageIndex.AutomaticScript = false; this.menuImageMax = new PdnMenuItem(ActionType.ActionImageMax); this.menuImageMax.AutomaticScript = false; this.menuImageMin = new PdnMenuItem(ActionType.ActionImageMin); this.menuImageMin.AutomaticScript = false; // // ImageMenu // this.DropDownItems.AddRange( new ToolStripItem[] { this.menuImageAdjust, this.menuImageSharpen, this.menuImageSmooth, this.menuImageSeparator1, this.menuImageEdgeDetection, this.menuImageInterOperation, this.menuImageSeparator2, this.menuImageShift, this.menuImageStitching, this.menuImageDepthExtension }); this.Name = "Menu.Image"; this.Text = PdnResources.GetString("Menu.Image.Text"); // // 调节 // this.menuImageAdjust.DropDownItems.AddRange( new ToolStripItem[] { this.menuImageReverseColor, this.menuImageGrayscale, this.menuImageWhiteBalance, this.menuImageColorBalance, this.menuImageShadingCorrection, this.menuImageHSLAdjust, this.menuImageBCGAdjust, this.menuImageRotate, this.menuImageChange }); // // 锐化 // this.menuImageSharpen.DropDownItems.AddRange( new ToolStripItem[] { this.menuImagePortray, this.menuImageEnhanceContour, this.menuImageBlurMask }); // // 平滑 // this.menuImageSmooth.DropDownItems.AddRange( new ToolStripItem[] { this.menuImageSigma, this.menuImageGaussianFiltering, this.menuImageLowPassFiltering, this.menuImageMedianFiltering, this.menuImageGaussianBlur, this.menuImageBilateralFiltering, this.menuImageWaveletDenoising }); // // 边缘检测 // this.menuImageEdgeDetection.DropDownItems.AddRange( new ToolStripItem[] { this.menuImageLog, this. menuImageCanny, this.menuImageSobel, this.menuImageKirsch, this.menuImagePrewitt, this.menuImageRoberts, this.menuImageLaplace }); // // 图像间操作 // this.menuImageInterOperation.DropDownItems.AddRange( new ToolStripItem[] { this.menuImageAddition, this.menuImageSubtraction, this.menuImageMultiplication, this.menuImageDivision, this.menuImageAverage, this.menuImageSquare, this.menuImageSquareRoot, this.menuImageLogarithm, this.menuImageIndex, this.menuImageMax, this.menuImageMin }); // // 图像偏移 // this.menuImageShift.Click += new EventHandler(menuImageShift_Click); // // 图像拼接 // this.menuImageStitching.Click += new EventHandler(menuImageStitching_Click); // // 景深扩展 // this.menuImageDepthExtension.Click += new EventHandler(MenuImageDepthExtension_Click); // // 以下是子菜单 // // // 反色 // this.menuImageReverseColor.Click += new EventHandler(menuImageReverseColor_Click); this.menuImageReverseColor.Text = PdnResources.GetString("Menu.Image.ReverseColor.Text"); this.menuImageReverseColor.Image = PdnResources.GetImageResource("Icons.MenuActionReverseColorIcon.png").Reference; // // 灰度化 // this.menuImageGrayscale.Click += new EventHandler(menuImageGrayscale_Click); this.menuImageGrayscale.Text = PdnResources.GetString("Menu.Image.Grayscale.Text"); this.menuImageGrayscale.Image = PdnResources.GetImageResource("Icons.MenuActionGrayscaleIcon.png").Reference; // // 白平衡 // this.menuImageWhiteBalance.Click += new EventHandler(menuImageWhiteBalance_Click); this.menuImageWhiteBalance.Text = PdnResources.GetString("Menu.Image.WhiteBalance.Text"); this.menuImageWhiteBalance.Image = PdnResources.GetImageResource("Icons.MenuActionWhiteBalanceIcon.png").Reference; // // 色彩平衡 // this.menuImageColorBalance.Click += new EventHandler(menuImageColorBalance_Click); this.menuImageColorBalance.Text = PdnResources.GetString("Menu.Image.ColorBalance.Text"); this.menuImageColorBalance.Image = PdnResources.GetImageResource("Icons.MenuActionColorBalanceIcon.png").Reference; // // 阴影校正 // this.menuImageShadingCorrection.Click += new EventHandler(MenuImageShadingCorrection_Click); this.menuImageShadingCorrection.Text = PdnResources.GetString("Menu.Image.ShadingCorrection.Text"); this.menuImageShadingCorrection.Image = PdnResources.GetImageResource("Icons.MenuActionShadingCorrectionIcon.png").Reference; // // 色度/饱和度/亮度 // this.menuImageHSLAdjust.Click += new EventHandler(menuImageHSLAdjust_Click); this.menuImageHSLAdjust.Text = PdnResources.GetString("Menu.Image.HSLAdjust.Text"); this.menuImageHSLAdjust.Image = PdnResources.GetImageResource("Icons.MenuActionHSLAdjustIcon.png").Reference; // // 亮度/对比度/伽马值 // this.menuImageBCGAdjust.Click += new EventHandler(menuImageBCGAdjust_Click); /*menuImageBCGAdjust_Click*/ this.menuImageBCGAdjust.Text = PdnResources.GetString("Menu.Image.BCGAdjust.Text"); this.menuImageBCGAdjust.Image = PdnResources.GetImageResource("Icons.MenuActionBCGAdjustIcon.png").Reference; // // 图像旋转 // this.menuImageRotate.NeedOpenDialog = true; this.menuImageRotate.Click += new EventHandler(menuImageRotate_Click); this.menuImageRotate.Text = PdnResources.GetString("Menu.Imagerotation.text"); this.menuImageRotate.Image = PdnResources.GetImageResource("Icons.MenuImageXuanZhuan.png").Reference; // // 分辨率调整 // this.menuImageChange.NeedOpenDialog = true; this.menuImageChange.Click += new EventHandler(menuImageChange_Click); this.menuImageChange.Text = "分辨率调整"; this.menuImageChange.Image = PdnResources.GetImageResource("Icons.MenuImageXuanZhuan.png").Reference; // // 描绘 // this.menuImagePortray.Click += new EventHandler(menuImagePortray_Click); this.menuImagePortray.Text = PdnResources.GetString("Menu.Image.Portray.Text"); this.menuImagePortray.Image = PdnResources.GetImageResource("Icons.MenuActionPortrayIcon.png").Reference; // // 加强轮廓 // this.menuImageEnhanceContour.Click += new EventHandler(menuImageEnhanceContour_Click); this.menuImageEnhanceContour.Text = PdnResources.GetString("Menu.Image.EnhanceContour.Text"); this.menuImageEnhanceContour.Image = PdnResources.GetImageResource("Icons.MenuActionEnhanceContourIcon.png").Reference; // // 虚化蒙版 // this.menuImageBlurMask.Click += new EventHandler(menuImageBlurMask_Click); this.menuImageBlurMask.Text = PdnResources.GetString("Menu.Image.BlurMask.Text"); this.menuImageBlurMask.Image = PdnResources.GetImageResource("Icons.MenuActionBlurMaskIcon.png").Reference; // // 西格玛 // this.menuImageSigma.Click += new EventHandler(menuImageSigma_Click); this.menuImageSigma.Text = PdnResources.GetString("Menu.Image.Sigma.Text"); this.menuImageSigma.Image = PdnResources.GetImageResource("Icons.MenuActionSigmaIcon.png").Reference; // // 各向异性高斯滤波 // this.menuImageGaussianFiltering.Click += new EventHandler(menuImageGaussianFiltering_Click); this.menuImageGaussianFiltering.Text = PdnResources.GetString("Menu.Image.GaussianFiltering.Text"); this.menuImageGaussianFiltering.Image = PdnResources.GetImageResource("Icons.MenuActionGaussianFilteringIcon.png").Reference; // // 低通滤波 // this.menuImageLowPassFiltering.Click += new EventHandler(menuImageLowPassFiltering_Click); this.menuImageLowPassFiltering.Text = PdnResources.GetString("Menu.Image.LowPassFiltering.Text"); this.menuImageLowPassFiltering.Image = PdnResources.GetImageResource("Icons.MenuActionLowPassFilteringIcon.png").Reference; // // 中值滤波 // this.menuImageMedianFiltering.Click += new EventHandler(menuImageMedianFiltering_Click); this.menuImageMedianFiltering.Text = PdnResources.GetString("Menu.Image.MedianFiltering.Text"); this.menuImageMedianFiltering.Image = PdnResources.GetImageResource("Icons.MenuActionMedianFilteringIcon.png").Reference; // // 高斯模糊 // this.menuImageGaussianBlur.Click += new EventHandler(menuImageGaussianBlur_Click); this.menuImageGaussianBlur.Text = PdnResources.GetString("Menu.Image.GaussianBlur.Text"); this.menuImageGaussianBlur.Image = PdnResources.GetImageResource("Icons.MenuActionGaussianBlurIcon.png").Reference; // // 双边滤波 // this.menuImageBilateralFiltering.Click += new EventHandler(menuImageBilateralFiltering_Click); this.menuImageBilateralFiltering.Text = PdnResources.GetString("Menu.Image.BilateralFiltering.Text"); this.menuImageBilateralFiltering.Image = PdnResources.GetImageResource("Icons.MenuActionBilateralFilteringIcon.png").Reference; // // 小波降噪 // this.menuImageWaveletDenoising.Click += new EventHandler(menuImageWaveletDenoising_Click); this.menuImageWaveletDenoising.Text = PdnResources.GetString("Menu.Image.WaveletDenoising.Text"); this.menuImageWaveletDenoising.Image = PdnResources.GetImageResource("Icons.MenuActionWaveletDenoisingIcon.png").Reference; // // Log // this.menuImageLog.Click += new EventHandler(menuImageLog_Click); this.menuImageLog.Text = PdnResources.GetString("Menu.Image.Log.Text"); this.menuImageLog.Image = PdnResources.GetImageResource("Icons.MenuActionLogIcon.png").Reference; // // Canny // this.menuImageCanny.Click += new EventHandler(menuImageCanny_Click); this.menuImageCanny.Text = PdnResources.GetString("Menu.Image.Canny.Text"); this.menuImageCanny.Image = PdnResources.GetImageResource("Icons.MenuActionCannyIcon.png").Reference; // // Sobel // this.menuImageSobel.Click += new EventHandler(menuImageSobel_Click); this.menuImageSobel.Text = PdnResources.GetString("Menu.Image.Sobel.Text"); this.menuImageSobel.Image = PdnResources.GetImageResource("Icons.MenuActionSobelIcon.png").Reference; // // Kirsch // this.menuImageKirsch.Click += new EventHandler(menuImageKirsch_Click); this.menuImageKirsch.Text = PdnResources.GetString("Menu.Image.Kirsch.Text"); this.menuImageKirsch.Image = PdnResources.GetImageResource("Icons.MenuActionKirschIcon.png").Reference; // // Prewitt // this.menuImagePrewitt.Click += new EventHandler(menuImagePrewitt_Click); this.menuImagePrewitt.Text = PdnResources.GetString("Menu.Image.Prewitt.Text"); this.menuImagePrewitt.Image = PdnResources.GetImageResource("Icons.MenuActionPrewittIcon.png").Reference; // // Roberts // this.menuImageRoberts.Click += new EventHandler(menuImageRoberts_Click); this.menuImageRoberts.Text = PdnResources.GetString("Menu.Image.Roberts.Text"); this.menuImageRoberts.Image = PdnResources.GetImageResource("Icons.MenuActionRobertsIcon.png").Reference; // // Laplace // this.menuImageLaplace.Click += new EventHandler(menuImageLaplace_Click); this.menuImageLaplace.Text = PdnResources.GetString("Menu.Image.Laplace.Text"); this.menuImageLaplace.Image = PdnResources.GetImageResource("Icons.MenuActionLaplaceIcon.png").Reference; // // 加 // this.menuImageAddition.Click += new EventHandler(menuImageAddition_Click); this.menuImageAddition.Text = PdnResources.GetString("Menu.Image.Addition.Text"); this.menuImageAddition.Image = PdnResources.GetImageResource("Icons.MenuActionAdditionIcon.png").Reference; // // 减 // this.menuImageSubtraction.Click += new EventHandler(menuImageSubtraction_Click); this.menuImageSubtraction.Text = PdnResources.GetString("Menu.Image.Subtraction.Text"); this.menuImageSubtraction.Image = PdnResources.GetImageResource("Icons.MenuActionSubtractionIcon.png").Reference; // // 乘 // this.menuImageMultiplication.Click += new EventHandler(menuImageMultiplication_Click); this.menuImageMultiplication.Text = PdnResources.GetString("Menu.Image.Multiplication.Text"); this.menuImageMultiplication.Image = PdnResources.GetImageResource("Icons.MenuActionMultiplicationIcon.png").Reference; // // 除 // this.menuImageDivision.Click += new EventHandler(menuImageDivision_Click); this.menuImageDivision.Text = PdnResources.GetString("Menu.Image.Division.Text"); this.menuImageDivision.Image = PdnResources.GetImageResource("Icons.MenuActionDivisionIcon.png").Reference; // // 平均 // this.menuImageAverage.Click += new EventHandler(menuImageAverage_Click); this.menuImageAverage.Text = PdnResources.GetString("Menu.Image.Average.Text"); this.menuImageAverage.Image = PdnResources.GetImageResource("Icons.MenuActionAverageIcon.png").Reference; // // 平方 // this.menuImageSquare.Click += new EventHandler(menuImageSquare_Click); this.menuImageSquare.Text = PdnResources.GetString("Menu.Image.Square.Text"); this.menuImageSquare.Image = PdnResources.GetImageResource("Icons.MenuActionSquareIcon.png").Reference; // // 平方根 // this.menuImageSquareRoot.Click += new EventHandler(menuImageSquareBoot_Click); this.menuImageSquareRoot.Text = PdnResources.GetString("Menu.Image.SquareRoot.Text"); this.menuImageSquareRoot.Image = PdnResources.GetImageResource("Icons.MenuActionSquareRootIcon.png").Reference; // // 对数 // this.menuImageLogarithm.Click += new EventHandler(menuImageLogarithm_Click); this.menuImageLogarithm.Text = PdnResources.GetString("Menu.Image.Logarithm.Text"); this.menuImageLogarithm.Image = PdnResources.GetImageResource("Icons.MenuActionLogarithmIcon.png").Reference; // // 指数 // this.menuImageIndex.Click += new EventHandler(menuImageIndex_Click); this.menuImageIndex.Text = PdnResources.GetString("Menu.Image.Index.Text"); this.menuImageIndex.Image = PdnResources.GetImageResource("Icons.MenuActionIndexIcon.png").Reference; // // 最大 // this.menuImageMax.Click += new EventHandler(menuImageMax_Click); this.menuImageMax.Text = PdnResources.GetString("Menu.Image.Max.Text"); this.menuImageMax.Image = PdnResources.GetImageResource("Icons.MenuActionMaxIcon.png").Reference; // // 最小 // this.menuImageMin.Click += new EventHandler(menuImageMin_Click); this.menuImageMin.Text = PdnResources.GetString("Menu.Image.Min.Text"); this.menuImageMin.Image = PdnResources.GetImageResource("Icons.MenuActionMinIcon.png").Reference; // // 加载菜单的文字和icon // this.LoadNames(this.Name); this.LoadIcons(); } /// /// 反色 /// /// /// private void menuImageReverseColor_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionRevertColor, PdnResources.GetString("Menu.ImageProcessing.adjust.Imageprocevert.text")/*;//待修改中文资源-scc备注 20191216*/,(PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 灰度化 /// /// /// private void menuImageGrayscale_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionBgr2Gray, PdnResources.GetString("Menu.ImageProcessing.adjust.Imagepaying.text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 白平衡 /// /// /// private void menuImageWhiteBalance_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionWhiteBalance, PdnResources.GetString("Menu.ImageProcessing.adjust.Imagepitebalance.text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 色彩平衡 /// /// /// private void menuImageColorBalance_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionColorBalance, PdnResources.GetString("Menu.Imageprocesorbalance.text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 阴影校正 /// /// /// private void MenuImageShadingCorrection_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionShadingCorrection, PdnResources.GetString("Menu.Imageprocessingadjustmentshadowcorrection.Text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 色度/饱和度/亮度 /// /// /// private void menuImageHSLAdjust_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionHSB, PdnResources.GetString("Menu.processingadjustmentchrom.Text")/*;//待修改中文资源-scc备注 20191212*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 亮度/对比度/伽马值 /// /// /// private void menuImageBCGAdjust_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionBCG, PdnResources.GetString("Menu.eprocessinadjustmentbrigh.Text")/*;//待修改中文资源-scc备注 20191212*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 图像旋转 /// /// /// private void menuImageRotate_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionImageRotate, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.Adjust.Text") + "-" + PdnResources.GetString("Menu.Imagerotation.text")/*;//待修改中文资源-scc备注 20191212*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 图像分辨率调整 /// /// /// private void menuImageChange_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.ImageChangeResolution, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.Adjust.Text") + "-" + "分辨率调整", (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 描绘 /// /// /// private void menuImagePortray_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionPortray, PdnResources.GetString("Menu.ImageProcessing.Sharpen.Imagscribe.text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 加强轮廓 /// /// /// private void menuImageEnhanceContour_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionEnhanceContour, PdnResources.GetString("Menu.Imageprochencontours.text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 虚化蒙版 /// /// /// private void menuImageBlurMask_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionBlurMask, PdnResources.GetString("Menu.Image.Text")+"-"+PdnResources.GetString("Menu.Image.Sharpen.Text")+"-"+PdnResources.GetString("Menu.Image.BlurMask.Text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 西格玛 /// /// /// private void menuImageSigma_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.Sigma,PdnResources.GetString("Menu.ImageProcessing.smooth.ImageProcgma.text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 各向异性高斯滤波 /// /// /// F private void menuImageGaussianFiltering_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.GaussianFiltering,PdnResources.GetString("Menu.ImageProcessing.smooth.Imagnfiltering.text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 低通滤波 /// /// /// private void menuImageLowPassFiltering_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.LowPassFiltering,PdnResources.GetString("Menu.Image.Text")+"-"+PdnResources.GetString("Menu.Image.Smooth.Text")+"-"+PdnResources.GetString("Menu.Image.LowPassFiltering.Text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 中值滤波 /// /// /// private void menuImageMedianFiltering_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.MedianFiltering, PdnResources.GetString("Menu.ImageProcessing.smooth.Imageprocdianfilter.text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 高斯模糊 /// /// /// private void menuImageGaussianBlur_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.GaussianBlur, PdnResources.GetString("Menu.ImageProcessing.smooth.ImageProcessianBlur.text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 双边滤波 /// /// /// private void menuImageBilateralFiltering_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.BilateralFiltering, PdnResources.GetString("Menu.ImageProcessing.smooth.Imageproltering.text")/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 小波降噪 /// /// /// private void menuImageWaveletDenoising_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.WaveletDenoising, PdnResources.GetString("Menu.ImageProcessing.smooth.Imageprocessineanfiltering.text")/* 小波降噪;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// Log /// /// /// private void menuImageLog_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new BshTransferAdjustDialog(AppWorkspace, ActionType.Log, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.EdgeDetection.Text") + "-Log"/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// Canny /// /// /// private void menuImageCanny_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new BshTransferAdjustDialog(AppWorkspace, ActionType.Canny, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.EdgeDetection.Text") + "-Canny"/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// Sobel /// /// /// private void menuImageSobel_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new BshTransferAdjustDialog(AppWorkspace, ActionType.Sobel, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.EdgeDetection.Text") + "-Sobel"/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// Kirsch /// /// /// private void menuImageKirsch_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new BshTransferAdjustDialog(AppWorkspace, ActionType.Kirsch, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.EdgeDetection.Text") + "-Kirsch"/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// Prewitt /// /// /// private void menuImagePrewitt_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new BshTransferAdjustDialog(AppWorkspace, ActionType.Prewitt, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.EdgeDetection.Text") + "-Prewitt"/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// Roberts /// /// /// private void menuImageRoberts_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new BshTransferAdjustDialog(AppWorkspace, ActionType.Roberts, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.EdgeDetection.Text") + "-Roberts"/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// Laplace /// /// /// private void menuImageLaplace_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new BshTransferAdjustDialog(AppWorkspace, ActionType.Laplace, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.EdgeDetection.Text") + "-Laplace"/*;//待修改中文资源-scc备注 20191216*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 加 /// /// /// private void menuImageAddition_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new InterImageOpDialog(AppWorkspace, ActionType.ActionImageAddition, PdnResources.GetString("Menu.ImageProcessing.boundarydetection.Imageprodd.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 减 /// /// /// private void menuImageSubtraction_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new InterImageOpDialog(AppWorkspace, ActionType.ActionImageSubtraction, PdnResources.GetString("Menu.ImageProcessing.boundarydetection.Imageprub.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 乘 /// /// /// private void menuImageMultiplication_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new InterImageOpDialog(AppWorkspace, ActionType.ActionImageMultiplication, PdnResources.GetString("Menu.ImageProcessing.boundarydetection.Imageprocply.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 除 /// /// /// private void menuImageDivision_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new InterImageOpDialog(AppWorkspace, ActionType.ActionImageDivision, PdnResources.GetString("Menu.ImageProcessing.boundarydetection.Imageproision.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 平均 /// /// /// private void menuImageAverage_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new InterImageOpDialog(AppWorkspace, ActionType.ActionImageAverage, PdnResources.GetString("Menu.ImageProcessing.boundarydetection.Imageperage.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 平方 /// /// /// private void menuImageSquare_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new InterImageOpDialog(AppWorkspace, ActionType.ActionImageSquare, PdnResources.GetString("Menu.ImageProcessing.boundarydetection.Imagepare.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 平方根 /// /// /// private void menuImageSquareBoot_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new InterImageOpDialog(AppWorkspace, ActionType.ActionImageSquareBoot, PdnResources.GetString("Menu.ImageProcessing.boundarydetection.Imageareroots.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 对数 /// /// /// private void menuImageLogarithm_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new InterImageOpDialog(AppWorkspace, ActionType.ActionImageLogarithm, PdnResources.GetString("Menu.ImageProcessing.boundarydetection.Imageprlog.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 指数 /// /// /// private void menuImageIndex_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new InterImageOpDialog(AppWorkspace, ActionType.ActionImageIndex, PdnResources.GetString("Menu.ImageProcessing.boundarydetection.Imageprodex.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 最大 /// /// /// private void menuImageMax_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new InterImageOpDialog(AppWorkspace, ActionType.ActionImageMax, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.InterImageOperation.Text") + "-" + PdnResources.GetString("Menu.max.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 最小 /// /// /// private void menuImageMin_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) { new InterImageOpDialog(AppWorkspace, ActionType.ActionImageMin, PdnResources.GetString("Menu.Image.Text") + "-" + PdnResources.GetString("Menu.Image.InterImageOperation.Text") + "-" + PdnResources.GetString("Menu.minimum.text")/*;//待修改中文资源-scc备注 20191217*/, (PdnMenuItem)sender).ShowDialog(); } else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 图像偏移 /// /// /// private void menuImageShift_Click(object sender, EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace != null) new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionImageOffset, PdnResources.GetString("Menu.Image.Text")+"-"+ PdnResources.GetString("Menu.Image.ImageShift.Text"), (PdnMenuItem)sender).ShowDialog(); else MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text")); } /// /// 图像拼接 /// /// /// private void menuImageStitching_Click(object sender, EventArgs e) { List> localxys = new List>(); double[] xs = new double[] { 0, 4, 8 }; double[] ys = new double[] { 0, 5, 0 }; double[] zs = new double[] { 8112.3, 7802.525, 8577.95 }; double[] cals = this.PanelFit(xs, ys, zs); double cala = cals[0]; for (int ix = 0; ix < 9; ix++) { List localys = new List(); for (int iy = 0; iy < 6; iy++) { double z = (-cals[0] * ix - cals[1] * iy - cals[3]) / cals[2]; localys.Add(z - 7); } localxys.Add(localys); } double zva = localxys[0][0]; //new BshTransferAdjustDialog(AppWorkspace, ActionType.ActionImageStitching, PdnResources.GetString("Menu.Image.Text")+"-"+ PdnResources.GetString("Menu.ImageCollection.ImageStitching.Text")).ShowDialog(); using (ImageMosaicsDialog imageMosaicsDialog = new ImageMosaicsDialog(this.AppWorkspace)) { imageMosaicsDialog.StartPosition = FormStartPosition.CenterScreen; imageMosaicsDialog.ShowDialog(); } if (AppWorkspace.startScriptRecording) { AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List()); } } /// /// 平面方程拟合,ax+by+cz+d=0,其中a=result[0],b=result[1],c=result[2],d=result[3] /// /// /// /// /// private double[] PanelFit(double[] x, double[] y, double[] z) { double[] result = new double[4]; int n = x.Length; double[,] A = new double[n, 3]; double[,] E = new double[n, 1]; for (int i = 0; i < n; i++) { A[i, 0] = x[i] - z[i]; A[i, 1] = y[i] - z[i]; A[i, 2] = 1; E[i, 0] = -z[i]; } double[,] AT = MatrixInver(A); double[,] ATxA = MatrixMultiply(AT, A); double[,] OPPAxTA = MatrixOpp(ATxA); double[,] OPPATAxAT = MatrixMultiply(OPPAxTA, AT); double[,] DP = MatrixMultiply(OPPATAxAT, E); result[0] = DP[0, 0]; result[1] = DP[1, 0]; result[2] = 1 - result[0] - result[1]; result[3] = DP[2, 0]; return result; } /// /// 矩阵转置 /// /// /// private double[,] MatrixInver(double[,] matrix) { double[,] result = new double[matrix.GetLength(1), matrix.GetLength(0)]; for (int i = 0; i < matrix.GetLength(1); i++) for (int j = 0; j < matrix.GetLength(0); j++) result[i, j] = matrix[j, i]; return result; } /// /// 矩阵相乘 /// /// /// /// private double[,] MatrixMultiply(double[,] matrixA, double[,] matrixB) { double[,] result = new double[matrixA.GetLength(0), matrixB.GetLength(1)]; for (int i = 0; i < matrixA.GetLength(0); i++) { for (int j = 0; j < matrixB.GetLength(1); j++) { result[i, j] = 0; for (int k = 0; k < matrixB.GetLength(0); k++) { result[i, j] += matrixA[i, k] * matrixB[k, j]; } } } return result; } /// /// 矩阵的逆 /// /// /// private double[,] MatrixOpp(double[,] matrix) { double X = 1 / MatrixSurplus(matrix); double[,] matrixB = new double[matrix.GetLength(0), matrix.GetLength(1)]; double[,] matrixSP = new double[matrix.GetLength(0), matrix.GetLength(1)]; double[,] matrixAB = new double[matrix.GetLength(0), matrix.GetLength(1)]; for (int i = 0; i < matrix.GetLength(0); i++) for (int j = 0; j < matrix.GetLength(1); j++) { for (int m = 0; m < matrix.GetLength(0); m++) for (int n = 0; n < matrix.GetLength(1); n++) matrixB[m, n] = matrix[m, n]; { for (int x = 0; x < matrix.GetLength(1); x++) matrixB[i, x] = 0; for (int y = 0; y < matrix.GetLength(0); y++) matrixB[y, j] = 0; matrixB[i, j] = 1; matrixSP[i, j] = MatrixSurplus(matrixB); matrixAB[i, j] = X * matrixSP[i, j]; } } return MatrixInver(matrixAB); } /// /// 矩阵的行列式的值 /// /// /// public static double MatrixSurplus(double[,] matrix) { double X = -1; double[,] a = matrix; int i, j, k, p, r, m, n; m = a.GetLength(0); n = a.GetLength(1); double temp = 1, temp1 = 1, s = 0, s1 = 0; if (n == 2) { for (i = 0; i < m; i++) for (j = 0; j < n; j++) if ((i + j) % 2 > 0) temp1 *= a[i, j]; else temp *= a[i, j]; X = temp - temp1; } else { for (k = 0; k < n; k++) { for (i = 0, j = k; i < m && j < n; i++, j++) temp *= a[i, j]; if (m - i > 0) { for (p = m - i, r = m - 1; p > 0; p--, r--) temp *= a[r, p - 1]; } s += temp; temp = 1; } for (k = n - 1; k >= 0; k--) { for (i = 0, j = k; i < m && j >= 0; i++, j--) temp1 *= a[i, j]; if (m - i > 0) { for (p = m - 1, r = i; r < m; p--, r++) temp1 *= a[r, p]; } s1 += temp1; temp1 = 1; } X = s - s1; } return X; } /// /// 景深拓展 /// /// /// private void MenuImageDepthExtension_Click(object sender, EventArgs e) { if (AppWorkspace.startScriptRecording) { AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List()); } using (ImageDepthExtensionDialog imageDepthExtensionDialog = new ImageDepthExtensionDialog(this.AppWorkspace)) { imageDepthExtensionDialog.StartPosition = FormStartPosition.CenterScreen; imageDepthExtensionDialog.ShowDialog(); } } protected override void OnDropDownOpening(EventArgs e) { if (AppWorkspace.ActiveDocumentWorkspace == null || AppWorkspace.ScriptRunning) { this.menuImageAdjust.Enabled = false; this.menuImageSharpen.Enabled = false; this.menuImageSmooth.Enabled = false; this.menuImageEdgeDetection.Enabled = false; this.menuImageInterOperation.Enabled = false; this.menuImageShift.Enabled = false; } else { this.menuImageAdjust.Enabled = true; this.menuImageSharpen.Enabled = true; this.menuImageSmooth.Enabled = true; this.menuImageEdgeDetection.Enabled = true; this.menuImageInterOperation.Enabled = true; this.menuImageShift.Enabled = true; } this.menuImageStitching.Enabled = !AppWorkspace.ScriptRunning; this.menuImageDepthExtension.Enabled = !AppWorkspace.ScriptRunning; base.OnDropDownOpening(e); } } }