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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • java数据类型有哪几种_java数据类型有哪些

    java数据类型有哪几种_java数据类型有哪些Java中的数据类型分为两大类分别是基本类型和引用类型,基本类型包含int,float,double,char,boolean等八种类型,引用类型包含类,数组,接口三种类型。【推荐课程:Java教程】java数据类型有:1、基本数据类型简单数据类型是不能简化的、内置的数据类型、由编程语言本身定义,它表示了真实的数字、字符和整数。在Java中共有八种基本数据类型,它们分别是以下几种类型:数据类型描述…

    2022年7月7日
    23
  • win7显示器亮度怎么调_虚拟机外接显示器

    win7显示器亮度怎么调_虚拟机外接显示器很久没有继续研究wddmhook了,最后一次研究还在3年前,不得不说虽然应用的少,但是wddmhook却是很有技术含量的一项技术,而且实用性很高,我们除了做虚拟显示器还能做很多的东西,比如高效的截屏(因为直接从驱动层面截屏,所以效率和实现效果秒杀mirrordriver和DXGI)、视频重定向(视频硬件加速的时候可以直接获取原始码流)、修改原始的显示器厂商信息、修改显示器支持分辨率,等等骚操作wddmhook都可以实现。去年,深圳某硬件公司找到我,他们正在做usb转HDMI或者USB转VGA的硬件

    2022年8月21日
    3
  • Spring Data JPA 之 JpaRepository

    Spring Data JPA 之 JpaRepositoryJpaRepository是Spring提供的非常强大的基本接口。1JpaRepository1.1JpaRepository接口定义JpaRepository接口的官方定义如下:publicinterfaceJpaRepository<T,ID>extendsPagingAndSortingRepository<T,ID>,Q…

    2022年10月20日
    1
  • Inputstream_java input

    Inputstream_java inputimportjava.io.File;importjava.io.FileInputStream;importjava.io.IOException;importjava.io.InputStream;publicclassInputStreamDemo{/**InputStream字节输入流*FileInputStream:文件字节输入…

    2022年9月21日
    0
  • JedisPool_java.util.Scanner

    JedisPool_java.util.Scanner本节目标通过JedisPool获取Jedis示例,并完成对redis简单的Key-value读写操作。完整代码结构如下:redis服务端在本地运行redis-server.exe,然后在resources新建jedis.properties:redis.host=localhostredis.port=6379配置jedis我们将jedis相关配置放在单独的SpringConfig中,在res…

    2022年9月4日
    2
  • 阻塞、非阻塞、多路复用、同步、异步、BIO、NIO、AIO 一锅端

    阻塞、非阻塞、多路复用、同步、异步、BIO、NIO、AIO 一锅端

    2022年2月18日
    58

发表回复

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

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