Calculate intersection (overlapping area) of two polygons (of which one a 35 sided irregular polygon) without the use of polybool function
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kid
el 22 de En. de 2014
Comentada: aosheng xuanyuan
el 24 de Oct. de 2015
I would like to calculate the coverage of the Pointer's gamut by any color space or display gamut in both the CIE 1931 xy chromaticity diagram and the CIE 1976 u'v' chromaticity diagram in Matlab R2013b. The only downside is that I can't use the polybool function of Matlab, because my student license does not include licensing for the Mapping Toolbox.
For examples see the images linked to below. The first is for CIE 1931 xy, the second for CIE 1976 u'v'.
The blue polygon is the spectral locus and line of purples (line segment connecting both ends of the curved part) and makes up the edge of the CIE 1931 xy and CIE 1976 u'v' chromaticity diagrams respectively.
The green polygon is the edge of the Pointer's gamut (or in this case an approximation thereof)
The red triangle in this case is the color space of the Rec. 2020 standard for 8k UHD / Super Hi-Vision, but can be any 3 to 6 sided convex irregular polygon as long as the vertices are inside or on the blue line.
What I would like to do is calculate the intersection of the red and green polygon, so that when I divide the result of that by the area of the green polygon I know the coverage of the Pointer's gamut. This seems fairly easy using the polybool function in Matlab, but without using that I have no idea where to start. Any ideas?
Probably not very helpful, but the code I used for the images is:
X = xlsread('pointerdata.xlsx','specloc','B2:B323');
Y = xlsread('pointerdata.xlsx','specloc','C2:C323');
P = xlsread('pointerdata.xlsx','calculations','DF9:DF44');
Q = xlsread('pointerdata.xlsx','calculations','DG9:DG44');
L = xlsread('pointerdata.xlsx','calculations','DF47:DF50');
M = xlsread('pointerdata.xlsx','calculations','DG47:DG50');
plot(X,Y,P,Q,L,M)
axis equal
axis ([0 0.8 0 0.9])
set(gca,'XTick',0:.1:.8)
The Excel-file is also attached.
Respuesta aceptada
Image Analyst
el 22 de En. de 2014
Do you have the Image Processing Toolbox? If so, use poly2mask to create binary images of the images, then AND them together
b1 = poly2mask(x1, y1, rows, columns);
b2 = poly2mask(x2, y2, rows, columns);
overlap = b1 & b2;
Más respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!