We are looking for 4 categories.
The four groups of flags (and their connections) are as follows...
NB This was solved independently of @Adib's answer, but their working was very useful for corroborating with my own afterwards, as - before a couple of corrections thanks to @Jens in comments - we initially agreed on 86% of the flags (yes, I worked out the percentage!).
Note that in each case:
The OP has provided us with a starting flag in its usual colours. The 7 flag designs that follow it are then a sequence of pairwise mergings of 8 flags, the first of which is the given starting flag, and all of whose countries satisfy a certain theme. I don't profess to understand anything technical behind the merges but I assume like others suggest that there is some algebra going on with the RGB codes. (My key approach to solving was to note that where one merged flag contains white, the other flag's colour shows in the merged image; where both merged flags are white, the merged image shows black.)
Belgium, France, Russia, Croatia, England, Sweden, Uruguay, Brazil.
These are the quarter finalists at the men's football World Cup in 2018.
Mali, Ukraine, Poland, Hungary, Sudan, Iran, Niger, Algeria.
All of these countries border exactly 7 other nations. I shall not list them here, for brevity's sake, but note that Algeria's total includes the disputed territory of Western Sahara as one of the seven.
UK, India, Russia, France, Pakistan, North Korea, China, USA.
These are all countries known to have nuclear weapons.
Uzbekistan, Estonia, Honduras, Taiwan, Georgia, Faroe Islands, Tunisia, Japan.
Each of these nations have a capital city beginning with 'T'. These are (respectively): Tashkent, Tallinn, Tegucigalpa, Taipei, Tblisi, Tórshavn, Tunis and Tokyo.
Each flag is paired except at the right hand side of the chart where it appears once.
Otherwise each flag appears in adjacent images so that two flags are superimposed.
I have several possibilities for the flags left blank (e.g. outlined cross, three stripes).
So far, the arrangement I have is like this:
I can't figure out how the colour blending works. It looks as if the r-g-b colour components are exclusive-ORed between two flags sharing the same image. But if you look at the first two images on the bottom row, that would mean a flag has two horizontal bands in height ratio of 1:2 and I can't find a flag like that. It looks as if there might be a different rule in various situations.
My flag map:
Row 1: Belgium,Romania,(UNKNOWN),Russia,Croatia,England,Sweden,Uruguay,Brazil
Row 2: Mali,(UNKNOWN),Poland,Hungary,Kuwait/Palestine,Iran,Niger,Algeria
Row 3: UK,India,(UNKNOWN MONO/TRI-COLOR),Pakistan,N.Korea,China,US
Row 4: Uzbekistan,(UNKNOWN TRI-COLOR),Honduras,Taiwan,Georgia,Faroe Island,Tunisia,Japan
I think the first category is..
The methods I've tried so far is using OpenCV2 to experiment on different color conversions, and one of the flags that was 'hidden' stood out very well when using color conversion from RGB to HSV (
Here's what I mean...