Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

How do I create a GUI that will run the following code?

1 Ansicht (letzte 30 Tage)
Naresh Naik
Naresh Naik am 20 Jan. 2013
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
imaqhwinfo;
imaqhwinfo('winvideo',1)
vid=videoinput('winvideo',1);
I=getsnapshot(vid);
figure,imshow(I);
I1=im2bw(I);
j=imfill(I1);title('Original Image');
PixinMicrons=4.65;
k=~j;
[z,obj]=bwlabel(k);
reg=regionprops(z,'Area','FilledArea','Centroid');
reg1=reg(1,1);
ID=sqrt(4*(reg1.FilledArea-reg1.Area)/pi);
OD= sqrt((4*(reg1.FilledArea))/pi);
WIDTH=((OD-ID)/2);
RATIO=OD/ID;
cameracenter=size(z)/2;
z(cameracenter(1),:)=1;
z(:,cameracenter(2))=1;
figure,imshow(z);
circlecenter=(reg.Centroid);
impixelinfo
if(cameracenter(1)>circlecenter(1))
XshiftinPix=(cameracenter(1)-circlecenter(1));
XshiftinMicrons=(XshiftinPix)*PixinMicrons*WIDTH;
elseif(cameracenter(1)<circlecenter(1))
XshiftinPix=(circlecenter(1)-cameracenter(1));
XshiftinMicrons=(XshiftinPix)*PixinMicrons*WIDTH;
end
if(cameracenter(2)>circlecenter(2))
YshiftinPix=(cameracenter(2)-circlecenter(2));
YshiftinMicrons=(YshiftinPix)*PixinMicrons*WIDTH;
elseif(cameracenter(2)<circlecenter(2))
YshiftinPix=(circlecenter(2)-cameracenter(2));
YshiftinMicrons=(YshiftinPix)*PixinMicrons*WIDTH;
end
  7 Kommentare
Naresh Naik
Naresh Naik am 31 Jan. 2013
after receiving the comments to this question i came to know that i didn't ask the question in proper way that makes me to delete any how i will take care about above comments in future questions ..
Jan
Jan am 31 Jan. 2013
@Naresh: You can edit your question and ask the admins for help if you are in doubt - the address is shown on the bottom of this page. Even the editors will assist you, if you ask them.

Antworten (1)

Walter Roberson
Walter Roberson am 21 Jan. 2013
You cannot create a GUI for that code unless you get rid of the "clear all", as "clear all" would instruct MATLAB to remove everything including the GUI.
  1 Kommentar
Jan
Jan am 21 Jan. 2013
+1. I will write an enhancement request, which let MLint warn in case of a clear all.

Diese Frage ist geschlossen.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by