Calculate power of each area
Show older comments
I want to calculate the power for each of the shapes in the picture.
Any help?!!

4 Comments
Image Analyst
on 31 Jul 2023
Not sure what you mean. You can read off the power from the Y axis. It's the height of the colored shape. What are you starting with? Do you have the data that plotted the diagram? Or do you have only the image and you need to find the height of each shape? And what does An represent? Is that the energy (= power * time)? And what do the Q1, Q2, and Q3 scattered in several places along the x axis mean? Do you have numerical values for those?
I've verified that Axx is the area of each shape, so yes it would be watt-hours. I'm assuming you want maximum power for each region?
Of course, the only way to get power with the original label ordering would be to calculate all of the areas first and then decipher which labels belong to which region -- because the diagram is completely unclear about which regions are which (some aren't even readable). So does the region numbering even matter? If the numbering doesn't matter, then there's obviously a further question.
Image Analyst
on 31 Jul 2023
@DGM I still don't know what "." means. For example at around Timer=6 you have "Q2.Q3" -- what exactly does that mean? And the A1 shape has an area (if A means area) of "4500.Q2". What does that mean? Is the dot supposed to be a multiplication sign? And is the width of the A1 block Q2? If so Q2 would be 5, or since it's half way along, would it be 2.5? If the width is Q2 then the area (energy) would be about 950*Q2, not "4500.Q2" as it's marked.
So if Q2=5, then A1 = 650 Watts * 5 hours = 650 (joules/second) * 5 hours * 3600 (seconds/hour) = 11.7 million joules of energy. Anyway, he wanted power not energy so we just need the height of the shape. But it's unclear what the power of a shape means exactly when the shape is stacked on top of another shape, for example A16. Is the power of A16 5450 (the height from the time axis) OR is it 5450 - 3000 (which is just the height of the light blue A16 rectangle)?
And for "Q2.Q3" at around 6, does this mean that Q3 times Q2 equals 6???? Or is Q2 the integer part and Q3 the fractional part to the right of the decimal point.
Overall an extremely confusing diagram!
Tasneem Abed
on 31 Jul 2023
Answers (1)
I'm just going to throw this out there.
% this image has points marked manually
inpict = imread('bbbbbb.png');
% data range from original image axis labels
xrange = [0 20];
yrange = [0 6000];
% get vertices and calibration info from marked image
axmask = all(inpict == permute([255 0 0],[1 3 2]),3);
vtmask = all(inpict == permute([0 255 0],[1 3 2]),3);
S = regionprops(axmask,'centroid');
axpts = vertcat(S.Centroid);
S = regionprops(vtmask,'centroid');
vertices = vertcat(S.Centroid);
% rescale to fit data range
pbrect = [axpts(1,:) diff(axpts,1,1)];
xx = xrange(1) + diff(xrange)*(vertices(:,1)-pbrect(1))/pbrect(3);
yy = yrange(1) + diff(yrange)*(pbrect(4) - (vertices(:,2)-pbrect(2)))/pbrect(4);
% get a list of which vertices belong to each polygon
pgons = {[1 2 4 3]; [3 4 6]; [4 7 6]; [6 10 11 7]; [5 6 9]; [6 10 9]; [9 11 14 13]; [8 9 12];
[9 13 12]; [12 16 15]; [15 18 19 16]; [12 14 33 31]; [15 18 17]; [17 21 20];
[20 24 23]; [23 27 26]; [29 30 34]; [34 35 37]; [37 38 40]; [40 41 43]; [43 44 46];
[17 19 22 21]; [20 22 25 24]; [23 25 28 27]; [26 28 31 29]; [30 32 36 34]; [35 37 39 36];
[39 42 40 38]; [41 43 45 42]; [44 46 47 45]; [46 47 48]; [32 33 50 48]; [48 52 53];
[49 53 48]; [49 53 54 50]; [53 54 57]; [53 57 56]; [53 56 55 51]; [55 57 60 58]; [59 60 62 61]};
% get some info about each polygon?
npgons = numel(pgons);
regionarea = zeros(npgons,1);
regionheight = zeros(npgons,1);
regionwidth = zeros(npgons,1);
for k = 1:numel(pgons)
px = xx(pgons{k});
py = yy(pgons{k});
thispgon = polyshape(px,py);
regionarea(k) = area(thispgon);
regionheight(k) = range(py);
regionwidth(k) = range(px);
end
% display it
table(regionarea, regionheight, regionwidth)
Not sure if that's useful, since the order doesn't correspond to the original order, but given the area, you could correlate the two.
EDIT: Oh. There's code. Well maybe I'll look at that later.
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!