[問題] 請問如何將將R,G,B再合成一張圖片已回收

看板MATLAB作者 (提姆王)時間15年前 (2010/05/27 23:50), 編輯推噓2(204)
留言6則, 4人參與, 最新討論串1/1
感謝各位大大的指點,我這個新手用matlab陸續做出一些效果了。 目前還剩下最後一個問題。 要將R,G,B合併。 但最後出線問題,麻煩各位大大指點一下,謝謝。 輸入圖形 clear all; close all; A=imread('wafer1.bmp'); 把影像分成R、G、B AR=A(:,:,1); AG=A(:,:,2); AB=A(:,:,3); subplot(2,2,1),imshow(A),title('原始影像'); subplot(2,2,2),imshow(AR),title('R影像'); subplot(2,2,3),imshow(AG),title('G影像'); subplot(2,2,4),imshow(AB),title('B影像'); 分析彩色晶圓之直方圖 subplot(2,2,1),imshow(A),title('原始影像'); subplot(2,2,2),imhist(AR),title('R影像直方圖'); subplot(2,2,3),imhist(AG),title('G影像直方圖'); subplot(2,2,4),imhist(AB),title('B影像直方圖'); Gamma修正法進行影像強化 BR=imadjust(AR); BG=imadjust(AG); BB=imadjust(AB); subplot(2,2,1),imshow(A),title('原始影像'); subplot(2,2,2),imshow(BR),title('R影像Gamma修正'); subplot(2,2,3),imshow(BG),title('G影像Gamma修正'); subplot(2,2,4),imshow(BB),title('B影像Gamma修正'); Otsu影像分割 CR =graythresh(BR); CG=graythresh(BG); CB =graythresh(BB); WR= im2bw(BR,CR); WG= im2bw(BG,CG); WB= im2bw(BB,CB); subplot(2,2,1),imshow(A),title('原始影像'); subplot(2,2,2),imshow(WR) ,title('R影像Otsu分割'); subplot(2,2,3),imshow(WG) ,title('G影像Otsu分割'); subplot(2,2,4),imshow(WB) ,title('B影像Otsu分割'); 利用Median Filter去除雜訊 WR=double(WR); WG=double(WG); WB=double(WB); IR=imnoise(WR,'salt & pepper',0.02); IG=imnoise(WG,'salt & pepper',0.02); IB=imnoise(WB,'salt & pepper',0.02); MR=medfilt2(WR); MG=medfilt2(WG); MB=medfilt2(WB); subplot(2,2,1),imshow(A),title('原始影像'); subplot(2,2,2),imshow(MR),title('R影像中值率波去除雜訊'); subplot(2,2,3),imshow(MG),title('G影像中值率波去除雜訊'); subplot(2,2,4),imshow(MB),title('B影像中值率波去除雜訊'); R,G,B合併 reshape(MR,MG,MB) 錯誤訊息如下 ??? Error using ==> reshape Size arguments must be integer scalars. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.136.178.10

05/28 00:13, , 1F
aa(:,:,1)=R ;aa(:,:,2)=G ;aa(:,:,3)=B ;
05/28 00:13, 1F

05/28 00:16, , 2F
還要要正規化
05/28 00:16, 2F

05/28 05:26, , 3F
f=cat(3,MR,MG,MB); imshow(f);
05/28 05:26, 3F

05/28 19:24, , 4F
應該不是用reshape 最簡單就樓上那樣
05/28 19:24, 4F

05/28 19:28, , 5F
cat +1
05/28 19:28, 5F

05/28 19:30, , 6F
reshape(a,b,c)是把一個一維的矩陣a轉成b*c的二維矩陣吧
05/28 19:30, 6F
文章代碼(AID): #1B_fI-tr (MATLAB)