slicing image by histogram

조회 수: 1 (최근 30일)
Tarik Razak
Tarik Razak 2012년 2월 10일
Hi I have image of connected text I was trying to use histogram vlues to segment it/slice it. Basicaly im=imread('test.jpg') 1. take histogram of the test image 2. slice/segment the image wherever the value of histogram is below certain number what would be the best way to do that? thanks

답변 (2개)

Image Analyst
Image Analyst 2012년 2월 10일
See my BlobsDemo tutorial on this topic:
Basically
binaryImage = grayImage >= lowThreshold & grayImage <= HighThreshold;
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'all');
You supply values for lowThreshold and highThreshold of course.

Tarik Razak
Tarik Razak 2012년 2월 10일
when i read grayImage=imread('image.jpg') and use the above code i get the error ??? Undefined function or method 'regionpropos' for input arguments of type 'double'.
Did i read it in wrong format? thanks
  댓글 수: 1
Image Analyst
Image Analyst 2012년 2월 11일
regionpropos() is not a function. Try regionprops() like I suggested. ALso make sure your image is grayscale:
[rows columns numberOfColorChannels] = size(grayImage);
if numberOfColorChannels > 1
grayImage = grayImage(:,:,2); % Take green channel only
% grayImage = rgb2gray(grayImage); % Alternative, weighted average of RG&B
end

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

Community Treasure Hunt

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

Start Hunting!

Translated by