I have a stupid question:
I have a black circle on white background, something like:

I have a code in Matlab that gets an image with a black circle and returns the number of pixels in the circle.
will I get the same number of pixels in a camera of 5 mega pixel and a camera of 8 mega pixel?
The short answer is: Under most circumstances, No. 8MP should have more pixels than 5MP, However…
That depends on many factors related to the camera and the images that you take: