问题描述
I=imread('circlesColored.png');
% Get the image as a b&w indexed (non-rgb) image
R=I(:,:,1);
R=(R>35&R<255);
imshow(R);
bwareaopen(I,50);
BW = gray2ind(R,2);
%Calculate its connected regions
L = bwlabel(BW); % Not using bwconncomps() for older version users
stats = regionprops(L,'Extent','Area');
%Find the ones that are like a circle
minextent = 0.75;
keepMask = [stats.Extent]>minextent;
%Extract the image of circles only and display
BWcircles = ismember(L,find(keepMask));
BWnonCircles = BW & ~BWcircles;
%show the circles
figure,imshow(BWcircles)
为什么这段代码在 BASIC 256 中不起作用?我已经在 qb64 中尝试过它并且有效。
解决方法
自从我上次用 BASIC 编程已经好几年了,但我记得有不同的风格语言(C、Pascal 和其他语言也是如此)。
我搜索了一些 QB64 和 Basic 256:简短的回答是 QB64 的 BASIC 风格支持行号,但是Basic 256 实现了不支持行号的更新版 BASIC。
为了在 BASIC 256 中使用 GOTO
,您必须使用标签(任何标识符后跟冒号“:”)
thisIsALabel: Print "What is your name"
input nameperson$
Print "What is your Dad's name"
input ageperson$
Print "Your Name is ";nameperson$;" ";ageperson$
GOTO thisIsALabel