Ask Your Question

Sharath's profile - activity

2020-09-26 16:10:53 -0600 received badge  Notable Question (source)
2018-03-07 05:03:26 -0600 received badge  Popular Question (source)
2016-08-27 01:30:45 -0600 received badge  Famous Question (source)
2015-07-29 06:19:46 -0600 commented question Denoising algorithm which takes amount of noise variance present in image and remove noise with respect to that variance

Hi berak, problem to sove is , I have noisy image -> noise power is estimated from the noisy image(let say variance of noise sigma^2). What I want to do is , find an algorithm which takes the estimated noise (sigma^2) and remove the noise in image w.r.to noise estimated. Initially I have used gaussian distribution function to apply known noise to sigma^2, later I understood the Sigma in gaussian distribution is responsible for determining the width of the filter matrix. So I didn't use gaussian distribution. Now, I am looking for good algorithm which takes known variance(sigma^2) of noise of image and remove the noise from image. Please give me good suggestion. Help would be appreciated greatly.

2015-07-27 01:14:13 -0600 asked a question Denoising algorithm which takes amount of noise variance present in image and remove noise with respect to that variance

Hi, How to denoise an image with specific noise variance(estimated already)? I want to pass the estimated noise variance to function to remove the noise in the image. Can anyone direct me to good filter algorithm which takes noise variance(computed from image) and removes noise ? Help would be appreciated greatly.

2015-06-26 05:57:29 -0600 commented question Template Matching issue in video(object detection in frame by frame)
2015-06-26 00:13:04 -0600 commented question Template Matching issue in video(object detection in frame by frame)

@Manimaran.., I can't share complete source code here as this application is confidential. And below link gives you idea and helps you to know how to push lot of templates into vector container and use it back in detection phase. http://answers.opencv.org/question/35... . If you have any doubts, come back.

2015-06-11 00:50:21 -0600 received badge  Enthusiast
2015-06-05 08:56:18 -0600 commented answer how to sum a 3 channel matrix to a one channel matrix?

hi, Can anyone provide me small code sample to sum a 3 channel matrix into one channel matrix using reshape and reduce functions using the above idea which explained by sammy ....

2015-06-03 09:40:33 -0600 asked a question How to initialize and use cv::gpu::MatchTemplateBuf in cv::gpu:: MatchTemplate Function ??

Hi, I want to use cv::gpu::MatchTemplate function to speedup the output.

   void gpu::matchTemplate(const GpuMat& image, const GpuMat& templ, GpuMat& result, int method,          MatchTemplateBuf& buf, Stream& stream=Stream::Null())

Can anyone provide some explaination or example on how to use the "MatchTemplateBuf" ? There is no documentation, which explains the usage of MatchTemplateBuf. Help would be appreciated greatly.

System : Cuda 6.5 Gpu: Nvidia GeForce 210 Windows 7 64bit OpenCV 2.4.10

2015-05-22 02:17:38 -0600 received badge  Notable Question (source)
2015-04-23 06:02:03 -0600 commented question Template Matching issue in video(object detection in frame by frame)

Hi Eduardo, I have completed the task with PSNR (Peak Signal to Noise Ratio) algorithm. By using PSNR we can find most valid similar pixel in both images(here images are Template and Source image). Once application finds similarity, it 'll draw rectangle around the detected template object in source image. Thank you.

2015-04-22 23:50:28 -0600 commented question Template Matching issue in video(object detection in frame by frame)

Hi Eduardo, Thanks for your answer. How to check the correlation score? Kindly explain me. In past I have worked with template matching on offline Images, now I am implementing this method on live video.

2015-04-22 08:42:35 -0600 asked a question Template Matching issue in video(object detection in frame by frame)

Hi,

I am working with multiple object detection application, as part of this I am trying to detect two of the objects using Template Matching method. I have cropped two templates in video for further process. Below are the templates, image description image description

First template is railway track separater, second one is switches placed next to track. I am trying to detect this two in source video while video file is running frame by frame in loop.

My application detecting two templates when they appear in frame. The problem is even though both templates disappear from frame, still application detecting some area. Below is the frame with expected result, image description

And frames with miss match, image description image description

Could any one help me to overcome this problem.

I just want to detect the objects with respect to providing templates in video. I don't want to track the objects. Below is the code I have used, //utility functions Mat TplMatch( Mat &img, Mat &mytemplate/vector<mat>temp/) { Mat result; matchTemplate( img, mytemplate/temp/, result, CV_TM_CCOEFF_NORMED ); normalize( result, result, 0, 1, NORM_MINMAX, -1, Mat() ); return result; }

        //Localizing the best match with minMaxLoc 
        Point minmax( Mat &result )
            {
                  double minVal, maxVal;
                  Point  minLoc, maxLoc, matchLoc;
                 minMaxLoc( result, &minVal, &maxVal, &minLoc, &maxLoc, Mat() );
                 matchLoc = maxLoc;
               //cout<<"minVAl of temp:"<<minVal<<"maxVAl of temp:"<<maxVal<<endl;
                  return matchLoc;
            }


     //in Main function(inside loop)

        Mat temp = imread("temp.png", 1);
    Mat result  =  TplMatch( videoFeed, temp);
   Point match = minmax(result);
   rectangle(videoFeed, match, Point(match.x + temp.cols , match.y + temp.rows), Scalar(0,255,0), 3);

help me to overcome this problem. Help would be appreciated greatly.

Regards.

2014-10-29 02:57:35 -0600 received badge  Popular Question (source)
2013-07-29 05:40:20 -0600 received badge  Student (source)
2013-07-29 04:36:26 -0600 commented question Angle and Scale Invariant Template matching

@Notas & @Mathieu Barnachon ... please see my updated question and help me to solve the issue.

2013-07-25 02:05:41 -0600 asked a question Angle and Scale Invariant Template matching

Below Function rotates the template image from 0 to 360(using for loop to rotate image matrix 20 degrees in each loop) degrees to search all matches present in all angles in source image. when I build the application , there is no errors . While debug the application I am getting below error,

Unhandled exception at 0x74ec812f in Template_Match.exe: Microsoft C++ exception: cv::Exception at memory location 0x002e02a8..

Someone please help me to rectify the issue.Help would be appreciated greatly.

/// function to rotate (0 to 360 degrees) template for template matching .
void matchTemplate()
{
    int  j, x, y, key;

    double minVal;
    char windowNameSource[] = "Original Image";
    char windowNameDestination[] = "Result Image";
    char windowNameCoefficientOfCorrelation[] = "Coefficient of Correlation Image";

    Point minLoc;
    Point tempLoc;

    Mat templateImage = imread("template.jpg");
    Mat sourceImage = imread("sourceImage.jpg");

    Mat graySourceImage = cvCreateMat(sourceImage.rows,sourceImage.cols,CV_32FC1);
    Mat grayTemplateImage = cvCreateMat(templateImage.rows,templateImage.cols,CV_32FC1);
    Mat binarySourceImage = cvCreateMat(sourceImage.rows,sourceImage.cols,CV_32FC1);
    Mat binaryTemplateImage = cvCreateMat(templateImage.rows,templateImage.cols,CV_32FC1);
    Mat destinationImage = cvCreateMat(sourceImage.rows,sourceImage.cols,CV_32FC3);

    sourceImage.copyTo(destinationImage);
    cvtColor(sourceImage,graySourceImage,CV_RGB2GRAY);
    cvtColor(templateImage,grayTemplateImage,CV_RGB2GRAY);

    threshold(graySourceImage,binarySourceImage,0.8,1.0,CV_THRESH_TOZERO);
    threshold(grayTemplateImage,binaryTemplateImage,0.8,1.0,CV_THRESH_TOZERO);

    float degree = 20.0f;
    for(j = 0; j <= 18; j++) 
    {
        Mat tempBinaryTemplateImage = cvCreateMat(templateImage.rows, templateImage.cols,     CV_32FC1);
        Mat result = cvCreateMat(sourceImage.rows - templateImage.rows + 1, sourceImage.cols -templateImage.cols + 1, CV_32FC1);
        resize(binaryTemplateImage, tempBinaryTemplateImage,Size(),0.5,0.5,CV_INTER_AREA);

        Mat rotateBinaryTemplateImage = cvCreateMat(tempBinaryTemplateImage.rows, tempBinaryTemplateImage.cols, CV_32FC1);

        for(y = 0; y < templateImage.cols; y++)
        {
            for(x = 0; x < templateImage.rows; x++)
            {
                float radian = (float)j * degree * CV_PI / 180.0f;
                int scale = y * templateImage.rows + x;
                int rotateY = - sin(radian) * ((float)x - (float)templateImage.rows / 2.0f) + cos(radian) * ((float)y - (float)templateImage.cols / 2.0f) + te
                int rotateX = cos(radian) * ((float)x - (float)templateImage.rows / 2.0f) + sin(radian) * ((float)y - (float)templateImage.cols / 2.0f) + temp

                if(rotateY < templateImage.cols && rotateX < templateImage.rows && rotateY >= 0 && rotateX  >= 0)
                    rotateBinaryTemplateImage.data[scale] = tempBinaryTemplateImage.data[rotateY * templateImage.rows + rotateX];
            }
        }

        matchTemplate(binarySourceImage, rotateBinaryTemplateImage, result, CV_TM_CCOEFF_NORMED);
        minMaxLoc(result, &minVal, NULL, &minLoc, NULL, NULL);

        if(minVal < 0.8)
        {
            tempLoc.x = minLoc.x + templateImage.rows;
            tempLoc.y = minLoc.y + templateImage.cols;
            rectangle(destinationImage, minLoc, tempLoc, CV_RGB(0, 255, 0), 1, 8, 0);
        }

    }
    imshow(windowNameDestination, destinationImage);
    key = waitKey(0);
}
2013-04-01 20:05:45 -0600 commented answer How can I imread just an ROI, not the whole image?

Hi steven, I am also doing assignment on processing Selected ROI from whole image . If you have any idea or sample codes to understand the concept please help me .Thank you !!

2013-04-01 19:57:01 -0600 commented answer Problem with template matching in SUB-IMAGE extracted from ORIGINAL-IMAGE.

Hi Steven , I have changed clone() function with cvCopy now it's not crashing but I am not getting any output. What I want to do is, Perform Template Matching on particular region of interest in original image by selecting ROI with mouse .If you have any idea about this regard.Please help me.Thank you!!

2013-04-01 19:52:20 -0600 received badge  Supporter (source)
2013-03-19 00:00:22 -0600 received badge  Editor (source)
2013-03-18 23:59:05 -0600 asked a question Problem with template matching in SUB-IMAGE extracted from ORIGINAL-IMAGE.

One whole day I have tried a lot to get all the related templates (with matchtemplate function) in sub-matrix, which i have already extracted from the original image with the mousecallback function. So my code is below for the Matchingfunction,

void CTemplate_MatchDlg::OnBnTemplatematch()

{ namedWindow("reference",CV_WINDOW_AUTOSIZE); while(true) {

 Mat ref = imread("img.jpg");                    //  Original Image   
 mod_ref = cvCreateMat(ref.rows,ref.cols,CV_32F);// resizing the image to fit in picture box
 resize(ref,mod_ref,Size(),0.5,0.5,CV_INTER_AREA);

   Mat tpl =imread("Template.jpg"); // TEMPLATE IMAGE  
  cvSetMouseCallback("reference",find_mouseHandler,0);

  Mat aim=roiImg1.clone(); // SUB_IMAGE FROM ORIGINALIMAGE

     if(select_flag1 == 1)
    {

        // imshow("ref",aim);

        Mat res(aim.rows-tpl.rows+1, aim.cols-tpl.cols+1,CV_32FC1);
                    matchTemplate(aim, tpl, res, CV_TM_CCOEFF_NORMED);
        threshold(res, res, 0.8, 1., CV_THRESH_TOZERO);

     while (1) 
   {
    double minval, maxval, threshold = 0.8;
    Point minloc, maxloc;
    minMaxLoc(res, &minval, &maxval, &minloc, &maxloc);

   //// Draw Bound boxes for detected templates in sub matrix

    if (maxval >= threshold)
     {
        rectangle(
            aim, 
            maxloc, 
            Point(maxloc.x + tpl.cols, maxloc.y + tpl.rows), 
            CV_RGB(0,255,0), 1,8,0
        );
        floodFill(res, maxloc, cv::Scalar(0), 0, cv::Scalar(.1), cv::Scalar(1.));
          }else
        break;
        }
     }
      ////Bounding box for ROI  selection with mouse
      rectangle(mod_ref, rect2, CV_RGB(255, 0, 0), 1, 8, 0);
    imshow("reference", mod_ref);
    waitKey(10);
    }

//cvReleaseMat(&mod_ref); destroyWindow("reference"); }

// Implement mouse callback

void find_mouseHandler(int event, int x, int y, int flags, void* param) { if (event == CV_EVENT_LBUTTONDOWN && !drag) { /* left button clicked. ROI selection begins*/ point1 = Point(x, y); drag = 1;

}

if (event == CV_EVENT_MOUSEMOVE && drag)
{
    /* mouse dragged. ROI being selected*/ 
    Mat img3 = mod_ref.clone();
    point2 = Point(x, y);
    rectangle(img3, point1, point2, CV_RGB(255, 0, 0), 1, 8, 0);
    imshow("reference", img3);

    //  
}

if (event == CV_EVENT_LBUTTONUP && drag)
{

    Mat img4=mod_ref.clone();
            point2 = Point(x, y);
    rect2 = Rect(point1.x,point1.y,x-point1.x,y-point1.y);
            drag = 0;
    roiImg1 = mod_ref(rect2);  //SUB_IMAGE MATRIX
        imshow("reference", img4);
}

if (event == CV_EVENT_LBUTTONUP)
{
   /* ROI selected */
    select_flag1 = 1;
    drag = 0;
}

}

build and debugging process successfully done. But, when I click the Match button in dialog I m getting the below error,

Unhandled exception at 0x74bf812f in Match.exe: Microsoft C++ exception: cv::Exception at memory location 0x001ae150..

So my idea is to get all the matches in the Sub-image when compare with the TEMPLTE IMAGE and show the final result (matches with bounding boxes) in the ORIGINAL IMAGE itself.

Anyone help me in this regard!! Help would be appreciated greatly!!