# Ultimate-QC
Ultimate QC

In the Code directory you will find the all of the code for the Ultimate QC 1.0 system. In the main directory is all of the source code for the system. UltimateQC.m is the main program, createMaskBetter.m creates a mask of the tray so that the program can crop the image to the size of the tray, createMask4.m extracts the blueberry color from the image, countBlueberries.m counts the blueberries, immatureMask.m extracts the immature color of the blueberries from the image, and countImmature.m counts the immature blueberries. In the Images directory are all of the blueberry images. In the blueberryDectector directory you will find the blueberryDetector.xml file. This file, the Images directory, and all of the files in the main directory are needed to execute the program. Once they are downloaded into your MATLAB folder of your computer you can open UltimateQC.m in MATLAB and run the program and then select an image from the Images directory.

In the blueberryDectector directory you will find the file howtotrainadetector.m. Executing this file in MATLAB shows the results of the blueberry detector. In the comments of this file you will see how to use the detectBlueberry.mat file and the images in the nonBlueberries2 directory to further train the blueberryDetector.xml file. A good detector requires thoundsands of positive images and negative images. The files contained in the immatureBerryDetector directory and the hsvImmatureBerryDetector were attempts at training a detector to defect immature blueberries.
