【发布时间】:2017-12-21 12:30:31
【问题描述】:
我尝试使用两个图像参数来控制我在项目中的图像。问题是当我在 Emgu CV 中应用任何公共 void 函数后无法重新分配图像时。 这是我的代码:
public static class Global
{
public static Image<Gray, byte> xrayPic;
public static Image<Gray, byte> rootPic;
}
private void takePhotoBtn_Click(object sender, EventArgs e)
{
Image<Bgr, Byte> ImageSrc = new Image<Bgr, Byte>(_subPath);
Image<Gray, Byte> GrayImage = ImageSrc.Convert<Gray, byte>();
Image<Gray, Byte> MedianImage = GrayImage.SmoothMedian(5);
Global.xrayPic = MedianImage;
Global.rootPic = MedianImage;
Global.xrayPic.Save(_subPath);
imgBox.Image.Dispose();
imgBox.Image = Global.xrayPic.Bitmap;
}
private void checkHistogram_CheckedChanged(object sender, EventArgs e)
{
if(checkHistogram.Checked)
{
Image<Gray, byte> tmpPic = Global.xrayPic;
tmpPic._EqualizeHist();
// Global.xrayPic._EqualizeHist();
imgBox.Image.Dispose();
imgBox.Image = tmpPic.Bitmap;
}
if(checkHistogram.Checked == false)
{
Global.xrayPic = Global.rootPic;
imgBox.Image.Dispose();
imgBox.Image = Global.xrayPic.Bitmap;
}
}
当我选中复选框以应用函数 __EqualizeHist() 时,它会自动应用函数将第一张图片调整为第二张图片(如附图)。但是,当我取消选中时,它不会返回到我的 root_Pic(第二张图片到第一张图片) This is the demonstration for my code
【问题讨论】:
标签: c# opencv parameters histogram emgucv