Impixel alternative for LAB Colour space

1 view (last 30 days)
Liz
Liz on 18 Feb 2014
Edited: Liz on 18 Feb 2014
Hello everyone, I've wrote a program for road extraction to find lines in an image and then do some colour segmentation to display the road. I originally did this in RGB colour model, and plotted the Hough lines on the original image and determined the mean colour of the lines for each RGB attribute. I realise I may get better results in LAB colour space but I'm struggling to determine how. Impixel function doesn't work in LAB, correct? This is part of the code for the RGB scheme;
% Find any lines in the image
lines = houghlines(Grey,theta,rho,P,'FillGap',2,'MinLength',10);
% Plot lines on original image
figure, imshow(I), hold on
P=[];
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
% Plot beginnings and ends of lines
plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');
plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');
% find average road colour - get all co-ords between endpoints
[x, y]=bresenham(xy(1,1),xy(1,2),xy(2,1),xy(2,2));
LineCoOrds{k}=[x, y];
% Get RGB values for these points & their mean for each indivdual line
P{k} = impixel(I,x,y);
Meanpix{k}=mean(P{k});
end
I know how to convert to LAB from RGB already
cform2lab = makecform('srgb2lab');
LABimage = applycform(I, cform2lab);
Any help is greatly appreciated
Many thanks!

Answers (0)

Community Treasure Hunt

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

Start Hunting!