グレースケール画像の各画素の輝度値を元に計算処理を行いたい。
Show older comments
グレースケール画像の各画素の輝度値を読み取って、それぞれの画素の輝度値に対して計算処理を行いたいのですが、輝度値の取得方法がいまいち分からず困っています。
pythonで以下のように書いていたのですが、これと同じ処理をMATLABでしたいと考えています。
ガンマ補正を各画素ごとに処理するコードです。
オリジナル画像に写っているプロパティは残すために、ガウシアンフィルタでぼかした輝度値を元に一定の輝度値になるような計算処理を行っています。
よろしくお願いいたします。
gfimg_blur = cv2.GaussianBlur(fresize_img,(499,499),0)
gfheight = gfimg_blur.shape[0]
gfwidth = gfimg_blur.shape[1]
np.clip(gfheight, 1,254)
np.clip(gfwidth,1,254)
gfb = gfimg_blur/255.0
gfg = np.log(0.5)/np.log(gfb)
gfimg2 = 255.0*np.power(fresize_img/255.0,gfg)
cv2.imwrite('ganma-'+str(i)+'.jpg',gfimg2)
Answers (0)
Categories
Find more on イメージ in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!