How to get the binary value inside the binary image?

조회 수: 1 (최근 30일)
Wei Qing
Wei Qing 2012년 8월 7일
How to extract the binary values inside the binary image into a set of array?
For example:
h = { 0 1 1 0 1 1 0 0 0 1 1 0 1 0 }

채택된 답변

Junaid
Junaid 2012년 8월 7일
Could you explain the example little more.
Let say you have binary image B, it is already binary so you can convert into array by
B(:)
I hope this is what you want right ?
  댓글 수: 2
Wei Qing
Wei Qing 2012년 8월 8일
편집: Wei Qing 2012년 8월 8일
ya. i want to get the binary data inside the binary image n store to an array. Then after that i am able to compare the binary data to another binary data get from different binary image. It is about the matching process of a finger-vein biometrics system. The binary image is finger-veins that i extracted from the finger region. The binary image is look like tis http://www.freeimagehosting.net/cq1wq.
Wei Qing
Wei Qing 2012년 8월 8일
the B(:) is get the pixels value of the binary image. But i tink i m able to solve it by convert any pixels value greater than 127 to 1 and pixels value lower than 128 to 0.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2012년 8월 8일
편집: Image Analyst 2012년 8월 8일
The binary data is already in an array - a cell array, as we can tell from the braces. I'm not sure how it got into a cell array in the first place, but anyway, to get it into a regular numerical array (a double), try this:
h = { 0 1 1 0 1 1 0 0 0 1 1 0 1 0 }
h_matrix = cell2mat(h)
To extract certain elements, just index it. For example, let's say you want elements 3 through 5. Then do this
subMatrix = h_matrix(3:5)
If you have a numerical array already (unlike the cell array that you gave as an example), and you want to convert it to a logical (binary) array, you can threshold. For example to set all values above some threshold value to true (1) and lower to false (0), you can do this:
thresholdValue = 127; % Or whatever value you want.
binaryArray = yourMatrix > thresholdValue;
  댓글 수: 2
Wei Qing
Wei Qing 2012년 8월 8일
The h initially should be a empty array. Then, i want to extract the binary data from the binary image to the empty h array. For example:- initially h={} after extract data from the image then h = { 0 1 1 0 1 1 0 0 0 1 1 0 1 0 }
Image Analyst
Image Analyst 2012년 8월 8일
This doesn't make sense. How on earth did you get numbers from nothing? Did you use a random integer generator, like randi()?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by