What is 840 in line 252 of edge2-npu yolov8n_cap main.cc

hi khadas team,
what is the constant number 840 in line 252 of the below source code?

Hello @aliliaei

@Louis-Cheng-Liu will help you later.

Hello @aliliaei ,

This is the padding size of input image.
YOLOv8 input size is 640×640, so whatever your image size, you must resize image to 640×640. For this reason, there are two way to resize.

First, resize image directly.


It is easy for preprocess and postprocess. However it makes objects deform.

Second, padding image to square first and then resize.


It keeps objects in its original shape. But it makes objects smaller.

I suggest you test both two ways and then choose more accurate one to use.

Thank you very much.
So 840 = 1920 - 1080
It depends on image size. It should be a variable like below:
int paddingSize = orig_img.cols - orig_img.rows;