You could do something like this:
// finding the center point of the screen
// note that $(window).height() returns the height of the viewport
var center = Math.floor(($(window).height() / 2)) + $(window).scrollTop();
// looping through images and checking each for being in middle
$('.mainimages').each(function(i, img) {
var top = $(img).offset().top;
if(top <= center && top + $(img).height() >= center) {
// $(img) is in the center
}
});
I don't use jQuery so I'm not certain if there are better methods to use to do this.
Also, not that I do not account for the margin / padding between images. So if you were to do something like put a colored border on the centered image (with no border on others) then there will be moments between images where no image will have a border.