Ricki Chindra
Ricki Chindra

Reputation: 27

Binary Image Matrix

How to find the matrix value from this signature picture?

enter image description here

how to find the matrix value from:

  1. RGB image to Gray Scale
  2. Gray Scale to Binary Image
  3. Binary Image to Inverted Binary Image
  4. Inverted Binary Image with clean border
  5. Inverted Binary Image with clean border to extract bounding box

I already know the code from RGB to extract bounding box:

%// Read in image and convert to binary
%// Also clear the borders
im = imread('http://postimg.org/image/qptg2jgsz/2a2705fb/');
im_bw = imclearborder(im2bw(rgb2gray(im)));

%// Find those non-zero pixel locations
[rows, cols] = find(im_bw);
min_row = min(rows);
max_row = max(rows);
min_col = min(cols);
max_col = max(cols);

%// Now extract the bounding box
bb = im_bw(min_row:max_row, min_col:max_col);

%// Show the image
imshow(bb);

Upvotes: 0

Views: 503

Answers (1)

Ander Biguri
Ander Biguri

Reputation: 35525

Edit: Actually in your code you already have the binary image... BW stands for Black and white...


Have you tried the basic Matlab example?

BW = im2bw(I, level);

In case you want an automatic choice of threshold level try Otsu's method.

level = graythresh(I)

Upvotes: 1

Related Questions