Does anyone know how I can go about doing this challenge? Like I need to identify the differences between these two images, so what should I learn to tackle this?

This might be too much information but I work in materials science and spend a lot of time analyzing microstructures, so I thought I would chime in with some thoughts.

The general goal here from a practical stand point would be to extract properties of each phase in the microstructure like area fraction of each phase (or volume fraction if certain assumptions can be made), precipitate shape which would describe the deformation/strain characteristics of the microstructure and how it responded to load (if present), does any phase exist on the grain boundary indicating that phase is nucleating on grain boundaries (could be annealing), and perhaps more.

I see there would be two important features to extract: grain boundaries and the grains themselves, where the grains themselves are more important. As already said the grain boundaries can be approximated with edge detection algorithms, and in microscopy/diffraction sciences the hough transform is really popular for this. The ease of extracting the grain boundaries is going to depend a lot on how the microstructure image was acquired.

Extracting the grains themselves is usually done with histogram segmentation. For a two phase microstructure this just a simple threshold. For more than two phases you will have to look for multiple peaks in the histogram to window, and each peak should correspond to different phase, producing a mask for each phase. You could combine this mask with the edges from the edge detection to computationally isolate each grain from each phase.

A proper metallographic polished/etched specimen should exhibit dark contrast at the grain boundaries in optical microscopy making edge detection easy, but it will be difficult to differentiate different phases since the contrast in each grain depends on phase and crystallographic orientation - the histogram segmentation will not work well (probably).

For SEM or TEM microscopy this depends on the detector. Detectors that produce a z-contrast (atomic number, such as back scatter in SEM or HAADF-STEM in TEM) work the best at differentiating grains as each phase will appear at roughly the same intensity in the image, but you may lose some contrast of the grain boundaries (but if my experience not that much). Secondary electron detectors like the ETD or TLD in SEM will give similar results as optical microscopy.

/r/Python Thread Link - i.redd.it