Draw a flag in R

Hi. It would not be difficult to create something like the Union Jack flag in R by using the polygon function for each unique region, assuming I had the x and y vertices of each region, and applying appropriate colors.

I could measure each region with a ruler. For example, starting at the lower left, the red region has two of its four vertices at (0,0) and (0.5, 0), for a flag that is approximately 9 by 5.

My question is, starting with a jpg file of the flag, is there an R way to locate all the vertices?

Also, given the jpg file, is there a way to identify the exact colors?

Thank you.


Hi, for the extracting colours bit, you could use magick.

Extracting colours from your images with Image Quantization (chichacha.netlify.app)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.