How do I create a GUI that will run the following code?
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
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
Jan
2013년 1월 21일
Please format your code and ask a specific question. Showing a program and asking for a general GUI is to vague to be answered specifically. So what kind of help do you expect?
Jan
2013년 1월 21일
It is more likely, that you get a useful answer, if you ask a specific question. Currently it is not clear which kind of help you expect. It is unlikely that a contributor will implement this for you, and if anybody does, it is unlikely that it matchs your needs exactly.
I suggest that you try to create the GUI by your own at first and come back with explicit questions on demand.
Walter Roberson
2013년 1월 22일
Look in the FEX for "41 sample GUI"
Jan
2013년 1월 29일
Think twice before you overwrite the contents of your question. Afterwards the given answers are meaningless and the persons, who have spent time for answering will hesitate to help you for other problems in the future.
Randy Souza
2013년 1월 29일
I have restored the original text of this question.
Naresh, if you have a good reason why this question should be removed from MATLAB Answers, please flag the question, explain why it should be deleted, and an administrator or high-reputation contributor will consider deleting the question. Please do not simply edit your question away.
Naresh Naik
2013년 1월 31일
Jan
2013년 1월 31일
@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.
답변 (1개)
Walter Roberson
2013년 1월 21일
1 개 추천
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
Jan
2013년 1월 21일
+1. I will write an enhancement request, which let MLint warn in case of a clear all.
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!