Ask Your Question

M Mahdi Chamseddine's profile - activity

2017-09-06 11:27:04 -0600 received badge  Necromancer (source)
2017-04-04 08:44:46 -0600 commented question OpenCV Video Capture corrupted color

Thanks to the moderator for giving me points so that I can add the images.

2017-04-04 06:53:53 -0600 asked a question OpenCV Video Capture corrupted color

I am trying to use VideoCapture in OpenCV to open a video stream from IDS uEye Ethernet Cameras on Windows. This is in fact known to be supported out of the box (only on Windows). My initial attempt succeeded with the video running flawlessly (for the first time). But when I modified the code to attempt to grab the time-stamp, the video started behaving weirdly and gave corrupted colors.

How the image should look like (taken using the provided software by IDS)

image description

How the image looks like when using OpenCV VideoCapture and saving the frame

image description

The portion of the code responsible for the video capture

int keyIn = -1;
cv::Mat frame;

cv::VideoCapture cap(1); // 0 is my webcam
// set the proper size of the image since OpenCV defaults to 640x480
cap.set(CV_CAP_PROP_FRAME_WIDTH, 1600);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 1200);
while (true)
{
    cap >> frame;
    cv::flip(frame, frame, 0); // the frame if captured flipped (for some reason)
    cv::imshow("Feed", frame);
    keyIn = cv::waitKey(60); // 60 should be enough since I am running 15 fps
    if (keyIn == 27) // esc is pressed
        break;
}

I also tried playing around with the the format by setting different values for CV_CAP_PROP_FORMAT but still nothing changed.

Note that running the code outputs the following in the console:

SETUP: Setting up device 1
SETUP: **Camera Info**
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 1600x1200
SETUP: trying specified format RGB24 @ 640x480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.


SETUP: Disconnecting device 1
SETUP: freeing Grabber Callback
SETUP: freeing Grabber
SETUP: freeing Control
SETUP: freeing Media Type
SETUP: removing filter NullRenderer...
SETUP: filter removed NullRenderer
SETUP: removing filter Sample Grabber...
SETUP: filter removed Sample Grabber
SETUP: removing filter Smart Tee...
SETUP: filter removed Smart Tee
SETUP: removing filter **Camera Info**...
SETUP: filter removed **Camera Info**
SETUP: freeing Capture Graph
SETUP: freeing Main Graph
SETUP: Device 1 disconnected and freed

SETUP: Setting up device 1
SETUP: **Camera Info**
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 640x480
SETUP: trying specified format RGB24 @ 1600x1200
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.

I do not understand why OpenCV defaults to 640x480 knowing that the original size is correct at 1600x1200 (this is forcing me to set the size manually).

Any input as to where might be the problem?

2017-03-24 03:37:53 -0600 received badge  Enthusiast
2017-03-21 10:08:35 -0600 received badge  Editor (source)
2017-03-21 09:54:05 -0600 asked a question Is it possible to use dense flow map in estimateRigidTransform?

I am trying to implement the algorithm in this paper "Layered Representation for Motion Analysis". In this paper uses dense optical flow and then calculates affine transforms of chunks of the image. It then discards the transformations with high residual errors as being on the edges of layers.

As far as I understood from the documentation of estimateRigidTransform is that given 2 images it would use features in the images to calculate the affine transform rather than dense flow map (implicite call to calcOpticalFlowPyrLK()).

This might be silly question but is it possible to formulate the problem in a different way as to output the affine transform of the dense flow?

2017-02-01 00:24:13 -0600 commented answer What is a good thinning algorithm for getting the "skeleton" of characters for OCR?

Hey @bsdnoobz, your blog's domain name expired and the links are inaccessible anymore. Could you please provide alternative links.

2017-01-27 01:17:43 -0600 commented answer Detecting thick edges

This is the updated link to Pearling. And in case it is moved again look for "Pearling: Stroke segmentation with crusted pearl strings" by B. Whited et al.