RPi Camera Pink r-pi B

318 views Asked by At

I am forcing problem with Raspberry Pi 3 and camera.
1 of 5 pics looks like this usually has bigger size. It Happens also on day.
My capture script is: raspistill -vf -hf -o img.jpg.

Can I somehow check quality after taking a picture or fix it?

1

There are 1 answers

0
Mark Setchell On BEST ANSWER

It's hard to say how you might differentiate poor quality images from good quality images without seeing both types :-)

However, you could do a quick command-line quality check using ImageMagick which is readily installed on a Raspberry Pi.

So, I imagine one of the following statistics would differ markedly between poor quality and good quality images:

  • mean
  • standard deviation
  • entropy

So, to get a measure of those values, at the command line with ImageMagick, you would do:

identify -format "%[mean], %[standard-deviation], %[entropy]\n" anImage.jpg
21841.8, 30697.6, 0.315319

So, I would try that for good and bad images and see if something differs.

Failing that, you could count the percentage of black pixels since there seem to be lots of those in your bad image. So, first threshold the image at say 5% so all pixels within 5% of fully black become black and all others become white, then look at the mean to determine how many are now black:

convert someImage.jpg -threshold 5% -format "%[fx:int((1-mean)*100)]" info:
87

That tells me that 87% of your pixels are just about black which seems too high for a normal image. So try running that against a normal image.

If you don't want to install ImageMagick to test for some reason, please provide a couple more good and bad images and I will check them for you - add a comment to my answer so I get informed you have added images.