Amigo, I don’t think it’s about detecting pieces already placed on the board by the player, it’s about predicting whether there is a valid place for a piece.
It will be interesting to see what ideas the brains come up with. All I’ve got is that you would have to go through each piece the player has left and place a ghost object of that shape on the board, moving it over one grid square at a time until one of two things - a place is found that meets the requirements or it gets to the end of the grid not having found a place.