Ask Your Question

Croolman's profile - activity

2019-07-19 08:35:37 -0600 received badge  Notable Question (source)
2019-02-27 06:01:14 -0600 received badge  Popular Question (source)
2018-06-28 13:20:20 -0600 received badge  Famous Question (source)
2017-11-02 14:56:24 -0600 received badge  Notable Question (source)
2017-07-25 03:05:17 -0600 received badge  Popular Question (source)
2017-02-28 15:17:50 -0600 commented answer What is the most effective way to access cv::Mat elements in a loop?

Important!!! The answer should be edited if possible

2016-04-20 11:57:34 -0600 asked a question Detecting edges on vehicles

I am trying to detect edges on the vehicles, but still getting bad results.

Input image:

image description

Desired/best output wanted (the green-ish line preferably):

image description

My output:

image description

I am using Canny edge detector and then HoughLinesP function. The first thing is that you can change 3 parametres in HoughLinesP and you get everytime something else, so it is hard to find the right constants. Secondly, if I accept the result I get, how would I determine that that one line in front is the one I want?

2016-04-20 10:53:39 -0600 answered a question What exactly minmaxLoc () function returns ?

This function as the documentation says returns the minimum and maximum value found in image/array.

Mat inArray;
double min, max; 
minMaxLoc(inArray, &min, &max);

If you need the exact location, you pass another two arguments as well. Then it will return the point where the extreme is. The function goes through the matrix and find the minimum and the maximum value. Note that the input image has to be grayscale.

Using it with matchTemplate function. The returned points would be the part of matched image.

2016-02-15 00:20:37 -0600 received badge  Enthusiast
2016-02-14 13:52:16 -0600 asked a question Optical Flow vizualization

I am trying to visualize the output of calcOpticalFlowPyrLK(). The problem is, I can't get to the output as in the examples. Every 10 frames I renew the points for the calculation of the flow. When drawing them I use simple code:

for (size_t i = 0; i < CornersCentroidNow.size(); i++){             
    if (feat_errors[i] > MAX_ERR || feat_found[i] == 0) continue; 
    Point p0(ceil(mc[i].x), ceil(mc[i].y)); // are the points of interest (centroids of contours)
    Point p1(ceil(CornersCentroidNow[i].x), ceil(CornersCentroidNow[i].y));     
    arrowedLine(empty, p0, p1, Scalar(0, 0, 255), 2, 8, 0, 0.2);
}

after this block of code. When I draw them every frame I get this output: nothing

If I update the previous frame used for calcOpticalFlowPyrLK() function

CentroidFrOld = CentroidFrNow.clone();

I get this output (the line is short and it is moving foward every 10 frames - as set to get new points)

Added

If I swap the prew points and next points as well

CentroidFrOld = CentroidFrNow.clone();
mc = CornersCentroidNow;

I get this output (the line is short, but it is moving along with the object) All_up

What I aim to get is a long straight arrow aiming in the right direction, but I am not able to achieve something similar as in the flow tutorial. The only thing that author doesn't do is to find new points every few frames. Something like this

Desired out

2016-02-14 13:27:31 -0600 commented question opencv 3.1.0 unresolved external

Two things with Opencv 3.1.0, there are no 32bit prebuild libraries and libraries for 64bit are for VS15 and VS13. if you need other options than those, you need to build them yourselve. As it is a lil bit complicated, you might as well end up with Opencv 3.0.0

2016-02-13 13:15:38 -0600 commented question Closing area with nearest points

All those images are post-processed that means, after dilatation and erosion. Function cv::convexHull helps in this case, but not in cases, when the points aren't so close together. I think thought that this function will help the further proccess.

2016-02-13 12:22:09 -0600 asked a question Closing area with nearest points

I have an imperfect mask

Imperfect

I want to connect nearby points together to get the "perfect" shape Desired output

The distance to connect is bigger, sometimes. I have tried approximate the polynom (viz below) which is too exact. Then I have tried to approx the polynom of approxed polynom, but that didn't work at all. Approx poly

2016-02-13 08:16:40 -0600 commented answer Extract parts from image

"=" assing only the refference, not the actual data

2016-02-10 08:23:23 -0600 commented answer Extract parts from image

copyTo is the right thing to do, now it is doing what I need to

2016-02-10 08:22:37 -0600 received badge  Supporter (source)
2016-02-10 07:56:47 -0600 asked a question Extract parts from image

I have tried to use ROI to extract parts of image, but I haven't succeded. I have an image which contains rectangles - outlines of detected moving object.Input

This is the outcome I want. i want to extract those parts which are defined by those rectangles to same-sized matrix

Output

I have tried something like

cropMat(boudingRect) = frame(boundinRect);

but with this I get only the rectangles, not the part that is inside

2016-02-10 03:44:40 -0600 commented answer imshow shows black screen

Allright, sometimes things has to be written down to actually click inside the head... So I added bin folder of OpenCv into the path and everythings working fine.

2016-02-10 03:39:08 -0600 commented answer imshow shows black screen

Yes, I am. I've done it before and it worked, Don't know why it isn't working now. For example opencv_ffmpeg300.dll is in bin folder of OpenCv path... as guide at opencv.org says, OPENCV_DIR points to ....x86/vc12 (depending on enviroment) vc12 folder contains lib and bin folder and lib folder next contains the libraries you specify in project (opencv_world300.dll, opencv_ts300.dll and their debug versions).

2016-02-10 02:52:22 -0600 commented answer imshow shows black screen

I am well aware of that, but can't come up with better solution. Before reinstalling the system I didn't need to do that.

2016-02-10 02:44:43 -0600 received badge  Self-Learner (source)
2016-02-09 09:02:38 -0600 marked best answer imshow shows black screen

I did create a project where everything was running as intended. Then I reinstalled my system, copied the project and I get black screen when showing any frame of proccessed video. My simple code:

#include <cstdio>
#include "opencv2/opencv.hpp"
#include <iostream>
#include <sstream>

using namespace cv;
using namespace std;

int main(int, char**)
{
VideoCapture cap("videofile.avi"); 
if (!cap.isOpened())  // check if we succeeded
return -1;

namedWindow("Frame", 1);
for (;;)
{
    Mat frame;
    if (!cap.read(frame)) {
        cerr << "Unable to read next frame." << endl;
        cerr << "Exiting..." << endl;
        exit(EXIT_FAILURE);
    }

    imshow("Frame", frame);
    if (waitKey(30) >= 0) break;
}

return 0;
}

The output I am getting: imshow output

I have installed all possible codecs I. Even the FFMPEG which I didn't need last time I was running the project.

There's also this log in console which has never been there before

***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****
2016-02-09 09:02:38 -0600 received badge  Scholar (source)
2016-02-09 08:31:33 -0600 commented question imshow shows black screen

EDIT: bin folder of OpenCv was missing in PATH variable. After adding new entry - %OPENCV_DIR%\bin, everything is working propelly.

Clumsy solution - copying 3 dlls into wrking folder

  • opencv_ffmpeg300.dll, opencv_ffmpeg.dll ,openh264-1.5.0-win64msvc.dll
2016-02-09 08:24:04 -0600 commented question Can't open video with AVC codec

Wow, that is working. Dunno why it was working the last time without all those things.