Cov txheej txheem:

Eyeballing Koj Cov Ntawv Muag Qhov Muag: qhov BME60B Project: 9 Kauj Ruam
Eyeballing Koj Cov Ntawv Muag Qhov Muag: qhov BME60B Project: 9 Kauj Ruam

Video: Eyeballing Koj Cov Ntawv Muag Qhov Muag: qhov BME60B Project: 9 Kauj Ruam

Video: Eyeballing Koj Cov Ntawv Muag Qhov Muag: qhov BME60B Project: 9 Kauj Ruam
Video: Vwm Rau Koj Cover by MyShoua ft. Deeda - Dib Xwb 2024, Hlis ntuj nqeg
Anonim
Eyeballing Koj Cov Ntawv Muag Qhov Muag: qhov BME60B Project
Eyeballing Koj Cov Ntawv Muag Qhov Muag: qhov BME60B Project

Los ntawm: Hannah Silos, Sang Hee Kim, Thomas Vazquez, Patrick Viste

Kev nthuav dav yog ib qho ntawm cov yam ntxwv tseem ceeb tam sim no rau tsom iav nyeem ntawv, uas tau cais los ntawm lawv daim ntawv tshuaj diopters. Raws li Michigan Technology University, lub diopter yog qhov ntev ntawm lub lens, feem ntau ntsuas hauv mm, hauv chav ntsuas (Michigan Technology University). Vim tias tsom iav nyeem ntawv muaj cov iav lo ntsiab muag, qhov ntev focal yuav zoo, ua rau cov diopters ua tau zoo ib yam (HyperPhysics). Qhov ntev focal nce ntxiv raws li qhov nrug nruab nrab ntawm qhov khoom tau txais deb dua ntawm lub lens tiag tiag, thiab qhov no ua rau cov diopters kom txo qis vim tias lawv sib piv sib piv. Yog li ntawd, kev nyeem cov tsom iav nrog cov diopters ntxiv yuav pab lub lens kom pom qhov pom kom nws zoo li qhov focal ntev tsawg dua los ntawm kev nce tus nqi ntawm diopters.

Cov cai uas tau nthuav tawm yuav raug siv los kwv yees lub diopter ntawm lub lens uas tsis muaj daim ntawv yuav tshuaj. Ob lub tswv yim tau siv los xam cov tshuaj: ib daim duab ntawm cov keeb kwm yav dhau los uas tsis siv lub iav, thiab lwm daim duab ntawm tib lub keeb kwm yav dhau tab sis dhau los ntawm lub lens xaiv. Qhov kev zov me nyuam yuav ntsuas qhov sib txawv ntawm ob daim duab no. Los ntawm qhov ntawd, peb yuav tuaj yeem kwv yees lub lens 'diopter thiab tsim cov txiaj ntsig rau tus neeg siv saib.

Rau Cov Lus Qhia no, koj yuav xav tau:

  • Daim kab xev dub-thiab-dawb qauv sau rau ntawm 11x8.5 hauv daim ntawv ntawv
  • Lub koob yees duab nrog lub peev xwm los xauv nws qhov ua kom pom tseeb
  • Lub koob yees duab, lossis qee yam zoo sib xws kom ruaj ntseg lub koob yees duab
  • Ntau yam ntawv sau tshuaj tsom iav nyeem ntawv
  • MATLAB

Kauj Ruam 1: Siv Duab

Coj Duab
Coj Duab
Coj Duab
Coj Duab
Coj Duab
Coj Duab

Txhawm rau xam qhov loj ntawm lub lens, koj yuav tsum muaj peev xwm sib piv nws rau qhov loj me ntawm qhov khoom. Txog qhov haujlwm no, peb yuav muab piv rau cov duab loj loj rau cov duab tswj.

Yog li, thawj qib yog coj ob daim duab ntawm tib daim duab - thawj zaug tsuas yog siv lub koob yees duab, thiab thib ob los ntawm lub lens ntawm lub tsom iav nyeem ntawv koj xav sim.

Koj yuav tau siv daim duab ntawm 8.5x11in dub thiab dawb checkerboard nrog 1in daim phiaj. Teem koj lub koob yees duab 11in ntawm lub checkerboard. Ua ntej yuav thaij duab, xauv qhov ua kom pom tseeb ntawm daim checkerboard.

Nqa daim duab ntawm lub checkerboard yam tsis muaj tsom iav nyeem ntawv. Tom qab ntawd, yam tsis txav ib yam dab tsi, tso lub tsom iav nyeem ntawv tso rau ntawm xub ntiag lub koob yees duab thiab thaij duab thib ob.

Nco ntsoov tias txoj haujlwm ntawm koj lub koob yees duab tsis txav ntawm kev txhaj tshuaj. Tib yam uas yuav tsum tau hloov ntawm ob daim duab yog qhov muaj lub iav tsom iav nyob rau ntawm xub ntiag ntawm lub koob yees duab.

Thaum koj ua tiav cov duab, upload lawv rau hauv koj lub computer.

Kauj ruam 2: Thauj cov Duab rau hauv MATLAB

Thauj cov Duab rau hauv MATLAB
Thauj cov Duab rau hauv MATLAB

Qhib tsab ntawv tshiab.

Ua ntej tshaj, qhia cov npe uas cov duab khaws cia. Tom qab ntawd, siv lub luag haujlwm dir txhawm rau rho tawm cov duab-j.webp

Dir = 'C: / Users / kuras / Desktop / classes / SQ2 / BME60b / Sandbox / testphotos'; GetDir = dir ('*. Jpg');

Txog peb txoj haujlwm, peb xav kom sai rau tus neeg siv ntawm qhov program uas cov ntaub ntawv lawv xav sib piv. Thawj ntu nug tus neeg siv kom qhia meej cov duab tswj, thiab ntu ob nug tus neeg siv kom qhia meej cov duab ntsuas.

  • %Nug tus neeg siv cov ntawv twg yog cov duab tswj.
  • Tswj = tswv yim ('# ntawm cov duab tswj. / N');
  • ControlFile = [GetDir (Tswj).name]
  • %Nug tus neeg siv cov ntawv twg yog cov duab uas lawv xav tshuaj xyuas.
  • ChooseFile = input ('\ n# ntawm daim duab koj xav tshuaj xyuas. / N');
  • PrescripFile = [GetDir (ChooseFile).name];

Kauj Ruam 3: Txheeb Xyuas Duab

Kev Txheeb Xyuas Duab
Kev Txheeb Xyuas Duab
Kev Txheeb Xyuas Duab
Kev Txheeb Xyuas Duab

Cov duab xim hauv MATLAB yog qhov loj me me MxNx3, hos cov duab grayscale yog MxN. Qhov no txhais tau tias nws nrawm dua los txhim kho/kho cov duab grayscale vim tias tsis muaj cov ntaub ntawv khaws tseg. (Kev ua haujlwm tsis zoo tau siv vim tias peb cov duab tuaj nyob rau hauv kab rov tav - kab kab ntawv no yuav lossis tsis tsim nyog hauv koj li.)

  • %hloov mus rau grayscale thiab tig
  • Kuv = nyeem (ControlFile);
  • Kuv = rgb2gray (kuv);
  • Kuv = imrotate (kuv, 90);

Tom ntej no, tso saib daim duab. Subplot muaj nuj nqi tau siv kom cov duab ntsuas yuav tuaj yeem nyob ze rau kev tswj hwm hauv cov kauj ruam tom ntej.

  • %tso saib
  • daim duab (1);
  • subplot (1, 2, 1)
  • imshow (kuv);
  • npe (ControlFile);

Siv imcrop kom sai rau tus neeg siv kom txiav cov checkerboard tawm ntawm daim duab tag nrho. Cov cai hauv qab no tseem qhia lub thawv ntawv kom muab cov lus qhia rau tus neeg siv.

  • %qoob loo tawm checkerboard rau kev tshuaj xyuas
  • tos rau (msgbox ({'Siv tus ntoo khaub lig plaub mos mos los txiav tawm ntawm lub checkerboard.', 'Tom qab ntawd ob npaug nyem rau thaj tsam ntawm kev txaus siab.'}));
  • I_crop = imcrop (kuv);

Siv imbinarize los binarize cov duab.

I_binary = imbinarize (I_crop);

Kauj Ruam 4: Xam Dav Dav ntawm Cov Squares Dawb ntawm Daim Ntawv Teev Npe

Xam qhov Dav Dav ntawm Cov Squares Dawb ntawm Daim Ntawv Teev Npe
Xam qhov Dav Dav ntawm Cov Squares Dawb ntawm Daim Ntawv Teev Npe
Xam qhov Dav Dav ntawm Cov Squares Dawb ntawm Daim Ntawv Teev Npe
Xam qhov Dav Dav ntawm Cov Squares Dawb ntawm Daim Ntawv Teev Npe
Xam qhov Dav Dav ntawm Cov Squares Dawb ntawm Daim Ntawv Teev Npe
Xam qhov Dav Dav ntawm Cov Squares Dawb ntawm Daim Ntawv Teev Npe

Tom ntej no, hais kom tus neeg siv kos kab hla cov duab siv imline. Kab no yuav tsum khiav hla kab hla ntawm daim tshev kos. Nws yuav tsum pib thiab xaus rau ntawm lub xwmfab dub (nws tsis muaj teeb meem qhov twg)- qhov no yog vim peb yuav ntsuas qhov dav ntawm cov xwmfab dawb, tsis yog cov dub.

  • %kos kab
  • daim duab (1)
  • subplot (1, 2, 1)
  • imshow (I_binary);
  • tos rau (msgbox ({'Nyem thiab rub kom kos kab hla 9 lub thawv, los ntawm qhov chaw dub mus rau qhov chaw dub.', 'Ob npaug nias rau kom paub meej.'}));
  • kab = imline;
  • position = tos (kab);
  • endpoints = line.getPosition;

Tshem tawm X thiab Y coodinates rau qhov kawg ntawm kab kos.

  • X = endpoints (:, 1)
  • Y = endpoints (:, 2);

Siv qhov tsis tsim nyog los tsim kab ntawv raws qhov sib zog pom nyob ntawm kab kab kos. Qhov no yuav tsum zoo li lub xwmfab yoj ntawm 0 (dub) txog 1 (dawb). Xam qhov peaks thiab lawv qhov chaw ib yam nkaus.

  • daim duab (2)
  • subplot (1, 2, 1)
  • title ('Kev siv duab hla txoj kab tsis tsim nyog (Tswj)')
  • improfile (I_binary, X, Y); daim phiaj rau;
  • [~, ~, c1, ~, ~] = improfile (I_binary, X, Y);
  • [peaks, loc] = findpeaks (c1 (:,:, 1));
  • tuav
  • plot (loc, ncov, 'ro');
  • tuav tseg

Nrhiav qhov ntev ntawm txhua lub toj siab ntawm kab ntawv tsis siv neeg siv lub voj. Khiav lub voj rau tib qhov nyiaj ntawm qhov siab tshaj plaws muaj nyob hauv kab ntawv tsis tsim nyog. Txhawm rau xam qhov ntev ntawm txhua lub toj siab, siv 'nrhiav' ua haujlwm txhawm rau nrhiav txhua qhov chaw uas muaj '1' hloov qhov "0" tus nqi siv zog. Tom qab ntawd, xam qhov ntev ntawm cov kab ntawd kom tau txais tag nrho qhov ntev ntawm toj siab, uas yuav tsum sib npaug qhov dav ntawm lub xwmfab dawb hauv pixels. ControlPlateauList = zeros (1, ntev (loc));

rau kuv = 1: ntev (qhov chaw)

yog tias kuv == ntev (loc)

toj siab = nrhiav (c1 (loc (i): kawg,:, 1));

lwm tus

toj siab = nrhiav (c1 (loc (i): loc (i+1) -1,:, 1));

kawg

ControlPlateauList (i) = ntev (toj siab);

kawg

Kauj Ruam 5: Rov Ua Kauj Ruam 3 thiab 4 rau Daim Duab Xeem

Rov Ua Dua Kauj Ruam 3 thiab 4 rau Kev Xeem Duab
Rov Ua Dua Kauj Ruam 3 thiab 4 rau Kev Xeem Duab

*Nco tseg: thaum kos kab kab tsis raug ntawm daim duab ntsuas, nco ntsoov kos nws hla cov xwm txheej uas sib haum rau kab uas koj kos rau ntawm cov duab tswj.

Kauj Ruam 6: Xam qhov kev nthuav dav ntawm lub Lens

Xam qhov kev nthuav dav ntawm lub Lens
Xam qhov kev nthuav dav ntawm lub Lens

Cov kev ntsuas loj tau suav los ntawm kev faib qhov nruab nrab ntawm qhov ntev ntawm toj siab, uas tau suav nyob hauv qib 5, los ntawm qhov nruab nrab ntawm qhov ntev ntawm kev tswj hwm toj siab, uas tau suav nyob hauv theem 4. Qhov no suav ua 1.0884.

kev loj hlob = txhais (toj siab)/txhais (ControlPlateauList);

Kauj Ruam 7: Nrhiav R-squared thiab Tus Neeg Siv Khoom Siv Tshuaj los ntawm Kev Sib Tham

Nrhiav R-squared thiab Tus Neeg Siv Khoom Siv Tshuaj Los Ntawm Kev Sib Tham
Nrhiav R-squared thiab Tus Neeg Siv Khoom Siv Tshuaj Los Ntawm Kev Sib Tham

Siv cov cai:

  • md1 = fitlm (GivenPrescription, MagArray);
  • Rsquared = md1. Rsquared. Ordinary;

Peb tuaj yeem pom R-squared tus nqi ntawm kab ntawv GivenPresciption (peb cov iav muab qhov tseem ceeb) vs. Los ntawm muaj qhov siab txaus R-squared tus nqi, nws tuaj yeem txiav txim siab tias muaj kev sib raug zoo txaus los ua pov thawj siv txoj hauv kev no. Rau qhov xwm txheej tshwj xeeb no, R-squared tus nqi yog 0.9912, uas qhia tias muaj kev sib raug zoo thiab yog li ntawd yog qhov ncaj ncees hauv kev siv cov qauv no hauv kev tshuaj xyuas.

Siv txoj haujlwm:

Daim ntawv yuav tshuaj = interp1 (MagArray, GivenPrescription, magnification, 'linear');

Peb tuaj yeem cuam tshuam tus nqi tshuaj raws tus qauv (ntawm x-axis) ntawm peb qhov kev nthuav dav (tus nqi ntawm y-axis) thiab pom tias tus neeg siv daim ntawv xaj tshuaj yog dab tsi.

Kev cuam tshuam cov ntaub ntawv yog qhov tseem ceeb rau txoj hauv kev no los ua haujlwm raws li nws tso cai rau peb ua kev xav txog cov ntaub ntawv peb tsis muaj, raws li cov ntaub ntawv peb muaj. Thaum txoj kab uas haum zoo tshaj plaws yuav yog cov neeg sib tw muaj zog rau qhov kev xav no, tsim kom muaj ciam teb los txo tus naj npawb ntawm cov txiaj ntsig tau txais txiaj ntsig zoo ib yam li cov tsom iav tsom iav tuaj nyob rau hauv cov txiaj ntsig zoo ib yam ntxiv. Qhov no tau piav qhia hauv cov kauj ruam tom ntej.

Kauj Ruam 8: Qhia Tus Neeg Siv Daim Ntawv Teev Npe ntawm Daim Duab

Qhia Tus Neeg Siv Daim Ntawv Teev Npe ntawm Kab Duab
Qhia Tus Neeg Siv Daim Ntawv Teev Npe ntawm Kab Duab

Siv cov cai hauv qab no:

  • daim duab;
  • lub ntsiab lus (GivenPrescription, MagArray, '-g')
  • tuav
  • lub ntsiab lus (Tshuaj, kev nthuav dav, 'bp')
  • tuav tseg
  • daim phiaj
  • lus dab neeg ('Cov ntaub ntawv', 'Cov ntsiab lus cuam tshuam', 'Qhov chaw', 'NW')

Peb tuaj yeem npaj cov phiaj xwm uas qhia txog Kev Loj Hlob piv rau Daim Ntawv Teev Npe nrog kab ntsuab thiab pom cov ntaub ntawv ntawm peb qhov kev suav nthuav tawm piv rau peb cov ntawv sau tshuaj nrog lub hnub qub xiav. Tom qab ntawd cov lus dab neeg sau lub npe, x-axis, thiab y-axis thiab tso cov lus dab neeg nyob rau saum kaum sab laug.

Kauj Ruam 9: Nqaim Koj Daim Ntawv Teev Npe

Nqaim Koj Daim Ntawv Teev Npe
Nqaim Koj Daim Ntawv Teev Npe

Cov cai hauv qab no yog siv los tsim kev sib puag rau daim ntawv yuav tshuaj:

  • yog tias Daim Ntawv Teev Npe <= 1.125

    CalculatedPrescription = '1.0';

  • elseif Daim Ntawv Teev Npe <= 1.375

    CalculatedPrescription = '1.25';

  • elseif Daim Ntawv Teev Npe <= 1.625

    CalculatedPrescription = '1.5';

  • elseif Cov Ntawv Pov Thawj <= 1.875

    CalculatedPrescription = '1.75';

  • elseif Daim Ntawv Teev Npe <= 2.25

    CalculatedPrescription = '2.0';

  • elseif Daim Ntawv Teev Npe <= 2.625

    CalculatedPrescription = '2.5';

  • elseif Daim Ntawv Teev Npe <= 3

    CalculatedPrescription = '2.75';

  • elseif Daim Ntawv Teev Npe <= 3.375

    CalculatedPrescription = '3.25';

  • lwm tus

    CalculatedPrescription = 'tsis paub';

  • kawg

Daim ntawv sau tshuaj pom los ntawm kev txhais lus tsis tas yuav cuam tshuam qhov tseeb daim ntawv yuav tshuaj - qhov no yog vim yuav muaj qhov hloov pauv me ntsis hauv kev tshuaj xyuas daim duab vim tib neeg ua yuam kev. Yog li, peb xav tau cov kauj ruam no txhawm rau cais cov ntawv yuav tshuaj.

Cov ntawv sau tshuaj uas tau muab feem ntau pib los ntawm 1.0 diopters thiab nce ntxiv los ntawm.25 hauv lawv cov ntawv yuav tshuaj, yog li tom qab suav cov ntawv yuav tshuaj peb xav txiav txim siab daim ntawv yuav tshuaj uas zoo tshaj rau tus neeg siv yuav xav tau. Tom qab suav cov ntawv yuav tshuaj, peb ua nws dhau qhov muab Yog tias nqe lus los tshuaj xyuas nws tus nqi thiab txiav txim tias daim ntawv yuav tshuaj twg yog qhov tsim nyog. Txhua yam uas tsawg dua lossis sib npaug rau 1.125, tom qab ntawv sau tshuaj yog 1.0. Txhua yam tsawg dua lossis sib npaug rau 1.375, daim ntawv yuav tshuaj yog 1.25. Txhua yam tsawg dua lossis sib npaug rau 1.625, daim ntawv yuav tshuaj yog 1.5. Ib yam twg tsawg dua lossis sib npaug rau 1.845, daim ntawv yuav tshuaj yog 1.75. Ntxiv rau

Peb muaj qhov txiaj ntsig nce ntxiv txij li peb tau tshuaj xyuas yog tias qhov txiaj ntsig tsawg dua. Yog tias peb tau ua qhov txiaj ntsig qis dua thawj zaug yog nqe lus yuav nyeem thawj zaug yog nqe lus txhua lub sijhawm. Yog tias daim ntawv sau tshuaj yog qhov tsawg tshaj plaws, peb xav kom nws lees paub tias nws yog qhov tsawg tshaj plaws tam sim ntawd, yog li ntawd vim li cas tus nqi me tshaj yog qhov peb pib nrog. Txhua yam uas siab dua li tus nqi siab tshaj txhais tau tias daim ntawv yuav tshuaj tsis nyob hauv ntau nrog peb cov ntaub ntawv, yog li nws yuav muab txoj hlua "Tsis paub".

Pom zoo: