两张bmp图像做比较相似度:请教有方法改变bmp图像的角度吗?
解决方案 »
- 结构类型问题,新手求知道
- Visual studio 2012怎么打包应用程序?
- 请教高手 树状查询
- KeyDown事件可以捕捉到Ctrl+C组合键吗
- Listview和数据连接 实现时时更新 [痴迷C#] 在线卧等
- 急问:关于TableLayoutPanel列增加与删除
- 我想找一个或者请人作一个或者自己做个软件能够把上网记录保存起来谢了
- 如何在.net下用C#实现动态画图功能??各位帮帮忙
- (c#) httpresponse得到了406错误,怎么解决
- 看过csdn助手.NET 0.1原代码的朋友请进
- c#(winform) 中有没有精确到小时的控件,datetimepicker控件好象只到天啊
- 关于C#的List<T>的remove的问题
角度变换参考http://blog.csdn.net/kenkao/archive/2008/10/26/3148122.aspx
public static Bitmap Whirl(Bitmap bmp, PointD org, double angle)
{
Bitmap src = new Bitmap(bmp.Width, bmp.Height);
Graphics g = Graphics.FromImage(src);
PointD o1 = new PointD();
o1 = o1.Whirl(org, angle); GraphicsState gs = g.Save();
g.TranslateTransform((float)o1.X, (float)o1.Y);
g.RotateTransform((float)angle);
g.DrawImage(bmp, 0, 0,bmp.Width,bmp.Height);
g.Restore(gs);
GraphHelper.DrawSelPoint(org.Point, g, 7);
g.Dispose();
return src;
}
{
public PointD()
{
x = 0;
y = 0;
} public PointD(double x, double y)
{
this.x = x;
this.y = y;
} double x; double y; public double Y
{
get { return y; }
set { y = value; }
} public double X
{
get { return x; }
set { x = value; }
} public PointD Whirl(PointD origin, double angle)
{
double len, agl;
PointD v = (this - origin);
len = v.VectorLength;
if (len == 0)
return new PointD(origin.x, origin.y); agl = v.Angle;
agl += angle;
agl %= 360;
if (agl < 0)
agl += 360;
agl = GraphHelper.ToPI(agl); return origin + new PointD(len * Math.Cos(agl), len * Math.Sin(agl));
}
}