Need some help, i am not able to find the desired contour
Input: 
After applying binary filter: 
After applying HSV filter: 
Output: 
However, the desired output should have been: 
Need some help, this is my code for hsv:
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "iostream"
using namespace cv;
using namespace std;
int main()
{
Mat image;
image = imread("C:/Proj/Denoised.jpg", CV_LOAD_IMAGE_COLOR);
if (!image.data)
{
cout << "Could not open the denoised image" << std::endl;
return -1;
}
// Create a new matrix to hold the hsv image
Mat HSV;
// convert RGB image to hsv image
cvtColor(image, HSV, CV_BGR2HSV);
namedWindow("Display RGB image", CV_WINDOW_AUTOSIZE);
imshow("Display RGB image", image);
//DISPLAY image
namedWindow("Result : HSV image", CV_WINDOW_AUTOSIZE);
imshow("Result : HSV image", HSV);
//save the HSV image
imwrite("C:/Proj/HSVimage.jpg", HSV);
waitKey(0);
return 0;
}
↧