How to name the cubes or identify them on a image after dividing an image into cubes?

조회 수: 4 (최근 30일)
I have a 8-bit tiff image(200x512) which I divided into cubes this way:
1) Make the midline(mid horizontal row) of the image by making the pixels in that row to black.
2) Draw such lines for every 14 rows from the midline till the bottom of image AND from the midline to the upper part of the image.So, now we get 13 pixels between each row.
3) Draw lines by making the pixels black vertically for every 14 pixel columns till the last column of the image.
Now, I have a image with cubes on it(like a grid). And I want to identify each cube so that I can delete the cubes which have black pixels greater than a threshold.
Can anyone help me out in identifying the cubes!!

답변 (1개)

Image Analyst
Image Analyst 2016년 9월 23일
Just threshold that image, label it, and call regionprops asking for the Euler number. The Euler number tells you how many holes there are in each region. Then get a vector saying which regions have more than some threshold number of holes and use ismember to extract them. It's pretty trivial.
labeledImage = bwlabel(grayImage > 0);
props = regionprops(labeledImage, 'EulerNumber');
allEulerNumbers = [props.EulerNumber];
badRegions = allEulerNumbers < ......whatever
badLabels = ismember(labeledImage, badRegions) > 0;
% Erase bad regions from gray scale image
grayImage(badLabels) = 0;
etc. Attach your lined image if you can't figure out how to complete it.
  댓글 수: 2
Varshini Guddanti
Varshini Guddanti 2016년 9월 23일
I cannot attach the image due to privacy issues.
My image is actually 8-bit uint8 green-black image [0 255][black green](if I'm saying it right!). But when I tried to display that image I only get a gray image but not my green one.
But, when I applied thresholding to my grayimage, my image got more disturbed.
Image Analyst
Image Analyst 2016년 9월 23일
Then don't use your private image. Use one of the demo images that ships with MATLAB and post the lined version of that.

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

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by