![]() Level = graythresh(I) % Compute an appropriate thresholdīW = im2bw(I, level) % Convert grayscale to binaryĪnd here is what the original image and result BW look like:įor an RGB image input, just replace ind2gray with rgb2gray in the above code. ![]() Thanks a lot jane p. I = ind2gray(X, map) % Convert indexed to grayscale I have also project on image processing in which I have to convert 2d image to 3d in Matlab then further processing on that 3d image is required for my project. I need to convert 2D to 3D if I choose to open 2D picture ( because I use histeq and imhist) I dont know how to do write a command for converting to 3D if it is needed and not if is choosen 3D picture. Here is how I would accomplish what you are doing in your example: load trees % Load the image data It is became 2D images because the method of segmentation have to do so. I suggest the function graythresh, which will compute a threshold to plug into im2bw (or the newer imbinarize). after i do the segmentation, the binary image become binary images that have value 1 and 0. Next, you need to determine a threshold to use to convert the grayscale image to a binary image. For RGB images the function rgb2gray would do the same. The sample built-in image trees.mat that you load in your example is an indexed image, and you should therefore use the function ind2gray to first convert it to a grayscale intensity image. ![]() Your first problem is that you are confusing indexed images (which have a colormap map) and RGB images (which don't). ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |