how to convert unit8 type images to logical type

조회 수: 14 (최근 30일)
neha viswanath
neha viswanath 2015년 2월 16일
댓글: neha viswanath 2015년 2월 17일
if true
myFolder = 'E:\\inverted\\i1';
for PicNum = 100:-1:1;
fullFileName = fullfile(myFolder,sprintf('%d.bmp',PicNum));
fprintf(1, 'Now reading %s\n', fullFileName);
imageArray{PicNum}=imread(fullFileName);
logical(imageArray{PicNum});//here im trying to convert my images to logical but its not happening
imshow(imageArray{PicNum}); % Display image.
end
end

채택된 답변

Image Analyst
Image Analyst 2015년 2월 16일
To convert a gray level image to a logical binary image you must threshold:
binaryImage = grayImage > someValue;
  댓글 수: 4
neha viswanath
neha viswanath 2015년 2월 16일
thankyou sir
neha viswanath
neha viswanath 2015년 2월 17일
sir,I need to access each image in cell array.
if true
for i=1:1:100
feature_extractor(logicalImage{i});
end
end
so i could get features of all the images in 'ans'.with the above code i could not accomplish my task.can you please help me out.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Adam
Adam 2015년 2월 16일
편집: Adam 2015년 2월 16일
imageArrayLogical = cellfun( @(im) logical(im), imageArray, 'UniformOutput', false );
or you can just do it in a for loop if you prefer. Note the result is still a cell array of your data so you still have to index into it using cell notation.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by