SlideShare a Scribd company logo
1 of 65
Download to read offline
โปรแกรม MATLAB
หน้าแรกของโปรแกรม MATLAB
เรื่อง Plot กราฟ
Label คือการแสดงคาสั่งป้ายชื่อ
Xlabel คือแสดงป้ายแกน x | Ylabel คือแสดงป้ายแกน y
เปลี่ยนสีของ plot
มีสีดังนี้ ได้แก่ เหลือง (y) แดง (r) เขียว (g) ฟ้า (b) ดา (k)
RGB triplet คือ แม่สีหลัก
[ 0 0 0 ]
RGB เป็น 0 หมดคือสีดา
[ 1 1 1 ]
RGB เป็น 1 คือสีขาว
ถ้าอยากทาให้เป็นสีชมพูต้องนาสีแดงผสมกับสีขาว จะได้ [0.2 1 1]
Code กราฟเป็นเส้นปะ
กราฟเป็นเส้นปะจุด
กราฟเป็นเครื่องหมาย + ตรงจุดตัด
จุดตัดเป็น o ตรงจุดตัด
สร้างกราฟหลายคู่อันดับ
การแสดงสัญลักษณ์กราฟ
การย้ายคาอธิบายสัญลักษณ์
การพลอทกราฟย่อย
การแยกกราฟออกเป็นกราฟย่อย ไม่ให้กราฟติดกัน
กราฟ 3 มิติ
การตั้งค่า setpath การกาหนด folder ย่อย
ให้คลิก Browse for folder เพื่อเรียก folder ที่จะใช้งานมาใช้
เปิดไฟล์ภาพ
การเรียกเปิดไฟล์เป็นรูปภาพ
เปิดภูเขา และให้สีเรียงกัน 8 สี เพื่อให้ดูภาพได้ง่ายขึ้น
คาสั่งเปิดภาพเพื่อดูร่องน้า
การแบ่งพื้นที่ลุ่มน้า
เรื่อง Image proaessive
ก่อนอื่นกด “ Browse for folder ” กาหนดเป้าหมาย โหลดภาพเข้าสู่ ‘ matlab ’
Imread ( im คือรูปภาพ read คืออ่าน ) การอ่านรูปภาพ
แล้วตามด้วยชื่อไฟล์รูปภาพ แต่ไม่ต้องปิด ; เพื่อจะให้โชว์ตัวเลข
คาสั่งโหลดไฟล์ภาพ
คาสั่งแสดงไฟล์ภาพ
คาสั่งทาให้ภาพสีกลายเป็นสีเทา
คาสั่งที่แสดงค่าช่วงคลื่นของภาพ (Histogram)
คาสั่งดูคุณสมบัติของไฟล์ภาพ
คาสั่งที่ทาให้ภาพเป็นสีดา-ขาว
การแสดงไฟล์ภาพที่ 2
การแสดงค่าช่วงคลื่นของภาพ
คาสั่งตัดแก้ไฟล์ภาพ
การแสดงค่าช่วงคลื่นของภาพหลังจากการตัดปรับภาพ
การทาให้ชุดตัวเลขกลายเป็นสี
การสร้างภาพ 3D
เซฟโค้ด
กด run แล้วใส่แว่น 3D ดูภาพ
โค้ดการทาภาพ 3D
I1 = rgb2gray(imread('pic1.jpg'));
I2 = rgb2gray(imread('pic2.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 with the 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 Stereo Images (Red - Left Image, Cyan - Right Image)');
cvexRectifyImages('lions_left.jpg', 'lion_right.jpg');
เรื่อง guide
พิมพ์ว่า guideแล้วเลือก Bank กด OK ภาพก็จะขึ้นตามภาพข้างล่าง
กด OK
กด Puch Button เพื่อสร้างปุ่มคาสั่ง
กด axes เป็นการแสดงชื่องของเฟรม
การเปลี่ยนชื่อปุ่ม คลิก Puch Button 2 ครั้ง
นางสาว สุมิตรา ประสมวงค์ กลุ่ม 01 58170020
สุมิตรา

More Related Content

More from Firstii Romeo

58170007 01 ชนาภา-คงเมือง
58170007 01 ชนาภา-คงเมือง58170007 01 ชนาภา-คงเมือง
58170007 01 ชนาภา-คงเมืองFirstii Romeo
 
ปิยวรรณ
ปิยวรรณปิยวรรณ
ปิยวรรณFirstii Romeo
 
สุภารัตน์
สุภารัตน์สุภารัตน์
สุภารัตน์Firstii Romeo
 
โครงการในพระราชดำริไบโอดีเซล
โครงการในพระราชดำริไบโอดีเซลโครงการในพระราชดำริไบโอดีเซล
โครงการในพระราชดำริไบโอดีเซลFirstii Romeo
 
ไบโอดีเซล
ไบโอดีเซลไบโอดีเซล
ไบโอดีเซลFirstii Romeo
 

More from Firstii Romeo (7)

58170007 01 ชนาภา-คงเมือง
58170007 01 ชนาภา-คงเมือง58170007 01 ชนาภา-คงเมือง
58170007 01 ชนาภา-คงเมือง
 
ปิยวรรณ
ปิยวรรณปิยวรรณ
ปิยวรรณ
 
สุภารัตน์
สุภารัตน์สุภารัตน์
สุภารัตน์
 
58170131 01
58170131 0158170131 01
58170131 01
 
58170110 01
58170110 0158170110 01
58170110 01
 
โครงการในพระราชดำริไบโอดีเซล
โครงการในพระราชดำริไบโอดีเซลโครงการในพระราชดำริไบโอดีเซล
โครงการในพระราชดำริไบโอดีเซล
 
ไบโอดีเซล
ไบโอดีเซลไบโอดีเซล
ไบโอดีเซล
 

สุมิตรา