Your C++ program maintains a 2-D grid (array) of objects, whereeach object keeps track of two values, the image component label(to be assigned by DFS or BFS), and the order in which the pixelwas discovered, which depends on the search strategy (DFS or BFS).Accordingly, each pixel is represented by an object thatencapsulates a label (component label: 2, 3, 4, …) and (order ofdiscovery: 1, 2, 3, …).
How do we make pixel as an object? Like, I know that I need tomake a class, but how would I make pixel as an object. The gridwhen generated should look like the picture
OR
OR