Ask Your Question

MValeriy's profile - activity

2018-07-27 01:33:11 -0500 received badge  Famous Question (source)
2017-12-18 17:30:27 -0500 received badge  Famous Question (source)
2017-06-13 14:17:53 -0500 received badge  Notable Question (source)
2017-05-15 06:20:42 -0500 received badge  Notable Question (source)
2017-03-14 17:11:39 -0500 received badge  Popular Question (source)
2017-02-02 10:13:11 -0500 received badge  Popular Question (source)
2015-12-14 05:28:06 -0500 received badge  Supporter (source)
2015-12-14 05:27:44 -0500 commented answer how can I find necessary rectangle? or how can I find the width

thank you very much, your help is invaluable for me

2015-12-14 04:35:43 -0500 commented answer how can I find necessary rectangle? or how can I find the width

can I use minMaxLoc() to do it? http://docs.opencv.org/modules/core/d...

2015-12-14 04:35:43 -0500 received badge  Commentator
2015-12-14 04:22:05 -0500 commented answer how can I find necessary rectangle? or how can I find the width

In your code, I have limited J, and thus exclude points at the beginning and the end.
for example: if (contours[i][j].x>1 & contours[i][j].x<948)

2015-12-14 04:20:30 -0500 commented answer how can I find necessary rectangle? or how can I find the width

Unfortunately I have a question again! Can I like something out of this set of points to find the coordinates of the point with the smallest X? see Figure: http://www.pictureshack.ru/images/322...

2015-12-09 07:45:08 -0500 commented answer how can I find necessary rectangle? or how can I find the width

Thank you so much

2015-12-08 04:43:40 -0500 commented question how can I find necessary rectangle? or how can I find the width

delete or close the question?

2015-12-08 04:42:45 -0500 commented question how can I find necessary rectangle? or how can I find the width

yes of course, there is still a lot of questions, but unfortunately I can not find a solution, but time is running out - study comes to an end. I published the existing questions in one, but because it did not receive more than one response considered that the question is not clear, so I wanted to write a few simple little question. Sorry

2015-12-08 03:47:51 -0500 commented question how can I find necessary rectangle? or how can I find the width

no , Code prompted me to this forum, I'm just trying to use it to solve my problem

2015-12-08 01:44:37 -0500 asked a question how can I find necessary rectangle? or how can I find the width

using the code I can find contour, then draw a rectangle and write information about the width and height.

#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main(int, char**)
{
    VideoCapture cap(0); // open the camera
    if(!cap.isOpened())  // check 
        return -1;
    Mat edges;
    namedWindow("edges",1);
    for(;;)
    {
        Mat frame;
        cap >> frame; 
        cvtColor(frame, edges, COLOR_BGR2GRAY);
        GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
        Canny(edges, edges, 0, 50, 3);
        vector<vector<Point> > contours;
        findContours(edges, contours, RETR_LIST, CHAIN_APPROX_SIMPLE);
        for( size_t i = 0; i < contours.size(); i++ )
        {
            Rect minRect = boundingRect(contours[i]);
            if(minRect.width > 50 & minRect.height > 50 )
            {
            rectangle(frame,minRect,Scalar(0,0,255));
putText(frame,format("width = %d , height = %d",minRect.width,minRect.height), Point(minRect.x,minRect.y),
                        FONT_HERSHEY_PLAIN, 1, Scalar(0,255,0));
                }
            }
            imshow("frame", frame);
            imshow("edges", edges);
            if(waitKey(30) >= 0) break;
        }
          return 0;
    }

With this code I can find required mass for simple figure, how can I as the width of the following figures:

http://www.pictureshack.ru/images/295...

http://www.pictureshack.ru/images/240...

thank you very much

2015-12-03 05:44:52 -0500 commented answer I get no video from the camera that is connected with firewire.

I try to launch their code. It does not work.is the code complete? because the error is already in the first sentence

2015-12-03 04:24:20 -0500 commented answer I get no video from the camera that is connected with firewire.

but there is no deviceID

2015-12-03 03:50:29 -0500 commented answer I get no video from the camera that is connected with firewire.

Hello, unfortunately I do not get along with your code. but I have found something of my camera. https://www.ptgrey.com/tan/10861 when I start FlyCapture2Test.cpp I get the following:

http://www.pictureshack.ru/images/423... and the examples I can not open, unfortunately, come error messages

2015-12-02 04:07:43 -0500 asked a question find and save the coordinates

The idea draw the line and find the point of intersection. I want to ask the first line to find the coordinates (x, y) and store them in a variable. then indented 5 pixel coordinates check again if the coordinates on the Y axis are the same check again until the Y is not greater than the initial stuns Y. save the coordinates, and then find the coordinates 50 and 200 pixels. then find the point where the Y coordinate again become equal to the initial value again and save it as a variable. the screen must be vyvezheny 1) the coordinates of the first line, 2) where Y is greater than nachalngoy 3-4) coordinates 50 and 200 pixels and 5) when Y again becomes equal to the original. 5 different points

I have the following code:

int main(int argc, char** argv)
{
 Mat src,cdst;
src = imread("2.jpg");
 if(src.empty())
 {return -1;}
    cvtColor(src, cdst, CV_BGR2GRAY); 

    vector<Rect> rects_of_lines;
    Rect rect_of_line;
    rect_of_line.x = 1;
    rect_of_line.y = 0;
    rect_of_line.width = 1;
    rect_of_line.height = src.rows;

    rects_of_lines.push_back( rect_of_line );
    rectangle( src, rect_of_line, Scalar(0,0,255));

    vector<vector<Point> > contours;
    findContours(cdst.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
    Rect _boundingRect;

    for (size_t i = 0; i < contours.size(); ++i)
    {
    if( contourArea( contours[i] ) > 20 )
    {
        _boundingRect = boundingRect( Mat(contours[i]) );

        for( int j = 0; j < rects_of_lines.size(); j++ )
            {
            Rect intersection = _boundingRect & rects_of_lines[j];
            if(intersection.height > 0)
            {
                intersection.x = intersection.x + (intersection.width / 2 );
                intersection.y = intersection.y + (intersection.height / 2 );
                intersection.width = 1;
                intersection.height = 1;
            rectangle( src, intersection, Scalar(255,0,0),10);
            putText(src, format("x = %d , y = %d",intersection.x,intersection.y),Point(intersection.x,intersection.y),CV_FONT_HERSHEY_COMPLEX,0.5,Scalar(255,255,255));
                                                        } } } }
    imshow("1", src);
  waitKey();
 return 0;
}

and folowing pictures

I have : http://www.pictureshack.ru/images/946... i need : http://www.pictureshack.ru/images/400...

2015-12-02 03:20:46 -0500 commented question how can I find the coordinates with the given step?

You know how I can find the overall width of the object? My idea was that we can measure in steps 1 and where y> 388 (388 is the middle), and start counting again at the end where y = 388 finish. but this technique is too complex to calculations, the computer downloads and video shows even more. maybe try again with find—Āontours? or there may be other suitable function?

2015-12-02 03:19:07 -0500 marked best answer how can I find the coordinates with the given step?

I have the following picture from camera: http://www.pictureshack.ru/images/100...

I need: http://www.pictureshack.ru/images/643...

I tried first to find the lines with HoughLines , but results were not good races : http://www.pictureshack.ru/done_66361...

then, I considered myself as I can see the laser line . I've tried using Canny , there are too many other unnecessary lines . After that I read on the internet about HSV . as firstly I made trackable:

int iLowH = 0;
 int iHighH = 255;

 int iLowS = 0; 
 int iHighS = 255;

 int iLowV = 0;
 int iHighV = 255;

 //Create trackbars
 cvCreateTrackbar("LowH", "Control", &iLowH, 255); 
 cvCreateTrackbar("HighH", "Control", &iHighH, 255);

 cvCreateTrackbar("LowS", "Control", &iLowS, 255); 
 cvCreateTrackbar("HighS", "Control", &iHighS, 255);

 cvCreateTrackbar("LowV", "Control", &iLowV, 255); 
 cvCreateTrackbar("HighV", "Control", &iHighV, 255);

as the next I have with findcountors that Countor have found:

vector<vector<Point> > contours;
vector<Point> contour;
findContours( imgThresholded, contours, CV_RETR_TREE, CV_CHAIN_APPROX_NONE );
//findContours( edges, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE );
for ( size_t i = 0; i < contours.size(); i++)
{drawContours(imgOriginal,contours,i,color);}

und I have :

http://www.pictureshack.ru/images/750...

How do I find the coordinates at the intersection of the lines drawn by me and " lines " in the picture?

2015-12-02 01:05:14 -0500 commented answer I get no video from the camera that is connected with firewire.

I'm not sure about the alternative. How do I run this code? I created a new file and tried to run, but it did not work

2015-12-02 00:58:08 -0500 commented answer I get no video from the camera that is connected with firewire.

Hi. you were with HAVE_DC1394 right. I have changed, but unfortunately no pictures

2015-12-01 06:22:54 -0500 commented question I get no video from the camera that is connected with firewire.

VideoCapture cap (CV_CAP_FIREWARE + 0); VideoCapture cap (CV_CAP_FIREWIRE + 0); Does not help

2015-12-01 05:10:28 -0500 asked a question I get no video from the camera that is connected with firewire.

I have a question. I get no video from the camera that is connected with firewire. ordinary web camera works properly

I work with opencv3.0.0 and VS12. there is no error, as if the program does not see the camera with VS10 and Opencv231 everything goes without problem

what could be the problem?

    #include "opencv2/opencv.hpp"

using namespace cv;

int main()
{
    int c;
    Mat img;
    VideoCapture cap(0);
    while (true)
    {
        cap >> img;
         if(img.empty()){
        continue;  }  //or break; 

        Mat edges;
        cvtColor(img, edges, CV_BGR2GRAY);

        Canny(edges, edges, 10, 100);
        imshow("Canny", edges); 
        imshow("Norm", img); 
        c=waitKey(1);

         if(c==27) 
         break;
    }
         return 0;
}
2015-12-01 01:08:29 -0500 asked a question I have problem with function Find Contours! what could be the problem?

I have very simple code. Upload an image and find a contour there. it should be so, but does not go

Code `

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/core.hpp"
#include <iostream>
using namespace cv;
using namespace std;
        /// Global Variables
        Scalar color = Scalar(0,0,255);
int main(int argc, char** argv)
{
 Mat src;
src = imread("11.jpg");
 if(src.empty())
 {
        return -1;
 }
  Mat gray;
    cvtColor( src, gray, COLOR_BGR2GRAY );
    gray = gray > 127;
            // Find contours
            vector<vector<Point> > contours;
            vector<Point> contour;
            findContours( gray, contours, CV_RETR_TREE, CV_CHAIN_APPROX_NONE );
            for ( size_t i = 0; i < contours.size(); i++)
            {
            drawContours(src,contours,i,color);
            }
    imshow("gray", gray);
    imshow("src", src);
    waitKey(0);
    return 0;
}`

it showed me: http://www.pictureshack.ru/images/702...

but if I ignore the side with find contour, which is displayed as normal picture me.

I work with opencv3.0.0 and VS12.

what could be the problem?