Height and width of an image

1 Ansicht (letzte 30 Tage)
Wong Wei Weng
Wong Wei Weng am 8 Okt. 2018
Kommentiert: Guillaume am 8 Okt. 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 Kommentare
KSSV
KSSV am 8 Okt. 2018
Bearbeitet: KSSV am 8 Okt. 2018
Read about imdistline, regionprops.
Wong Wei Weng
Wong Wei Weng am 8 Okt. 2018
can it be 2 value? one horizontally and one is vertically?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

ANKUR KUMAR
ANKUR KUMAR am 8 Okt. 2018
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 Kommentare
Guillaume
Guillaume am 8 Okt. 2018
Note:
nnz(something)
is simpler and a lot faster to compute than:
length(find(something))

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by