MATLAB Answers

0

Height and width of an image

Asked by Wong Wei Weng on 8 Oct 2018
Latest activity Commented on by Guillaume
on 8 Oct 2018
Hi, is it possible to find the height and width of the object inside an image? I had attached an image with white and black line to find width and height value

  2 Comments

KSSV
on 8 Oct 2018
Read about imdistline, regionprops.
can it be 2 value? one horizontally and one is vertically?

Sign in to comment.

Tags

1 Answer

Answer by ANKUR KUMAR on 8 Oct 2018
 Accepted Answer

Try this,
A=imread('testing.jpg');
AA=rgb2gray(A);
len=max(arrayfun(@(x) length(find(AA(:,x)~=255)),1:800))
bred=max(arrayfun(@(x) length(find(AA(x,:)~=255)),1:800))

  9 Comments

is it I straight used in the axes or?
Guillaume
on 8 Oct 2018
Note:
nnz(something)
is simpler and a lot faster to compute than:
length(find(something))

Sign in to comment.