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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by shantanu shukla
on 14 Nov 2013

a=imread('a6.jpg'); m=ones(600,800,3); c=255.*m; e=ones(600,800,3) for i=1:600; for j=1:800; if a(i,j,1)<100 if a(i,j,1)>55 c(i,j,1)=a(i,j,1); if a(i,j,2)<104 if a(i,j,2)>75 c(i,j,2)=a(i,j,2); if a(i,j,3)<90 if a(i,j,3)>56 c(i,j,3)=a(i,j,3); end end end end end end end end e=c./255; colormap(jet); image(e); ...

Answer by Image Analyst
on 25 Nov 2013

You cannot get it from thresholding or even combined with texture classification. There is just too much higher level knowledge required. Maybe try this: http://www.mathworks.com/matlabcentral/fileexchange/37197-dem-diffused-expectation-maximisation-for-image-segmentation or similar. But even that won't be perfect. I suggest you use ginput or roipoly to manually locate them (unless you have thousands of images).

## 5 Comments

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/106050#comment_179860

Could you upload a copy of the image?

## shantanu shukla (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/106050#comment_180645

## shantanu shukla (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/106050#comment_180646

Here is the image file and there is a little bit change in code. plz rply me asp thank u

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/106050#comment_180650

Which object(s) are you trying to extract?

## shantanu shukla (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/106050#comment_181776

Mr. Walter i want to extract tree ,river ,houses and roads. so plz help me regarding this