1. MATLAB圖像處理imrotate
如果中間的圖像沒有黑色的點,就很簡單了,直接用find(a==0)找到黑色的點的坐標,賦白就行。如果中間圖有黑色,我寫了個函數,可以把底面賦白,這程序其實不難,就是掃描賦值。
function [r]=back2white(a)
[in,jn]=size(a);
for i=1:3%先把「鏡框」賦白,因為里邊那個矩形沒緊貼外框
for j=1:jn
if a(i,j)~=255
a(i,j)=255;
end
if a(in+1-i,j)~=255
a(in+1-i,j)=255;
end
end
for j=1:in%兩豎邊賦白
if a(j,i)~=255
a(j,i)=255;
end
if a(j,jn+1-i)~=255
a(j,jn+1-i)=255;
end
end
end
for i=4:in-3
j=4;
while(a(i,j)<250)%此處選250為了保險
a(i,j)=255;
j=j+1;
end
k=jn-3;
while(a(i,k)<250)
a(i,k)=255;
k=k-1;
end
end
r=a;
PR(r);
2. 求教,matlab圖像歪斜矯正代碼解釋
將模板在圖像上移動,和覆蓋的圖像塊做卷積,響應超過閾值的部分為匹配到。
3. matlab怎樣將圖像水平鏡像,再順時針旋轉45度,顯示旋轉後的圖像。代碼
imrotate(image, 180); %水平鏡像
imrotate(image, -45); % 順時針旋轉45度
4. 求MATLAB代碼
MATLAB實用源代碼
1圖像的讀取及旋轉
A=imread('');%讀取圖像
subplot(2,2,1),imshow(A),title('原始圖像');%輸出圖像
I=rgb2gray(A);
subplot(2,2,2),imshow(A),title('灰度圖像');
subplot(2,2,3),imhist(I),title('灰度圖像直方圖');%輸出原圖直方圖
theta = 30;J = imrotate(I,theta);% Try varying the angle, theta.
subplot(2,2,4), imshow(J),title(『旋轉圖像』)
2邊緣檢測
I=imread('C:\Users\HP\Desktop\平時總結\路飛.jpg');
subplot(2,2,1),imshow(I),title('原始圖像');
I1=edge(I,'sobel');
subplot(2,2,2),imshow(I1),title('sobel邊緣檢測');
I2=edge(I,'prewitt');
subplot(2,2,3),imshow(I2),title('prewitt邊緣檢測');
I3=edge(I,'log');
subplot(2,2,4),imshow(I3),title('log邊緣檢測');
3圖像反轉
MATLAB 程序實現如下:
I=imread('xian.bmp');
J=double(I);
J=-J+(256-1);%圖像反轉線性變換
H=uint8(J);
subplot(1,2,1),imshow(I);
subplot(1,2,2),imshow(H);
4.灰度線性變換
MATLAB 程序實現如下:
I=imread('xian.bmp');
subplot(2,2,1),imshow(I);
title('原始圖像');
axis([50,250,50,200]);
axis on;%顯示坐標系
I1=rgb2gray(I);
subplot(2,2,2),imshow(I1);
title('灰度圖像');
axis([50,250,50,200]);
axis on; %顯示坐標系
J=imadjust(I1,[0.1 0.5],[]); %局部拉伸,把[0.1 0.5]內的灰度拉伸為[0 1]
subplot(2,2,3),imshow(J);
title('線性變換圖像[0.1 0.5]');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
K=imadjust(I1,[0.3 0.7],[]); %局部拉伸,把[0.3 0.7]內的灰度拉伸為[0 1]
subplot(2,2,4),imshow(K);
title('線性變換圖像[0.3 0.7]');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
5.非線性變換
MATLAB 程序實現如下:
I=imread('xian.bmp');
I1=rgb2gray(I);
subplot(1,2,1),imshow(I1);
title(' 灰度圖像');
axis([50,250,50,200]);
grid on;%顯示網格線
axis on;%顯示坐標系
J=double(I1);
J=40*(log(J+1));
H=uint8(J);
subplot(1,2,2),imshow(H);
title(' 對數變換圖像');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
4.直方圖均衡化
MATLAB 程序實現如下:
I=imread('xian.bmp');
I=rgb2gray(I);
figure;
subplot(2,2,1);
imshow(I);
subplot(2,2,2);
imhist(I);
I1=histeq(I);
figure;
subplot(2,2,1);
imshow(I1);
subplot(2,2,2);
imhist(I1);
5. 線性平滑濾波器
用MATLAB實現領域平均法抑制雜訊程序:
I=imread('xian.bmp');
subplot(231)
imshow(I)
title('原始圖像')
I=rgb2gray(I);
I1=imnoise(I,'salt & pepper',0.02);
subplot(232)
imshow(I1)
title(' 添加椒鹽雜訊的圖像')
k1=filter2(fspecial('average',3),I1)/255; %進行3*3模板平滑濾波
k2=filter2(fspecial('average',5),I1)/255; %進行5*5模板平滑濾波k3=filter2(fspecial('average',7),I1)/255; %進行7*7模板平滑濾波
k4=filter2(fspecial('average',9),I1)/255; %進行9*9模板平滑濾波
subplot(233),imshow(k1);title('3*3 模板平滑濾波');
subplot(234),imshow(k2);title('5*5 模板平滑濾波');
subplot(235),imshow(k3);title('7*7 模板平滑濾波');
subplot(236),imshow(k4);title('9*9 模板平滑濾波');
6.中值濾波器
用MATLAB實現中值濾波程序如下:
I=imread('xian.bmp');
I=rgb2gray(I);
J=imnoise(I,'salt&pepper',0.02);
subplot(231),imshow(I);title('原圖像');
subplot(232),imshow(J);title('添加椒鹽雜訊圖像');
k1=medfilt2(J); %進行3*3模板中值濾波
k2=medfilt2(J,[5,5]); %進行5*5模板中值濾波
k3=medfilt2(J,[7,7]); %進行7*7模板中值濾波
k4=medfilt2(J,[9,9]); %進行9*9模板中值濾波
subplot(233),imshow(k1);title('3*3模板中值濾波');
subplot(234),imshow(k2);title('5*5模板中值濾波 ');
subplot(235),imshow(k3);title('7*7模板中值濾波');
subplot(236),imshow(k4);title('9*9 模板中值濾波');
7.用Sobel運算元和拉普拉斯對圖像銳化:
I=imread('xian.bmp');
subplot(2,2,1),imshow(I);
title('原始圖像');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on;%顯示坐標系
I1=im2bw(I);
subplot(2,2,2),imshow(I1);
title('二值圖像');
axis([50,250,50,200]);
grid on;%顯示網格線
axis on;%顯示坐標系
H=fspecial('sobel');%選擇sobel運算元
J=filter2(H,I1); %卷積運算
subplot(2,2,3),imshow(J);
title('sobel運算元銳化圖像');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on;%顯示坐標系
h=[0 1 0,1 -4 1,0 1 0]; %拉普拉斯運算元
J1=conv2(I1,h,'same');%卷積運算
subplot(2,2,4),imshow(J1);
title('拉普拉斯運算元銳化圖像');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
8.梯度運算元檢測邊緣
用 MATLAB實現如下:
I=imread('xian.bmp');
subplot(2,3,1);
imshow(I);
title('原始圖像');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
I1=im2bw(I);
subplot(2,3,2);
imshow(I1);
title('二值圖像');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
I2=edge(I1,'roberts');
figure;
subplot(2,3,3);
imshow(I2);
title('roberts運算元分割結果');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
I3=edge(I1,'sobel');
subplot(2,3,4);
imshow(I3);
title('sobel運算元分割結果');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
I4=edge(I1,'Prewitt');
subplot(2,3,5);
imshow(I4);
title('Prewitt運算元分割結果 ');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
9.LOG運算元檢測邊緣
用 MATLAB程序實現如下:
I=imread('xian.bmp');
subplot(2,2,1);
imshow(I);
title('原始圖像');
I1=rgb2gray(I);
subplot(2,2,2);
imshow(I1);
title('灰度圖像');
I2=edge(I1,'log');
subplot(2,2,3);
imshow(I2);
title('log運算元分割結果');
10.Canny運算元檢測邊 緣
用MATLAB程序實現如下:
I=imread('xian.bmp');
subplot(2,2,1);
imshow(I);
title('原始圖像')
I1=rgb2gray(I);
subplot(2,2,2);
imshow(I1);
title('灰度圖像');
I2=edge(I1,'canny');
subplot(2,2,3);
imshow(I2);
title('canny運算元分割結果');
11.邊界跟蹤 (bwtraceboundary函數)
clc
clear all
I=imread('xian.bmp');
figure
imshow(I);
title('原始圖像');
I1=rgb2gray(I); %將彩色圖像轉化灰度圖像
threshold=graythresh(I1); %計算將灰度圖像轉化為二值圖像所需的門限
BW=im2bw(I1, threshold); %將灰度圖像轉化為二值圖像
figure
imshow(BW);
title('二值圖像');
dim=size(BW);
col=round(dim(2)/2)-90; %計算起始點列坐標
row=find(BW(:,col),1); %計算起始點行坐標
connectivity=8;
num_points=180;
contour=bwtraceboundary(BW,[row,col],'N',connectivity,num_points);
%提取邊界
figure
imshow(I1);
hold on;
plot(contour(:,2),contour(:,1), 'g','LineWidth' ,2);
title('邊界跟蹤圖像');
12.Hough變換
I= imread('xian.bmp');
rotI=rgb2gray(I);
subplot(2,2,1);
imshow(rotI);
title('灰度圖像');
axis([50,250,50,200]);
grid on;
axis on;
BW=edge(rotI,'prewitt');
subplot(2,2,2);
imshow(BW);
title('prewitt運算元邊緣檢測 後圖像');
axis([50,250,50,200]);
grid on;
axis on;
[H,T,R]=hough(BW);
subplot(2,2,3);
imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit');
title('霍夫變換圖');
xlabel('\theta'),ylabel('\rho');
axis on , axis normal, hold on;
P=houghpeaks(H,5,'threshold',ceil(0.3*max(H(:))));
x=T(P(:,2));y=R(P(:,1));
plot(x,y,'s','color','white');
lines=houghlines(BW,T,R,P,'FillGap',5,'MinLength',7);
subplot(2,2,4);,imshow(rotI);
title('霍夫變換圖像檢測');
axis([50,250,50,200]);
grid on;
axis on;
hold on;
max_len=0;
for k=1:length(lines)
xy=[lines(k).point1;lines(k).point2];
plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');
plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');
len=norm(lines(k).point1-lines(k).point2);
if(len>max_len)
max_len=len;
xy_long=xy;
end
end
plot(xy_long(:,1),xy_long(:,2),'LineWidth',2,'Color','cyan');
13.直方圖閾值法
用 MATLAB實現直方圖閾值法:
I=imread('xian.bmp');
I1=rgb2gray(I);
figure;
subplot(2,2,1);
imshow(I1);
title(' 灰度圖像')
axis([50,250,50,200]);
grid on;%顯示網格線
axis on; %顯示坐標系
[m,n]=size(I1);%測量圖像尺寸參數
GP=zeros(1,256); %預創建存放灰度出現概率的向量
for k=0:255
GP(k+1)=length(find(I1==k))/(m*n);%計算每級灰度出現的概率,將其存入GP中相應位置
end
subplot(2,2,2),bar(0:255,GP,'g')%繪制直方圖
title('灰度直方圖')
xlabel('灰度值')
ylabel(' 出現概率')
I2=im2bw(I,150/255);
subplot(2,2,3),imshow(I2);
title('閾值150的分割圖像')
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
I3=im2bw(I,200/255); %
subplot(2,2,4),imshow(I3);
title('閾值200的分割圖像')
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
14. 自動閾值法:Otsu法
用MATLAB實現Otsu演算法:
clc
clear all
I=imread('xian.bmp');
subplot(1,2,1),imshow(I);
title('原始圖像')
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
level=graythresh(I); %確定灰度閾值
BW=im2bw(I,level);
subplot(1,2,2),imshow(BW);
title('Otsu 法閾值分割圖像')
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
15.膨脹操作
I=imread('xian.bmp'); %載入圖像
I1=rgb2gray(I);
subplot(1,2,1);
imshow(I1);
title('灰度圖像')
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
se=strel('disk',1); %生成圓形結構元素
I2=imdilate(I1,se); %用生成的結構元素對圖像進行膨脹
subplot(1,2,2);
imshow(I2);
title(' 膨脹後圖像');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
16.腐蝕操作
MATLAB 實現腐蝕操作
I=imread('xian.bmp'); %載入圖像
I1=rgb2gray(I);
subplot(1,2,1);
imshow(I1);
title('灰度圖像')
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
se=strel('disk',1); %生成圓形結構元素
I2=imerode(I1,se); %用生成的結構元素對圖像進行腐蝕
subplot(1,2,2);
imshow(I2);
title('腐蝕後圖像');
axis([50,250,50,200]);
grid on; %顯示網格線
axis on; %顯示坐標系
17.開啟和閉合操作
用 MATLAB實現開啟和閉合操作
I=imread('xian.bmp'); %載入圖像
subplot(2,2,1),imshow(I);
title('原始圖像');
axis([50,250,50,200]);
axis on; %顯示坐標系
I1=rgb2gray(I);
subplot(2,2,2),imshow(I1);
title('灰度圖像');
axis([50,250,50,200]);
axis on; %顯示坐標系
se=strel('disk',1); %採用半徑為1的圓作為結構元素
I2=imopen(I1,se); %開啟操作
I3=imclose(I1,se); %閉合操作
subplot(2,2,3),imshow(I2);
title('開啟運算後圖像');
axis([50,250,50,200]);
axis on; %顯示坐標系
subplot(2,2,4),imshow(I3);
title('閉合運算後圖像');
axis([50,250,50,200]);
axis on; %顯示坐標系
18.開啟和閉合組合操作
I=imread('xian.bmp');%載入圖像
subplot(3,2,1),imshow(I);
title('原始圖像');
axis([50,250,50,200]);
axis on;%顯示坐標系
I1=rgb2gray(I);
subplot(3,2,2),imshow(I1);
title('灰度圖像');
axis([50,250,50,200]);
axis on;%顯示坐標系
se=strel('disk',1);
I2=imopen(I1,se);%開啟操作
I3=imclose(I1,se);%閉合操作
subplot(3,2,3),imshow(I2);
title('開啟運算後圖像');
axis([50,250,50,200]);
axis on;%顯示坐標系
subplot(3,2,4),imshow(I3);
title('閉合運算後圖像');
axis([50,250,50,200]);
axis on;%顯示坐標系
se=strel('disk',1);
I4=imopen(I1,se);
I5=imclose(I4,se);
subplot(3,2,5),imshow(I5);%開—閉運算圖像
title('開—閉運算圖像');
axis([50,250,50,200]);
axis on;%顯示坐標系
I6=imclose(I1,se);
I7=imopen(I6,se);
subplot(3,2,6),imshow(I7);%閉—開運算圖像
title('閉—開運算圖像');
axis([50,250,50,200]);
axis on;%顯示坐標系
19.形態學邊界提取
利用 MATLAB實現如下:
I=imread('xian.bmp');%載入圖像
subplot(1,3,1),imshow(I);
title('原始圖像');
axis([50,250,50,200]);
grid on;%顯示網格線
axis on;%顯示坐標系
I1=im2bw(I);
subplot(1,3,2),imshow(I1);
title('二值化圖像');
axis([50,250,50,200]);
grid on;%顯示網格線
axis on;%顯示坐標系
I2=bwperim(I1); %獲取區域的周長
subplot(1,3,3),imshow(I2);
title('邊界周長的二值圖像');
axis([50,250,50,200]);
grid on;
axis on;
20.形態學骨架提取
利用MATLAB實現如下:
I=imread('xian.bmp');
subplot(2,2,1),imshow(I);
title('原始圖像');
axis([50,250,50,200]);
axis on;
I1=im2bw(I);
subplot(2,2,2),imshow(I1);
title('二值圖像');
axis([50,250,50,200]);
axis on;
I2=bwmorph(I1,'skel',1);
subplot(2,2,3),imshow(I2);
title('1次骨架提取');
axis([50,250,50,200]);
axis on;
I3=bwmorph(I1,'skel',2);
subplot(2,2,4),imshow(I3);
title('2次骨架提取');
axis([50,250,50,200]);
axis on;
21.直接提取四個頂點坐標
I = imread('xian.bmp');
I = I(:,:,1);
BW=im2bw(I);
figure
imshow(~BW)
[x,y]=getpts
平滑濾波
h=fspecial('average',9);
I_gray=imfilter(I_gray,h,'replicate');%平滑濾波
5. matlab中圖像旋轉
旋轉步驟:
一 matlab函數:B = imrotate(A,angle,method);A是原始圖像,angle是旋轉角度,B為旋轉後的圖像;
二 使用method參數可以改變插值演算法。 B = imrotate(A,angle,method,bbox)bbox參數用於指定輸出圖像屬性:'crop': 通過對旋轉後的圖像B進行裁剪, 保持旋轉後輸出圖像B的尺寸和輸入圖像A的尺寸一樣。{'loose'}: 使輸出圖像足夠大, 以保證源圖像旋轉後超出圖像尺寸范圍的像素值沒有丟失。 一般上這種格式產生的圖像的尺寸都要大於源圖像的尺寸。
6. 遺傳演算法實現數字水印用MATLAB,程序怎麼寫啊可以把我的積分都給了你
一、嵌入水印信息的MATLAB程序
首先讀入原始圖象並設置參數,然後嵌入水印信息,程序代碼如下:
clear
%
%讀入原圖象
trueImage=imread('C:\Documents and Settings\ks001\My Documents\My Pictures\lean.tif');
alfa=.1;
LENGTH=2500;
subplot(2,2,1);
imshow(trueImage);
title('原始圖象');
%
%對原圖象進行DCT變換
dctF1=dct2('C:\Documents and Settings\ks001\My Documents\My Pictures\lean.tif');
subplot(2,2,2);
imshow(log(abs(dctF1)),[ ]);
title('DCT cofficient matrix');
[m,n]=size(dctF1);
%
%產生水印序列並對其排序
radon('right',10);
watermark1=radon(LENGTH,1);
subplot(2,2,3);
title('watermark seqence')
[Y0,I0]=sort(watermark1);
%
%找出水印嵌入位置(幅值較大的n個頻域成分)
A=dctF1(:);
[Y1,I1]=sort(A);
x=m*n;
k=LENGTH;
M=zeros(x,1);
%
%修改幅值較大的n個頻域成分的幅值,嵌入水印(因為兩個問題不同,所以有兩個注釋符)
for i=1:x
if k>=1
M(x)=Y1(x)*(1+alfa*Y0(k));
k=k-1;
else
M(x)=Y1(x);
end
x=x-1;
end
N=zeros(x,1);
x=m*n;
for i=1:x
N(I1(i))=M(i);
end
a=1;
for j=1:n
for i=1:m
dctF2(i,j)=N(a);
a=a+1;
end
end
%
%DCT反變換,得到嵌入水印的圖象
idctF1=idct2(dctF2);
subplot(2,2,4);
imshow(idctF1,[ ]);
title('嵌入水印後的圖象');
end
二、提取恢復水印信息的MATLAB程序
水印提取過程是水印嵌入過程的逆過程,相對嵌入過程來說比較復雜,難度較大,下面是水印提取檢測的MATLAB程序代碼:
function watermark_detect(image,Y1,I0,waterMark1)
%image:嵌入水印的圖象
%Y1:原始圖象的序列排序
%I0:原始水印的序列排序
%waterMark1:原始水印序列
%
%對嵌入水印圖象進行DCT變化
dctW1=dct2(image);
%
%找出幅值較大的系數
B=dtW1(:);
[Y1,I2]=sort(B);
[m1,n1]=size(dctW1);
y=m1*n1;
k=length(waterMark1);
N0=zeros(k,1);
%
%提取水印序列
while k>=1
N0(k)=(Y2(y)-Y1(y))/alfa/Y1(y);
k=k-1;
y=y-1;
end
k=length(waterMark1);
waterMark2=zeros(k,1);
for i=1:k
waterMark2(I0(i))=N0(i);
end
%
%選取50個測試序列,其中第10個為提取出的水印
figure;
for i=1;50
if i==10;
waterMark=waterMark2;
else
waterMark=rand(k,1);
end
%計算各個序列與原來水印序列的相關值
c=waterMark'*waterMark1/sqrt(waterMark'*waterMark);
stem(i,c);
hold on;
end
%
三、接下來對嵌入水印的圖象進行不同的攻擊,用以測試水印的魯棒性。
程序的目的和程序代碼如下:
%
%攻擊實驗
disp('input you choice according to the following
image processing operation:');
disp('0--exit');
disp('1--smoothing patterns');
%添加噪音
disp('2--adding uniorm noise 添加噪音');
%濾波
disp('3--adding filter [10 10] 濾波');
%剪切
disp('4--cutting part of the image 剪切');
%壓縮
disp('5--10 quality JPEG compressing 壓縮');
%旋轉45度
disp('6--rotate 45 旋轉');
%
d=input('please input you choice(請輸入您的選擇):');
while d~=0
switch d
case 1
watermark_detect(idctF1,Y1,I0,waterMark1);
case 2
WImage2=idctF1;
noise0=10*rand(size(WImage2));
WImage2=WImage2+noise0;
figure;
imshow(WImage2,[ ]);
title('adding uniform noise 添加噪音');
watemark_detect(WImage2,Y1,I0,waterMark1);
case 3
WImage3=idctF1;
H=fspcial('gaussian高斯',[10,10],5);
WImage3=imfilter(WImage3,H);
figure;
imshow(WImage3,[ ]);
title(through filter [10,10] 濾波');
watemark_detect(WImage3,Y1,I0,waterMark1);
case 4
WImage4=idctF1; WImage4(1:128,1;128)=256;
figure;
imshow(WImage4);
title('cutting part of the image 剪切');
watemark_detect(WImage4,Y1,I0,waterMark1);
case 5
WImage5=idctF1;
WImage5=im2double(WImage5);
cnum=10;
dctm=dctmtx(8);
p1=dctm;
p2=dctm.';
imageDCT=blkproc(WImage5,[8,8],'p1*p2*x',dctm,dctm.');
DCTvar=im2col(imageDCT,[8,8],'distinct').';
n=size(DCTvar,1);
DCTvar=(sum(DCTvar.*DCTvar)-(sum(DCTvar)/n).^2)/n;
[m,order]=sort(DCTvar);
cnum=64-cnum;
mask=ones(8,8);
mask(order(1:cnum))=zeros(1,cnum);
im88=zeros(9,9);
im88(1:8,1:8)=mask;
im128128=kron(im88(1:8,1:8),ones(16));
dctm=dctmtx(8);
p1=dctm.';
p2=mask(1;8,1:8);
p3=dctm;
Wimage5=bikproc(imageDCT,[8,8],'p1*(x.8p2)*p3',dctm.',mask(1:8,1:8),dctm);
figure;
imshow(Wimage5);
title('JPEG Image 壓縮');
watemark_detect(WImage5,Y1,I0,waterMark1);
case 6 WImage6=idctF1;
WImage6=imrotate(WImage6,45,'bilinear','corp');
figure;
imshow(Wimage6);
title('rotate 45 旋轉');
watemark_detect(WImage6,Y1,I0,waterMark1);
case 0
break;
otherwise
error('you have a valid value(您的輸入錯誤)');
end
d=input('please input you choice(請輸入您的選擇):');
end
%結束