windows mobile 数字图像处理问题,百思不得其解
程序代码:
using System;
using System.Linq;
using System.Collections.Generic;
using using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace imgmanage
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void menuItem1_Click(object sender, EventArgs e)
{
}
private void menuItem2_Click(object sender, EventArgs e)
{
Color c1 = new Color();
Color c2 = new Color();
Color c3 = new Color();
Color c4 = new Color();
int rr, gg, bb, r1, r2, r3, r4, fxr, fyr, i, j;
int g1, g2, g3, g4, fxg, fyg, b1, b2, b3, b4, fxb, fyb;
Bitmap box1 = new Bitmap(pictureBox1.Image);
for (i = 0; i < pictureBox1.Image.Width - 2; i++)
{
for (j = 0; j < pictureBox1.Image.Height - 2; j++)
{
c1 = box1.GetPixel(i, j);
c2 = box1.GetPixel(i + 1, j + 1);
c3 = box1.GetPixel(i + 1, j);
c4 = box1.GetPixel(i, j + 1);
r1 = c1.R;
r2 = c2.R;
r3 = c3.R;
r4 = c4.R;
fxr = r1 - r2;
fyr = r3 - r4;
rr = Math.Abs(fxr) + Math.Abs(fyr) + 128;
if (rr < 0) rr = 0;
if (rr > 255) rr = 255;
g1 = c1.G;
g2 = c2.G;
g3 = c3.G;
g4 = c4.G;
fxg = g1 - g2;
fyg = g3 - g4;
gg = Math.Abs(fxg) + Math.Abs(fyg) + 128;
if (gg < 0) gg = 0;
if (gg > 255) gg = 255;
b1 = c1.B;
b2 = c2.B;
b3 = c3.B;
b4 = c4.B;
fxb = b1 - b2;
fyb = b3 - b4;
bb = Math.Abs(fxb) + Math.Abs(fyb);
if (bb < 0) bb = 0;
if (bb > 255) bb = 255;
Color cc = Color.FromArgb(rr, gg, bb);
box1.SetPixel(i, j, cc);
}
pictureBox1.Refresh();
pictureBox1.Image = box1;
}
}
[b] private void menuItem7_Click(object sender, EventArgs e)
{
Graphics g = this.pictureBox1.CreateGraphics();
string path = @"E:\淘宝网店素材搜集\装修图片\bird.bmp";
Bitmap bitmap = new Bitmap(path);
float[][] matrixItems ={
new float[]{1,0,0,0,0,},
new float[]{0,1,0,0,0 },
new float[]{0,0,1,0,0 },
new float[]{0,0,0,1,0 },
new float[]{0,0,0,0,1 }};
ColorMatrix colorMatrix = new ColorMatrix(matrixItems);
ImageAttributes imageAtt = new ImageAttributes();
imageAtt.SetColorMatrix(
colorMatrix,
ColorMatrixFlag.Default,
ColorAdjustType.Bitmap);
int iWidth = bitmap.Width;
int iHeight = bitmap.Height;
g.DrawLine( new Pen(Color.Black,25),
new Point(10,35),
new Point(200,35));
g.DrawImage(bitmap,new Rectangle(30,0,iWidth,iHeight),0,0,iWidth,iHeight,GraphicsUnit.Pixel,imageAtt);
}
}
}
出现如下错误:
错误 1 找不到类型或命名空间名称“ColorMatrix”(是否缺少 using 指令或程序集引
错误 2 找不到类型或命名空间名称“ColorMatrix”(是否缺少 using 指令或程序集引用?)
错误 3 “System.Drawing.Imaging.ImageAttributes”不包含“SetColorMatrix”的定义,并且找不到可接受类型为“System.Drawing.Imaging.ImageAttributes”的第一个参数的扩展方法“SetColorMatrix”(是否缺少 using 指令或程序集引用?)
错误 4 当前上下文中不存在名称“ColorMatrixFlag”
错误 5 当前上下文中不存在名称“ColorAdjustType”
错误 6 “DrawLine”方法没有采用“3”个参数的重载
我的空间引用没问题啊,怎么还出现这些问题,我的开发平台是visual studio 2008 用的是windows mobile 6.0 sdk
希望有高手指点迷津






