Find the edge of an image
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I wanted to find the edge in an palm image .when i use edge command i am able to get the edge but the output is in binary form. Is there any command to show the same edge representation in my original gray image?
0 Kommentare
Antworten (2)
David Sanchez
am 10 Jul. 2013
There is shorter way to do this, but the idea is this:
[rows cols] = size(I);
nI = zeros(rows,cols);
for row = 1:rows
for col = 1:cols
nI(row,col) = I(row,col)*double(BW(row,col));
end
end
imagescc(nI);
where I is your palm image and BW the image returned by edge and nI the image containing the edges with pixel values (gray scale values in your case) instead of ones
David Sanchez
am 10 Jul. 2013
Are you sure you are assigning matrices correctly? Try this out. In this case, I is an image in matlab database. nI can not be binary since neither I nor double(BW) are.
I = imread('circuit.tif');
BW = edge(I,'prewitt');
[rows cols] = size(I);
nI = zeros(rows,cols);
for row = 1:rows
for col = 1:cols
nI(row,col) = I(row,col)*double(BW(row,col));
end
end
imagesc(nI);
>> whos
Name Size Bytes Class Attributes
BW 280x272 76160 logical
I 280x272 76160 uint8
col 1x1 8 double
cols 1x1 8 double
nI 280x272 609280 double
row 1x1 8 double
rows 1x1 8 double
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!