What does ~= means in image segmentation??
8 views (last 30 days)
Show older comments
begginer01
on 13 Sep 2017
Commented: Image Analyst
on 14 Sep 2017
Hello...
What does this error means? How to resolve it?? Please help this is related to MRF segmentation
Error message:
Subscripted assignment dimension mismatch.
Error in EnergyOfLabelField
E(:,i)=sum(Nei8~=i,2);
I don't know how to resolve it....Please help me and solve this issue.. I am attaching my code too so that you can check. Please reply asap.
Accepted Answer
Image Analyst
on 13 Sep 2017
~ means "not", so "Nei8~=i" means "Nei8 not equal to i".
3 Comments
Walter Roberson
on 13 Sep 2017
The code
E=zeros(n,class_number);
for i=1:class_number
E(:,i)=sum(Nei8~=i,2);
end
assumes that the result of sum(Nei8~=i,2) is a vector of length n. That would happen if Nei8 is a column vector of length n rows, or if it is a 2D array with n rows. It would not be the case if Nei8 is a 3 or more dimensional array, and it would not be the case if Nei8 is empty.
You should give the command
dbstop if error
and run your code. When it stops, ask it to display n and to display size(Nei8): if Nei8 is not n x something then you have a problem.
Image Analyst
on 14 Sep 2017
It will throw an error on this line first:
Nei8=imstack2vectors(NeiX(segmentation));
because NeiX was not passed in or defined within the function. Who wrote this weird code for you anyway? Can't you ask the author?
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!