The iPhone 6's camera has 8 megapixels and the Galaxy S6's has 16, but they take pictures with similar sharpness and clarity.
At the same time, pictures won't be as sharp if pixels are too large. This was the case with the HTC One (M8)'s four "UltraPixel" camera, which simply means it has four megapixels with each pixel being larger than you'd normally find on a smartphone. It resulted in good bokeh (when a subject pops out against a purposefully blurry background) and relatively good low-light shots. But image clarity and sharpness was only decent because four megapixels isn't enough to capture finer details. HTC has since ditched the UltraPixels in favor of regular megapixels for new One (M9).
So why does that happen?
It's understandable that most people think higher megapixel counts lead to better pictures. Megapixels have been the main point of measurement smartphone manufacturers use to tell people how good their mobile device cameras are.
Theoretically, more pixels should make a sharper image, similar to how more tiles make a more detailed mosaic, but that's not exactly the case.
Pixels rest on your camera's sensor to capture light. The larger the sensor, the more pixels it can support which often leads to better, sharper pictures. But as more pixels are added to a sensor, the smaller they need to be to fit onto the sensor itself. And the smaller the pixel, the less light it can capture, which results in images with "noise," or unwanted artifacts that reduce an image's sharpness.
One way to counter this is keep the shutter open for longer to allow enough light to hit the sensor. But even the most minute movements you make when the shutter is open will result in blurriness, which then leads to poor quality images, especially in low-light situations. Apart from the new LG G4, most smartphones don't give you control over the shutter.
Flickr \ Daniel Piraino
So, there's a fine balance of sensor and pixel size smartphone manufacturers need to strike to make a good camera. The iPhone 6's camera has a 1/2.2-inch sensor with 8 megapixels, while the Galaxy S6's camera has a larger 1/1.9-inch sensor with 16 megapixels. Simply put, they're both very similar cameras that use different methods and components to achieve similar results.