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


曙海教育集團論壇DSP專區DSP系統和硬件開發討論區 → 李現路:DSP6000圖像位置移動與變形的典型算法(四)


  共有8444人關注過本帖樹形打印

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

客人(124.78.*.*)
  1樓


李現路:DSP6000圖像位置移動與變形的典型算法(四)  發帖心情 Post By:2009-12-3 13:49:29

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

 

五、圖像的旋轉實驗


數學表達式原理:


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

坐標變成(x1,y1)。其數學表達式為:

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

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


算法的C語言代碼:


/*圖像旋轉參數*/

Float fAngle=3.1415927/3; //旋轉的角度

*畫矩形邊框函數*/

Void drawRectangle();

*計算圖像旋轉參數*/

Void computeParameter();

/*進行圖像旋轉處理*/

void rotate()

{

         int i,j,intInc;

         int intCapYInc;

         int intCapX,intCapY;

        

         /*進行圖像旋轉,重新賦值*/

         //方框內奇數行

         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;

            }

            

            //判斷是否在原圖范圍內

            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;

            }

                                

                   }       

         }

                          

         //方框內偶數行

         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;

            }            


            //判斷是否在原圖范圍內

            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;

            }

                                

                   }       

         }       

}



                                              曙海教育


                                            曙海嵌入式學院


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


                                           電話:021-51875830


                                           網址:http://www.51qianru.cn


                                              講師:李現路


                          版權所有-曙海教育 歡迎轉摘,轉摘請注明作者和出處


支持(0中立(0反對(0單帖管理 | 引用 | 回復 回到頂部

返回版面帖子列表

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








簽名
主站蜘蛛池模板: 仙桃市| 民权县| 英山县| 广东省| 泰州市| 萍乡市| 娄底市| 三明市| 万全县| 那坡县| 天台县| 合水县| 大化| 离岛区| 遵义市| 梅河口市| 新田县| 芷江| 牡丹江市| 宜君县| 南岸区| 垫江县| 太康县| 岳阳县| 东兰县| 建平县| 红原县| 丹巴县| 凤阳县| 南华县| 池州市| 重庆市| 松江区| 英山县| 错那县| 赤峰市| 永年县| 建阳市| 教育| 文安县| 玉环县|