File Exchange

image thumbnail

Image segmentation & Extraction

version 1.0 (19.5 KB) by

This program segments and extracts objects from an image.

96 Ratings



View License

Editor's Note: Popular File 2008 2009 2010 2011

A simple program for object extraction from images.

Comments and Ratings (157)

Divya Pretty

pls send the code "A methodology or extracting standing human bodies from single images"

Divya Pretty

hello ...anyone pls help me...i'm doing a project "A methodology or extracting standing human bodies from single images"
so i need code for my project...its very urgent guys..i hv vry less time....can anyone pls send the code ...
thanks in advance..


ilamparithi E

Hi I'm doing project on "text extraction from image using ensemble methods"...I need a matlab code for decision tree..plz do consider this and help u...

siva prakash

tumor size measurement after segmentation in matlab source code

qais ahmed

thank you in advance

pei liu

many many thanks, I'll have a try!

rami mohsen

Oh Farid !

Hello everyone. im doing my project which is extracting wound image using Dynamic Color Distribution Entropy of Neighborhoods technique. Anyone have seen or using this technique? please help me find out this coding.

thanx in advance.

ramin barati

Hello everyone.. im doing my project in Image Processing(brain tumor seg.) using ACO tech.(ant colony optimization)
so can anyone pls help me find out the codings of it..
im urgently in need of it...

Hui Zhou

thank you


lucky (view profile)

i have a project on traffic sign detection..plz provide me code for the same

shodhan gk

Anybody having code for hand written circuit recognition using matlab...thank u in advance..
if hav means plz send me(

monika shah

hello, i am having problem extracting features from segmented mammogram images. can anybody provide me code for feature extraction? my email id is,, thankyou!


NITHYA (view profile)

pls guide me to form the fitness function in PSO for brain tumor detection using gray value of the image


MALU P (view profile)

Pls get me the code for segmentation


swathi (view profile)


MUFIX (view profile)


sindhu (view profile)

plz tell me after extracting building and their shadow using envi how we calculate the length of shadow automatically?
Is their any code for obtaining this length?
thanx a lot in advance


komal (view profile)

hey everyone, can i get the code for deep segmentation of an image using kn-n algorithm..
my email id is please do forward.


hoang (view profile)



Harold (view profile)

Is it possible to store the logical array of each segment into a 3 dimensional array? I need to be able to call up the logical array representation of each segment.



hi , your code was easy to underestand , thanx :) but i hav ea question plz answer it as soon as possible : how can i extract all of components by loop? i tried so many ways but in every single of them i faced an error , may you pleas explain it to us? thax alot


raj (view profile)

Hello everyone.. im doing my project in Image Processing(brain tumor seg.) using ACO tech.(ant colony optimization)
so can anyone pls help me find out the codings of it..
im urgently in need of it...


hello, my email is If anybody can have code regarding Text Extraction From images using DWT.please send me


hello sir, i am doing my research work in Text Extraction From images using DWT.Can I get matlab coding regarding this project .I mainly face problem to remove non- text regions, help me sir.

pankaj soni

is this program worked only for given image?
What is the application of this program beyond the test image "car3.jpg" ?

Mehmet Erdem

does anyone studied 'The Pixon Method Image Segmentation' with MATLAB? any ideas about how should i proceed?

priswe kumari

hey!i m doing my final year project on Multivariate image segmentation using semantic region growing with adaptive edge penalty by A.k can i get source code of it.i want it for reference.?if any one has kindly mail it to


NAVIN (view profile)


sunil Kumar

how to use loop to extract all number

hemanth kumar

i got the output.. it's really good.... i need the algorithm how to extract the features from the segmented images ... Anybody can help me plz my id


please give me the code for marching cubes.

wht should i enter when it asks for 'enter the file name'car3.jpg is giving error Undefined variable "car3" or class "car3.jpg".

zheli hairan

im=imread(k)is wrong ,it should be im=imread('k');

raj kumar

hi jeny rajan i am rajesh doing my final semester project can i able to get code for number plate location using contour algorithm thanks in advance.just for reference i think it will help me to build my code with regards rajesh

mimi phuong

Hello Jeny,
How does it work for 3D case? for the msk and B?

siri mendu

sir im doing project on face recognition plz send me the code for face feature extraction


Tranos (view profile)

I am trying to code the use of local median in active contour without edges but I don't understand the following: Correspondingly, f1 and f2 are computed with
f1 = median(u0 ∗ H(φ) ∗W) (10)
f2 = median(u0 ∗ (1 − H(φ)) ∗W) (11)
How do f1 and f2 look like?
Can some1 help?

Jay Moothy

Can i get matlab code for watershed segmentation???



dileep kumar

Enter the file nameseg.m
??? Error using ==> imread at 357
Can't open file "C:\Users\ghost\Documents\MATLAB\seg" for reading;
you may not have read permission.

Error in ==> seg at 8

plz help me overcome this error.......................

i wish to detect specific fungi colonies that are of black/white coloured......these colonies have different patterns......plz help me in dis regard


valli (view profile)


Dalal (view profile)

i am trying to segment the image of signature
is it possible to apply the same code ? if not ,, can anyone help me plz
thank you

Damien Garcia

Damien Garcia (view profile)


Ben (view profile)

please dont forget mail id is.....


Ben (view profile)

hello every body, can you give me a code for building extraction using mathematical morphologie ?? and thanks a lot

Thank you for your great effort

plzzz send me a matlab code for image segmentation using morphology.......plzzzz somebody help me...

pls send some matlab code(.m file) for image segmentation using mail id is.......


Matt (view profile)



I don't really see what use could ber done by such a code beyond the example... It is good I think in order to have a first approach of basic functions use if you are a Matlab newbie (rgbtogray, bwlabel, ...) that you sometimes search for hours.

However, I don't really see who may use taht in the future...

Mark Hayworth

I'm truly baffled why this poorly commented, poorly coded, piece of ad hoc code is the third most downloaded in the last 30 days. It just must be self perpetuating - people see it at the top of the list and download it so it stays at the top of the list. It is so bad in too many ways to list. The author clearly doesn't know how to use the Image Processing Toolbox functions. If you want a much, much better image segmentation demo/tutorial, check out this one: (A pick of the week)

nonie ideris

dear sir,
i have a picture of a horse with human, but i only need to extract an image of a horse, thus, i decided to try doing region of interest method. can u please show me the coding to do image segmentation using ROI? thank you so much for your help. =)

its good idea but not so general since the number of the connected labels can be change and the id i think should be added information of shape of digits for improvr rate of recognition


thank you


Renji (view profile)

well good work

hendra togi

hi sir..
I have a project in Digital Image Processing.
My project title is : Robust DWT-SVD Domain Image Watermarking.
I have a problem. after applying SVD to cover image and the visual watermark, I have no idea hoe to modify the singular values of the cover image in each subband with the singular values of the visual watermark
Thank you.


Ashar (view profile)

Dear Jenny rajan,
here in my case first i need to read an image from the expm then need to normalize the concentrations in the chamber from 1 to 0, 1 for brighter image and 0 for dark they are black and white and to compute the standard deviation along some lines perpendicular to the chamber axis to see the mixing in that chamber. how to write a program to calculate this. Your feed back will be highly appreciated. Thanks in advance


i want to know how this program cuts a certain portion and also i want to know how to make this extract with true colour. pls give me solution soon

kumar kumar

how to give the value if i want to get all the text objects. if i give 17 i get only one , if i give any other i get only some dot.....


Rushmi (view profile)

What if I want to extract the plate from image of high resolution.
Also I want to extract the whole frame from the image.

thanks for the simple code.
it's exactly what i wanted!


its working fine, great. is there any technique to find automatically ROI. I am working on fingerprint compression.

gourav kumar soni

thank you ,, it helhs me.

majid uwanoich

hi, I can not download it?!!!

huang etoun

florin raja

javid ullah


Al F

sorry i'm a complete idiot, it does what it's supposed to. Ignore the last comment!

Al F

??? The function, script, or class seg
cannot be indexed using {} or . indexing.

jiang maple


chenna rao


RC Choong

i got ant error in this
??? Attempt to execute SCRIPT edge as a function.
Error in ==> car at 11
BW = edge(im1,'sobel'); %finding edges
can u help me find out what is problem, thank you

mohammad amin abou harb

extremely specific i mean you chose the 17th object in L==17 no intelligence as far as im concerned

mes liste

Sujeong You


Shashank Tyagi

gr8 it worked for me ...

oodbae adriano

it didn't work by me. all commands would be described as unknown

sunil samant

chuleeporn Kan

Thanks .

krishna patteti

Phyu Moe

For teaching and learning

Lev Che

Francois Appert

fizz aq


rama prad

benchalgo SAMY

goood software...

manoj kannan

manoj kumar


manoj kumar

good for software implementation

Xz Xz


Diego Barragán

very good

martin ruzek

I think you should connect all the commands that are needed, for example I am not able to run it because I dont have command rgb2gray and others

yuanquan wang

ko soe


yousef mowaswasah


paresh patel

liao zhijian

thank you

Aya kh


amy lia

selma salem

When i use quadtree program to segmente my grayscale image, i get in the result a binary image segmented!, can you help me to obtain a grayscale one.

Soumen Barik

I think it will help us in our project..

Zahra Chaghazardi

Dear Chris Shoemaker
I am working on the watermarking project in spread spectrum domain. I want to simulate it by matlab. can you help me about this?

wenjun wu

Taner Ince

loges waran

good work

suresh siri


gelare ta

Deepak Malani Malani

yati mr

mohan p


Maoyuan Chen

Good work!

Anonymous Voter

sneha latha



Özkan SARI

only reads your image. I tested with some other car images and your program fails.

brijesh tripathi

Gaurav Tripathi

This is a gud one.

avinash pokhriyal


Maria Garcia

This is goooooood!

Chunyi Chen


s b

Good work!

subasri muthalraj

Lihardo Ranja


kruthika rathinavel

im getting an error == > conv2

a moh

i tried to run it but i get this error
??? Error using ==> conv2
First and second arguments must be single or double.

Error in ==> seg at 20
B=conv2(BW,msk); %Smoothing image to reduce the number of connected components


gaurav santhalia

plz tell me what input should i when it is asked to give input i give as car3...but there is an error...plz suggest me...

Karthik Raja

Simply Padam... ok Good

mohan reddy

mohamed hassan

thank you

Simon Lin

BW arguments must be single or double, if so, please update code.

Benamira Elias

Thanks Jeny! Simple and useful

Mohamed Sami

nice work

Mahdi Yazdian

nejat rahman

cool coolleen

i m doing my final year project of mini portions segmentation method in face recognition using matlab. may i know how to put my cropped small portions of the face into matrix (eg: 6x9 matrix, where 6 refer to number of photos, n 9 refer to the number of small portions). by the way, i also would like to know how can i compare the matrix column by column in order to get the eigenvalues. n i m new to matlab, so i hope u will help me to clear my doubts. if u have to source code, pls send a copy to me. thanks and really appreciate for your help. Hope can hear from u soon.

Tony Gladvin George

As Mr.Sergei KOptenko indicated, line no:17 "B=conv2(BW,msk)" will throw an error. Please use "B=conv2(double(BW),msk)", instead.

Alex Denone

boonrit pongsatitpat


venkatesh sundararaj

Xin Huang

too simple and meaningless. more complex examples need to be added. and objects extraction can be subdivided to supervised method and Un-su one, this code is an Un-su algorithm, can it extract all the objects of interests in an Un-supervied approach?

lissa anastasia

tq for the code.i try to run this code into matlab..but why the command 'imread' is going error?below is the error..

Enter the file nameseg.m
??? Attempt to execute SCRIPT imread as a function.

Error in ==> Untitled8 at 7

mufid mufid

i used part of the porgram for detect license plate of the car but.. there many other object is there any one can help me to fill the other edge or object without effect the license plate?

Wang Bin

Well done.
The contour detection is good.But I am confused what does the last figure intend to show?

Jagannath Reddy

Ajimon S

Really good

Sergei Koptenko

1) In Matlab R14(SP2) it gives:

??? Error using ==> conv2
First and second arguments must be single or double.

Error in ==> seg at 17
B=conv2(BW,msk); %Smoothing image to reduce the number of connected components

2) What is the application of this program beyond the test image "car3.jpg" ?



adding BSD license

MATLAB Release
MATLAB 6.1 (R12.1)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today