Ask Your Question

qinling123's profile - activity

2020-10-01 04:01:21 -0600 received badge  Popular Question (source)
2014-10-14 21:54:21 -0600 asked a question how to fit an ellipse to 2D data with random three points and thire gradient?

i need to fit an ellipse to 2D data with random three points and their gradient. and the points is the edge points of one image. i use the Opencv function to calculate the gradient of each point.

i konw the RANSAC algorithm can do this job. and this algorithm can find the inner points fitting the ellipse and reject the noise points. but this algorithm uses five random points and it increases the sample times. so i want to improve this algorithm.

now considering the ellipse property, i find the three random points and their gradient can fit an ellipse. i have done this job combining the RANSAC algorithm. i choose three random points, calculate the ellipse center with their gradient. when i choose the fourth point and add some constraint of the ellipse. lastly, i find the inner points. but it doesnot work well.

so i want to know how to make this job well, especially restraining the fourth point with the ellipse property.

thanks! this is all the points enter image description here

this is the result(the green points is the inner points, the red is the noise, the blue is the center) enter image description here

2014-10-12 08:31:44 -0600 commented question how to use the SVM algorithm to find the inner points in the job of ellipse fitting

ok, thanks, i find the SVM algorithm cannot do this job. but it can move the noise points and leave the efficient points. for example, leave the points looking like making up an circle in the image above

2014-10-11 20:44:00 -0600 asked a question how to use the SVM algorithm to find the inner points in the job of ellipse fitting

i need to fit an ellipse with many points of noise points. i konw the RANSAC algorithm can do this job. and this algorithm can find the inner points fitting the ellipse and reject the noise points. recently, i have learnt SVM algorithm, consider that if find the appropriate Kernel function, we can do this nonlinear classification. according this kernal function, we can mapped all the point to high-dimensional space, to solve the linear inseparable problem in the original space.

so i want to konw whether the SVM can be used to find the inner points and how to do this job?

or have other method to solve this problem?

this is the image of points including noise used to fit an ellipse

thanks!image description

2013-12-06 06:38:32 -0600 asked a question digital recongnition in seven-segment numeric instrument

i want to do digital recongnition with sewing method. i have marked the seven-segment a-f in accordance with the clockwise direction. the process is

enter code here

#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <stdio.h>
using namespace cv;
using namespace std;
const uchar by=1; 
const int store=200;
int main()
{      
    Mat w=imread("0.bmp");
if (!w.data)
{
    cout<<"error"<<endl;
}
imshow("souce_image",w);
Mat r;
threshold(w,r,60,255,THRESH_BINARY);
imshow("threshold_image",r);
    cout<<r.size().height<<"*"<<r.size().width<<endl;
    Mat q;
r.copyTo(q);
Point p1(q.size().width*1.0/2,0);
Point p2(q.size().width*1.0/2,q.size().height);
Point p3(0,q.size().height*1.0/3);
Point p4(q.size().width,q.size().height*1.0/3);
Point p5(0,q.size().height*2.0/3);
Point p6(q.size().width,q.size().height*2.0/3);
    line(q,p1,p2,Scalar(255),1);
line(q,p3,p4,Scalar(255),1);
line(q,p5,p6,Scalar(255),1);
    int a=0,b=0,c=0,d=0,e=0,f=0,g=0;
//a g d 
int j_agd=r.size().width*1.0/2;
//a
for (int i_a=0;i_a<r.size().height*1.0/3;i_a=i_a+by)
{
    if (r.at<uchar>(j_agd,i_a)>store)
    {
        a=1;
        Point a1(j_agd,i_a);
        line(q,a1,a1,Scalar(0,0,255),4);
        break;
    }
}
//g
for (int i_g=r.size().height*1.0/3;i_g<r.size().height*2.0/3;i_g=i_g+by)
{
    if (r.at<uchar>(j_agd,i_g)>store)
    {
        g=1;
        Point g1(j_agd,i_g);
        line(q,g1,g1,Scalar(0,0,255),4);
        break;
    }
}
//d
for (int i_d=r.size().height*2.0/3;i_d<r.size().height;i_d=i_d+by)
{
    if (r.at<uchar>(j_agd,i_d)>store)
    {
        d=1;
        Point d1(j_agd,i_d);
        line(q,d1,d1,Scalar(0,0,255),4);
        break;
    }
}
    //b f
int i_bf=r.size().height*1.0/3;
//b
for (int j_b=0;j_b<r.size().width*1.0/2;j_b=j_b+by)
{
    if (r.at<uchar>(j_b,i_bf)>store)
    {
        b=1;
        Point b1(j_b,i_bf);
        line(q,b1,b1,Scalar(0,0,255),4);
        break;
    }
}
//f
for (int j_f=r.size().width*1.0/2;j_f<r.size().width;j_f=j_f+by)
{
    if (r.at<uchar>(j_f,i_bf)>store)
    {
        f=1;
        Point f1(j_f,i_bf);
        line(q,f1,f1,Scalar(0,0,255),4);
        break;
    }
}
//c e
int i_ce=r.size().height*2.0/3;
//c
for (int j_c=0;j_c<r.size().width*1.0/2;j_c=j_c+by)
{
    if (r.at<uchar>(j_c,i_ce)>store)
    {
        c=1;
        Point c1(j_c,i_ce);
        line(q,c1,c1,Scalar(0,0,255),4);
        break;
    }
}
//e
for (int j_e=r.size().width*1.0/2;j_e<r.size().width;j_e=j_e+by)
{
    if (r.at<uchar>(j_e,i_ce)>store)
    {
        e=1;
        Point e1(j_e,i_ce);
        line(q,e1,e1,Scalar(0,0,255 ...
(more)
2013-11-08 00:46:35 -0600 asked a question How to compare two images which have only brightness different?

I have made a program about the instrument detection. And I take out two images about the instrument pointer. I use perspective transformation to correct one of the images. Finally, I achieve two images different from the location of the pointer. I only need to compare the location of the pointer. So I use the OpenCV function absdiff to subtract them. But the result includes other information. I find two images have been different from the brightness. I need a good method to solve the problem so that the two images have the same brightness and are different from the pointer location. Thanks! image description image description image description image description

image1 and image2 is the source image, image3 is the warppespective image. Gray the image2 and subtract it with image3. Achieve the imag4. image4 includes other information. I only want the two pointers. I find that the difference brightness between image1 and image2 causes the rusult. How to solve this matter? Thanks!

2013-11-03 20:45:13 -0600 commented question how to make two images only different from the brightness become the same

I have made a program about the instrument detection. And I take out two images about the instrument pointer. I use perspective transformation to correct one of the images. Finally, I achieve two images different from the location of the pointer. I only need to compare the location of the pointer. So I use the OpenCV function absdiff to subtract them. But the result includes other information. I find two images have been different from the brightness. I need a good method to solve the problem so that the two images have the same brightness and are different from the pointer location. Thanks!!

2013-11-03 07:59:52 -0600 received badge  Editor (source)
2013-11-03 07:55:45 -0600 asked a question how to make two images only different from the brightness become the same

I take out two images only different from the brightness. I want to make them subtract with the function absdiff of OpenCV. But fail, how can I make them become the same. Thanks!