Usually this is done not by the count of lines (up, down, left, right), but by the angle of one pizza slice. The whole pizza is 360 degrees, so you may choose a number like 10-20-30 degrees, to make slices even. Then take the x, y
coordinates of the image pixel and after subtracting the center pixel coordinates calculate the slice number as atan((y - y_center)/(x - x_center))
.
To avoid calculation complications, you may want to split the calculation into the two similar, but separate cases when x > x_center
and x < x_center
to avoid ZeroDivide
and make life easier.
Regarding the dominant colors, there are a bunch of articles on this site, just use the search, I don't want to copy-paste someone else's work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.