Upcoming maintenance
Dear Customers and Partners.
This website will be undergoing scheduled maintenance on June 14, 2023. Please be aware there may be disruption to the developer portal website and associated services during the scheduled maintenance period.
This upgrade is essential to ensure the continued performance, reliability, and security of Developer World.
We apologize for any inconvenience.
Camera 5M JpegQuality=100
-
Hi!
I can't take picture (one shot, CAM_IMGSIZE_5M) with Jpagquality=100 (jpgbufsize_divisor = 26). Increase Memory or jpgbufsize_divisor don't change anything. All work fine with Jpegquality<=85. Someone have solution?
Regard. -
Hey, @DidierC-3
Could you share your code so I can try it on my side?
-
@CamilaSouza
If I delete "setQuality" pgm works
Regards#include <SDHCI.h>
#include <stdio.h> /* for sprintf */#include <Camera.h>
#define BAUDRATE (115200)
SDClass theSD;
/**
Print error message */
void printError(enum CamErr err)
{
Serial.print("Error: ");
switch (err)
{
case CAM_ERR_NO_DEVICE:
Serial.println("No Device");
break;
case CAM_ERR_ILLEGAL_DEVERR:
Serial.println("Illegal device error");
break;
case CAM_ERR_ALREADY_INITIALIZED:
Serial.println("Already initialized");
break;
case CAM_ERR_NOT_INITIALIZED:
Serial.println("Not initialized");
break;
case CAM_ERR_NOT_STILL_INITIALIZED:
Serial.println("Still picture not initialized");
break;
case CAM_ERR_CANT_CREATE_THREAD:
Serial.println("Failed to create thread");
break;
case CAM_ERR_INVALID_PARAM:
Serial.println("Invalid parameter");
break;
case CAM_ERR_NO_MEMORY:
Serial.println("No memory");
break;
case CAM_ERR_USR_INUSED:
Serial.println("Buffer already in use");
break;
case CAM_ERR_NOT_PERMITTED:
Serial.println("Operation not permitted");
break;
default:
break;
}
}/**
@brief Initialize camera */ void setup() { CamErr err;
/* Open serial communications and wait for port to open */
Serial.begin(BAUDRATE);
while (!Serial)
{
; /* wait for serial port to connect. Needed for native USB port only */
}/* Initialize SD /
while (!theSD.begin())
{
/ wait until SD card is mounted. */
Serial.println("Insert SD card.");
}/* begin() without parameters means that
number of buffers = 1, 30FPS, QVGA, YUV 4:2:2 format */
Serial.println("Prepare camera");
err = theCamera.begin();
theCamera.begin(
1, //default = 1
CAM_VIDEO_FPS_NONE, //default = CAM_VIDEO_FPS_5
CAM_IMGSIZE_5M_H, //default = CAM_IMGSIZE_QVGA_H (320)
CAM_IMGSIZE_5M_V, //default = CAM_IMGSIZE_QVGA_V (240)
CAM_IMAGE_PIX_FMT_JPG, //default = CAM_IMAGE_PIX_FMT_JPG
26 //default = 7
);
if (err != CAM_ERR_SUCCESS)
{
printError(err);
}/* Auto white balance configuration */
Serial.println("Set Auto white balance parameter");
err = theCamera.setAutoWhiteBalanceMode(CAM_WHITE_BALANCE_AUTO);
if (err != CAM_ERR_SUCCESS)
{
printError(err);
}Serial.println("Set HDR Auto");
theCamera.setHDR(CAM_HDR_MODE_AUTO);
if (err != CAM_ERR_SUCCESS)
{
printError(err);
}
/* Set parameters about still picture.In the following case, QUADVGA and JPEG. */ Serial.println("Set Quality"); theCamera.setJPEGQuality(100); if (err != CAM_ERR_SUCCESS) { printError(err); } int g_divisor = 7; Serial.println("Set still picture format"); while (1) { err = theCamera.setStillPictureImageFormat(CAM_IMGSIZE_5M_H, CAM_IMGSIZE_5M_V, CAM_IMAGE_PIX_FMT_JPG, g_divisor); if (err == CAM_ERR_NO_MEMORY) { g_divisor++; } else { break; } } Serial.println(g_divisor); }
/**
@brief Take picture with format JPEG per second */
void loop()
{
sleep(1); /* wait for one second to take still picture. */Serial.println("call takePicture()");
CamImage img = theCamera.takePicture();/* Check availability of the img instance. /
/ If any errors occur, the img is not available. */if (img.isAvailable())
{
/* Create file name */char filename[16] = {0}; sprintf(filename, "PICT03.JPG"); Serial.print("Save taken picture as "); Serial.print(filename); Serial.println(""); /* Remove the old file with the same file name as new created file, * and create new file. */ theSD.remove(filename); File myFile = theSD.open(filename, FILE_WRITE); myFile.write(img.getImgBuff(), img.getImgSize()); myFile.close(); }
while(1) {}
}
-
Hey, @DidierC-3
Sorry to take so long to respond.
How is your project going? Did you solve your issue?
I tried taking a picture with size CAM_IMGSIZE_5M and I also cannot go up to 100% quality.
I can only go up to 90%, which gives me a picture of size 365KB.I don't know if you're still interested in this topic, but I'm investigating internally and will post any progress in here for future reference.