欧美日韩一区二区高清,久久视频这里只有精品,超黄网站在线观看,成人av影院在线观看

以文本方式查看主題

-  曙海教育集團論壇  (http://www.martymets.com/bbs/index.asp)
--  DSP系統(tǒng)和硬件開發(fā)討論區(qū)  (http://www.martymets.com/bbs/list.asp?boardid=5)
----  李現(xiàn)路:DSP6000圖像位置移動與變形的典型算法(四)  (http://www.martymets.com/bbs/dispbbs.asp?boardid=5&id=85)

--  作者:admin
--  發(fā)布時間:2009-12-3 13:49:29
--  李現(xiàn)路:DSP6000圖像位置移動與變形的典型算法(四)

  李現(xiàn)路:DSP6000圖像位置移動與變形的典型算法(四)

 

五、圖像的旋轉(zhuǎn)實驗


數(shù)學(xué)表達式原理:


下面我們來推導(dǎo)一下旋轉(zhuǎn)運算的變換公式。如下圖所示,點(x0,y0)經(jīng)過旋轉(zhuǎn)θ度后

坐標(biāo)變成(x1,y1)。其數(shù)學(xué)表達式為:

X0=x1cos(θ)+y1sin(θ)+ccos(θ)-dsin(θ)+a ;

Y0=-xsin(θ)+y1cos(θ)+csin(θ)-dcos(θ)+ b


算法的C語言代碼:


/*圖像旋轉(zhuǎn)參數(shù)*/

Float fAngle=3.1415927/3; //旋轉(zhuǎn)的角度

*畫矩形邊框函數(shù)*/

Void drawRectangle();

*計算圖像旋轉(zhuǎn)參數(shù)*/

Void computeParameter();

/*進行圖像旋轉(zhuǎn)處理*/

void rotate()

{

         int i,j,intInc;

         int intCapYInc;

         int intCapX,intCapY;

        

         /*進行圖像旋轉(zhuǎn),重新賦值*/

         //方框內(nèi)奇數(shù)行

         for(i=intALines;i<intDLines;i++)

         {

             for(j=intAPixels;j<intDPixels;j++)

             {

            intInc = i*2;  


            intCapX    = (int)(j*cosAngle + intInc*sinAngle + f1 + 0.5);

            intCapYInc = (int)(intInc*cosAngle - j*sinAngle + f1 + 0.5);          

                     

            if((intCapYInc%2)==0)

            {

                     intCapY = intCapYInc/2;

            }

            else

            {

                     intCapY = (intCapYInc-1)/2+numLines/2;

            }

            

            //判斷是否在原圖范圍內(nèi)

            if((intCapX>=0) && (intCapX<numPixels) && (intCapY>=0) && (intCapY<numLines))  

            {

                                //傳送亮度信號

                                *(Uint8 *)(tempYbuffer + i*numPixels + j) = *(Uint8 *)(capYbuffer + intCapY*numPixels + intCapX);                                                                         

                 }

            else

            {

                      *(Uint8 *)(tempYbuffer + i*numPixels + j) = 0xFF;

            }

                                

                   }       

         }

                          

         //方框內(nèi)偶數(shù)行

         for(i=numLines/2+intALines;i<numLines/2+intDLines;i++)

         {

             for(j=intAPixels;j<intDPixels;j++)

             {                

            intInc = (i-numLines/2)*2 + 1;


            intCapX    = (int)(j*cosAngle + intInc*sinAngle + f1 + 0.5);

            intCapYInc = (int)(intInc*cosAngle - j*sinAngle + f1 + 0.5);          

                     

            if((intCapYInc%2)==0)

            {

                     intCapY = intCapYInc/2;

            }

            else

            {

                     intCapY = (intCapYInc-1)/2+numLines/2;

            }            


            //判斷是否在原圖范圍內(nèi)

            if((intCapX>=0) && (intCapX<numPixels) && (intCapY>=0) && (intCapY<numLines))  

            {

                                //傳送亮度信號

                                *(Uint8 *)(tempYbuffer + i*numPixels + j) = *(Uint8 *)(capYbuffer + intCapY*numPixels + intCapX);                                                                         

                 }

            else

            {

                      *(Uint8 *)(tempYbuffer + i*numPixels + j) = 0xFF;

            }

                                

                   }       

         }       

}



                                              曙海教育


                                            曙海嵌入式學(xué)院


                        (課程:DSP培訓(xùn),FPGA培訓(xùn),MTK培訓(xùn),Android培訓(xùn),iPhone培訓(xùn))


                                           電話:021-51875830


                                           網(wǎng)址:http://www.51qianru.cn


                                              講師:李現(xiàn)路


                          版權(quán)所有-曙海教育 歡迎轉(zhuǎn)摘,轉(zhuǎn)摘請注明作者和出處


主站蜘蛛池模板: 镶黄旗| 鞍山市| 永新县| 韶关市| 县级市| 鄂伦春自治旗| 安泽县| 壤塘县| 武穴市| 修水县| 凌海市| 万年县| 班戈县| 阿勒泰市| 宜春市| 大名县| 莒南县| 沅陵县| 银川市| 深水埗区| 杨浦区| 女性| 贺州市| 内乡县| 杨浦区| 措美县| 昌吉市| 饶平县| 穆棱市| 陆丰市| 沁源县| 延庆县| 新兴县| 万盛区| 会理县| 郎溪县| 巩义市| 宁安市| 乌鲁木齐县| 扎赉特旗| 原阳县|