widepeepoHappy
I think I found the source of the problem. I did some testing by saving the original JPEG file to a file. When there's no problem with the conversion to bitmap the JPEG file looks just fine (using a paint program to view it). But when that conversion error happens the JPEG files itself looks bad. It's still a JPEG image of the correct size (height and width) but only a portion of the image is correct. It's always an upper portion that's correct, maybe half, a third, or just a few rows of pixel data, but the rest, the lower portion, is either blank or garbage.
OBSERVATION
So my first observation is that AN error actually occurs during the capture of the JPEG image, ...
Code: Select all
camera_fb_t * CameraFrameBuffer = esp_camera_fb_get();
but it doesn't TELL YOU that an error has occurred. You still get a non-NULL pointer to the frame buffer returned from the function call. I've always taken that to mean that there were no problems in the esp_camera_fb_get(), but apparently not.
QUESTION
Is there some error variable or SOMETHING that I should be checking after that function call to see if some error may have occurred? None of the sample programs that I've come across show any kind of error checking.
SUGGESTION
There SHOULD be some indication of the failure that (actually) occurs during the esp_camera_fb_get().
Getting a failure from the conversion function just confuses the situation. The actual error occurs during esp_camera_fb_get(), not esp_camera_fb_get().
FURTHER TEST / ANOTHER OBSERVATION
I have several ESP32-CAMs so I tried a different one and I encountered no conversion errors. Taking a close look at the one that experienced the failures I noticed a very slight kink in the very short ribbon cable that connects the camera itself to the board. Since that ribbon cable causes the camera to not lay flat against the board (and easily jiggle while taking a picture) I had adopted the approach of manually holding the camera flat against the board whenever I'm taking a picture.
CONCLUSION?
I'm concluding that my repeated pressing on the camera to hold it steady against the board eventually caused that tiny kink in the ribbon cable and that kink resulted in a crack in at least one of the wires in the cable and that crack caused an intermittent disconnect of that line between the camera and the board.
WHAT YOU MIGHT DO?
So, maybe have a close look at that ribbon cable on your board. Let me know if you see the same symptoms.
WHAT THE MANUFACTURER MIGHT DO?
My board is an ESP32-CAM, which is not manufactured by espressif, so it might (just) be a problem with whoever manufactured my particular board. But maybe it's a similar problem with espressif boards. I'm thinking that there needs to be some change in the board design so that the camera is assured to lay nice and flat all the time.