โดย นายเกิบโบก แห่ง 01 Sony Vegas · คู่มือการใช้โปรแกรม Sony Vegas V. 7.0 ... 1.เปิดโปรแกรม
ภาคผนวก -...
Transcript of ภาคผนวก -...
![Page 1: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/1.jpg)
ภาคผนวก
![Page 2: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/2.jpg)
52
ภาคผนวก ก
คู่มือการใช้โปรแกรมการตรวจสอบช้ินงาน
![Page 3: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/3.jpg)
53
การเปิดใช้โปรแกรมตรวจสอบชิ้นงาน
1. เปิดโปรแกรม MATLAB
ภาพที ่ก.1 หน้าต่างของโปรแกรมแมทแลบ
2. เลือกที่ OPEN เพ่ือเรียกโค้ดท่ีเขียนไว้ขึ้นมาใช้
![Page 4: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/4.jpg)
54
ภาพที ่ก.2 หน้าต่างในการเปิดไฟล์
3. เมื่อเปิดไฟล์จะได้หน้าต่างโค้ดข้ึนมา
ภาพที ่ก.3 หน้าต่างเมื่อเปิดไฟล์ขึ้นมา
4. เปิดที่หน้าต่าง MATLAB แล้วเลือกที่อยู่ไฟล์ภาพที่ต้องการตรวจสอบ
![Page 5: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/5.jpg)
55
ภาพที ่ก.4 การเลือกที่อยู่ภาพบนหน้าต่างแมทแลบ
5. กดปุ่ม RUN ที่หน้าต่างโค้ด แล้วเลือก Add to Path รอจนกว่าโปรแกรมจะท างานเสร็จ
ภาพที ่ก.5 หน้าต่างเมื่อกดปุ่ม (RUN)
![Page 6: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/6.jpg)
56
6. เมื่อโปรแกรมท างานเสร็จ ข้อมูลจะถูกบันทึกไว้ที่ Folder ที่ต าแหน่งของไฟล์ภาพ โดยเป็นไฟล์ ชื่อ Data
ภาพที ่ก.6 ไฟล์ข้อมูลที่บันทึกไว้
![Page 7: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/7.jpg)
56
ภาคผนวก ข ตัวอย่างโค้ดโปรแกรมการตรวจสอบชิ้นงาน
![Page 8: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/8.jpg)
57
ตัวอย่างโค้ดโปรแกรมการตรวจสอบชิ้นงาน
datdir = dir('*.bmp'); numfiles = length(datdir); if numfiles <= 0 disp('No File *.BMP'); else for fil = 1:numfiles fname = datdir(fil).name; Raw = imread(fname); [ht,wd] =size(Raw); for r = 1:ht, for c = 1:wd, Raw(r,c) = Raw(r,c)+(0.2*Raw(r,c)); end end figure(100);imshow(Raw);title(fname);impixelinfo polecode = 0; corecode = 0; polel=('Pass'); Error = ('Pole Good'); error = ('Core Good'); TW2 = 0; CH = 0; CB = 0; PNO = 0;
![Page 9: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/9.jpg)
58
Core = sum(Raw(430:670,1:wd),2)/wd; Coreh = medfilt1(Core, 5); Corehmax = max(Coreh); Corehmin = min(Coreh); Coreheight = Corehmax - ((Corehmax-Corehmin)/3); CORE = find(Coreh >= Coreheight ); COREH = min(CORE)+430; COREh = max(CORE)+430; corehight = COREh -COREH; if corehight < 80 COREH = COREh - 120; corehight = COREh -COREH; end CORESUM = sum(CORE); if CORESUM > 0 figure(100); hold on; line([1 wd], [COREH COREH], 'Color', [0 0 1], 'LineStyle', ':'); line([1 wd], [COREh COREh], 'Color', [0 0 1], 'LineStyle', ':'); hold off end CH = corehight; CoreB = sum(Raw(COREH:COREh , :))/(COREh-COREH-9); CoreBo = medfilt1(CoreB, 5); CoreBmax = max(CoreBo); CoreBmin = min(CoreBo); Corebot = CoreBmax -((CoreBmax-CoreBmin)/2); COREB = find(CoreBo >= Corebot); COREBMAX = max(COREB); COREBMIN = min(COREB); corebottom = COREBMAX - COREBMIN;
![Page 10: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/10.jpg)
59
if COREBMAX > (wd-1) COREBMAX = wd; corebottom = COREBMAX - COREBMIN; end if COREBMIN < 2 COREBMIN = 1; corebottom = COREBMAX - COREBMIN; end SUMCOREB = sum(COREB); if SUMCOREB > 0 figure(100); hold on; line([COREBMAX COREBMAX], [COREH COREh], 'Color', [1 0 0], 'LineStyle', ':'); line([COREBMIN COREBMIN], [COREH COREh], 'Color', [1 0 0], 'LineStyle', ':'); hold off end CB = corebottom; pole = sum(Raw(1:(ht/3), :))/(ht/3); poleo = medfilt1(pole, 5); POLEMAXX = max(poleo) ; polemin = min(poleo); polew = POLEMAXX - (POLEMAXX-polemin)/2.5; POLE = find(poleo >= polew); poleL = min(POLE); poleR = max(POLE); polewidth = poleR - poleL; if poleL < 2 poleL =1; polewidth = poleR - poleL; end
![Page 11: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/11.jpg)
60
if poleR >(wd-1) poleR = wd; polewidth = poleR - poleL; end TW2 = polewidth; SUMPOLE = sum(POLE); if SUMPOLE > 0 figure(100); hold on; line([poleL poleL], [1 COREH], 'Color', [0 1 0], 'LineStyle', ':'); line([poleR poleR], [1 COREH], 'Color', [0 1 0], 'LineStyle', ':'); hold off end Ep1 = sum(Raw(COREH - 80:COREH - 50,poleL:poleR),2)/TW2; epmax = max(Ep1); epmin = min(Ep1); xep = epmax - (epmax - epmin)/2; EP = find(Ep1 <= xep); nft = max(EP)+ COREH-80; twmax = sum(Raw(295:nft-10,poleL:poleR),2)/TW2; tmax = max(twmax); tmin = min(twmax); xt = tmax - (tmax-tmin)/2; tf = find(twmax >= xt); TWmax = max(tf)+295; figure(100); hold on; line([poleL poleR], [nft nft], 'Color', [0 1 0], 'LineStyle', ':'); line([poleL poleR], [TWmax TWmax], 'Color', [1 0 0], 'LineStyle', ':'); hold off
![Page 12: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/12.jpg)
61
PNO = nft - TWmax; tw = sum(Raw(TWmax-40:TWmax,poleL:poleR))/41; twmax = max(tw); twmin = min(tw); tx = twmax -(twmax-twmin)/2; ft = find(tw >= tx); tWmax = max(ft)+poleL; tWmin = min(ft)+poleL; figure(100); hold on; line([tWmax tWmax], [1 COREH], 'Color', [0 0 1], 'LineStyle', ':'); line([tWmin tWmin], [1 COREH], 'Color', [0 0 1], 'LineStyle', ':'); hold off TW1 = tWmax - tWmin; th = graythresh(Raw); th = th -(th/10); Gray = im2bw(Raw,th); x = TWmax - 25; TX = 0; while TX <= (TW2 - 30) x = x-1; xx = Gray(x:x,poleL:poleR); xz = find(xx == 1); ss = sum(xz); if ss > 1 L = min(xz)+poleL; R = max(xz)+poleL; TX = R-L; else L=0;
![Page 13: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/13.jpg)
62
R=0; end ep1max = x; end figure(100); hold on; line([poleL poleR], [ep1max ep1max], 'Color', [1 0 0], 'LineStyle', ':'); hold off GRAY = ~Gray; POLE = sum(sum(GRAY(1:ep1max-10,poleL+15:poleR-15))); POLE1 = sum(sum(GRAY(ep1max:TWmax-10,tWmin+5:tWmax-5))); if POLE >= 500 || POLE1 >= 500 Error = ('Pole Corrosion'); polel=('Fail'); polecode = 1; end CORE = sum(sum(GRAY(COREH+5:COREh-5,COREBMIN+15:COREBMAX-15))); if CORE >= 500 error = ('Core Corrosion'); polel=('Fail'); corecode = 1; end figure(100);hold on text(15, 15, fname, 'Color', [1 1 0]); pnomsg = sprintf('TW2=%d(nm),PNO=%d', TW2, PNO); text(15, 45, pnomsg, 'Color', [1 1 0],'FontSize',10); plmsg = sprintf('CW=%d(nm),CH=%d(nm)',CB, CH); text(15, 75, plmsg, 'Color', [1 1 0],'FontSize',10);
![Page 14: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/14.jpg)
63
if corecode == 1 text(700, 35, error, 'Color', [1 0 0],'FontSize',14); else text(700, 35, error, 'Color', [0 1 0],'FontSize',14); end if polecode == 1 text(700, 95, Error, 'Color', [1 0 0],'FontSize',14); else text(700, 95, Error, 'Color', [0 1 0],'FontSize',14); end hold off if fil < 2 fid = fopen('Data.txt','w'); fprintf(fid,'%s\r\n','SERIAL CB CH TW2 PNO Corrosion'); end if fil > 0 fprintf(fid,'%s %d %d %d %d %s\r\n',fname(1:length(fname)-4),CB,CH,TW2,PNO,polel); end figure(100); fr1 = getframe; % ------- Save image (Pitiphong A.) -------------- % ImageAdds = [pwd '\Image\']; if ~exist(ImageAdds) status = mkdir(ImageAdds); if ~status ImageAdds = pwd; end
![Page 15: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/15.jpg)
64
end PicAdds = [ImageAdds '\' fname(1:length(fname)-4) '.jpg']; imwrite(fr1.cdata,PicAdds); end end close all;
![Page 16: ภาคผนวก - PSRUrdi/files/res_che2553/resche_files/584_Appendix.pdfการเปิดใช้โปรแกรมตรวจสอบชิ้นงาน 1. เปิดโปรแกรม](https://reader034.fdocuments.net/reader034/viewer/2022051915/6007242ffe2d385f6d5d4664/html5/thumbnails/16.jpg)
64
ภาคผนวก ค
เอกสารตีพิมพ์