错误 1 当前上下文中不存在名称"PicSrc"
namespaceWindowsApplication1{publicunsafepartialclassForm1:Form{privateboolBusy=false...
namespace WindowsApplication1
{
public unsafe partial class Form1 : Form
{
private bool Busy = false;
[DllImport("AdaptHistEqualize.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true)]
private static extern void AdaptHistEqualize(byte* Scan0, int Width, int Height, int Stride, int TileX, int TileY, double CutLimit, bool SeparateChannel);
[DllImport("Kernel32.dll", EntryPoint = "RtlMoveMemory", SetLastError = true)]
private static extern void CopyMemory(byte* Dest, byte* src, int Length);
public Form1()
{
InitializeComponent();
}
private void ShowAdaptHistEqualizeResult()
{
Busy = true;
Bitmap SrcB = (Bitmap)PicSrc.Image;
Bitmap DstB = (Bitmap)PicDest.Image;
BitmapData SrcBmpData = SrcB.LockBits(new Rectangle(0, 0, SrcB.Width, SrcB.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
BitmapData DstBmpData = DstB.LockBits(new Rectangle(0, 0, DstB.Width, DstB.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
CopyMemory((byte*)DstBmpData.Scan0, (byte*)SrcBmpData.Scan0, SrcBmpData.Stride * SrcBmpData.Height);
Stopwatch Sw = new Stopwatch();
Sw.Start();
AdaptHistEqualize((byte*)DstBmpData.Scan0, SrcBmpData.Width, SrcBmpData.Height, SrcBmpData.Stride, TileX.Value, TileY.Value, ClipLimit.Value * 0.001f, SepChannel.Checked);
Sw.Stop();
this.Text = Sw.ElapsedMilliseconds.ToString();
SrcB.UnlockBits(SrcBmpData);
DstB.UnlockBits(DstBmpData);
PicDest.Invalidate();
Application.DoEvents();
Busy = false;
}
private void CmdOpen_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
PicSrc.Image.Dispose();
PicDest.Image.Dispose();
PicSrc.Image = Bitmap.FromFile(openFileDialog.FileName);
PicDest.Image = Bitmap.FromFile(openFileDialog.FileName);
ShowAdaptHistEqualizeResult();
}
} 展开
{
public unsafe partial class Form1 : Form
{
private bool Busy = false;
[DllImport("AdaptHistEqualize.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, ExactSpelling = true)]
private static extern void AdaptHistEqualize(byte* Scan0, int Width, int Height, int Stride, int TileX, int TileY, double CutLimit, bool SeparateChannel);
[DllImport("Kernel32.dll", EntryPoint = "RtlMoveMemory", SetLastError = true)]
private static extern void CopyMemory(byte* Dest, byte* src, int Length);
public Form1()
{
InitializeComponent();
}
private void ShowAdaptHistEqualizeResult()
{
Busy = true;
Bitmap SrcB = (Bitmap)PicSrc.Image;
Bitmap DstB = (Bitmap)PicDest.Image;
BitmapData SrcBmpData = SrcB.LockBits(new Rectangle(0, 0, SrcB.Width, SrcB.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
BitmapData DstBmpData = DstB.LockBits(new Rectangle(0, 0, DstB.Width, DstB.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
CopyMemory((byte*)DstBmpData.Scan0, (byte*)SrcBmpData.Scan0, SrcBmpData.Stride * SrcBmpData.Height);
Stopwatch Sw = new Stopwatch();
Sw.Start();
AdaptHistEqualize((byte*)DstBmpData.Scan0, SrcBmpData.Width, SrcBmpData.Height, SrcBmpData.Stride, TileX.Value, TileY.Value, ClipLimit.Value * 0.001f, SepChannel.Checked);
Sw.Stop();
this.Text = Sw.ElapsedMilliseconds.ToString();
SrcB.UnlockBits(SrcBmpData);
DstB.UnlockBits(DstBmpData);
PicDest.Invalidate();
Application.DoEvents();
Busy = false;
}
private void CmdOpen_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
PicSrc.Image.Dispose();
PicDest.Image.Dispose();
PicSrc.Image = Bitmap.FromFile(openFileDialog.FileName);
PicDest.Image = Bitmap.FromFile(openFileDialog.FileName);
ShowAdaptHistEqualizeResult();
}
} 展开
2个回答
展开全部
我眼睛都找坏了都没找到你这个picsrc,你好歹截图撒。
给你几个原因你看看是不是:
1、该变量没有定义
2、可能定义的地方与调用的地方并不再一个级
3、你打错字母了
4、你可能真打错字母了
给你几个原因你看看是不是:
1、该变量没有定义
2、可能定义的地方与调用的地方并不再一个级
3、你打错字母了
4、你可能真打错字母了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询