Ask Your Question

rohit.guitar's profile - activity

2019-09-22 16:48:40 -0600 received badge  Student (source)
2017-07-25 19:00:59 -0600 received badge  Famous Question (source)
2017-07-25 19:00:59 -0600 received badge  Notable Question (source)
2015-11-19 09:18:20 -0600 received badge  Popular Question (source)
2015-07-10 18:37:11 -0600 asked a question Remove bright spots

I am trying to remove the bright spots from an image. What kind of filters i can use.I want to remove the bright spots you can see on the background. I am using C++.

(http://imgur.com/ql1DvqR)

2015-07-10 09:32:19 -0600 received badge  Supporter (source)
2015-07-10 09:32:17 -0600 commented answer Contour properties

Thanks it worked ....:-)

2015-07-10 09:31:44 -0600 received badge  Enthusiast
2015-07-09 20:56:08 -0600 asked a question Contour properties

I have trying to get the major and minor axis of a contour by enclosing into a eclipse using fiteclipse(). But it is returning me a Rotating rect object. Can anyone help me with getting the major and minor axis values in C++?

2015-06-30 11:56:08 -0600 asked a question Thresholding histogram

I have been trying to get a good threshold to distinguish you objects.

My code is here.

void compareHist(Mat img1,Mat img2){ if( img1.empty() || img2.empty()) { return; }

vector<Mat> bgr_planes1,bgr_planes2;
split(img1, bgr_planes1);
split(img2, bgr_planes2);
int histSize = 256;

/// Set the ranges ( for B,G,R) )
float range[] = { 0, 256 } ;
const float* histRange = { range };

bool uniform = true; bool accumulate = false;

Mat b_hist1, g_hist1, r_hist1;
Mat b_hist2, g_hist2, r_hist2;

/// Compute the histograms:
calcHist( &bgr_planes1[0], 1, 0, Mat(), b_hist1, 1, &histSize, &histRange, uniform, accumulate );
calcHist( &bgr_planes1[1], 1, 0, Mat(), g_hist1, 1, &histSize, &histRange, uniform, accumulate );
calcHist( &bgr_planes1[2], 1, 0, Mat(), r_hist1, 1, &histSize, &histRange, uniform, accumulate );

/// Compute the histograms:
calcHist( &bgr_planes2[0], 1, 0, Mat(), b_hist2, 1, &histSize, &histRange, uniform, accumulate );
calcHist( &bgr_planes2[1], 1, 0, Mat(), g_hist2, 1, &histSize, &histRange, uniform, accumulate );
calcHist( &bgr_planes2[2], 1, 0, Mat(), r_hist2, 1, &histSize, &histRange, uniform, accumulate );

// Draw the histograms for B, G and R
int hist_w = 520; int hist_h = 400;
int bin_w = cvRound( (double) hist_w/histSize );

Mat histImage1( hist_h, hist_w, CV_8UC3, Scalar( 0,0,0) );
Mat histImage2( hist_h, hist_w, CV_8UC3, Scalar( 0,0,0) );
Mat histImage3( hist_h, hist_w, CV_8UC3, Scalar( 0,0,0) );

namedWindow("Blue hist", WINDOW_AUTOSIZE );
imshow("Blue hist", b_hist1 );
namedWindow("Green hist", WINDOW_AUTOSIZE );
imshow("Green hist", g_hist1 );
namedWindow("Red hist", WINDOW_AUTOSIZE );
imshow("Red hist", r_hist1 );


/// Normalize the result to [ 0, histImage.rows ]
normalize(b_hist1, b_hist1, 0, histImage1.rows, NORM_MINMAX, -1, Mat());
normalize(b_hist2, b_hist2, 0, histImage1.rows, NORM_MINMAX, -1, Mat());


normalize(g_hist1, g_hist1, 0, histImage2.rows, NORM_MINMAX, -1, Mat());
normalize(g_hist2, g_hist2, 0, histImage2.rows, NORM_MINMAX, -1, Mat());


normalize(r_hist1, r_hist1, 0, histImage3.rows, NORM_MINMAX, -1, Mat());
normalize(r_hist2, r_hist2, 0, histImage3.rows, NORM_MINMAX, -1, Mat());


/// Draw for each channel
for( int i = 1; i < histSize; i++ )
{
    line( histImage1, Point( bin_w*(i-1), hist_h -
                           cvRound(b_hist1.at<float>(i-1)) ) ,
         Point( bin_w*(i), hist_h - cvRound(b_hist1.at<float>(i)) ),
         Scalar( 255, 0, 0), 2, 8, 0  );
    line( histImage1, Point( bin_w*(i-1), hist_h -
                            cvRound(b_hist2.at<float>(i-1)) ) ,
         Point( bin_w*(i), hist_h - cvRound(b_hist2.at<float>(i)) ),
         Scalar( 255, 255, 0), 2, 8, 0  );
}

for( int i = 1; i < histSize; i++ )
{
    line( histImage2, Point( bin_w*(i-1), hist_h -
                            cvRound(g_hist1.at<float>(i-1)) ) ,
         Point( bin_w*(i), hist_h - cvRound(g_hist1.at<float>(i)) ),
         Scalar( 0, 255, 0), 2, 8, 0  );
    line( histImage2, Point( bin_w*(i-1), hist_h -
                            cvRound(g_hist2.at<float>(i-1)) ) ,
         Point( bin_w*(i), hist_h - cvRound(g_hist2.at<float>(i)) ),
         Scalar( 0, 255, 100), 2, 8, 0  );
}

for( int i = 1; i < histSize; i++ )
{
    line( histImage3, Point( bin_w*(i-1), hist_h -
                            cvRound(r_hist1.at<float>(i-1)) ) ,
         Point( bin_w*(i), hist_h - cvRound(r_hist1.at<float>(i)) ),
         Scalar( 0, 0, 255), 2, 8, 0  );
    line( histImage3, Point( bin_w*(i-1), hist_h -
                            cvRound(r_hist2.at<float>(i-1)) ) ,
         Point( bin_w*(i), hist_h - cvRound(r_hist2.at<float>(i)) ),
         Scalar( 0, 255,255), 2, 8, 0  );
}

namedWindow("Blue hist", WINDOW_AUTOSIZE );
imshow("Blue hist", b_hist1 );
namedWindow("Green hist", WINDOW_AUTOSIZE );
imshow("Green hist", g_hist1 );
namedWindow("Red hist", WINDOW_AUTOSIZE );
imshow("Red hist", r_hist1 );

}

My output is showing me just black and ... (more)

2015-06-02 09:05:42 -0600 commented question Weed extraction algorithm 2D images

I have updated the question .... Please guide me through... Thanks

2015-06-01 14:10:06 -0600 commented question Weed extraction algorithm 2D images

It has both on the top that is crop and the bottom one is weed

2015-06-01 14:04:22 -0600 commented question Weed extraction algorithm 2D images

Please check i have updated the question.

2015-06-01 14:03:56 -0600 received badge  Editor (source)
2015-06-01 09:09:42 -0600 asked a question Weed extraction algorithm 2D images

Hello , I m working on a project in which i need to work on real time weed extraction algorithm. I came up with very simple algorithm. First remove the background (soil , any other stuff) in a frame using color spaces then use template matching and find the location of crop plants (as weed plants doesn't have a regular shape).

Any comments or suggestion for new algorithm or proposed one ? Any suggestions for weed characteristics i can use for final step ? Thanks in advance

Here is the reference image of enviornment.

It has both on the top that is crop and the bottom one is weed

First

Second

2015-05-08 15:25:26 -0600 commented question Detection of texture portions in a image

I was looking to do template matching ... do you know the difference between template matching and inpainting ?

2015-05-08 15:18:41 -0600 asked a question Detection of texture portions in a image

I am working on a project and i need to remove the areas in a image which matches with my texture image. What kind of techniques i can use to successfully accomplish the task in openCV? I need to further scale it to video processing