WebEnh

.net7 mvc jquery bootstrap json 学习中 第一次学PHP,正在研究中。自学进行时... ... 我的博客 https://enhweb.github.io/ 不错的皮肤:darkgreentrip,iMetro_HD
随笔 - 1079, 文章 - 1, 评论 - 75, 阅读 - 174万
  首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

C# Afroge摄像头翻转90

Posted on   WebEnh  阅读(125)  评论(0编辑  收藏  举报
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
1.dll和命名空间就不在此列举了,如下只是将转换方法介绍:
第一个函数:
        public void Rotate90()
        {
            // 计算角度,类变量
            //dAngle = dAngle + 90;
            //dAngle = dAngle % 360;
  
            // 事件绑定,实时绘制,达到效果,本来就是实时绘制的原理
            videoSourcePlayer1.NewFrame -= new VideoSourcePlayer.NewFrameHandler(videoSourcePlayer_NewFrame);
            videoSourcePlayer1.NewFrame += new VideoSourcePlayer.NewFrameHandler(videoSourcePlayer_NewFrame);
        }
  
第二个函数:
        public void videoSourcePlayer_NewFrame(object sender, ref Bitmap image)
        {
            int dAngle = 90;
            if (image != null)
            {
                RotateFlipType pType = RotateFlipType.RotateNoneFlipNone;
                if (dAngle == 0)
                {
                    pType = RotateFlipType.RotateNoneFlipNone;
                }
                else if (dAngle == 90)
                {
                    pType = RotateFlipType.Rotate90FlipNone;
                }
                else if (dAngle == 180)
                {
                    pType = RotateFlipType.Rotate180FlipNone;
                }
                else if (dAngle == 270)
                {
                    pType = RotateFlipType.Rotate270FlipNone;
                }
  
                // 实时按角度绘制
                image.RotateFlip(pType);
            }
        }
直接在要调节摄像头的地方调用Rotate90();方法就可以了。

  

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示