Ask Your Question

Mathieu Barnachon's profile - activity

2020-12-04 10:42:41 -0600 received badge  Good Answer (source)
2019-10-23 20:33:47 -0600 received badge  Nice Answer (source)
2019-02-04 21:57:32 -0600 received badge  Nice Answer (source)
2018-11-06 11:14:11 -0600 received badge  Nice Answer (source)
2017-09-02 17:50:37 -0600 received badge  Nice Answer (source)
2016-05-27 10:05:32 -0600 commented question I have problem HELP!!

What about providing relevant part of your code? What about try to explain what is your goal and your problem? What about having a look at the FAQ first?

2016-05-24 03:16:11 -0600 answered a question Identifying black cars with OpenCV in Python

I'm assuming from your question, that you already know where are the parking spot. In that case, you could try to detect car with the OpenCV (see that question) . Then you could see if the detected car is in a parking spot or not (arriving, leaving, etc.).

Another solution, also knowing the parking spot, is to compare pixel by pixel the difference between a known empty spot and the current one. This will suffer from the illumination issue due to the sun, but could be counter-balanced with a Mixture of Gaussian for background learning, or multiple samples of the parking spot at different time of the day (it seems you have the hour on the top of the image).

2016-05-17 12:14:40 -0600 answered a question Logistic Regression on MNIST dataset

I think that the data should be categorical (also refered as one-hot-encoding) , ie for 2 classes: [1,0] instead of [0], then for mnist, it should be: [1,0,0,0,0,0,0,0,0,0] for class 0, [0,1,0,0,0,0,0,0,0,0] for class 1, etc.

You could find a small description here.

There is plenty of Python methods to do that, but none in OpenCV as far as I know it... But if you implement it, feel free to add a pull request for it (has well as a doc update in another pull request if that solve your issue!)

2016-05-13 05:47:30 -0600 commented answer Can't find CUDA::FAST_CUDA class

How do you compute the keypoints? If you are using compute, it returns the vector of keypoints computed, right?

2016-05-13 03:25:53 -0600 answered a question Can't find CUDA::FAST_CUDA class

I think (hope?) you are using OpenCV version 3.x, so now, FAST in Cuda is referred as cv::cuda::FastFeatureDetector. It was previously named FAST_GPU (2.49) and also FAST_CUDA, but I can't find the right version right now.

Have a look at the different documentation here.

2016-04-29 07:58:26 -0600 edited question VideoWriter fails to write

The problem what i am facing is that when i try to save the image using Videowriter it creates the video file but the size is 0. I had created a header declaring a function which saves the video and a separate .cpp file which defines the function.When i write the whole code in only one file not in seperate file as before including ViceoCapture and VideoWriter it runs fine and even save the video file with appropriate file size.

When i started to debug i found that every time i receive a frame but VideoWriter.open is null or it says no symbols loaded for opencv_highgui.dll

savevideo.cpp file

#include"SaveVideo.h"
int CSaveVideo::savevideo()//string InpVideo, int pinstatus)
{
    VideoCapture oVcam(0);
    Mat vFrame;
    string OutPath = "C:\\Users\\20080031\\Desktop\\";
    string Filename = "Vout.avi";
    int vfourcc = CV_FOURCC('M', 'J', 'P', 'G');
    int vfps = 20;
    VideoWriter oVWrite;
    oVWrite.open(Filename, vfourcc, vfps, Size(480, 640), true);
    if (!oVcam.isOpened())
    {
        cout << "Camera not opened" << endl;
    }
    while (1)
    {
        oVcam.read(vFrame);
        imshow("Input", vFrame);
        waitKey(1);
       oVWrite.write(vFrame);
    }
}
CSaveVideo::CSaveVideo()
{
    cout << "Inside Constructor" << endl;
}
CSaveVideo::~CSaveVideo()
{
    //VideoCapture Vcam0;
    cout << "Inside Distructor" << endl;
    //Vcam0.release();
}

saveVideo.h

#ifndef SAVEVIDEO_H
#define SAVEVIDEO_H
#include<iostream>
#include<stdio.h>
#include<string>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/core/core.hpp>
#include <opencv2\opencv.hpp>
using namespace std;
using namespace cv;
class CSaveVideo
{
public:
CSaveVideo();
    ~CSaveVideo();

    //string m_sGPIOpinstatus;
    //char m_cSTOP;

    int savevideo();//string PinStatus, char End,  );
};
#endif SAVEVIDEO_H
2016-04-27 09:01:54 -0600 edited question "_rvec" and "_tvec" for solvePnPRansac() are wrong.

Environment:
OpenCV 3.1.0
OS X 10.11.4

I am using "solvePnPRansac()" to get "_rvec" and "_tvec".
However, I thought values are wrong.
Because when I tried same step with "OpenCV 2.4.12", there is the difference between both.

call "solvePnP" with arg "rvec", but set "_local_model.col" as "_rvec". ("tvec" also)

Code:

opencv-3.1.0/modules/calib3d/src/solvepnp.cpp (https://github.com/Itseez/opencv/blob...)

result = solvePnP(opoints_inliers, ipoints_inliers, cameraMatrix, distCoeffs, rvec, tvec, false, flags == SOLVEPNP_P3P ? SOLVEPNP_EPNP : flags) ? 1 : -1;
_rvec.assign(_local_model.col(0));    // output rotation vector
_tvec.assign(_local_model.col(1));    // output translation vector

I think this is right.

Code:

result = solvePnP(opoints_inliers, ipoints_inliers, cameraMatrix, distCoeffs, _local_model.col(0), _local_model.col(1), false, flags == SOLVEPNP_P3P ? SOLVEPNP_EPNP : flags) ? 1 : -1;

What do you think?

2016-04-26 09:23:24 -0600 answered a question active appearance model

You will have to dive into research papers for that: Active Appearance Models, PAMI paper, and the ECCV'98 paper. I also suggest you have a look at 'Active Appearance Models' in Google Scholar, that could help to have more up-to-date reference and/or improvement of AAM.

2016-04-25 04:57:22 -0600 answered a question mosaicing a sequence of overlapping images

There is a full stitching pipeline in OpenCV.

You can also have a look at the feature2d tutorials to implement a custom stitching approach (with a look at the stereoCalibration sample to have a clue). You should prefer the stitching pipeline, or a least have a look at it, to be sure you understand how it works before jumping on implementing your own. Googling the stitching methods could also be interesting.

2016-04-21 07:57:08 -0600 received badge  Nice Answer (source)
2016-04-20 15:35:48 -0600 edited question OpenCV tutorial project on Github ?

I could not follow up much with openCV tutorials, Is there xCode, iOS project downloads available of those tutorials mentioned in the openCV tutorial link. So I could understand better ? Or any other materials to learn using openCV with xCode to create iOS apps ?

2016-04-20 15:28:37 -0600 commented answer ORB keypoints distribution over an image

I'm not sure of what you mean: you don't perform (directly) the whole image detection. But keep in mind that the matching must consider the image as a whole, not only cell by cell.

2016-04-20 10:16:16 -0600 answered a question ORB keypoints distribution over an image

In the version 2.4 you get a gridAdaptatedFeatureDetector that was sampling point in a grid for you.

In version 3.1, it seems gone, no clue why, but you can reproduce the behavior yourself: split your image using a grid, and detect a reasonable amount of points in each cell. Therefore, you need to adjust the grid size and the features number per cell to help your stitching.

2016-04-20 02:11:43 -0600 answered a question how to find mouth and detect yawning in realtime video using opencv c++?

You probably have to use facial landmark detection (try google it to have some more info). One of the libraries known to work well with OpenCV is Dlib. You could find an example of the face detection with a webcam here. There is plenty of other libraries, most of them easily compatible with OpenCV.

If you are interested to understand how to train these detectors, or create your own, the book: Mastering OpenCV with Practical Computer Vision Projects on the chapter 7 offers a good introduction to it. You could also have a look at the chapter 6 that could be of interest.

2016-04-18 02:24:16 -0600 edited question Stereo Rectify get incorrect result!

I am working on stereo calibration with these steps: 1. findChessborad -> cornerSubPix 2. stereoCalibrate to get R T E F 3.undistortPoints and computeCorrespondEpilines 4.stereoRectify to get R1 R2 P1 P2 Q 5.initUndistortRectifyMap to get remap matrix 6 remap

all the steps followed the cpp example given in the opencv package. one pair of images I used as below: image description image description

the result I get is: image description

if I use : findFundamentalMat and stereoRectifyUncalibrated instead of stereorectify to get R1 R2 P1 P2 will get a correct result.

here is my code snapshot:

//FOR STD LIB
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <iterator>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <sstream>

//FOR OPENCVLIB
#include "opencv2/opencv.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/core/core.hpp"

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv/cvaux.hpp"
//using namespace std;
//using namespace cv;


#define infinite 1e400
#define numImagePairs 10

const std::string PathPrefix = "/home/roby/Developer/projects/Calibration_rectify/res/";
typedef std::vector<std::string> ImageNameList;
typedef std::vector<cv::Point2f> PointList;
typedef std::vector<PointList> LEFT_PointVec;
typedef std::vector<PointList> RIGHT_PointVec;
typedef std::vector<std::vector<cv::Point3f> > Point3DList;
const cv::Size CHECKERBOARD_SIZE = cv::Size(7,6);


#define BYTE unsigned char

int main(int argc, const char * argv[])
{
    ImageNameList rightCameraList;
    ImageNameList leftCameraList;

    ImageNameList goodrightCameraList;
    ImageNameList goodleftCameraList;

    LEFT_PointVec leftCameraPTvec;
    RIGHT_PointVec rightCameraPTvec;
    Point3DList objectPoints;

    int numGoodImgPairs = numImagePairs;
    const float squareSize = 1.f;  // Set this to your actual square size
    cv::Size imageSize;

    //load image name
    std::ostringstream ss;

    for (int i = 1; i <= numImagePairs; i++) {
    ss << i;
        rightCameraList.push_back(PathPrefix + "right/right"+ss.str() +".png");
        leftCameraList.push_back(PathPrefix + "left/left"+ss.str() +".png");
        ss.str(""); //clear stream content
    }

    for (int i = 0; i < numImagePairs; i++) {
        cv::Mat rightimg = cv::imread(rightCameraList[i],0);
        cv::Mat leftimg = cv::imread(leftCameraList[i],0);
        if (rightimg.size != leftimg.size) {
            std::cout<<"Left Image size != Right Image Size"<<std::endl;
            return 0;
        }else{
            imageSize = rightimg.size();
        }

        rightimg.convertTo(rightimg, CV_8U);
        leftimg.convertTo(leftimg, CV_8U);

        PointList right_ptList;
        PointList left_ptList;

        if (cv::findChessboardCorners(rightimg, CHECKERBOARD_SIZE, right_ptList)) {
            if (cv::findChessboardCorners(leftimg, CHECKERBOARD_SIZE, left_ptList)) {
                cv::cornerSubPix(rightimg, right_ptList, cv::Size(11,11), cv::Size(-1,-1),
                                 cv::TermCriteria(cv::TermCriteria::COUNT+cv::TermCriteria::EPS,
                                          30, 0.01));
                cv::cornerSubPix(leftimg, left_ptList, cv::Size(11,11), cv::Size(-1,-1),
                                 cv::TermCriteria(cv::TermCriteria::COUNT+cv::TermCriteria::EPS,
                                          30, 0.01));
                rightCameraPTvec.push_back(right_ptList);
                leftCameraPTvec.push_back(left_ptList);
                goodleftCameraList.push_back(leftCameraList[i]);
                goodrightCameraList.push_back(rightCameraList[i]);
            }else{
                numGoodImgPairs--;
                std::cout<<"CHESSBOARD NOT FOUND in LEFT IMG!"<<std::endl;
            }
        }else{
            numGoodImgPairs--;
            std::cout<<"CHESSBOARD NOT FOUND in RIGHT IMG!"<<std::endl;
        }
    }

    if (numGoodImgPairs < 2) {
        std::cout<<"Error: too little pairs to run the calibration"<<std::endl;
        return 0;
    }
    objectPoints.resize(numGoodImgPairs);

    for( int i = 0; i < numGoodImgPairs; i++ )
    {
        for( int j = 0; j < CHECKERBOARD_SIZE.height; j++ )
            for( int k = 0; k < CHECKERBOARD_SIZE.width; k++ )
                objectPoints[i].push_back(cv::Point3f(k*squareSize, j*squareSize, 0));
    }
    cv::Mat cameraMatrix[2], distCoeffs[2];
    cameraMatrix[0] = cv::Mat ...
(more)
2016-04-15 03:25:49 -0600 commented answer Training color histogram values to svm.

Nice! Any pull request commng soon? :-)

2016-04-15 02:28:42 -0600 commented answer Training color histogram values to svm.

You could also use PCA and keep only the 2 first eigen vector, TSNE is not (yet?) implemented in OpenCV.

2016-04-14 14:19:57 -0600 commented question How to train correctly a cascade

I suggest you have a look at this thread (and all the comments associated!). You could also look for other questions (and their answers) on this forum, which provide a lot of tricks to help. If none of these are working, don't hesitate to come back to us, and give use more details about your dataset (like samples images).

2016-04-14 02:04:16 -0600 edited question How to implement CLAHE algorithm in android using opencv 3?

hello, i am new in opencv, i trying to convert grayscale bitmap to CLAHE but i can't. i use this code

ImageView img;

Bitmap original, grayscale, histogram, resize, threshold;

int fixedwidth = 480; int fixedheight = 800; Button btn_original, btn_grayscale, btn_histogram, btn_resize, btn_threshold; Mat rgbMat; Mat grayMat; Mat CLAHEmat;

static { System.loadLibrary("opencv_java3"); }

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

img = (ImageView) findViewById(R.id.imageView);

btn_original = (Button) findViewById(R.id.btn_original);
btn_grayscale = (Button) findViewById(R.id.btn_grayscale);
btn_histogram = (Button) findViewById(R.id.btn_histogram);
btn_resize = (Button) findViewById(R.id.btn_resize);
btn_threshold = (Button) findViewById(R.id.btn_threshold);

original = BitmapFactory.decodeResource(getResources(), R.drawable.sample);

btn_original.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        img.setImageBitmap(original);
    }
});

btn_grayscale.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        /*grayscale = getGrayscale(original);
        img.setImageBitmap(grayscale);*/
        grayscale = BitmapFactory.decodeResource(getResources(), R.drawable.sample);

        rgbMat = new Mat();
        Utils.bitmapToMat(grayscale, rgbMat);

        grayMat = new Mat(grayscale.getHeight(), grayscale.getWidth(),
                CvType.CV_8U, new Scalar(1));
        Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY, 1);
        Utils.matToBitmap(grayMat, grayscale);
        img.setImageBitmap(grayscale);
        Log.e("Width & Height:-", grayscale.getWidth() + "-" + grayscale.getHeight());
    }
});

btn_histogram.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        //histogram=HistogramEqualization.histogramEqualization(resize);

        int lnth = grayscale.getByteCount();

        ByteBuffer dst = ByteBuffer.allocate(lnth);
        grayscale.copyPixelsToBuffer(dst);
        byte[] byteArray = dst.array();

        Log.e("byte array", byteArray + "");
        Mat orgImage = new Mat();
        orgImage.put(0, 0, byteArray);

        Mat labImage = new Mat(grayscale.getHeight(), grayscale.getWidth(), CvType.CV_8UC1);
        Imgproc.cvtColor(orgImage, labImage, Imgproc.COLOR_BGR2Lab);

        CLAHE clahe = Imgproc.createCLAHE();
        CLAHEmat = new Mat(grayscale.getHeight(), grayscale.getWidth(), CvType.CV_8UC1);
        clahe.apply(labImage, CLAHEmat);

        Utils.matToBitmap(CLAHEmat, histogram);
        img.setImageBitmap(histogram);
    }
});

btn_threshold.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.sheet);

        Mat rgbMat = new Mat();
        Utils.bitmapToMat(bmp, rgbMat);

        Mat grayMat = new Mat(histogram.getHeight(), histogram.getWidth(),
                CvType.CV_8U, new Scalar(1));
        Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY, 1);
        Mat bwMat = new Mat();

        Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY);
        Imgproc.equalizeHist(grayMat, grayMat);

        Imgproc.threshold(grayMat, bwMat, 127.5, 255.0, Imgproc.THRESH_OTSU);
        Utils.matToBitmap(bwMat, bmp);
        Imgproc.createCLAHE();
        img.setImageBitmap(bmp);
    }
});

}}

but i got this error

CvException [org.opencv.core.CvException: cv::Exception: /builds/master_pack-android/opencv/modules/imgproc/src/clahe.cpp:354: error: (-215) _src.type() == CV_8UC1 || _src.type() == CV_16UC1 in function virtual void {anonymous}::CLAHE_Impl::apply(cv::InputArray, cv::OutputArray)]

please help me..

thanks in advance

2016-04-13 09:58:23 -0600 commented question How to detect different random colors from the picture?

Have you try histograms?

2016-04-13 07:34:14 -0600 commented answer Adjusting an image over another ?

That's cool! Do you have some images to share? Also, I'm wondering if you manage to hook the OpenCV calibration process with your disc or if you really on another tool? Because I'm wondering if the calibrateCamera function works with a single point per frame. Anyway, thanks for sharing!

2016-04-13 05:58:29 -0600 commented answer Adjusting an image over another ?

That's interesting! How do you heat the ring? Once for the whole calibration or all the time in a continuous process?

2016-04-12 10:28:43 -0600 answered a question Adjusting an image over another ?

You need to rectify your images (in a stereo rectify way) in order that each pixel of the IR image match the RGB image. Have a look at the stereoCalibrate function to see how to do that, and also at the sample cpp/stereo_calib.cpp for a working example.

2016-04-12 04:15:46 -0600 commented question Real time disparity map using C++ with opencv on MVS

Could you post the relevant part of your code (the one that has been profiled as a bottleneck) or explain what is your current issue when moving to realtime?

2016-04-12 04:12:22 -0600 edited question Issues by performing non-local means filter operation on 16bit image

Dear great OpenCV community,

I have some issues by processing 16bit Images through the cv::fastNlMeansDenoising Image filter. I have read in the documentation that it is possible if you set the normType = NORM_L1 So i have tried it but nothing happens. The Images still look like the origin Images. So i thought maybe it is a issue with the depth of the Images. Therefore i have integrated in my program a down sampling of the Image before the filtering Operation (16bit -> 8bit) and after the filtering Operation is performed i integrated a up sampling of the Images (8bit -> 16bit). And now the supprising result was that it works with 8bit data perfectly and with 16bit data it seems like the filtering Operation isn't performed because the processed Images look exactly like the original Images

This is my code which i use for the filtering Operation. The Settings of the filter become inserted by the user of my program

//this works perfectly

cv::Mat inputIm;
cv::Mat outputIm;
filterInputCvImage.convertTo(inputIm, CV_8U, 1 / 256.);
cv::fastNlMeansDenoising(inputIm, outputIm, h, templateWindowSize, searchWindowSize, cv::NORM_L1);
outputIm.convertTo(filterOutputImage, CV_16U, 256.0);

//this does not work

cv::fastNlMeansDenoising(filterInputImage, filterOutputImage, h, templateWindowSize, searchWindowSize, cv::NORM_L1);
2016-04-12 02:57:56 -0600 commented question Why the trained model's performance is not the same while running on PC and Android?

Are you using the same camera for both detections (video recorded with the mobile camera process on PC)? Cameras quality can have an impact, also, the codec used for recording/playing could have an impact, as well as the underneath binding for opening the video. For the speed of detection, as said previously, you just can't compare that way...

2016-04-11 06:50:50 -0600 answered a question Passing "hints" to Object Tracking algorithm?

What you intend to use is a prediction/correction approach. Fortunately, OpenCV has one built-in: the Kalman filter. Have a look at the documentation and the sample in cpp/kalman.cpp. I also suggest you have a look at the Wikipedia page (as referenced in the documentation) to be sure you understand how it works).

Basically, the Kalman filter will make a prediction of where the next position should be, that you will correct with the measurement you retrieve (you robot next move probably in this case). You need also to model the noise of the observation. The "Learning OpenCV" book has a section about this prediction/correction process (not sure about the upcoming release, but it should have it also).

2016-04-11 02:15:27 -0600 answered a question OpenCV C++ Stereo Calib Example

To launch this sample, you need to specify the number of corners of your image:

./stereo_calib -w=4 -h=6 stereo_image_list.xml

from your sample images. If you launch the program without the right XML file or with a corner width or a corner height higher than in your image, the detection can't find the pattern and is returning this message. So, to ensure everything is working fine, launch the default OpenCV stereo file (I'm assuming you are launching the executable from the sample/data directory):

../cpp/stereo_calib -w=9 -h=6 ./stereo_calib.xml

This should show you the sample images of OpenCV with the correct corners detection.

Depending how you have generated your XML list of images, it may require that you are in the same folder as the images (relative or absolute path to images).

2016-04-08 02:37:36 -0600 commented question Problem with setting width and height of webcam

It seems from what I've seen on Google that this camera does not support MJPEG HD resolution. You have to go through YUV instead. To the best of my knowledge, this is not supported by OpenCV VideoCapture. You have to read the YUV stream through UVC directly...

2016-04-08 02:32:16 -0600 answered a question Face Detection using CascadeClassifier
  1. This is an older tutorial, using the legacy C-API, which is basically not recommended anymore.
  2. Here is the new version using C++ API.
  3. To read an image, instead of the line capture.open( -1 ); you could use the URL of the image: capture.open( "/path/to/my/image.png" ); This will use VideoCapture to read the image (but according to the following code it will close rapidly...). And it is not really recommended to use VideoCapture for image reading (different results possible from the usual image reading due to the codec used).
  4. You could replace the VideoCapture usage by a simple imread call. But if you wonder how to do that, I suggest you have a look at the beginner tutorial of OpenCV (complete list).
2016-04-08 02:22:58 -0600 answered a question Convert image to cylindrical shape.

You have to return the dst image, not the dstback image, which is the image unwrapped (ie back to normal). In you case you don't have to use warpBackward in your function. Use the code from your previous question provided by @LBerger to display the all the images.

2016-04-07 09:57:08 -0600 commented question OpenCV C++ Stereo Calib Example

Did you actually specify the number of corners in the chessboard? Usually, when it fails in detecting the corners it is related to the number you have(n't) specified.

2016-04-06 07:38:57 -0600 commented question Can we convert classified raster to shapefile using opencv

What have you tried so far? This is a help forum, not a do-my-job-for-me-forum!

2016-04-05 09:53:55 -0600 commented question I want to read MICR(Magnatic Ink Character Recognition) code (Used on bank Check's bottom) using camera and convert it into text. Anybody have any idea, please help?

What I've you try so far?

2016-04-05 09:49:15 -0600 answered a question how to get the defenition (source code) of cv2.calibratecamera function

Have a look at the GitHub of OpenCV, module calib3d here. It is not an easy task to calibrate the camera, you should be prepared for it!

2016-04-05 09:46:06 -0600 commented answer About opencv_traincascade....

I read it and I agree ;-) Very helpful indeed!

2016-04-05 02:56:15 -0600 answered a question Math on every pixel to Calculate NDVI?

If you want to convert your image in HSL, the proper way to do it in OpenCV is:

cv::cvtColor( src, dst, cv::COLOR_BGR2HLS );

If your intent is to do it manually, then you can iterate through the pixel that way:

for(int r = 0 ; r < src.rows ; ++r) {
    for(int c = 0 ; c < src.cols ; ++c) {
        dst.at<cv::Vec3b>(r,c) = cv::Vec3b(newHue, /*newLigthness*/1, /*newSaturation*/1);
    }
}

This is the most standard (and slow way) to iterate through pixels, but also the most obvious. If you want to have a look at how to speed-up the pixel iteration, I suggest you have a look at this tutorial or even, this tutorial for a very basic (but yet helpful) introduction to OpenCV images..

2016-04-04 07:28:59 -0600 answered a question rotate RotatedRect

Use the warpAffine method:

cv::Mat rotation = cv::getRotationMatrix2D(rotatedRect.center, -rotatedRect.angle, 1);
cv::warpAffine(src, dst, rotation, dst.size());
2016-04-04 07:23:17 -0600 answered a question Contour perspective warp

You need to find first the Homography. Have a look at this tutorial. Then, it would be easier to reverse the usage of scene points and object points to get the transformation that gives you the rectangle in the way you want (instead of finding the orientation of the rectangle in the scene, you try to find the fronto-parallel orientation, if that does make sense).

You could also have a look at the affine transformation estimation made by the estimageRigidTransform function or the findTransformEEC function.

2016-04-01 03:06:28 -0600 answered a question OpenCV CUDA - method that works like inRange()

That is normal: merge creates a multi-channels image from multiple images. (see the doc here). The inRange function creates a binary mask, and I assume, according to your title, that is what you want to do. The inRange function does not exist (yet) in GPU, therefore, you have two options:

  1. Implement the GPU version of inRange (make a pull request and make the OpenCV community happy). Here is some info if you want to contribute to OpenCV.
  2. Download the merged image and to the inRange on CPU, eventually upload the result to GPU if you still need to process the image after that. This option is not suitable if you have to do some other process to the GPU after, as it could be slower than doing everything on CPU.
2016-04-01 02:22:59 -0600 answered a question How to convert pixel segmentation to polylines?

Have you try the cv::findContours method directly on the getLabelContourMask() from SEEDS? You can also increase the size of the boundaries to help the detection.

If it does not work, I think the only solution is to do it by hand: iterate through the getLabelContourMask (on vertical, the on horizontal) and add the positive pixel to a line. You have to first find the beginning on the line (let say scanning horizontal pixel until you find a positive one, and then iterate through a vertical neighborhood. Quite old school, but I don't see any other solution...

2016-03-31 09:43:54 -0600 answered a question Where have example of Camshift-Kalman with OpenCV2

If you want to see the Kalman.cpp sample or the camshifdemo.cpp sample, they are in the samples/cpp directory. There is also a sample of CamShift using the TAPI here. Or if you want it in Python: Kalman and camshift.

Usually, samples are in the samples directory... But if you are more precise on what you want to do, we can give you more detailed answer

2016-03-29 05:48:31 -0600 answered a question Pass by reference errors

You should first check if the images have been properly opened:

Mat img = imread("img1.png, IMREAD_COLOR);
if(img.empty()) throw std::runtime_error("unable to open the image");

The same apply for the logo. Feel free to replace the exception by whatever you want.

You should always check the boundaries of your images:

if( logo.rows <= mat.rows and logo.cols <= mat.cols)
    logo.copyTo(mat(Rect(0,0,logo.cols,logo.rows)

That should solve your issues.

2016-03-23 03:16:27 -0600 commented question How can I update the documentation

Very good initiative! Please do it, it makes things better for everyone.

2016-03-22 10:01:40 -0600 commented question Is it possible to make HoG scale invariant?

What do you mean by scale invariant? This is a histogram, so it is by definition.