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

以文本方式查看主題

-  曙海教育集團論壇  (http://m.martymets.com/bbs/index.asp)
--  DSP系統和硬件開發討論區  (http://m.martymets.com/bbs/list.asp?boardid=5)
----  李現路:DSP6000圖像位置移動與變形的典型算法(三)  (http://m.martymets.com/bbs/dispbbs.asp?boardid=5&id=84)

--  作者:admin
--  發布時間:2009-12-3 13:48:22
--  李現路:DSP6000圖像位置移動與變形的典型算法(三)

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

 

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

數學表達式原理:


設圖像高度為IHeight,寬度為IWidth,原圖中(x0,y0)經過水平鏡像后從未將變為

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

X0=IWidth-y1; y0=y1


算法的C語言代碼:


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

void horizTranspose()

{

         int i,j;

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

         {            

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

              //傳送臨時Y緩沖區

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

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

                      numPixels>>1);                                                       

             //傳送臨時Cb緩沖區

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

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

                      numPixels>>2);        

             //傳送臨時Cr緩沖區

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

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

                      numPixels>>2);                                                                          

                  

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

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

                   {

                            //傳送臨時Y緩沖區               

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

                   }

                               

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

                   {

                            //傳送臨時Cb緩沖區

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

                            //傳送臨時Cr緩沖區

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

                   }

                                      

          }

}



四、圖像的縮放算法

數學表達式原理:

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

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

X0=x1/fx; y0=y1/fy


算法的C語言代碼:

 

/*圖像縮放參數*/

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

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

/*縮放處理函數*/


/*縮放處理*/

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);          

            

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

            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;

            }                                             

                   }       

         }

}


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

主站蜘蛛池模板: 兴仁县| 县级市| 集贤县| 张掖市| 镇巴县| 盐源县| 宜兰市| 邢台市| 新龙县| 武定县| 府谷县| 桦南县| 鄂尔多斯市| 华容县| 剑阁县| 微博| 阳谷县| 安岳县| 赞皇县| 闽侯县| 孝感市| 合肥市| 富锦市| 辽源市| 井研县| 汉寿县| 文成县| 岳池县| 建宁县| 晴隆县| 东莞市| 灵川县| 蕲春县| 门源| 略阳县| 股票| 获嘉县| 伊宁县| 成都市| 大埔区| 舟山市|