Hi i need help with my project. i have this beans that detected by using a simpleblobdetector fuction.
I detected several blob and i want to know if the beans is a “good beans” or “bad beans”. I qdebug the result but i dont know which blob is the result showing.
Is it possible to label every blob like “blob 1, blob 2,” So i know this result belong to which blob.
Here below is my code for detecting the blob
// Storage for blobs
vector<KeyPoint> keypoints;
// Set up detector with params
Ptr<SimpleBlobDetector> detector = SimpleBlobDetector::create(params);
// Detect blobs
detector->detect( frameBrightness, keypoints);
Mat im_with_keypoints ;
cv::Scalar mean;
drawKeypoints( frameBrightness, keypoints, im_with_keypoints, Scalar(0,0,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS );
size_t i;
Point Coordinate;
for( i = 0; i < keypoints.size(); i++ )
{
Coordinate = keypoints[i].pt ;
Rect r(Coordinate.x-(keypoints[i].size /2), Coordinate.y-(keypoints[i].size/2), keypoints[i].size, keypoints[i].size) ;
Mat roi(im_with_keypoints, r);
mean = cv::mean(roi);
if (mean[0]>= 15 && mean[0]<= 87){
if(mean[1]>=70 && mean[1]<= 135){
if(mean[2]>=79 && mean [2] <= 148){
result = "Good Beans";
}
else{
result = "Bad Beans";
}
}
else{
result = "Bad Beans";
}
}
else {
result = "Bad Beans";
}
qDebug() << result ;
}