why I must enclose array bracket '[]' to show the image on next process after apply multithresh?
Show older comments
I applied multi threshold using Otsu and show the result of the process using this script. it runs well.
a=imread('segment.jpg');
figure, imshow(a);
b=imadjust(a, [0.8 1],[]);
figure, imshow(b);
level = multithresh(b);
seg_I = imquantize(b,level);
figure, imshow(seg_I, []);
j=imcomplement(seg_I);
figure, imshow(j,[]); title('image complement');
but, why I must enclose array bracket '[]' to show the image on next process after apply multithresh? please help, thanks ^^
3 Comments
Adam
on 21 Oct 2016
Who told you that you do have to? Have you tried doing so without? Usually it is only necessary to pass [] as an argument to a Matlab builtin function if it is an argument you don't want to specify, but you do want to specify a later one. This is quite rare, but min or max is an example where it is often used e.g
a = rand( 10, 10 );
min( a, [], 2 )
to run the min on the 2nd dimension.
Using [] as the final argument seems to be superfluous though because it should be interpreted the same as not including the argument at all as far as I am aware, in a builtin function, that is.
setiawandika
on 21 Oct 2016
Adam
on 21 Oct 2016
Ok, that makes sense, I haven't used it in those circumstances so never read up about the specifics of bypassing that argument. It is an ugly way for Mathworks to solve the problem, but I guess a lack of overloading in Matlab leads to this kind of thing!
Accepted Answer
More Answers (0)
Categories
Find more on Language Support in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!