SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
MATLAB
เริมต้นการใช้matlab *ถ้าต้องการลบข้อมูลให้พิมพ์คําว่าclc แล้วกด Enter
การทําแถวและคอลัมน์ แถว จะใช้การ เว้นวรรค และ,
คอลัมน์ จะใช้; เซมิโคลอน เช่น x = [ ]; การใส่ ; เป็นการยับยังไม่ให้ แสดงผล
วิธีลัด การทําตัวเลขโดยไม่ต้องพิมพ์จํานวนทังหมด โดยใช้คําสัง: โคลอน หมายถึง ถึง เช่น : 20
การใส่ ( ) เช่น x (5) ค่า ลัพธ์ที
การทํากราฟ โดย ใช้คําสัง plot(x) plot(x, '--bs') กราฟเส้นจุดไข่ปลา
plot(x, 'b--o') กราฟเป็นรูปวงกลม ตัว b คือ สีเส้นของกราฟ
คําสัง Guide
การออกแบบเครืองคิดเลข โดยการออกแบบจากคําสังGuide
เมือออกแบบ เสร็จแล้ว จะใส่ค่าลงไปในปุ่มตัวเลข โดยแก้
str=get(handles.input,'String');
str=strcat(str,'7');
set(handles.input,'String',str);
เขียนโค้ด นี ตังแต่ –
ทําการใส่โค้ดลงไป โดย คลิกขวาทีตัวเลข ไปที View Callbacks > CerateFcn
str=get(handles.input,'String');
str=strcat(str,'7');
set(handles.input,'String',str);
คําสังเรียกภาพ imread(‘……’)
ตามด้วย
>> I = imread (' .jpg') ประกาศ ชือตัวแปร I
>> whos I
699840 uint8 u=unsun = ไม่มีเครืองหมาย , int=intiger
คําสังเรียกรูปภาพfigure,imshow(I) figure คือ พืนหลังภาพ imshow โชว์ภาพ (I) ทีอยู่ของภาพ
เรียกภาพสี ให้เป็นสีเทา ดํา ด้วยคําสัง>> figure,imshow(gray)
คําสังแปรรูปภาพ ให้เป็นกราฟ >> figure,imhist(gray)
ตารางเมตริกซ์ เช่น x = [ ; ; ; ];
>> image (x)
คําสังเรียกกล้อง imaqtool
การทําภาพ3 มิติ
พิมพ์คําสัง โดยไปที NewScript คําสัง ให้แก้โค้ด%read image and transform gray
แล้วลบ ใส่โค้ดนีลงไป จะได้เป็นภาพ3 มิติ
I1 = rgb2gray(imread('left1.jpg'));
I2 = rgb2gray(imread('right2.jpg'));
imshowpair(I1, I2,'montage');
title('I1 (left);I2 (right)');
figure;
imshowpair(I1,I2,'ColorChannels','red-cyan');
title('Composite Image (Red - Left Image, Cyan- Right Image)');
blobs1 = detectSURFFeatures(I1, 'MetricThreshold', 2000);
blobs2 = detectSURFFeatures(I2, 'MetricThreshold', 2000);
figure;
imshow(I1);
hold on;
plot(selectStrongest(blobs1, 30));
title('Thirty strongest SURF features in I1');
figure;
imshow(I2);
hold on;
plot(selectStrongest(blobs2, 30));
title('Thirty strongest SURF features in I2');
[features1, validBlobs1] = extractFeatures(I1, blobs1);
[features2, validBlobs2] = extractFeatures(I2, blobs2);
indexPairs = matchFeatures(features1, features2, 'Metric','SAD', ...
'MatchThreshold', 5);
matchedPoints1 = validBlobs1(indexPairs(:,1),:);
matchedPoints2 = validBlobs2(indexPairs(:,2),:);
figure;
showMatchedFeatures(I1, I2, matchedPoints1, matchedPoints2);
legend('Putatively matched points in I1', 'Putatively matched points in I2');
[fMatrix, epipolarInliers, status] = estimateFundamentalMatrix(...
matchedPoints1, matchedPoints2, 'Method', 'RANSAC',...
'NumTrials', 10000, 'DistanceThreshold', 0.1, 'Confidence', 99.99);
if status ~= 0 || isEpipoleInImage(fMatrix, size(I1)) ...
|| isEpipoleInImage(fMatrix', size(I2))
error(['Either not enough matching points were found or '...
'the epipoles are inside the images. You may need to'...
'inspect and improve the quality of detected features',...
'and/or improve the quality of your images.']);
end
inlierPoints1 = matchedPoints1(epipolarInliers, :);
inlierPoints2 = matchedPoints2(epipolarInliers, :);
figure;
showMatchedFeatures(I1, I2, inlierPoints1, inlierPoints2);
legend('Inlier points in I1', 'Inlier points in I2');
[t1, t2] = estimateUncalibratedRectification(fMatrix, ...
inlierPoints1.Location, inlierPoints2.Location, size(I2));
tform1 = projective2d(t1);
tform2 = projective2d(t2);
I1Rect = imwarp(I1, tform1, 'OutputView', imref2d(size(I1)));
I2Rect = imwarp(I2, tform2, 'OutputView', imref2d(size(I2)));
% transform the points to visualize them together withthe rectified images
pts1Rect = transformPointsForward(tform1, inlierPoints1.Location);
pts2Rect = transformPointsForward(tform2, inlierPoints2.Location);
figure;
showMatchedFeatures(I1Rect,I2Rect, pts1Rect, pts2Rect);
legend('Inlier points in rectified I1', 'Inlier points in rectified I2');
Irectified = cvexTransformImagePair(I1, tform1, I2, tform2);
figure;
imshow(Irectified);
title('Rectified StereoImages(Red - Left Image, Cyan - Right Image)');
cvexRectifyImages('left.jpg', 'right.jpg');
การผสมสี การเรียกสีจากภาพขาวดํา เป็นภาพสี
Matlab
Matlab

Mais conteúdo relacionado

Mais procurados

หลัการเบื้องต้นการเขียนโปรแกรมVB6.0
หลัการเบื้องต้นการเขียนโปรแกรมVB6.0หลัการเบื้องต้นการเขียนโปรแกรมVB6.0
หลัการเบื้องต้นการเขียนโปรแกรมVB6.0
sup11
 
ฟังก์ชันค่าสัมบูรณ์
ฟังก์ชันค่าสัมบูรณ์ฟังก์ชันค่าสัมบูรณ์
ฟังก์ชันค่าสัมบูรณ์
guest7695029
 
เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์
guestdd0343
 
เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์
guestbcc425
 
เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์
guest7695029
 
กลุ่ม 4 การเขียนคำสั่งควบคุมแบบวนซ้ำ
กลุ่ม 4 การเขียนคำสั่งควบคุมแบบวนซ้ำกลุ่ม 4 การเขียนคำสั่งควบคุมแบบวนซ้ำ
กลุ่ม 4 การเขียนคำสั่งควบคุมแบบวนซ้ำ
Sarocha Makranit
 

Mais procurados (18)

ฟังก์ชันเอกโพแนนเชียล
ฟังก์ชันเอกโพแนนเชียลฟังก์ชันเอกโพแนนเชียล
ฟังก์ชันเอกโพแนนเชียล
 
Learn 4
Learn 4Learn 4
Learn 4
 
linear function
linear functionlinear function
linear function
 
Matlab2
Matlab2Matlab2
Matlab2
 
หลัการเบื้องต้นการเขียนโปรแกรมVB6.0
หลัการเบื้องต้นการเขียนโปรแกรมVB6.0หลัการเบื้องต้นการเขียนโปรแกรมVB6.0
หลัการเบื้องต้นการเขียนโปรแกรมVB6.0
 
ฟังก์ชันค่าสัมบูรณ์
ฟังก์ชันค่าสัมบูรณ์ฟังก์ชันค่าสัมบูรณ์
ฟังก์ชันค่าสัมบูรณ์
 
Week4-1
Week4-1Week4-1
Week4-1
 
เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์
 
Ass3 2
Ass3 2Ass3 2
Ass3 2
 
บทที่ 3
บทที่ 3บทที่ 3
บทที่ 3
 
ปิยวรรณ
ปิยวรรณปิยวรรณ
ปิยวรรณ
 
นายณัฐนนท์ คำเกตุ 58670310
นายณัฐนนท์ คำเกตุ 58670310นายณัฐนนท์ คำเกตุ 58670310
นายณัฐนนท์ คำเกตุ 58670310
 
7
77
7
 
Week4-1
Week4-1Week4-1
Week4-1
 
เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์
 
06 for loops
06 for loops06 for loops
06 for loops
 
เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์เรื่องฟังก์ชันค่าสัมบูรณ์
เรื่องฟังก์ชันค่าสัมบูรณ์
 
กลุ่ม 4 การเขียนคำสั่งควบคุมแบบวนซ้ำ
กลุ่ม 4 การเขียนคำสั่งควบคุมแบบวนซ้ำกลุ่ม 4 การเขียนคำสั่งควบคุมแบบวนซ้ำ
กลุ่ม 4 การเขียนคำสั่งควบคุมแบบวนซ้ำ
 

Semelhante a Matlab (15)

58170110 01
58170110 0158170110 01
58170110 01
 
น.ส.ลลิตภัทร สงวนผิว 58670381 กลุ่ม3302
น.ส.ลลิตภัทร สงวนผิว 58670381 กลุ่ม3302น.ส.ลลิตภัทร สงวนผิว 58670381 กลุ่ม3302
น.ส.ลลิตภัทร สงวนผิว 58670381 กลุ่ม3302
 
09 multi arrays
09 multi arrays09 multi arrays
09 multi arrays
 
Matlap
MatlapMatlap
Matlap
 
2
22
2
 
Matlab นางสาว-สุนิษา-คงงาม-58670054
Matlab นางสาว-สุนิษา-คงงาม-58670054Matlab นางสาว-สุนิษา-คงงาม-58670054
Matlab นางสาว-สุนิษา-คงงาม-58670054
 
Ch2
Ch2Ch2
Ch2
 
นายสมรัก สุขโศตร์ 58670153 กลุ่ม3302
นายสมรัก สุขโศตร์ 58670153 กลุ่ม3302นายสมรัก สุขโศตร์ 58670153 กลุ่ม3302
นายสมรัก สุขโศตร์ 58670153 กลุ่ม3302
 
58170038
5817003858170038
58170038
 
Matlab 58670396-บรีม
Matlab 58670396-บรีมMatlab 58670396-บรีม
Matlab 58670396-บรีม
 
C lang
C langC lang
C lang
 
Matlab 58170042 (1)
Matlab 58170042 (1)Matlab 58170042 (1)
Matlab 58170042 (1)
 
บทที่ 5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1
บทที่  5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1บทที่  5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1
บทที่ 5 ข้อมูลชนิดอาร์เรย์และสตริง 6.1
 
Computer programming
Computer  programmingComputer  programming
Computer programming
 
Computer programming
Computer programmingComputer programming
Computer programming
 

Matlab