Ask Your Question

frageDE's profile - activity

2020-04-24 20:50:52 -0500 received badge  Popular Question (source)
2016-04-07 11:20:20 -0500 received badge  Supporter (source)
2016-04-07 11:06:32 -0500 commented answer which class can show an image in java?

I think highgui is not working anymore. So you may want to reconsider your suggestion.

2016-04-07 11:04:28 -0500 commented answer imshow equivalence in Java

This does not work anymore since highgui is deprecated.

2016-03-10 02:57:10 -0500 received badge  Enthusiast
2016-03-09 04:42:31 -0500 asked a question Broken ffmpeg settings when writing video

I have an OpenCV (2.4.9) application written in C++, which takes a video as input, processes it, and records the results as video as well. It works for 3 out of 4 videos on mine, but with 1 video it does not record, which is weird.

I initialize the writer object like this:

// Load input video
VideoCapture captureIn(videoPathRGB);

// Setup output video according to the input video
VideoWriter output_cap(videoPathResult, captureIn.get(CV_CAP_PROP_FOURCC), captureIn.get(CV_CAP_PROP_FPS), cv::Size(captureIn.get(CV_CAP_PROP_FRAME_WIDTH), captureIn.get(CV_CAP_PROP_FRAME_HEIGHT)));

and then after the processing step, I write it with:

// record the stream by passing the modified frame at each step
 output_cap.write(linedFrame);

and of course, at the end I finish with:

// do the cleaning
captureIn.release();
output_cap.release();

The videos I process are all mp4 files with around 1-2 minutes. Normally this works, but with 1 specific video I get the following error:

[libx264 @ 0xa64b20] broken ffmpeg default settings detected
[libx264 @ 0xa64b20] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0xa64b20] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0xa64b20] speed presets are listed in x264 --help
[libx264 @ 0xa64b20] profile is optional; x264 defaults to high
Could not open codec 'libx264': Unspecified error

And obviously it does not record.

Any thoughts?

2015-10-28 09:32:20 -0500 received badge  Nice Answer (source)
2015-10-28 03:17:46 -0500 received badge  Scholar (source)
2015-10-27 10:57:00 -0500 received badge  Student (source)
2015-10-27 10:49:37 -0500 received badge  Teacher (source)
2015-10-27 10:36:36 -0500 received badge  Self-Learner (source)
2015-10-27 09:51:29 -0500 commented question OpenCV: Masking Operation Does not Function Properly

@berak You were right. I populated the matrix with zeros before feeding into the copyTo() function, and it worked. No ridiculous output anymore. Thanks.

Mat maskedImage = Mat::zeros(frame.rows, frame.cols, CV_8UC3);
frame.copyTo(maskedImage, mask);
2015-10-27 06:21:23 -0500 asked a question OpenCV: Masking Operation Does not Function Properly

I have an image which I want to crop, for this I am using masking operation with copyTo() function. Here is the code block that does the operation:

// ROI by creating mask for the trapezoid
Mat mask = Mat(frame.rows, frame.cols, CV_8UC1, Scalar(0));

// Create Polygon from vertices
approxPolyDP(pointsForTrapezoid, roiPolygonized, 1.0, true);

// Fill polygon white
fillConvexPoly(mask, &roiPolygonized[0], roiPolygonized.size(), 255, 8, 0);

// Create new image for result storage
Mat maskedImage = Mat(frame.rows, frame.cols, CV_8UC3);
frame.copyTo(maskedImage, mask);
return maskedImage;

However, there is something really weird with this. I get different outputs from each run. Sometimes it works and sometimes it does not. Let me explain with snapshots:

This is the correct mask which I generate:

enter image description here

This is the correctly applied mask, after the operation:

enter image description here

And these are the ridiculously applied masks, after the operations:

enter image description here enter image description here enter image description here

As you can see, sometimes the masking operation works, and sometimes it does not. I don't know what the hell is wrong with OpenCV, but this shouldn't happen. Same code with same input should not create different output on each run. I suspect that copyTo() function is messed up.

Any thoughts?

2015-06-10 06:55:29 -0500 received badge  Critic (source)
2015-06-10 06:54:55 -0500 commented question Calculating the tilt in pixels

I am not allowed to modify the hardware of the boat, it does not belong to me and I am supposed to solve the problem using a vision approach. Thanks though.

2015-06-08 03:06:58 -0500 commented question Calculating the tilt in pixels

My vehicle is a boat sailing on the sea surface, so there is no climbing. However the tilt happens all the time. And if the sea is wavy, the tilt becomes even higher. The thing is not only understand whether there is tilt or not, but also how much we tilt.

2015-06-05 02:18:47 -0500 commented question Calculating the tilt in pixels

My Kalman filter works with the center of the detected object's bounding box. My problem is not with Kalman filter actually, it works just fine. The stuff which I want is, when the camera tilts, the center of bounding boxes should be updated accordingly to the tilt.

2015-06-03 07:05:23 -0500 asked a question Calculating the tilt in pixels

I have a working object detection&tracking system already implemented in OpenCV. It detects, tracks and maps the objects in the world frame. However, since my camera is mounted on a moving vehicle, it tilts and therefore the coordinates of the tracked objects are changing drastically in the image frame, which results in wrong mapping of objects in the world frame.

Is there a way to understand how much the camera tilts between frames, so that I can add or subtract the amount of tilting for the coordinates of the detected objects?

Things to keep in mind:

  • I do not have a gyroscope or anything like tilt-sensor, I cannot make use of additional hardware. I am looking for a vision solution.
  • I am using only single camera (No stereovision).

What I tried so far:

  • I have my horizon line detected, I tried to take that as a reference point, but horizon also tilts, therefore this did not work.
    • Same goes for keypoints, their coordinates change when the tilt happens, this did not work either.

Thanks in advance.

2015-05-28 09:27:35 -0500 commented question Calculating distance to an unknown object with single camera

This is what I see and out of this field, I am trying to get the distance to the dynamic targets. I did not understand what you meant by "just compute the distance from boat to the object on water", that is what I am wondering anyway, I mean that is the question that I pose. Calculating the distance to the object on the water surface.

2015-05-28 06:56:29 -0500 commented question Calculating distance to an unknown object with single camera

Thank you for your rapid answer. Yes, unfortunately the targets have different sizes. They could be small jet-skis, kayaks, fishing boats or huge container ships. Therefore going over the size parameter would not work in my case.

2015-05-28 06:46:47 -0500 asked a question Calculating distance to an unknown object with single camera

Hi all,

The title says it all, I have a camera mounted on a moving boat and I want to know the distance of the detected targets. Here is the scenario:

  • I have the GPS information.
  • I do know my velocity and direction.
  • I have a single camera and an algorithm to detect the targets.
  • I am moving, changing my location all the time. However the camera is mounted.
  • Targets are moving, they are mostly boats sailing around.
  • My camera is calibrated already.
  • Edit: Targets have different sizes. They could be kayaks, boats, huge container ships, sailing boats, etc.

Give these, is there a way to find how far is the detected target from me?

Any help is appreciated.

Thanks

2015-05-28 06:39:54 -0500 received badge  Editor (source)
2015-05-28 06:38:31 -0500 asked a question Tilting Camera, calculating the shift

Hi all,

I have the following scenario:

  • Moving Camera (On a sailing boat)
  • Moving targets (Already detected, they are In the field of view)
  • Tilts (Due to waves)

Now, in order to calculate the world coordinates of the detected targets, I have to know their image coordinates. However, due to tilting, the image coordinates are changing greatly. This messes up the calculation of image-to-world coordination. In order to overcome this, I need an algorithm which could tell me how much does the camera tilt, so that I can add this up to the image coordinates and get the correct calculation.

Is there such an algorithm already implemented in OpenCV? Would be glad if you could share.

Thanks.

Note: Using gyroscope is out of option.