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


曙海教育集團論壇DSP專區(qū)DSP系統(tǒng)和硬件開發(fā)討論區(qū) → 李現(xiàn)路:DSP6000圖像位置移動與變形的典型算法(三)


  共有8369人關(guān)注過本帖樹形打印

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

客人(124.78.*.*)
  1樓


李現(xiàn)路:DSP6000圖像位置移動與變形的典型算法(三)  發(fā)帖心情 Post By:2009-12-3 13:48:22

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

 

三、圖像的水平鏡像變換算法

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


設(shè)圖像高度為IHeight,寬度為IWidth,原圖中(x0,y0)經(jīng)過水平鏡像后從未將變?yōu)?/p>

(IWidth-x0,y0),其表達式為:

X0=IWidth-y1; y0=y1


算法的C語言代碼:


/*水平鏡像變換處理*/

void horizTranspose()

{

         int i,j;

         for(i=0;i<numLines;i++)

         {            

              /*前半部分為原始圖像*/

              //傳送臨時Y緩沖區(qū)

                   DAT_copy((void *)(capYbuffer + i * numPixels),

                      (void *)(tempYbuffer + i * numPixels),

                      numPixels>>1);                                                       

             //傳送臨時Cb緩沖區(qū)

             DAT_copy((void *)(capCbbuffer + i * (numPixels >> 1)),

                      (void *)(tempCbbuffer + i * (numPixels >> 1)),

                      numPixels>>2);        

             //傳送臨時Cr緩沖區(qū)

             DAT_copy((void *)(capCrbuffer + i * (numPixels >> 1)),

                      (void *)(tempCrbuffer + i * (numPixels >> 1)),

                      numPixels>>2);                                                                          

                  

                   /*后半部分為水平鏡像圖像*/

                   for(j=numPixels/2;j<numPixels;j++)

                   {

                            //傳送臨時Y緩沖區(qū)               

                            *(Uint8 *)(tempYbuffer + i*numPixels + j) = *(Uint8 *)(capYbuffer + i*numPixels + numPixels-1-j);             

                   }

                               

             for(j=(numPixels>>2);j<(numPixels>>1);j++)

                   {

                            //傳送臨時Cb緩沖區(qū)

                            *(Uint8 *)(tempCbbuffer + i*(numPixels>>1) + j) = *(Uint8 *)(capCbbuffer + i*(numPixels>>1) + (numPixels>>1)-1-j);                   

                            //傳送臨時Cr緩沖區(qū)

                            *(Uint8 *)(tempCrbuffer + i*(numPixels>>1) + j) = *(Uint8 *)(capCrbuffer + i*(numPixels>>1) + (numPixels>>1)-1-j);                   

                   }

                                      

          }

}



四、圖像的縮放算法

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

假設(shè)圖像x軸方向縮放比率fx,y軸方向縮放比率是fy,那么原圖中點(x0,y0)對應(yīng)

于新圖中的點(x1,y1)的轉(zhuǎn)換表達式為:

X0=x1/fx; y0=y1/fy


算法的C語言代碼:

 

/*圖像縮放參數(shù)*/

Float fXZoomRatio=0.5; //水平縮放比率

Float fYZoomRatio=0.5; //垂直縮放比率

/*縮放處理函數(shù)*/


/*縮放處理*/

void zoom()

{

         int i,j;

         int intCapX,intCapY;

         for(i=0;i<numLines;i++)

         {

             for(j=0;j<numPixels;j++)

             {                    

            intCapX = (int)(j/fYZoomRatio+0.5);

            intCapY = (int)(i/fXZoomRatio+0.5);          

            

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

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

            {  

                     if((i<numLines/2) && (intCapY>=0) && (intCapY<numLines/2))

                     {

                                         //傳送亮度信號

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

                                }

                                else if((i>=numLines/2) && (i<numLines) && (intCapY>=numLines/2) && (intCapY<numLines))

                                {

                                             //傳送亮度信號

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

                                }

                                else

                                {

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

                                }                                                                                  

                 }

            else

            {

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

            }                                             

                   }       

         }

}


[此貼子已經(jīng)被作者于2009-12-3 13:54:26編輯過]

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

返回版面帖子列表

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








簽名
主站蜘蛛池模板: 张家港市| 曲靖市| 读书| 淮滨县| 苍梧县| 淮南市| 石柱| 赞皇县| 民和| 报价| 积石山| 商南县| 雅江县| 三江| 刚察县| 大悟县| 三台县| 桦甸市| 英山县| 原平市| 得荣县| 新源县| 蒙山县| 柳州市| 冀州市| 揭东县| 怀集县| 泽库县| 东方市| 桐庐县| 景洪市| 六盘水市| 元谋县| 绩溪县| 垣曲县| 五华县| 东辽县| 二连浩特市| 阿尔山市| 商河县| 大石桥市|