0
$\begingroup$

I'm trying to segment a specific part in a gray-scale image and I want to achieve this by applying the OSTU algorithm, but after using this function:

im = imread('ready.jpg');
oim =otsu(im,10);
figure,imshow(oim, [1 10]);

I could show the output image, but I do not know how can I save the result to be able to use it later as a mask.

$\endgroup$

1 Answer 1

1
$\begingroup$

I am sorry that I cannot see where your problem is. What do you mean by "how can I save the result?" If you want to use $oim$ in matlab, then it is already there. If you are interested in extracting one specific class, you can simply get the corresponding $n$th mask by calling $mask=(oim==n)$, which returns a binary mask with only the pixel belonging to the $n$th class marked as 1s.

If you are going to save the classification result outside of matlab, for example a tif image, simply use imwrite function in matlab. Late you can read it via imread function.

$\endgroup$
1
  • $\begingroup$ thank you very much for answer,Actually I solved the problem by convert the result from matrix to grayimage,So I could save it normally oim2 =mat2gray(oim); $\endgroup$
    – Fooz
    Apr 1, 2013 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.