Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
involving region latitude and longitude in regionprops

Subject: involving region latitude and longitude in regionprops

From: edward kabanyas

Date: 24 Apr, 2012 01:46:08

Message: 1 of 4

Hi all,

Assuming that I have an image file as "data". Data size (row =176, coulumn = 450)

 lat = -15: 0.2: 20; %size is the same as row of data
 lon = 70.2 :0.2:160; % size is the same as column of data

T0 = 25.0; % threshold for data
RL = zeros(size(data));
RL(find(data > T0)) = 1;

RLL = bwlabel(RL,4);

STATS = regionprops(RLL, 'Area','Centroid');

Question: how to involve latitude and longitude in regionprops so that the 'Area', 'centeroid' will be in km^2 and latitude,longitude, respectively.

Thanks for sharing,

EDward

Subject: involving region latitude and longitude in regionprops

From: ImageAnalyst

Date: 24 Apr, 2012 02:38:52

Message: 2 of 4

On Apr 23, 9:46 pm, "edward kabanyas" <djuky_...@yahoo.com> wrote:
> Hi all,
>
> Assuming that I have an image file as "data". Data size (row =176, coulumn = 450)
>
>  lat =  -15: 0.2: 20; %size is the same as row of data
>  lon =   70.2 :0.2:160; % size is the same as column of data
>
> T0 = 25.0; % threshold for data
> RL = zeros(size(data));
> RL(find(data > T0)) = 1;
>
> RLL = bwlabel(RL,4);
>
> STATS = regionprops(RLL, 'Area','Centroid');
>
> Question: how to involve latitude and longitude in regionprops so that the 'Area', 'centeroid' will be in km^2 and latitude,longitude, respectively.
>
> Thanks for sharing,
>
> EDward
----------------------------------------------------------------------------------
Well isn't the lat just -15 + 0.2*(rowNumber)? And longitude just
70.2+0.2*columnNumber?

For area:
xCalibration = abs(lon(end)-lon(1))/length(lon);
yCalibration = abs(lat(end)-lat(1))/length(lat);

area = areaInPixels * xCalibration * yCalibration;

Subject: involving region latitude and longitude in regionprops

From: ImageAnalyst

Date: 24 Apr, 2012 02:39:42

Message: 3 of 4

Of course you also need to know how many km are in a lat or long, if
they aren't already in units of km.

Subject: involving region latitude and longitude in regionprops

From: edward kabanyas

Date: 24 Apr, 2012 03:00:09

Message: 4 of 4

Hi ImageAnalyst,

Thanks for your reply.

> Of course you also need to know how many km are in a lat or long, if
> they aren't already in units of km.

Thus, we can not directly involve the latitude and longitude in the regionprops, but we further calculate the parameters within STATS to get them in km or longitude/latitude position.

Edward

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us