Which points on the same curve?

In summary, the conversation is about finding and saving points on three different curves simultaneously. The code is using OpenCV to compare and calculate coordinates in an image. The goal is to identify specific points within the curves and save them for further analysis.
  • #1
sanane
1
0
Hi everyone
ın fact at the beginning ı want to select three points every curve Idid it But now I shold find which points ont the same time AND THEN I shold save its How can do it

My code is here
C:
#include <iostream>
#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/contrib/contrib.hpp"
#include <vector>
#include <stdio.h>
#include <algorithm>
using namespace std;
using namespace cv;
struct Koordinat {
        int x;
        int y;
};
int main()
{
        int const r1 = 50, r2 = 73, r3 = 15;
        std::vector<Koordinat> cember1, cember2, cember3;

        Mat image = imread("C:\\OpenCv2.4.6\\6.png");

        int ikiBoyutKarsilastirDizi[100][2] = {};
        int atlananKoordinatlar[100][2] = {};
        cv::Vec3b pixelColor(255, 255, 0);

        //circle( image, Point( 385, 385 ), 100.0, Scalar( 0, 0, 255 ), 1, 8 );
        //circle(image, Point(385, 385), 100, Scalar(255, 0, 0), 1, 8, 0);

        Vec3b color2 = image.at<Vec3b>(Point(394, 378));        for (int i = 0; i < image.cols; ++i) {  // row la sütunun yeri  yanlış olduğu için hesaplamalar yanlıs çıkıyor...
                for (int j = 0; j < image.rows; ++j) {
                      
                        Vec3b intensity = image.at<Vec3b>(j, i);
                        uchar blue = intensity.val[0];
                        uchar green = intensity.val[1];
                        uchar red = intensity.val[2];
                        //int b = int(image.at<cv::Vec3b>(i, j)[0]);
                        //int g = int(image.at<cv::Vec3b>(i, j)[1]);
                        //int r = int(image.at<cv::Vec3b>(i, j)[2]);
                        int x = 385, y = 385;

                        int cember_denklemi1;
                        int cember_denklemi2;
                        int cember_denklemi3;
                        //float cember_denklemi1, cember_denklemi2, cember_denklemi3;
                        ///**/
                        //cember_denklemi1 = sqrt((i - x)*(i - x) + (j - y)*(j - y) - (r1*r1));
                        //cember_denklemi2 = sqrt((i - x)*(i - x) + (j - y)*(j - y) - (r2*r2));
                        //cember_denklemi3 = sqrt((i - x)*(i - x) + (j - y)*(j - y) - (r3*r3));

                        cember_denklemi1 =  (i - x)*(i - x) + (j - y)*(j - y) - (r1*r1);
                          cember_denklemi2 = (i - x)*(i - x) + (j - y)*(j - y) - (r2*r2);
                        cember_denklemi3 = (i - x)*(i - x) + (j - y)*(j - y) - (r3*r3);
                        int sayac = 0;

              
                        if (cember_denklemi1 >=0 && cember_denklemi1 <=300&&(blue&&red&&green>0))
                        {
                              
                              
                                image.at<Vec3b>(Point(i, j)) = pixelColor;
                              
              

                              
                                //Vec3b color = image.at<Vec3b>(Point(i, j));
                                cout << "gelen koordinat : " << i << " " << j << endl;
                                if (ikiBoyutKarsilastirDizi[0][0] == 0)
                                        //eğer dizinin içi boş ise vektörü ata. i ve j yi göster.
                                {
                                        ikiBoyutKarsilastirDizi[0][0] = i;
                                        ikiBoyutKarsilastirDizi[0][1] = j;
                                        cout << "KIRMIZI" << i << " " << j << endl;
                      
                                //      image.at<Vec3b>(Point(i, j)) = color2;
                                }
                                else
                                {
                                        for (int z = 0; z<100; z++)//dizinin büyüklüğü 100 olduğu için.
                                        {
                                                if (ikiBoyutKarsilastirDizi[z][0] != 0 && ikiBoyutKarsilastirDizi[z][1] != 0)
                                                {
                                                      
/* 287 365 yüzünden and or oldu */if (abs(ikiBoyutKarsilastirDizi[z][0] - i) >= 5 || abs(ikiBoyutKarsilastirDizi[z][1] - j) >= 5) // eğer daha önce diziye atanmış vektörün x ve y'si yeni eklenmeye çalışan vektörün x ve y' sinden 5 fazla yada eksik mi kontrolü. abs'ın amacı -3 yada -2 çıkma durumunda olayı kurtarmak.
                                                        {
                                                              
                                                                sayac = z;
                                                      
                                                        }
                                                        else
                                                        {
                                                              
                                                                sayac = -1;
                                                                break;
                                                        }
                                                }
                                        }
                                      
                                        if (sayac != -1)
                                        {
                                              
                                                ikiBoyutKarsilastirDizi[sayac + 1][0] = i;
                                                ikiBoyutKarsilastirDizi[sayac + 1][1] = j;
                                                cout << "KIRMIZI" << i << " " << j << endl;
                                      
                                        }
                                        else //atlanan koordinat buraya düşecek.
                                        {
                                                cout << "atlanan koordinat: " <<i << " " << j << endl;
                                              
                                        }

                                }
                        }
                        int sayac2=0;
                         if (cember_denklemi2 >=0 && cember_denklemi2 <=300&&(blue&&red&&green>0))
                        {
                              
                              
                                image.at<Vec3b>(Point(i, j)) = pixelColor;
                              
              

                              
                                //Vec3b color = image.at<Vec3b>(Point(i, j));
                                cout << "gelen koordinat1 : " << i << " " << j << endl;
                                if (ikiBoyutKarsilastirDizi[0][0] == 0)
                                        //eğer dizinin içi boş ise vektörü ata. i ve j yi göster.
                                {
                                        ikiBoyutKarsilastirDizi[0][0] = i;
                                        ikiBoyutKarsilastirDizi[0][1] = j;
                                        cout << "BUYUK" << i << " " << j << endl;
                      
                                //      image.at<Vec3b>(Point(i, j)) = color2;
                                }
                                else
                                {
                                        for (int z = 0; z<100; z++)//dizinin büyüklüğü 100 olduğu için.
                                        {//0 0 geldiğinde 5 ten büyük gözüktüğü için dahil ediyor 0'lar için özel bir şey lazım.
                                                if (ikiBoyutKarsilastirDizi[z][0] != 0 && ikiBoyutKarsilastirDizi[z][1] != 0) // birinci yada ikinci değer 0 değilse aramaya devam et.
                                                {
                                                      
/* 287 365 yüzünden and or oldu */if (abs(ikiBoyutKarsilastirDizi[z][0] - i) >= 5 || abs(ikiBoyutKarsilastirDizi[z][1] - j) >= 5)
                                                        {
                                                              
                                                              
                                                                sayac2 = z;
                                                      
                                                        }
                                                        else
                                                        {
                                                              
                                                                sayac2 = -1;
                                                                break;
                                                        }
                                                }
                                        }
                                        //bütün değerlerin kontrolü yapıldıktan sonra eleman eklenmeli ve gösterilmeli.
                                        if (sayac2 != -1)
                                        {
                                              
                                                ikiBoyutKarsilastirDizi[sayac2 + 1][0] = i;
                                                ikiBoyutKarsilastirDizi[sayac2 + 1][1] = j;
                                                cout << "BUYUK" << i << " " << j << endl;
                                      
                                        }
                                        else //atlanan koordinat buraya düşecek.
                                        {
                                                cout << "atlanan koordinat1: " <<i << " " << j << endl;
                                              
                                        }

                                }
                        }
                        int sayac3=0;
                       
                        if (cember_denklemi3 >=0 && cember_denklemi3 <=300&&(blue&&red&&green>0))
                        {
                              
                              
                                image.at<Vec3b>(Point(i, j)) = pixelColor;
                              
              

                              
                                //Vec3b color = image.at<Vec3b>(Point(i, j));
                                cout << "gelen koordinat2 : " << i << " " << j << endl;
                                if (ikiBoyutKarsilastirDizi[0][0] == 0)
                                        //eğer dizinin içi boş ise vektörü ata. i ve j yi göster.
                                {
                                        ikiBoyutKarsilastirDizi[0][0] = i;
                                        ikiBoyutKarsilastirDizi[0][1] = j;
                                        cout << "KUCUK" << i << " " << j << endl;
                      
                                //      image.at<Vec3b>(Point(i, j)) = color2;
                                }
                                else //dizinin ilk elemanı atanmış ise karşılaştırma yap 5 fark kuralına uygunsa diziye ekle, uygun değilse vektörü atla. Atladıysan vektörü gösterme atlamadıysan vektörü göster.
                                {
                                        for (int z = 0; z<100; z++)//dizinin büyüklüğü 100 olduğu için.
                                        {//0 0 geldiğinde 5 ten büyük gözüktüğü için dahil ediyor 0'lar için özel bir şey lazım.
                                                if (ikiBoyutKarsilastirDizi[z][0] != 0 && ikiBoyutKarsilastirDizi[z][1] != 0) // birinci yada ikinci değer 0 değilse aramaya devam et.
                                                {
                                                      
/* 287 365 yüzünden and or oldu */if (abs(ikiBoyutKarsilastirDizi[z][0] - i) >= 5 || abs(ikiBoyutKarsilastirDizi[z][1] - j) >= 5) // eğer daha önce diziye atanmış vektörün x ve y'si yeni eklenmeye çalışan vektörün x ve y' sinden 5 fazla yada eksik mi kontrolü. abs'ın amacı -3 yada -2 çıkma durumunda olayı kurtarmak.
                                                        {// Doğruysa,atlamadığımız için karşılaştırma dizisine ata,göster.
                                                                //sürekli olarak 1'e yada 0 a kaydediyor dizideki ilk 0 indisini bul demek lazım.iptal kontrolü dışarı çıkar.
                                                              
                                                                sayac3 = z;
                                                      
                                                        }
                                                        else
                                                        {
                                                              
                                                                sayac3 = -1;
                                                                break;
                                                        }
                                                }
                                        }
                                        //bütün değerlerin kontrolü yapıldıktan sonra eleman eklenmeli ve gösterilmeli.
                                        if (sayac3 != -1)
                                        {
                                              
                                                ikiBoyutKarsilastirDizi[sayac3 + 1][0] = i;
                                                ikiBoyutKarsilastirDizi[sayac3 + 1][1] = j;
                                                cout << "KUCUK" << i << " " << j << endl;
                                      
                                        }
                                        else //atlanan koordinat buraya düşecek.
                                        {
                                                cout << "atlanan koordinat2: " <<i << " " << j << endl;
                                              
                                        }

                                }
                        }
                       
                }
        }
        imshow("Image", image);
        int k = waitKey();
           imwrite("5.jpg", image);
        //waitKey( 0 );
        return(0);
}
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
I am sorry. But your description is not clear enough. From your code I can see your native language is Turkish and you probably cannot speak or write English too well. If you want to program on a professional level in the future I urge you to learn English.
In the professional world software is documented in English so that everyone can understand your program. And when you want to build upon a program from someone else it would be very difficult to do so if it was written in a language you don't understand
 

1. What is a curve?

A curve is a continuous line or path that changes direction at various points. In mathematics and science, a curve is often represented by a mathematical equation or function.

2. What are points on a curve?

Points on a curve are specific locations along the curve where the coordinates of the curve's equation satisfy the given conditions. These points can be used to plot the curve and understand its shape and behavior.

3. How do you determine which points are on the same curve?

To determine which points are on the same curve, you can use the curve's equation or function. Plug in the coordinates of each point and see if they satisfy the equation. If they do, then the points are on the same curve.

4. Can points on the same curve have different coordinates?

Yes, points on the same curve can have different coordinates. In fact, the whole purpose of a curve is to show the relationship between different coordinates. Each point on the curve represents a unique set of coordinates that satisfy the curve's equation.

5. What is the significance of points on the same curve?

Points on the same curve are important because they help us visualize and understand the behavior of the curve. By plotting multiple points on a curve, we can see how the curve changes and get a better understanding of its properties.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
23
Views
7K
  • Engineering and Comp Sci Homework Help
Replies
13
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
13
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
14
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
7K
  • Programming and Computer Science
Replies
5
Views
2K
Back
Top