Fast edges of a color image (actual color, not converting to grayscale)

버전 1.1.0.0 (2.31 KB) 작성자: Joao Henriques
Edges of a color image by the max gradient method.
다운로드 수: 6K
업데이트 날짜: 2010/7/7

라이선스 보기

Extracts the edges of a color image without converting it to grayscale.

Changes in color are detected even when the grayscale color of two pixels are the same. The edge strength is typically greater or equal to the magnitude obtained by simply filtering a grayscale image.

Optionally, the edge orientation can also be returned.

Example:
The image generated by the example code (presented here as the screenshot) shows two edge types:
White - edges found by both methods.
Red - edges found only by the color method.

This clearly shows that a significant amount of information is lost by the standard method, but it is recovered with the gradient method.

figure, im = imread('peppers.png'); imshow(im)

%get color edges and normalize magnitude
C = coloredges(im);
C = C / max(C(:));

%get grayscale edges and normalize magnitude
G_image = single(rgb2gray(im)) / 255;
G = sqrt(imfilter(G_image, fspecial('sobel')').^2 + imfilter(G_image, fspecial('sobel')).^2);
G = G / max(G(:));

%show comparison
figure, imshow(uint8(255 * cat(3, C, G, G)))

Algorithm:
The RGB color of each pixel is treated as a 3D vector, and the strength of the edge is the magnitude of the maximum gradient. This also works if the image is in any other (3-dimensional) color space. Direct formulas for the jacobian eigenvalues were used, so this function is vectorized and yields good results without sacrificing performance.

인용 양식

Joao Henriques (2025). Fast edges of a color image (actual color, not converting to grayscale) (https://www.mathworks.com/matlabcentral/fileexchange/28114-fast-edges-of-a-color-image-actual-color-not-converting-to-grayscale), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2008b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.1.0.0

Updated example and screenshot, to show the differences between the standard method and the one presented here.

1.0.0.0