# Application of Machine Learning to Assess the Quality of Food Products--Case Study: Coffee Bean
## 2 Materials and Methods
### Image Collection by Camera  
In order to acquire digital images, a NIKON D5100 (Nikon Corp., Bangkok, Thailand) camera was used, which is characterized by high performance due to its resolution, the speed of capturing images and precise focusing. This camera was equipped with a 16.2-megapixel sensor, which fully ensured the acquisition of sufficient detail when taking digital photos with a coffee bean subject. In addition, this camera takes digital photos at a speed of about 4 frames/s, which also meets the expected criterion for using this model in the study. This camera, the NIKON D5100, was equipped with an AF system that allows for precise focusing. The application of vision devices in various aspects of research requires key image parameters, such as proper focus setting, matching ISO sensitivity value, exposure time selection, and maintaining conditions of the same environment within the repeatability of results. It is very common to encounter the problem of incorrect preparation of image acquisition parameters, which nowadays for machine learning can be a key aspect in the process of image recognition.  
Image acquisition using the research and measurement station in the study was performed according to the procedure of the author's solution (see [PERSON] et al. (2023)) [40; 41; 42]. In the process of image acquisition, the NIKON D5100 camera was equipped with a Nikkor Lens 28 mm. The selected lens is a wide-angle lenses, which gives the camera to make a wider field of view without losing the quality of the acquired image. The main criterion for the selection of the lens was to be able to take digital images at close range while preserving the quality of the coffee bean structure as well as its proportions. A series of 160 digital images depicting the selected type of coffee were taken during the study. Each of the 160 images contained a single object representing a coffee bean. Each coffee bean, in the process of image acquisition, needed to be rotated to image the top as well as the bottom part. These parts of the coffee bean are significantly different. This resulted in the preparation of 80 coffee beans for each research class.  
With the purpose of maintaining the reproducibility of the results, the same image acquisition conditions were established for the coffee beans according to the exposure criterion and the established environment. Before taking digital images, the device was calibrated, and the image parameters were set, including setting the ISO sensitivity at 200, the aperture was set at f/6.3, the exposure time was 160 s, and the focal length was 28 mm. During the process of image acquisition, flash was not used due to the preservation of the conditions regarding the uniformity of illumination established by the measuring and research station according to [PERSON] et al. (2023) [40]. When taking the images, the white balance was set in manual mode in order to achieve the most accurate match of color to the designated environment.  
As a result of image acquisition, 240 coffee beans were randomly sampled, i.e., 80 under-roasted coffee beans, 80 over-roasted coffee beans and 80 standard coffee beans (of appropriate quality). In effect, 480 digital images with a resolution of 4928 \(\times\) 3264 (300 dpi) and 24-bit image depth saved in JPG format were obtained.