Ask Your Question

nistar's profile - activity

2020-01-17 02:34:12 -0600 received badge  Popular Question (source)
2019-08-27 11:08:01 -0600 received badge  Notable Question (source)
2018-10-10 03:43:38 -0600 received badge  Popular Question (source)
2017-05-15 00:56:17 -0600 commented answer Problem of "uchar"

But how to eliminate the point of value 0

2017-05-11 05:30:55 -0600 asked a question Problem of "uchar"

I want to calculate average value in a rectangle without Invalid value(0).
But outputs of my program have problem. num_valid = 0, sumValue = 0 and outputValue = -nan.
Why???
Please help me.

        int num_valid=0;
        int sumValue=0;
        for(int row = selectRect.y; row < selectRect.height; row++)  //selectRect is a rectangle
        {
            for(int col=selectRect.x; col<selectRect.width; col++)
            {
                uchar value = outputImage[RIGHT].at<uchar>(row, col);  //outputImage[RIGHT] is a grayImage
                if(value != 0)
                {
                    num_valid++;
                    sumValue += value;
                }
            }
        }
        if(num_valid > selectRect.width * selectRect.height / 2){
            printf("invalid\n");
        }
        else{
            float outputValue = sumValue / num_valid;
            printf("Out: %d / %d = %f \n", sumValue, num_valid, outputValue);
        }
2017-03-01 20:40:42 -0600 asked a question How to calibrate Homography for binocular carema

Now I have a very strange algorithm of disparity map.
It use bicubic block to stereo calibrate right image, and use a homography matrix to calculate this warp.
I can't understand what algorithm it is, and how to calibrate this homography.
Please, help me!!!

2017-01-21 07:33:34 -0600 received badge  Famous Question (source)
2016-12-06 21:50:51 -0600 asked a question How to read image from a buffer of YUV422

I have some image data, its format is yuyv(YUV422), and only have its buffer.
I use Mat::Mat(Size size, int type, void* data, size_t step=AUTO_STEP)
and write cv::Mat img = cv::Mat(cv::Size(640,480), CV_8UC2, imgBuffer);
the step is AUTO_STEP, is it correct?

Then I try to change a zone to black ( 0,44,64 en YUV )

for (int i=0; i<50; i++)
{
    for (int j=0; j<50; j++)
    {
        img.at<cv::Vec2b>(j,i)[0]=0;
        if(j%2==0)
            img.at<cv::Vec2b>(j,i)[1]=44;
        else
            img.at<cv::Vec2b>(j,i)[1]=62;
    }
}

But the output color is green, I don't know why? Please, help me

2016-12-06 11:20:28 -0600 received badge  Student (source)
2016-12-04 20:01:02 -0600 asked a question How to read images from a camera buffer

My camera can not direct use cv::imread for read image.
Only have a buffer of uint32.
So how to convert the image to Mat.

Thanks

2016-06-16 17:18:32 -0600 received badge  Notable Question (source)
2016-06-16 17:18:32 -0600 received badge  Popular Question (source)
2016-03-31 06:43:48 -0600 asked a question Where have example of Camshift-Kalman with OpenCV2

I only find some examples with opencv1
I find this but I can't understand how to function

2016-02-23 03:29:18 -0600 commented question How to use CMT?

Opencv 2.4.11

2016-02-22 10:20:50 -0600 asked a question How to use CMT?

I want to use CMT.
But I don't understand the program.
Are there some examples only with web camera?

I try to use the libCMT.
But the number of BRISK keypoints is little.
How to change the parameter?

detectorType = "Feature2D.BRISK";
descriptorType = "Feature2D.BRISK";
matcherType = "BruteForce-Hamming";
thrOutlier = 20;
thrConf = 0.75;
thrRatio = 0.8;
descriptorLength = 512;
estimateScale = true;
estimateRotation = true;
nbInitialKeypoints = 0;

//Initialise detector, descriptor, matcher
detector = cv::Algorithm::create<cv::FeatureDetector>(detectorType.c_str());
descriptorExtractor = cv::Algorithm::create<cv::DescriptorExtractor>(descriptorType.c_str());
descriptorMatcher = cv::DescriptorMatcher::create(matcherType.c_str());
2016-02-08 07:34:09 -0600 asked a question How to set the OpenTLD parameters

I use the version of arthurv
But I run worse than some video on internet.
If I turn my head about 60 degree, it will be lost. And it can't re-recognize my face.
I think that I need to optimize the parameters in "parameters.yml"
But I don't know what mean are they?

Parameters:
min_win: 15
patch_size: 15
ncc_thesame: 0.95
valid: 0.5
num_trees: 10
num_features: 13
thr_fern: 0.5
thr_nn: 0.65
thr_nn_valid: 0.7
num_closest_init: 10
num_warps_init: 20
noise_init: 5
angle_init: 20
shift_init: 0.02
scale_init: 0.02
num_closest_update: 10
num_warps_update: 10
noise_update: 5
angle_update: 10
shift_update: 0.02
scale_update: 0.02
overlap: 0.2
num_patches: 100
bb_x: 288
bb_y: 36
bb_w: 25
bb_h: 42

2016-01-29 06:54:42 -0600 commented answer May I install 2 versions of OpenCV on Ubuntu?

I find this
cmake -DBUILD_SHARED_LIBS=OFF, is necessary?

2016-01-29 05:10:50 -0600 asked a question May I install 2 versions of OpenCV on Ubuntu?

Now I use OpenCV3.1. But the TLD tracker of Contrib is very bad.
So I want to use OpenTLD of arthurv this
But the version is opencv 2.3.

May I install 2 versions of OpenCV on Ubuntu?

2016-01-29 04:08:12 -0600 commented question Opencv3.1 don't have "PatchGenerator" with OpenTLD(arthurv)

Help me, please

2016-01-27 09:44:46 -0600 asked a question Opencv3.1 don't have "PatchGenerator" with OpenTLD(arthurv)

I want to use OpenTLD arthurv with OpenCV3.1.
But it run in OpenCV2.X. I don't know which version is it.

When I build the code, have error.
TLD.h: error: 'PatchGenerator' in namespace 'cv' does not name a type. cv::PatchGenerator generator; But OpenCV 3.1 don't have the function.

Then I download OpenCV2.4.10, and copy all files in "legacy" to project. Ana add "#include "legacy.hpp"" in TLD.h

But have more error of "EM", I don't know how to continue.
Which head file is about "EM"?

Thanks a lot

2016-01-26 05:14:11 -0600 commented question How to install OpenTLD with OpenCV3

I make it, but is only a application.
How to use it with OpenCV?

2016-01-25 10:46:46 -0600 commented question How to install OpenTLD with OpenCV3

I dont know which version I need to install ?
I download this ,but it don´t install.
I download this, but when I install PPA, don´t download from the server.
I don't know how to continue

2016-01-25 08:12:33 -0600 commented question How to install OpenTLD with OpenCV3

Help me, thanks a lot

2016-01-25 04:23:33 -0600 commented question How to speed up TLD tracker in opencv 3 with contrib modules ?

Can install OpenTDL with OpenCV3.0.0? How to do it?

2016-01-25 04:19:07 -0600 asked a question Can use OpenTDL with OpenCV3.0.0

I use openCV3.0.0, Qt5, and Ubuntu14.04

I try the program of example here
But it run vey slow. In interenet,

And the OpenTDL can install with OpenCV3???
How to do it???

Or how to improve the frame rates of the exmaple???

2016-01-22 12:18:43 -0600 commented question How to install OpenTLD with OpenCV3

But it function very slow

2016-01-22 08:52:56 -0600 asked a question How to install OpenTLD with OpenCV3

I use ubuntu 14.04, opencv3.0.0, and QT5.
I try the TLD tracker of Opencv3.0
(https://github.com/Itseez/opencv_cont...)
But it run very slowly.

Can install OpenTLD with OpenCV3 in Ubuntu? How to do it?
And are there some examples of C++?

2016-01-19 09:23:52 -0600 asked a question How to compute the rotation angle with Hu moment

I use matchShapes() to find the similar contour.
Then use minAreaRect(), can compute the centre of contour.
But the angle isn't correct. Because the contour is irregular.

If compare the parameter of 2 Hu moment, can compute the rotation angle?
How to do it???

Thanks a lot

2016-01-15 05:07:29 -0600 commented answer How to track a letter T

How to compare the results of matchShapes???
On opencv1, results are 0~1, but I use opencv3, is different.

2016-01-14 09:23:30 -0600 commented answer How to track a letter T

the function 'matchShapes' only can match 1 contour, right?
But if the image of camera have 1000 contour, It will run 1000 times?
It's very slow?

2016-01-14 05:48:14 -0600 asked a question How to track a letter T

I want to use Contour Matching.
I need compute coordinate of center and rotation angle of contour.

Contour Matching is Hu Moment, and are there more algorithm?
For coordinate of center, only use MinAreaRect.
But the rotation angle of MinAreaRect, same time is error, especially when angle is more than 45 degree.
How to do it???
Thanks a lot

2016-01-07 16:01:06 -0600 commented question How to install opencv3.0 with contrib in Ubuntu

Error :
/opencv_contrib-master/modules/xfeatures2d/src/sift.cpp:108:36: fatal error: opencv2/core/hal/hal.hpp

2016-01-07 15:16:21 -0600 asked a question How to install opencv3.0 with contrib in Ubuntu

Before I used OpenCV3.1, and install contrib perfectly.
But now I need to use a 3rd party, I can only use opencv3.0.
contrib

I use cmake-gui to install.
And I only change OPENCV_EXTRA_MODULES_PATH: <opencv_contrib>/modules

But it don't install the party 'xphoto'.
Then I don't install the party 'xphoto'.
There is more problem in the party 'xfeatures2d', but I need use SURF.

Why the contrib have problem??

2016-01-03 11:43:47 -0600 commented question How to use decomposeHomographyMat in OpenCV3

There is more question.
When the program run, there are 4 value of rotations.
Which one is the correct value?

And I need the rotation angle for the camera plane.
How to do it?

2016-01-03 08:58:05 -0600 asked a question How to track a letter ' T ', and compute rotation angle

I need to use a gimbal for track a letter ' T '.
I need the parameter: center coordinate value, and rotation angle of T.
How to do it? thanks.

2016-01-03 08:34:03 -0600 commented question How to use decomposeHomographyMat in OpenCV3

It's great, thanks a lot

2016-01-03 08:20:25 -0600 asked a question How to use decomposeHomographyMat in OpenCV3

I did the calibration and there is the intrinsic camera calibration matrix 'K'.
Then I used SURF and there is the homography matrix 'H'.

Now I need to decompose Homography matrix, in OpenCV3 there is a function 'decomposeHomographyMat'
int cv::decomposeHomographyMat(InputArray H, InputArray K, OutputArrayOfArrays rotations, OutputArrayOfArrays translations, OutputArrayOfArrays normals )

I write:

Mat rotations, translations, normals;
decomposeHomographyMat(H, K, rotations, translations, normals) ;

When I build the program, it don't have error.
But when it run, there is a problem.

OpenCV Error: Assertion failed (k == STD_VECTOR_MAT) in getMatRef, file/home/lwc-pc/opencv-3.1.0/modules/core/src/matrix.cpp, line 2667 terminate called after throwing an instance of 'cv::Exception' what(): /home/lwc-pc/opencv-3.1.0/modules/core/src/matrix.cpp:2667: error: (-215) k == STD_VECTOR_MAT in function getMatRef

I don't know why?
Help me , please!!!!!

2016-01-03 07:56:26 -0600 commented question How to use decomposeHomographyMat in OpenCV3

Help me, please

2016-01-02 08:38:07 -0600 asked a question How to use decomposeHomographyMat in OpenCV3

I did the calibration and there is the intrinsic camera calibration matrix.

FileStorage fs("out_camera_data.xml", FileStorage::READ);
Mat cameraMatrix, distCoeffs;
fs["Camera_Matrix"] >> cameraMatrix;
fs["Distortion_Coefficients"] >> distCoeffs;


Then I used SURF and there is the homography matrix.

Mat H = findHomography( obj, scene, CV_RANSAC );


Now I need to decompose Homography matrix, in OpenCV3 there is a function 'decomposeHomographyMat link text'

Mat rotations, translations, normals;
decomposeHomographyMat(H, cameraMatrix, rotations, translations, normals) ;


When I build the program, it don't have error.
But when it run, there is a problem.

OpenCV Error: Assertion failed (k == STD_VECTOR_MAT) in getMatRef
terminate called after throwing an instance of 'cv::Exception'
what(): error: (-215) k == STD_VECTOR_MAT in function getMatRef

I don't know why?
Help me, please.........

2016-01-01 05:25:53 -0600 commented question How to use the mouse events in OpenCV3

there isn't error, only don't function. I don't understand why?????

2015-12-31 09:26:36 -0600 asked a question How to use the mouse events in OpenCV3

Before I use OpenCV2, and there is a program for select a rectangle, but now it don't function.
How to change the program?????


Mat image;  
bool backprojMode = false;   
bool selectObject = false;  
int trackObject = 0;   
Point origin;  
Rect selection;  
static void onMouse( int event, int x, int y, int, void* ){

if( selectObject ){
    selection.x = MIN(x, origin.x);
    selection.y = MIN(y, origin.y);
    selection.width = std::abs(x - origin.x);
    selection.height = std::abs(y - origin.y);
    selection &= Rect(0, 0, image.cols, image.rows);
}
switch( event ) {
case CV_EVENT_LBUTTONDOWN:
    origin = Point(x,y);
    selection = Rect(x,y,0,0);
    selectObject = true;
    break;
case CV_EVENT_LBUTTONUP:
    selectObject = false;
    if( selection.width > 0 && selection.height > 0 )
        trackObject = -1;
    break;
}
}
2015-12-26 14:10:21 -0600 commented question How to use Surf on OpenCV3.0.0

I use the command 'cmake -DOPENCV_EXTRA_MODULES_PATH=/opencv_contrib-master/modules /opencv-3.0.0/build'. And 'make' successfully, then 'sudo make install'.

But ‘#include <opencv2 xfeatures2d.hpp="">’, there isn't the file in /usr/local/include/opencv2

2015-12-26 09:49:27 -0600 commented question How to use Surf on OpenCV3.0.0

I don't lose anythings, I think so.

The command has problem?

2015-12-26 09:19:43 -0600 asked a question How to use Surf on OpenCV3.0.0

Download the "opencv_contrib" on https://github.com/itseez/opencv_contrib

  1. cd /opencv-3.0.0

  2. cmake -DOPENCV_EXTRA_MODULES_PATH=/opencv_contrib-master/modules /opencv-3.0.0

  3. make -j5

But when I 'make", there is a error. I don't know how to do.

[ 65%] Built target opencv_face

[ 65%] Building CXX object modules/bioinspired/CMakeFiles/opencv_test_bioinspired.dir/test/test_retina_ocl.cpp.o

[ 65%] Building CXX object modules/bgsegm/CMakeFiles/opencv_test_bgsegm.dir/test/test_main.cpp.o

make[2]: * [modules/xphoto/CMakeFiles/opencv_xphoto.dir/src/grayworld_white_balance.cpp.o] Error 1

make[1]: * [modules/xphoto/CMakeFiles/opencv_xphoto.dir/all] Error 2

make[1]: * Waiting for unfinished jobs....

[ 65%] Building CXX object modules/bioinspired/CMakeFiles/opencv_test_bioinspired.dir/test/test_main.cpp.o

[ 65%] Building CXX object modules/bioinspired/CMakeFiles/opencv_perf_bioinspired.dir/perf/opencl/perf_retina.cpp.o

[ 65%] Linking CXX executable ../../bin/opencv_test_bioinspired

[ 65%] Linking CXX executable ../../bin/opencv_perf_bioinspired

[ 65%] Linking CXX executable ../../bin/opencv_test_bgsegm

[ 65%] Built target opencv_test_bioinspired

[ 65%] Built target opencv_perf_bioinspired

[ 65%] Built target opencv_test_bgsegm

make: * [all] Error 2

2015-12-11 09:33:59 -0600 asked a question How to do "decomposeHomographyMat" in OpenCV 2.4

I need to use the euler angels from Homography. I find a function “decomposeHomographyMat” in OpenCV 3. But I use OpenCV 2.4. How to do it?

2015-12-11 09:28:25 -0600 received badge  Enthusiast
2015-12-09 08:27:48 -0600 commented question How to calculate angle from homography

I need the rotation angle of 2D

2015-12-09 07:32:56 -0600 asked a question How to calculate angle from homography

I use SURF to findHomography.

Now I need the angle of object.

How to do it?

Thanks a lot

2015-11-11 05:30:34 -0600 asked a question How to calibrate on ubuntu

on the file /home/opencv-2.4.10/samples/cpp/tutorial_code/calib3d/camera_calibration, have 'camera_calibration.cpp','in_VID5.xml','VID5.xml'.

According to my situation, I change the 'in_VID5.xml','VID5.xml'

But I don't know how to continue? What command to use?