久久一区二区中文字幕_日韩人体视频_国产影视一区_久久爱www.

南京軟件定制開發

南京傾心軟件歡迎您訪問本站

13605185909

新聞資訊

NEWS CENTER
欄目導航

南京軟件開發之快速搞定攝像頭圖像旋轉

發布時間:Mar 08, 2022         已有 人瀏覽
經常會遇到的一個問題,攝像頭顯示出來的圖像是鏡像,與我們真實情況正好相反,
那么下面的代碼可以幫你快速實現旋轉。

// 指定圖像的旋轉程度和用于翻轉圖像的軸。
public void videoSourcePlayer_NewFrame(object sender, ref Bitmap image)
        {
            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);
            }
        }
 
        /// <summary>
        /// 旋轉函數,外部調用觸發
        /// </summary>
        public void Rotate()
        {
            // 計算角度,類變量
            dAngle = dAngle + 90;
            dAngle = dAngle % 360;
            
            // 事件綁定,實時繪制,達到效果,本來就是實時繪制的原理
            videoSourcePlayer.NewFrame -= new VideoSourcePlayer.NewFrameHandler(videoSourcePlayer_NewFrame);
            videoSourcePlayer.NewFrame += new VideoSourcePlayer.NewFrameHandler(videoSourcePlayer_NewFrame);
        }

 
是不是非常方便且快速呢,歡迎來交流討論。
Copyright © 2020-2022 南京傾心軟件技術有限公司 版權所有     蘇ICP備2020070309號-1
QQ在線咨詢
13605185909
返回頂部
主站蜘蛛池模板: 华容县| 望江县| 凌源市| 平果县| 廉江市| 乐亭县| 定南县| 昌黎县| 延津县| 临江市| 水富县| 安福县| 雅江县| 苍山县| 潜山县| 德庆县| 金湖县| 漾濞| 鹤庆县| 万州区| 波密县| 邹平县| 遂平县| 广平县| 金堂县| 碌曲县| 老河口市| 南川市| 莎车县| 嵊泗县| 荥经县| 辰溪县| 建宁县| 会昌县| 鄯善县| 秭归县| 胶南市| 收藏| 泸溪县| 黄大仙区| 古蔺县|