How to code this in matlab

10 visualizzazioni (ultimi 30 giorni)
Poonam
Poonam il 26 Mar 2013
Given-Seed which is selected as initial seed is centre pixel of an RGB image
For grow formula we use intensity based similarity between seed and 8 neighbour pixels of the seed
The similarity index between two neighbourhood pixels of RGB intensities (x,y) and (x+i,y+j)is given by
Dist=sqrt(Dr+Dg+Db);
where
Dr=((f(x+i,y+j,1)-f(x,y,1))^2
Dg=((f(x+i,y+j,2)-f(x,y,2))^2
Db=((f(x+i,y+j,3)-f(x,y,3))^2
  2 Commenti
Sean de Wolski
Sean de Wolski il 26 Mar 2013
What have you done so far?
Poonam
Poonam il 26 Mar 2013
This is what i have done for HSV image
function d=dist(f,seed,cp8)
r=rgb2hsv(f);
[m,n]=size(r);
seed=[m/2,n/2];
Dh=(r(x+i,y+j,1)-r(x,y,1)).^2;
Ds=(r(x+i,y+j,2)-r(x,y,2)).^2;
Dv=(r(x+i,y+j,3)-r(x,y,3)).^2;
d=sqrt(Dh+Ds+Dv);

Accedi per commentare.

Risposte (1)

Image Analyst
Image Analyst il 26 Mar 2013
Calculate delta E as in my demo http://www.mathworks.com/matlabcentral/fileexchange/31118-color-segmentation-by-delta-e-color-difference. Basically that's the color difference.
Does the value of the seed change from pixel to pixel (difficult), or is it always going to be the color that you selected as the first seed point (very easy)?
  2 Commenti
Poonam
Poonam il 26 Mar 2013
seed point is going to be always the color which was selected as first seed point
Image Analyst
Image Analyst il 26 Mar 2013
Then my delta E app is exactly what you want. Download it and run it. If you want, you can replace imfreehand() with ginput(1) so that you pick a single pixel rather than outlining a region.

Accedi per commentare.

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by