數(shù)字圖像處理- 幾何變換_第1頁
數(shù)字圖像處理- 幾何變換_第2頁
數(shù)字圖像處理- 幾何變換_第3頁
數(shù)字圖像處理- 幾何變換_第4頁
數(shù)字圖像處理- 幾何變換_第5頁
已閱讀5頁,還剩32頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、配套課件數(shù)字圖像處理 編程框架、理論分析、實(shí)例應(yīng)用和源碼實(shí)現(xiàn)數(shù)字圖像處理1幾何變換,就是一個像素的值保持不變,但它的位置發(fā)生改變,并且這種改變符合一定的幾何數(shù)學(xué)特性。不同的幾何數(shù)學(xué)特性,就決定了幾何變換的類型,例如簡單的幾何變換包括平移、旋轉(zhuǎn)、鏡像、轉(zhuǎn)置、縮放和切變,而復(fù)雜的幾何變換包括仿射變換、投影變換和非剛體變換。數(shù)字圖像處理2數(shù)字圖像處理3數(shù)字圖像處理4平移旋轉(zhuǎn)鏡像轉(zhuǎn)置切變縮放數(shù)字圖像處理5xy0s(x,y)t(x,y)(xs,ys)(xt,yt)dxdy向前映射向后映射數(shù)字圖像處理6數(shù)字圖像處理7CTMatrix CImageProcessing:Image_translation(

2、const CTMatrix& color_image, long delta_x, long delta_y )long image_height = color_image.Get_height();long image_width = color_image.Get_width();long new_height = image_height + abs( delta_y );long new_width = image_width + abs( delta_x );CTMatrix translated_image( new_height, new_width );for( i

3、nt row = 0; row new_height; row + )for( int column = 0; column 0 )row_mapped = row - delta_y;int column_mapped = column;if( delta_x 0 )column_mapped = column - delta_x;if( color_image.Is_point_valid( CImagePoint( row_mapped, column_mapped ) ) )translated_image row column = color_image row_mapped col

4、umn_mapped ;elsetranslated_image row column = RGB_TRIPLE( 128, 128, 128 );return translated_image;數(shù)字圖像處理8void CDigitalImageProcessingDoc:OnGeometrytransformImagetranslation()/ TODO: Add your command handler code hereif( m_image.IsColorImage()long delta_x = 60;long delta_y = 30;CTMatrix translated_im

5、age = CImageProcessing:Image_translation( m_image.Get_color_image(), delta_x, delta_y );m_image.ImportFrom( translated_image );UpdateAllViews(NULL);數(shù)字圖像處理9向前映射向后映射數(shù)字圖像處理10數(shù)字圖像處理11xy0s(x,y)t(x,y)(xs,ys)(xt,yt)數(shù)字圖像處理12數(shù)字圖像處理13向前映射向后映射數(shù)字圖像處理14數(shù)字圖像處理15CTMatrix CImageProcessing:Image_mirror( const CTMatr

6、ix& color_image, bool is_horizontal )long image_height = color_image.Get_height();long image_width = color_image.Get_width();CTMatrix dest_image( image_height, image_width );for( long row = 0; row image_height; row + )for( long column = 0; column image_width; column + )long source_row = row;long

7、 source_column = column;if( is_horizontal = true )source_column = image_width - column - 1;elsesource_row = image_height - row - 1;dest_image row column = color_image source_row source_column ;return dest_image;數(shù)字圖像處理16數(shù)字圖像處理17數(shù)字圖像處理18CTMatrix CImageProcessing:Image_transpose( const CTMatrix& co

8、lor_image )long image_height = color_image.Get_height();long image_width = color_image.Get_width();CTMatrix dest_image( image_width, image_height );for( long row = 0; row image_width; row + )for( long column = 0; column image_height; column + )long source_row = column;long source_column = row;dest_i

9、mage row column = color_image source_row source_column ;return dest_image;數(shù)字圖像處理19逆時針旋轉(zhuǎn)90度垂直鏡像旋轉(zhuǎn)轉(zhuǎn)置數(shù)字圖像處理20 xy0s(x,y)t(x,y)(xs,ys)(xt,yt)HsHtWsWtSV=Ht/HsSH=Wt/Ws向前映射向后映射數(shù)字圖像處理21數(shù)字圖像處理22CTMatrix CImageProcessing:Image_zoom( const CTMatrix& color_image, double horizontal_scale, double vertical_scal

10、e )long source_height = color_image.Get_height();long source_width = color_image.Get_width();long dest_height = long( source_height * vertical_scale );long dest_width = long( source_width * horizontal_scale );CTMatrix dest_image( dest_height, dest_width );for( int dest_row = 0; dest_row dest_height;

11、 dest_row + )for( int dest_column = 0; dest_column dest_width; dest_column + )long source_row = long( dest_row / vertical_scale );long source_column = long( dest_column / horizontal_scale );if( color_image.Is_point_valid( CImagePoint( source_row, source_column ) ) )dest_image dest_row dest_column =

12、color_image source_row source_column ;elsedest_image dest_row dest_column = RGB_TRIPLE( 128, 128, 128 );return dest_image;數(shù)字圖像處理23切變,是一種坐標(biāo)系的扭曲變換,進(jìn)行非均勻的拉伸。切變的時候,角度會發(fā)生變化,但面積卻保持不變。數(shù)字圖像處理24xy0s(x,y)t(x,y)(xs,ys)(xt,yt)HsHtWsWtHt=Hs+s2WsWt=Ws+s1Hs向前映射向后映射數(shù)字圖像處理25數(shù)字圖像處理26仿射變換投影變換非剛體變換數(shù)字圖像處理27平移變換圖像旋轉(zhuǎn)圖像縮放仿

13、射變換,是一種二維坐標(biāo)到二維坐標(biāo)之間的線性變換,保持二維圖形的“平直性”(即變換后直線還是直線,不會打彎,圓弧還是圓弧)和“平行性”(即保證二維圖形間的相對位置關(guān)系不變,平行線還是平行線,相交直線之間的夾角不變)仿射變換可以理解為:1)對坐標(biāo)進(jìn)行縮放、旋轉(zhuǎn)和平移后取得的新坐標(biāo)值;2)經(jīng)過對坐標(biāo)軸的縮放、旋轉(zhuǎn)和平移后原坐標(biāo)在新坐標(biāo)系中的值。數(shù)字圖像處理28數(shù)字圖像處理29數(shù)字圖像處理30CTMatrix CImageProcessing:Image_affine( const CTMatrix& color_image, double m00, double m01, double m0

14、2, double m10, double m11, double m12 )long source_height = color_image.Get_height();long source_width = color_image.Get_width();long dest_height = source_height * 2;long dest_width = source_width * 2;CTMatrix dest_image( dest_height, dest_width );for( int dest_row = 0; dest_row dest_height; dest_ro

15、w + )for( int dest_column = 0; dest_column dest_width; dest_column + )int source_column = int( m00 * dest_column + m01 * dest_row + m02 );int source_row = int( m10 * dest_column + m11 * dest_row + m12 );if( color_image.Is_point_valid( CImagePoint( source_row, source_column ) ) )dest_image dest_row dest_column = color_image source_row source_column ;elsedest_image dest_row dest_column = RGB_TRIPLE( 128, 128, 128

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論