Ask Your Question

Ztar03's profile - activity

2020-02-28 10:22:56 -0500 received badge  Popular Question (source)
2017-10-18 23:42:08 -0500 edited question How to get the length of each of the curves present in the retina image?

How to get the length of each of the curves present in the image? I have an image of a retina, I need to calculate the l

2017-10-18 23:39:31 -0500 asked a question How to get the length of each of the curves present in the retina image?

How to get the length of each of the curves present in the image? I have an image of a retina, I need to calculate the l

2015-01-27 10:46:38 -0500 commented question Detected lanes with Hough in OpenCV

Thank you very much for the help you've resolved by adjusting the angle at which the Hough works and have gone a little further segmentation only now emerged a new problem I hope you can help me here I leave the link http://answers.opencv.org/question/53...

2015-01-25 14:17:21 -0500 received badge  Student (source)
2015-01-25 13:55:52 -0500 asked a question Where to save coordinates of probabilistic Hough?

Hi all Yesterday I posted a question which fortunately resolved I'm just now another problem, what is at issue is this ... since I submitted my images to different algorithms ... get a picture with rail lines but are not complete ... I was finding out the equation of each line and solve the system of equations ... and I have a program that gives me the coordinates of the intersection but now my problem is to keep the coordenas delivering HoughP to solving the system of equations and thus finally draw the lines to form a kind of triangle.

Enclose the images obtained

image description

This is what I try to do ...

image description

This is the code of the intersection

 #include <iostream>
 #include <vector>
 #include <stdio.h>
 #include <iomanip>
 #include <iostream>
 #include <math.h>
 #include <algorithm>

 using namespace std;
 int main(){
 float x1 = 406;
 float x2 = 436;
 float x3 = 202;
 float x4 = 206;
 float y1 = 83;
 float y2 = 93;
 float y3 = 7;
 float y4 = 100;

 float d = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
// If d is zero, there is no intersection
 if (d == 0) {
    cout << "NO hay interseccion\n";
 }

 // Get the x and y
 float pre = (x1*y2 - y1*x2);
 float post = (x3*y4 - y3*x4);
 float x = ( pre * (x3 - x4) - (x1 - x2) * post ) / d;
 float y = ( pre * (y3 - y4) - (y1 - y2) * post ) / d;

// Check if the x and y coordinates are within both lines
if ( x < min(x1, x2) || x > max(x1, x2) || x < min(x3, x4) || x > max(x3, x4) ){
    cout << "son colineales\n";
} 
if ( y < min(y1, y2) || y > max(y1, y2) || y < min(y3, y4) || y > max(y3, y4) ) {
    cout << "son colineales\n"; 
}

// Return the point of intersection
cout << x << "\n";
cout << y << "\n";
return 0;

}

And this is the part that takes the HoughP and trace the lines

  vector<cv::Vec4i> findLines(cv::Mat& binary) {
       lines.clear();
       cv::HoughLinesP(binary, lines, 1, CV_PI/720, 25, 10, 10 );
      return lines;
  }
  // Draw the detected lines on an image
  void drawDetectedLines(cv::Mat &image, cv::Scalar color=cv::Scalar(255,0,0)) {
         // Draw the lines
          vector<cv::Vec4i>::const_iterator it2= lines.begin();
          while (it2!=lines.end()) {
          float x1=((*it2)[0]);
          float y1=((*it2)[1]+shift);
          float x2=((*it2)[2]);
          float y2=((*it2)[3]+shift);
          cv::Point pt1(x1,y1);        
          cv::Point pt2(x2,y2);
          //Angle lines
          double Angle = atan2(pt2.y - pt1.y,pt2.x - pt1.x) * 180.0 / CV_PI; 
          if(Angle>10){
                cv::line( image, pt1, pt2, color, 6 );
                cout << "Angulo "<< Angle << "\n"; 
           } 

              cout << " HoughP line: ("<< pt1 <<"," << pt2 << ")\n"; 
                      ++it2;
          }

  }
2015-01-25 12:55:53 -0500 received badge  Enthusiast
2015-01-24 10:33:19 -0500 asked a question Join lines to a certain limit

I made an algorithm which detect the Hough lines present in the image after that make a bitwise between the lines obtained in Hough and HoughP and get a picture like that enclose, now what I need is to join the lines to form a triangle,someone to suggest something ?? image description

image description

2015-01-24 10:21:21 -0500 received badge  Scholar (source)
2015-01-22 23:40:15 -0500 asked a question How to get the ROI of an image from the center

Hello good evening I started researching about getting the ROI of an image and from what I understand is using function RECT I've tried but I get an error and honestly do not quite understand its parameters mean, if someone can help me roi get the picture attached below.

image description

My code is the next

Mat image;
image = imread(argv[1]);
int alto = 100; 
Rect roi(0,(image.rows)-alto,image.cols,alto);
Mat imgROI = image(roi);
imwrite("ROI.jpg",imgROI);

and the error is the next

Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and type), nor 'array op scalar', nor 'scalar op array') in binary_op, file /home/jenny/Downloads/opencv-2.4.9/modules/core/src/arithm.cpp, line 1021 terminate called after throwing an instance of 'cv::Exception'

2015-01-18 15:41:06 -0500 commented question Detected lanes with Hough in OpenCV

I modified the code as you indicated to me and now I got a picture like the one attached.

2015-01-17 06:21:32 -0500 received badge  Necromancer (source)
2015-01-16 02:08:25 -0500 answered a question lane tracking - how to group hough lines

I am working with the same and have some problems someone to provide me ideas because even though I try not detect the dotted lines lane and sometimes yellow either http://answers.opencv.org/question/53...

2015-01-16 01:57:49 -0500 received badge  Editor (source)
2015-01-16 01:45:25 -0500 asked a question Detected lanes with Hough in OpenCV

Now I've been working on the analysis of images with OpenCV, what I'm trying to do is recognize the lane dividing lines, what I do is:

  1. I receive an image,
  2. Then grayscale transform
  3. I applying GaussianBlur
  4. After I get in the ROI
  5. I apply the wily
  6. After looking lines with lines Hough transform
  7. Draw lines obtained from the Hough

But I've run into a problem which is: it does not recognize dotted boundaries, nor does not always recognize the yellow lines. Someone give me an idea I've tried everything but can not get anything ...

I hope you help me solve this problem, you will thank a lot. I attached code and some sample images.

#include "opencv2/highgui/highgui.hpp"
#include <opencv2/objdetect/objdetect.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <vector>
#include <stdio.h>
#include "linefinder.h"

#define PI 3.1415926

using namespace cv;
using namespace std;

int main(int argc, char* argv[]) {
  int houghVote = 200;
  string arg = argv[1];
  Mat image;
  image = imread(argv[1]);  
  Mat gray;
  cvtColor(image,gray,CV_RGB2GRAY);
  GaussianBlur( gray, gray, Size( 5, 5 ), 0, 0 );
  vector<string> codes;
  Mat corners;
  findDataMatrix(gray, codes, corners);
  drawDataMatrixCodes(image, codes, corners);
  //Mat image = imread("");
  //Rect region_of_interest = Rect(x, y, w, h);
  //Mat image_roi = image(region_of_interest);
  std::cout << image.cols << "\n";
  std::cout << image.rows << "\n";
  Rect roi(0,200,640,206);
  Mat imgROI = image(roi);
  // Display the image
  imwrite("original.bmp", imgROI);
  // Canny algorithm
  Mat contours;
  Canny(imgROI, contours, 120, 300, 3); 
  imwrite("canny.bmp", contours);
  Mat contoursInv;
  threshold(contours,contoursInv,128,255,THRESH_BINARY_INV);
  // Display Canny image
  imwrite("contours.bmp", contoursInv);

 /* 
 Hough tranform for line detection with feedback
 Increase by 25 for the next frame if we found some lines.  
 This is so we don't miss other lines that may crop up in the next frame
 but at the same time we don't want to start the feed back loop from scratch. 
 */
 std::vector<Vec2f> lines;
 if (houghVote < 1 or lines.size() > 2){ // we lost all lines. reset 
    houghVote = 200; 
 }/*else{ 
    houghVote += 25;
 } */
 while(lines.size() < 5 && houghVote > 0){
    HoughLines(contours,lines,1,PI/180, houghVote);
    houghVote -= 5;
 }
 std::cout << houghVote << "\n";
 Mat result(imgROI.size(),CV_8U,Scalar(255));
 imgROI.copyTo(result);
 // Draw the limes
 std::vector<Vec2f>::const_iterator it= lines.begin();
 Mat hough(imgROI.size(),CV_8U,Scalar(0));
 while (it!=lines.end()) {
    float rho= (*it)[0];   // first element is distance rho
    float theta= (*it)[1]; // second element is angle theta
    if ( theta > 0.09 && theta < 1.48 || theta < 3.14 && theta > 1.66 ) { 
    // filter to remove   vertical and horizontal lines
        // point of intersection of the line with first row
        Point pt1(rho/cos(theta),0);        
        // point of intersection of the line with last row
        Point pt2((rho-result.rows*sin(theta))/cos(theta),result.rows);
        // draw a white line
        line( result, pt1, pt2, Scalar(255), 8); 
        line( hough, pt1, pt2, Scalar(255), 8);
    }
    ++it;
  }

  // Display the detected line image
  std::cout << "line image:"<< "\n";
  namedWindow("Detected Lines with Hough");
  imwrite ...
(more)