cv图像翻转,EmguCV图像旋转「建议收藏」

iusethiscodeprivatevoidbutton12_Click(objectsender,EventArgse){Bitmapbm=newBitmap(pictureBox1.Image);Imageimg=newImage(bm);doublex=20;img.Rotate(x,newGray(255));pictureBox9.Image…

大家好,又见面了,我是你们的朋友全栈君。

cv图像翻转,EmguCV图像旋转「建议收藏」

i use this codeprivate void button12_Click(object sender, EventArgs e)

{

Bitmap bm = new Bitmap(pictureBox1.Image);

Image img = new Image(bm);

double x = 20;

img.Rotate(x, new Gray(255));

pictureBox9.Image = img.ToBitmap();

}

for image rotation

but it doesn’t work ,

why????

解决方案follow this link: http://www.emgu.com/wiki/files/1.4.0.0/html/ae9c1603-5135-1a2f-bd46-1dd736d4d7a8.htm[^]

You will see the Rotate method also has an argument called crop, set this argument false and all information of your image will be preserved.

I think your code should be changed into:

img = img.Rotate(x, new Gray(255),false);

Hope this will help you!

You may have to try this:

Image imgOut= img.Rotate(x, new Gray(255));

pictureBox9.Image= imgOut.ToBitmap();

I did not compile, even though i have emgucv on my machine, but I looked into their libray. I believe you should call like I said above.

see their implementation:

public Image WarpAffine(Matrix mapMatrix, int width, int height, INTER interpolationType, WARP warpType, TColor backgroundColor) where TMapDepth: new()

{

Image image = new Image(width, height);

//this call externs c function

CvInvoke.cvWarpAffine(base.Ptr, image.Ptr, mapMatrix.Ptr, (int) (interpolationType | ((INTER) ((int) warpType))), backgroundColor.MCvScalar);

return image;

}

Well, in case of “it doesn’t work”.

The problem is not that complected.

change this line

img.Rotate(x, new Gray(255));

to

img = img.Rotate(x, new Gray(255));

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/127844.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 二叉树中序遍历图示[通俗易懂]

    二叉树中序遍历图示[通俗易懂]一,中序遍历二叉树的算法1,调用自身来遍历节点的左子树2,访问这个节点3,调用自身来遍历节点的右子树二,实例三,方法调用tree.inOrder(tree.root);四,执行示意图总结:学习二叉树的时候,一直对遍历所用到的递推跟递归思想迷惘。现在使用示意图,觉得清晰多了,希望能帮有需要的人。…

    2022年9月14日
    3
  • 武侠世界中的ERP乱弹[通俗易懂]

    1990年一位威力大侠(Wylie)发明了ERP,它内通百窍(企业各个业务部门),外通天地二气(客户,供应商),彻底摆脱了原先MRP,MRPII对人体的约束,从此武侠世界进入了新的篇章,各式奇功妙法,各路英雄豪杰辈出,好一派繁荣盛世!二十几年的血雨腥风过去了,江湖格局日趋稳定。天下以五派为尊,分别是SAP,Oracle,Sage,Infor,Microsoft,其它小门小派,不一一细数。作

    2022年4月7日
    37
  • python3.x默认使用UTF-8编码_pycharm怎么debug

    python3.x默认使用UTF-8编码_pycharm怎么debugpycharm设置默认的UTF-8编码模式!

    2022年8月29日
    4
  • 五大主流浏览器及四大内核1

    五大主流浏览器及四大内核1

    2021年10月23日
    42
  • Circular buffer

    Circular buffer

    2022年1月16日
    49
  • 如何更改WIFI频段_wifi5g与2.4g怎么切换

    如何更改WIFI频段_wifi5g与2.4g怎么切换首先打开浏览器并输入IP地址进入路由器管理页面,此时需要输入用户名以及密码进行登录,登录成功以后点击左侧的“无线设置”选项,然后点击“高级无线设置”选项,之后我们就可以修改WiFi的频段了。需要注意的是,目前仅能将无线频段修改为2.4GHz或者5GHz两个频段。如果您的iPhone手机突然不能连接WiFi了,那么您可以打开手机“设置”应用,然后点击“通用”选项,接着点击“还原”选项,进入后选择点击…

    2022年10月20日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号