I keep getting this error message "Error using * Too many input arguments. Error in untitled (line 96) output_dia​meter=iSta​tus.EquivD​iameter*Pi​xelSize; " from running the code below. How do I solve it please?

close all;clear all;clc;%Close image; Clean up variables; Clear the screen
%Basic parameters of high-speed photography)
fps=500;%Set the frames taken per second)++++++++++++++++++++++
first=1;increment=10;last=931;t=0;%Set the image number and interval++++++++++++++++
Height=0.064;%The actual height of the picture, in unit m, is determined according to the calibrated picture)+++++++++++++++++++
Platform_rising_velocity=0.235;%dThe unit is m/s£¬platform rising velocity++++++++++++++++
time_of_acceleration_stage=0.1; %The unit is m/s£¬the acceleration stage
Pixel_num=1024 ;%pixels of the images, never change
det_t=1/fps;%The time interval between the images being processed, in units of s
gray_min=0.23;%minimum threshold)++++++++++++++++++++++++++++
gray_max=0.26;%maximum threshold)+++++++++++++++++++++++
%-------Start edge detection-------%
Fid1=fopen('BubbleStatus.txt','w');%Open the file and store the bubble information)
fprintf(Fid1,'fig_num t Area Eq_d Perimeter Local_CX Local_CZ Global_CX Global_CZ Distance_away_surface Eccentricity major_axis minor_axis\n');%ÎļþÌâÍ·
distance=0;
acceleration=Platform_rising_velocity/time_of_acceleration_stage;
for k=first:increment:last
%Print file name)
if k < 10
iName=sprintf('C001H001S000100000%d.bmp',k);%case:C001H001S00010000 3829.bmp
elseif k >= 10&&k < 100
iName=sprintf('C001H001S00010000%d.bmp',k);
elseif k >=100&&k < 1000
iName=sprintf('C001H001S0001000%d.bmp',k);
else
iName=sprintf('C001H001S000100%d.bmp',k);
end
%Read the original image)
I=imread(iName);%=========================================================
%figure('name','¶Ô±Èͼ(area chart)'),subplot(241),imshow(I),title('ԭͼI(artwork master)');
%ԭͼÏÔʾ(Actual View)
%image conversion)
iGray=rgb2gray(I);%Grayscale image conversion
%subplot(248);imhist(iGray);%grey level histogram
%iBW=im2bw(iGray,0.50);%Binary image conversion)£»1--white)£¬0--black)
level=graythresh(iGray);%Find an appropriate threshold for the image using the maximum inter-group variance method
gray_real=(k-first)*(gray_max-gray_min)/(last-first)+gray_min;
iBW=im2bw(iGray,gray_real);%Binary image conversion)£»1--white)£¬0--black)
%subplot(242),imshow(iBW),title('¶þֵͼÏñiBW');%¶þֵͼÏÔʾ(Binary graph display)
%Image Filling
iFill=imfill(~iBW,'holes');%Filling
%subplot(243),imshow(iFill),title('Ìî³äͼÏñ(Fill in the image)iFill');%ÏÔʾ( display)
%½µÔë-²ÉÓø¯Ê´ºÍÅòÕͲÙ×÷È¥³ýµã×´ÔëÉù(Noise reduction - use corrosion and expansion operations to remove point noise)
%step 1
str=strel('disk',3);%structure element
%iErode=imerode(~iFill,str);%¸¯Ê´(corrosion)
%subplot(244),imshow(iErode),title('¸¯Ê´Í¼ÐÎ(etch pattern)iErode');%ÏÔʾ( display)
%step 2
iRemovel=bwareaopen(iFill,150);%Delete the object whose area is less than 50
%subplot(245),imshow(iRemovel),title('ÒÆ³ýÐ¡Ãæ»ýͼÏñ(Remove small area images)iRemovel');%ÏÔʾ( display)
%Img=imdilate(~I_Re,str);%¿ªÔËËã(Open operation)
%Img=imdilate(Img,str);
%Img=imerode(Img,str);%±ÕÔËËã(closed operation)
%subplot(246),imshow(Img),title('Eroded Image');%ÏÔʾ( display)
%wo ways to detect the edge
%scheme one
iEdge1=edge(iRemovel,'canny');
%subplot(246),imshow(~iEdge1),title('±ßÔµ(edge)-Scheme1-iEdge1');%ÏÔʾ( display)
%scheme two
str=strel('disk',2);
Img1=imerode(~iRemovel,str);
Img=~iRemovel;
iEdge2=Img-Img1;%To determine the boundary)
%subplot(247),imshow(~iEdge2),title('±ßÔµ(edge)-Scheme2-iEdge2');%ÏÔʾ( display)
%##########Terminate edge detection)##########
%-------Scale_Reset_Start-------%
%ͼÏñ·Ö±æÂÊ(image resolution)image resolutionµÄµ¥Î»Ò²¿ÉÒÔ(The units can also be)
%ÿÀåÃ×µÄÏñËØÊý£¨PPC£¬pixel per centimeter£©À´ºâÁ¿µÄ(to measure)
%¿í¶ÈÏñËØ£ºWidth£»¸ß¶ÈÏñËØ£ºHeight£»//µ¥Î»ÊÇÏñËØ(In pixels)
%ˮƽ·Ö±æÂÊ£ºHorzResolution£»´¹Ö±·Ö±æÂÊVertResolution //µ¥Î»ÊÇ·Ö±æÂÊ£¨The unit is resolution£©
%È·¶¨Í¼Ïñ´óС£¨µ¥Î»ÏñËØ£©¡¢È·¶¨·Ö±æÂÊ£¨Determine the image size (unit pixel), determine the resolution£©
info=imfinfo(iName);%Get the image details£©=============================
%W=info.Width;%¿í¶ÈÏñËØ¸öÊý£¨Number of width pixels£©
%H=info.Height;%¸ß¶ÈÏñËØ¸öÊý£¨Number of height pixels£©
%È·¶¨µ¥¸öÏñËØµÄʵ¼Ê´óС£¨Determine the actual size of a single pixel£©
PixelSize=Height/Pixel_num;%Z·½Ïò£¨Z direction£©-µ¥Î»ÏñËØµÄ³¤¶È£¨Length per pixel£©-µ¥Î»Îªm/pixel
%##################Scale_Reset_End##################
%-------The bubble area, circumference, center of gravity and eccentricity were calculated£©-------%
%·Ö±ðÇóÈ¡Ãæ»ý¡¢Öܳ¤¡¢ÖØÐÄÒÔ¼°Æ«ÐÄÂÊ£¨The area, circumference, center of gravity and eccentricity were calculated respectively£©
iStatus=regionprops(iRemovel,'Area','Perimeter','Centroid','Eccentricity','EquivDiameter','MajorAxisLength','MinorAxisLength');
output_diameter=iStatus.EquivDiameter*PixelSize;
output_area=3.1415926*output_diameter^2;
output_perimeter=iStatus.Perimeter*PixelSize;
%Locate the center of the bubble, especially the first bubble£©
if k==first
centroidx=iStatus.Centroid(1,1)*PixelSize;
centroidz=iStatus.Centroid(1,2)*PixelSize;
Initial_X=iStatus.Centroid(1,1)*PixelSize;
Initial_Z=iStatus.Centroid(1,2)*PixelSize;
Initial_d=iStatus.EquivDiameter*PixelSize;
else
centroidx=iStatus.Centroid(1,1)*PixelSize;
centroidz=iStatus.Centroid(1,2)*PixelSize;
end
%Determine the height of the first image (the bubble is leaving the nozzle but has not yet left)£©
if first<fps*time_of_acceleration_stage+2
initial_distance=0.5*acceleration*((first-1)*det_t)^2;
else
initial_distance=0.5*acceleration*(time_of_acceleration_stage)^2+(first-fps*time_of_acceleration_stage-1)*det_t*Platform_rising_velocity;
end
%Determine the height position of the Kth image£©
if k<fps*time_of_acceleration_stage+2
distance=0.5*acceleration*((k-1)*det_t)^2;
else
distance=0.5*acceleration*(time_of_acceleration_stage)^2+(k-fps*time_of_acceleration_stage-1)*det_t*Platform_rising_velocity;
end
original=Height-Initial_Z-0.5*Initial_d;
distance=distance-initial_distance;
output_centroidx=centroidx-Initial_X;
output_centroidz=Height-centroidz+distance-original;
output_eccentricity=iStatus.Eccentricity;
output_majorAxisLength=iStatus.MajorAxisLength*PixelSize;
output_minorAxisLength=iStatus.MinorAxisLength*PixelSize;
H=1.0-output_centroidz;
%Output: fig_num t Area Eq_d Perimeter LCX LCZ GCX GCZ H Eccentricity major_axis minor_axis
fprintf(Fid1,'%f %f %f %f %f %f %f %f %f %f %f %f %f\n',k,t,output_area,output_diameter,output_perimeter,centroidx,centroidz,output_centroidx,output_centroidz,H,output_eccentricity,output_majorAxisLength,output_minorAxisLength);%ÎļþÊä³öÆøÅÝÊôÐÔ
% if k==first
% fclose(Fid1);%¹Ø±ÕÎļþ£¨ closed file£©
% Fid1=fopen('BubbleStatus.txt','a');%´ò¿ªÎļþ£¨open file£©
% end
t=t+det_t*increment;
%##########ÖÕÖ¹¼ÆËãÆøÅÝÃæ»ý¡¢Öܳ¤¡¢ÖØÐÄ¡¢Æ«ÐÄÂÊ£¨The calculation of bubble area, circumference, center of gravity and eccentricity was terminated£©##########
end
fclose(Fid1);%¹Ø±ÕÎļþ£¨ closed file£©
% %----Begin to plot the trajectory of the bubbles over time£©--------
% if k==first
% [m,n]=size(iEdge2);C=ones(m,n);%È·¶¨Í¼Æ¬¾ØÕó´óС£»¶¨ÒåоØÕó£¨Determine the image matrix size; Define a new matrix£©
% end
% for ji=1:m
% for jj=1:n
% if ~iEdge2(ji,jj)==0
% C(ji,jj)=0;
% end
% end
% end
%
% cy_round=round(iStatus.Centroid(1,1));
% cx_round=round(iStatus.Centroid(1,2));
%
% C(cx_round,cy_round)=0;
% C(cx_round+1,cy_round)=0;
% C(cx_round+1,cy_round-1)=0;
% C(cx_round+1,cy_round+1)=0;
%
% C(cx_round-1,cy_round)=0;
% C(cx_round-1,cy_round+1)=0;
% C(cx_round-1,cy_round-1)=0;
% C(cx_round,cy_round+1)=0;
% C(cx_round,cy_round-1)=0;
%
% %#######ÖÕÖ¹»æÖÆ£¨Termination of the draw£©####################
% end
% fclose(Fid1);%¹Ø±ÕÎļþ£¨ closed file£©
% imshow(C);%ÆøÅݹ켣Ïߣ¨Bubble trajectory£©

3 Comments

Put the complete error message in context in the body of the question instead of the title...it would help to remove all the superfluous commented-out code down to the portion that is pertinent to the problem...
As is, don't have any idea where it really is and don't have the time to try to find it...
More accurate...don't want to take the time...
The problem is apparently your call to regionprops returned more than one region.

Sign in to comment.

Answers (0)

Products

Release

R2014a

Asked:

on 4 Aug 2019

Commented:

dpb
on 4 Aug 2019

Community Treasure Hunt

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

Start Hunting!