MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

 Subject: MeanIntensity From: Aikerim Date: 20 Jul, 2011 19:04:09 Message: 1 of 16 Hello, Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? I got these errors: ??? Error using ==> regionprops>ParseInputs at 1112 Size of I doesn't match size information found in the first input argument. Error in ==> regionprops at 154 [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); please help!
 Subject: MeanIntensity From: Jeff Date: 20 Jul, 2011 19:43:09 Message: 2 of 16 "Aikerim" wrote in message ... > Hello, > Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? > I got these errors: > ??? Error using ==> regionprops>ParseInputs at 1112 > Size of I doesn't match size information found in the first input argument. > > Error in ==> regionprops at 154 > [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); > please help! To calculate mean intensity, regionprops needs the raw image in addition to a labeled or binary image: STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionprops—either BW, CC, or L—identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). An example: stats = regionprops(BW_image, Intensity_image, 'MeanIntensity');
 Subject: MeanIntensity From: Aikerim Date: 20 Jul, 2011 20:04:10 Message: 3 of 16 "Jeff " wrote in message ... > "Aikerim" wrote in message ... > > Hello, > > Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? > > I got these errors: > > ??? Error using ==> regionprops>ParseInputs at 1112 > > Size of I doesn't match size information found in the first input argument. > > > > Error in ==> regionprops at 154 > > [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); > > please help! > > To calculate mean intensity, regionprops needs the raw image in addition to a labeled or binary image: > STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionprops—either BW, CC, or L—identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). > > An example: > stats = regionprops(BW_image, Intensity_image, 'MeanIntensity'); I knew these thing,the function.I dont know what should I put instead of Intensity_image??? My code: I = imread('pvs6multiscale1j.jpg'); imshow(I); threshold = graythresh(I); bw = im2bw(I,threshold); % remove all object containing fewer than 30 pixels bw = bwareaopen(bw,180); L=bwlabel(bw,8); stats=regionprops(L, _______ ,'MeanIntensity');
 Subject: MeanIntensity From: Jeff Date: 20 Jul, 2011 23:05:25 Message: 4 of 16 "Aikerim" wrote in message ... > "Jeff " wrote in message ... > > "Aikerim" wrote in message ... > > > Hello, > > > Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? > > > I got these errors: > > > ??? Error using ==> regionprops>ParseInputs at 1112 > > > Size of I doesn't match size information found in the first input argument. > > > > > > Error in ==> regionprops at 154 > > > [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); > > > please help! > > > > To calculate mean intensity, regionprops needs the raw image in addition to a labeled or binary image: > > STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionprops—either BW, CC, or L—identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). > > > > An example: > > stats = regionprops(BW_image, Intensity_image, 'MeanIntensity'); > > I knew these thing,the function.I dont know what should I put instead of Intensity_image??? > My code: > > I = imread('pvs6multiscale1j.jpg'); > imshow(I); > threshold = graythresh(I); > bw = im2bw(I,threshold); > > % remove all object containing fewer than 30 pixels > bw = bwareaopen(bw,180); > > > L=bwlabel(bw,8); > stats=regionprops(L, _______ ,'MeanIntensity'); In this context, regionprops requires a grayscale image. The easiest way to do this is to use RGB2GRAY, but there are other ways: gray_img = rgb2gray(I); L=bwlabel(bw, 8); stats = regionprops(L, gray_img, 'MeanIntensity');
 Subject: MeanIntensity From: Aikerim Date: 21 Jul, 2011 08:36:09 Message: 5 of 16 "Jeff " wrote in message ... > "Aikerim" wrote in message ... > > "Jeff " wrote in message ... > > > "Aikerim" wrote in message ... > > > > Hello, > > > > Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? > > > > I got these errors: > > > > ??? Error using ==> regionprops>ParseInputs at 1112 > > > > Size of I doesn't match size information found in the first input argument. > > > > > > > > Error in ==> regionprops at 154 > > > > [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); > > > > please help! > > > > > > To calculate mean intensity, regionprops needs the raw image in addition to a labeled or binary image: > > > STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionprops—either BW, CC, or L—identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). > > > > > > An example: > > > stats = regionprops(BW_image, Intensity_image, 'MeanIntensity'); > > > > I knew these thing,the function.I dont know what should I put instead of Intensity_image??? > > My code: > > > > I = imread('pvs6multiscale1j.jpg'); > > imshow(I); > > threshold = graythresh(I); > > bw = im2bw(I,threshold); > > > > % remove all object containing fewer than 30 pixels > > bw = bwareaopen(bw,180); > > > > > > L=bwlabel(bw,8); > > stats=regionprops(L, _______ ,'MeanIntensity'); > > In this context, regionprops requires a grayscale image. The easiest way to do this is to use RGB2GRAY, but there are other ways: > > gray_img = rgb2gray(I); > L=bwlabel(bw, 8); > stats = regionprops(L, gray_img, 'MeanIntensity'); Hi, But my image is already in grayscale I mean the original image (I)???
 Subject: MeanIntensity From: Jeff Date: 21 Jul, 2011 15:58:09 Message: 6 of 16 "Aikerim" wrote in message ... > "Jeff " wrote in message ... > > "Aikerim" wrote in message ... > > > "Jeff " wrote in message ... > > > > "Aikerim" wrote in message ... > > > > > Hello, > > > > > Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? > > > > > I got these errors: > > > > > ??? Error using ==> regionprops>ParseInputs at 1112 > > > > > Size of I doesn't match size information found in the first input argument. > > > > > > > > > > Error in ==> regionprops at 154 > > > > > [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); > > > > > please help! > > > > > > > > To calculate mean intensity, regionprops needs the raw image in addition to a labeled or binary image: > > > > STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionprops—either BW, CC, or L—identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). > > > > > > > > An example: > > > > stats = regionprops(BW_image, Intensity_image, 'MeanIntensity'); > > > > > > I knew these thing,the function.I dont know what should I put instead of Intensity_image??? > > > My code: > > > > > > I = imread('pvs6multiscale1j.jpg'); > > > imshow(I); > > > threshold = graythresh(I); > > > bw = im2bw(I,threshold); > > > > > > % remove all object containing fewer than 30 pixels > > > bw = bwareaopen(bw,180); > > > > > > > > > L=bwlabel(bw,8); > > > stats=regionprops(L, _______ ,'MeanIntensity'); > > > > In this context, regionprops requires a grayscale image. The easiest way to do this is to use RGB2GRAY, but there are other ways: > > > > gray_img = rgb2gray(I); > > L=bwlabel(bw, 8); > > stats = regionprops(L, gray_img, 'MeanIntensity'); > > Hi, > But my image is already in grayscale I mean the original image (I)??? Are you sure it is in grayscale, and not an RGB that looks like it is grayscale? Do one of two things: 1 - post the results of size(L) as well as size(I) 2 - post your original image somewhere so we can download it and run it through your code
 Subject: MeanIntensity From: Aikerim Date: 21 Jul, 2011 16:20:10 Message: 7 of 16 "Jeff " wrote in message ... > "Aikerim" wrote in message ... > > "Jeff " wrote in message ... > > > "Aikerim" wrote in message ... > > > > "Jeff " wrote in message ... > > > > > "Aikerim" wrote in message ... > > > > > > Hello, > > > > > > Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? > > > > > > I got these errors: > > > > > > ??? Error using ==> regionprops>ParseInputs at 1112 > > > > > > Size of I doesn't match size information found in the first input argument. > > > > > > > > > > > > Error in ==> regionprops at 154 > > > > > > [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); > > > > > > please help! > > > > > > > > > > To calculate mean intensity, regionprops needs the raw image in addition to a labeled or binary image: > > > > > STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionprops—either BW, CC, or L—identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). > > > > > > > > > > An example: > > > > > stats = regionprops(BW_image, Intensity_image, 'MeanIntensity'); > > > > > > > > I knew these thing,the function.I dont know what should I put instead of Intensity_image??? > > > > My code: > > > > > > > > I = imread('pvs6multiscale1j.jpg'); > > > > imshow(I); > > > > threshold = graythresh(I); > > > > bw = im2bw(I,threshold); > > > > > > > > % remove all object containing fewer than 30 pixels > > > > bw = bwareaopen(bw,180); > > > > > > > > > > > > L=bwlabel(bw,8); > > > > stats=regionprops(L, _______ ,'MeanIntensity'); > > > > > > In this context, regionprops requires a grayscale image. The easiest way to do this is to use RGB2GRAY, but there are other ways: > > > > > > gray_img = rgb2gray(I); > > > L=bwlabel(bw, 8); > > > stats = regionprops(L, gray_img, 'MeanIntensity'); > > > > Hi, > > But my image is already in grayscale I mean the original image (I)??? > > Are you sure it is in grayscale, and not an RGB that looks like it is grayscale? Do one of two things: > 1 - post the results of size(L) as well as size(I) > 2 - post your original image somewhere so we can download it and run it through your code Could u try this link: http://imageshack.us/photo/my-images/851/pvs6multiscale1j.jpg/
 Subject: MeanIntensity From: Jeff Date: 21 Jul, 2011 16:52:09 Message: 8 of 16 "Aikerim" wrote in message ... > "Jeff " wrote in message ... > > "Aikerim" wrote in message ... > > > "Jeff " wrote in message ... > > > > "Aikerim" wrote in message ... > > > > > "Jeff " wrote in message ... > > > > > > "Aikerim" wrote in message ... > > > > > > > Hello, > > > > > > > Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? > > > > > > > I got these errors: > > > > > > > ??? Error using ==> regionprops>ParseInputs at 1112 > > > > > > > Size of I doesn't match size information found in the first input argument. > > > > > > > > > > > > > > Error in ==> regionprops at 154 > > > > > > > [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); > > > > > > > please help! > > > > > > > > > > > > To calculate mean intensity, regionprops needs the raw image in addition to a labeled or binary image: > > > > > > STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionprops—either BW, CC, or L—identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). > > > > > > > > > > > > An example: > > > > > > stats = regionprops(BW_image, Intensity_image, 'MeanIntensity'); > > > > > > > > > > I knew these thing,the function.I dont know what should I put instead of Intensity_image??? > > > > > My code: > > > > > > > > > > I = imread('pvs6multiscale1j.jpg'); > > > > > imshow(I); > > > > > threshold = graythresh(I); > > > > > bw = im2bw(I,threshold); > > > > > > > > > > % remove all object containing fewer than 30 pixels > > > > > bw = bwareaopen(bw,180); > > > > > > > > > > > > > > > L=bwlabel(bw,8); > > > > > stats=regionprops(L, _______ ,'MeanIntensity'); > > > > > > > > In this context, regionprops requires a grayscale image. The easiest way to do this is to use RGB2GRAY, but there are other ways: > > > > > > > > gray_img = rgb2gray(I); > > > > L=bwlabel(bw, 8); > > > > stats = regionprops(L, gray_img, 'MeanIntensity'); > > > > > > Hi, > > > But my image is already in grayscale I mean the original image (I)??? > > > > Are you sure it is in grayscale, and not an RGB that looks like it is grayscale? Do one of two things: > > 1 - post the results of size(L) as well as size(I) > > 2 - post your original image somewhere so we can download it and run it through your code > > Could u try this link: > http://imageshack.us/photo/my-images/851/pvs6multiscale1j.jpg/ Are you sure that's the right image? It looks like a binary mask displayed in matlab then saved. In any case, the following code works with the image you provided: I = imread('pvs6multiscale1j.jpg'); imshow(I); threshold = graythresh(I); bw = im2bw(I,threshold); % remove all object containing fewer than 30 pixels bw = bwareaopen(bw,180); L=bwlabel(bw,8); stats=regionprops(L, I ,'MeanIntensity');
 Subject: MeanIntensity From: Aikerim Date: 21 Jul, 2011 17:07:09 Message: 9 of 16 "Jeff " wrote in message ... > "Aikerim" wrote in message ... > > "Jeff " wrote in message ... > > > "Aikerim" wrote in message ... > > > > "Jeff " wrote in message ... > > > > > "Aikerim" wrote in message ... > > > > > > "Jeff " wrote in message ... > > > > > > > "Aikerim" wrote in message ... > > > > > > > > Hello, > > > > > > > > Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? > > > > > > > > I got these errors: > > > > > > > > ??? Error using ==> regionprops>ParseInputs at 1112 > > > > > > > > Size of I doesn't match size information found in the first input argument. > > > > > > > > > > > > > > > > Error in ==> regionprops at 154 > > > > > > > > [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); > > > > > > > > please help! > > > > > > > > > > > > > > To calculate mean intensity, regionprops needs the raw image in addition to a labeled or binary image: > > > > > > > STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionprops—either BW, CC, or L—identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). > > > > > > > > > > > > > > An example: > > > > > > > stats = regionprops(BW_image, Intensity_image, 'MeanIntensity'); > > > > > > > > > > > > I knew these thing,the function.I dont know what should I put instead of Intensity_image??? > > > > > > My code: > > > > > > > > > > > > I = imread('pvs6multiscale1j.jpg'); > > > > > > imshow(I); > > > > > > threshold = graythresh(I); > > > > > > bw = im2bw(I,threshold); > > > > > > > > > > > > % remove all object containing fewer than 30 pixels > > > > > > bw = bwareaopen(bw,180); > > > > > > > > > > > > > > > > > > L=bwlabel(bw,8); > > > > > > stats=regionprops(L, _______ ,'MeanIntensity'); > > > > > > > > > > In this context, regionprops requires a grayscale image. The easiest way to do this is to use RGB2GRAY, but there are other ways: > > > > > > > > > > gray_img = rgb2gray(I); > > > > > L=bwlabel(bw, 8); > > > > > stats = regionprops(L, gray_img, 'MeanIntensity'); > > > > > > > > Hi, > > > > But my image is already in grayscale I mean the original image (I)??? > > > > > > Are you sure it is in grayscale, and not an RGB that looks like it is grayscale? Do one of two things: > > > 1 - post the results of size(L) as well as size(I) > > > 2 - post your original image somewhere so we can download it and run it through your code > > > > Could u try this link: > > http://imageshack.us/photo/my-images/851/pvs6multiscale1j.jpg/ > > Are you sure that's the right image? It looks like a binary mask displayed in matlab then saved. > > In any case, the following code works with the image you provided: > > I = imread('pvs6multiscale1j.jpg'); > imshow(I); > threshold = graythresh(I); > bw = im2bw(I,threshold); > > % remove all object containing fewer than 30 pixels > bw = bwareaopen(bw,180); > > L=bwlabel(bw,8); > stats=regionprops(L, I ,'MeanIntensity'); That's image is after the segmentation, it's my objective image,so it's strange it doesn't work on my Matlab (2009).It gives the mentioned before errors about 'not matching'...anyway,thank you!
 Subject: MeanIntensity From: Jeff Date: 21 Jul, 2011 18:13:09 Message: 10 of 16 "Aikerim" wrote in message ... > "Jeff " wrote in message ... > > "Aikerim" wrote in message ... > > > "Jeff " wrote in message ... > > > > "Aikerim" wrote in message ... > > > > > "Jeff " wrote in message ... > > > > > > "Aikerim" wrote in message ... > > > > > > > "Jeff " wrote in message ... > > > > > > > > "Aikerim" wrote in message ... > > > > > > > > > Hello, > > > > > > > > > Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? > > > > > > > > > I got these errors: > > > > > > > > > ??? Error using ==> regionprops>ParseInputs at 1112 > > > > > > > > > Size of I doesn't match size information found in the first input argument. > > > > > > > > > > > > > > > > > > Error in ==> regionprops at 154 > > > > > > > > > [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); > > > > > > > > > please help! > > > > > > > > > > > > > > > > To calculate mean intensity, regionprops needs the raw image in addition to a labeled or binary image: > > > > > > > > STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionprops—either BW, CC, or L—identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). > > > > > > > > > > > > > > > > An example: > > > > > > > > stats = regionprops(BW_image, Intensity_image, 'MeanIntensity'); > > > > > > > > > > > > > > I knew these thing,the function.I dont know what should I put instead of Intensity_image??? > > > > > > > My code: > > > > > > > > > > > > > > I = imread('pvs6multiscale1j.jpg'); > > > > > > > imshow(I); > > > > > > > threshold = graythresh(I); > > > > > > > bw = im2bw(I,threshold); > > > > > > > > > > > > > > % remove all object containing fewer than 30 pixels > > > > > > > bw = bwareaopen(bw,180); > > > > > > > > > > > > > > > > > > > > > L=bwlabel(bw,8); > > > > > > > stats=regionprops(L, _______ ,'MeanIntensity'); > > > > > > > > > > > > In this context, regionprops requires a grayscale image. The easiest way to do this is to use RGB2GRAY, but there are other ways: > > > > > > > > > > > > gray_img = rgb2gray(I); > > > > > > L=bwlabel(bw, 8); > > > > > > stats = regionprops(L, gray_img, 'MeanIntensity'); > > > > > > > > > > Hi, > > > > > But my image is already in grayscale I mean the original image (I)??? > > > > > > > > Are you sure it is in grayscale, and not an RGB that looks like it is grayscale? Do one of two things: > > > > 1 - post the results of size(L) as well as size(I) > > > > 2 - post your original image somewhere so we can download it and run it through your code > > > > > > Could u try this link: > > > http://imageshack.us/photo/my-images/851/pvs6multiscale1j.jpg/ > > > > Are you sure that's the right image? It looks like a binary mask displayed in matlab then saved. > > > > In any case, the following code works with the image you provided: > > > > I = imread('pvs6multiscale1j.jpg'); > > imshow(I); > > threshold = graythresh(I); > > bw = im2bw(I,threshold); > > > > % remove all object containing fewer than 30 pixels > > bw = bwareaopen(bw,180); > > > > L=bwlabel(bw,8); > > stats=regionprops(L, I ,'MeanIntensity'); > That's image is after the segmentation, it's my objective image,so it's strange it doesn't work on my Matlab (2009).It gives the mentioned before errors about 'not matching'...anyway,thank you! Sorry, I wasn't specific enough. Please post your original image, the one you are reading in the first step.
 Subject: MeanIntensity From: Aikerim Date: 21 Jul, 2011 18:25:10 Message: 11 of 16 "Jeff " wrote in message ... > "Aikerim" wrote in message ... > > "Jeff " wrote in message ... > > > "Aikerim" wrote in message ... > > > > "Jeff " wrote in message ... > > > > > "Aikerim" wrote in message ... > > > > > > "Jeff " wrote in message ... > > > > > > > "Aikerim" wrote in message ... > > > > > > > > "Jeff " wrote in message ... > > > > > > > > > "Aikerim" wrote in message ... > > > > > > > > > > Hello, > > > > > > > > > > Could someone provide me with an example (code) of meanintensity finding.I should calculate the mean object intensity in the range 0-100. I've tried regionprops (L,I,'MeanIntensity') , how to understand that size (I) must to be equal size (L) how to write or set it? > > > > > > > > > > I got these errors: > > > > > > > > > > ??? Error using ==> regionprops>ParseInputs at 1112 > > > > > > > > > > Size of I doesn't match size information found in the first input argument. > > > > > > > > > > > > > > > > > > > > Error in ==> regionprops at 154 > > > > > > > > > > [I,requestedStats,officialStats] = ParseInputs(imageSize, varargin{:}); > > > > > > > > > > please help! > > > > > > > > > > > > > > > > > > To calculate mean intensity, regionprops needs the raw image in addition to a labeled or binary image: > > > > > > > > > STATS = regionprops(..., I, properties) measures a set of properties for each labeled region in the image I. The first input to regionprops—either BW, CC, or L—identifies the regions in I. The sizes must match: size(I) must equal size(BW), CC.ImageSize, or size(L). > > > > > > > > > > > > > > > > > > An example: > > > > > > > > > stats = regionprops(BW_image, Intensity_image, 'MeanIntensity'); > > > > > > > > > > > > > > > > I knew these thing,the function.I dont know what should I put instead of Intensity_image??? > > > > > > > > My code: > > > > > > > > > > > > > > > > I = imread('pvs6multiscale1j.jpg'); > > > > > > > > imshow(I); > > > > > > > > threshold = graythresh(I); > > > > > > > > bw = im2bw(I,threshold); > > > > > > > > > > > > > > > > % remove all object containing fewer than 30 pixels > > > > > > > > bw = bwareaopen(bw,180); > > > > > > > > > > > > > > > > > > > > > > > > L=bwlabel(bw,8); > > > > > > > > stats=regionprops(L, _______ ,'MeanIntensity'); > > > > > > > > > > > > > > In this context, regionprops requires a grayscale image. The easiest way to do this is to use RGB2GRAY, but there are other ways: > > > > > > > > > > > > > > gray_img = rgb2gray(I); > > > > > > > L=bwlabel(bw, 8); > > > > > > > stats = regionprops(L, gray_img, 'MeanIntensity'); > > > > > > > > > > > > Hi, > > > > > > But my image is already in grayscale I mean the original image (I)??? > > > > > > > > > > Are you sure it is in grayscale, and not an RGB that looks like it is grayscale? Do one of two things: > > > > > 1 - post the results of size(L) as well as size(I) > > > > > 2 - post your original image somewhere so we can download it and run it through your code > > > > > > > > Could u try this link: > > > > http://imageshack.us/photo/my-images/851/pvs6multiscale1j.jpg/ > > > > > > Are you sure that's the right image? It looks like a binary mask displayed in matlab then saved. > > > > > > In any case, the following code works with the image you provided: > > > > > > I = imread('pvs6multiscale1j.jpg'); > > > imshow(I); > > > threshold = graythresh(I); > > > bw = im2bw(I,threshold); > > > > > > % remove all object containing fewer than 30 pixels > > > bw = bwareaopen(bw,180); > > > > > > L=bwlabel(bw,8); > > > stats=regionprops(L, I ,'MeanIntensity'); > > That's image is after the segmentation, it's my objective image,so it's strange it doesn't work on my Matlab (2009).It gives the mentioned before errors about 'not matching'...anyway,thank you! > > Sorry, I wasn't specific enough. Please post your original image, the one you are reading in the first step. http://imageshack.us/photo/my-images/825/pvs6.jpg/ here's an initial image before segmentation.but i should use the another one (in previous link)