2025-06-04 8:07 PM - last edited on 2025-06-05 2:43 AM by Andrew Neil
I am using the STM32N6570-DK kit, and I want to use the camera to capture 224*160 size image, but I don't know how to do this, the sample programs are all about 800*480,and I can't understand the configuration of the downsize.
The lines below can change the original 2592*1944 size into 800*480, but how? When initializing the IMX335 sensor, it was set to capture the 2592*1944 size image.
/* Configure the downsize */
DonwsizeConf.HRatio = 25656;
DonwsizeConf.VRatio = 33161;
DonwsizeConf.HSize = 800;
DonwsizeConf.VSize = 480;
DonwsizeConf.HDivFactor = 316;
DonwsizeConf.VDivFactor = 253;
2025-06-12 12:21 AM
Hi @Z-YF,
Were you able to understand this configuration? If yes, could you please share the details with me?
2025-06-12 3:03 AM - edited 2025-06-12 3:12 AM
Hi everyone,
I am currently working with the MB1854B ST camera module and have successfully changed the camera resolutionfrom default configuration 2592x1944 to 256x256. However, the image now appears too small on the display, making it difficult to view clearly.
I would like to scale up the image feed on the LCD screen while keeping the camera resolution at 256x256, in order to make the image more visible.
While reviewing the code, I came across parameters in MX_DCMIPP_Init() function that were previously used to map a 2592x1944 camera resolution to an 800x480 LCD screen.
I believe modifying similar parameters could help scale the 256x256 image appropriately on the LCD.
DonwsizeConf.HRatio = 25656;
DonwsizeConf.VRatio = 33161;
DonwsizeConf.HSize = 800;
DonwsizeConf.VSize = 480;
DonwsizeConf.HDivFactor = 316;
DonwsizeConf.VDivFactor = 253;
These parameters appear to be located at line 389 in the code. However, there is no documentation or tutorial explaining how to adjust these values correctly.
Could someone please guide me on how to properly modify these parameters to achieve the desired scaling effect on the LCD?
2025-06-12 8:20 AM - edited 2025-06-12 8:20 AM
Hello,
For downsize , refer to the chapter 39.7.4 Downsize in the referance Manual of N6 for software configuration:
STM32N647/657xx Arm<Sup>®</Sup>-based 32-bit MCUs - Reference manual
For each value a formula is provided withinregiter description part (sections 39.14.71 & 39.14.72)
The division factor is an unsigned integer based on the source/destination ratio:
div = max(int(1024 / (source/destination)), 1023)
The down scale ratio is expressed in unsigned 3.13 format:
ratio = max(int((SourceSize - 1) / (DestinationSize -1)) * 8192), 8 * 8192 - 1)
Best Regards.
2025-06-13 12:46 AM
I think it is duplicate of this.
2025-06-13 12:47 AM
Hi @Ch_JE ,
I believe both of the formulas should use min instead of max, as I was calculating the default configuration required to downsize a 2592x1944 camera resolution to 800x480 for the LCD on the STM32N6570-DK. Based on the formula from 39.14.71, the result would be:
HDivFactor = max(int(1024/(2592/800)),1023)
= max(int(316.04),1023)
= 1023
But in the default configuration here (Line 393) it is given to be
DonwsizeConf.HDivFactor = 316;
Similarly, I think this applies to the other three parameters as well. Could you kindly confirm this?
2025-06-13 1:09 AM
Yeah, but I believe this error is caused by floating-point number calculation. I have not tried the new one, but I believe both will work.