cellstr function is not working in matlab - cell

The following code works perfectly with octave, but I'm having trouble getting it to work in Matlab. If anyone can explain the difference and how to fix the code in Matlab, that would be wonderful.
n = 10;
class(n)
ans = double
cellstr(n)
Matlab error code
Error using cellstr (line 49)
Conversion to cellstr from double is not possible.
Thank you

Related

FREAK is not a member of cv?

I am trying a code from tutorial to test the marker-less AR experience with OpenCV + OpenGL. But the problem is that when I compiled the code I found out that there is an error with the following segment of code:
cv::Ptr<cv::DescriptorExtractor> extractor = cv::FREAK(false, false),
and the error is:
FREAK is not a member of cv.
So, can someone tell me why is that happening? I have tried to search for a solution and tried to solve as much as I can but every time I got error.

Assertion sv_count !=0 failed - Function train_auto, SVM type - EPS_SVR

The question is related to the OpenCV library, version 2.4.13.2.
I am using n dimensional feature vectors from images for training and performing regression. The output values range between 0 and 255.
The function CvSVM::train works without an error, but requires a manual setting of parameters. So, I would prefer using the function CvSVM::train_auto to perform cross validation and determine the best parameters for the situation.
But I am facing the error:
OpenCV Error: Assertion failed (sv_count != 0) in CvSVM::do_train.
On changing the type to NU_SVR, it works well. The problem is only with type EPS_SVR.
I would appreciate any help I could receive to fix this.
EDIT: I was able to pinpoint the problem to line Number 1786 in the file-
opencv-master\sources\modules\ml\src\svm.cpp
FOR_IN_GRID(p, p_grid)
Upon commenting it, the code runs without errors. I am unaware of the reasons possible.
Facing the same bug. Found out that this bug was caused by svm.setP(x) and svm.setTermCriteria((cv2.TERM_CRITERIA_EPS, y)) where x and y values more than 0.1 (10^-1).

vision.internal.disparityParser in MATLAB

I am working with the computer Vision toolbox in MATLAB 2014b
there is a function for Semi-global Matching (SGM )
I am trying to generate a disparity map of a stereo images. However, the disparity range needs to be quite large for some experiments.
Here is the function call:
Dmap = disparity(I1 I2, 'BlockSize', 15, 'DisparityRange', [-2466, 2466]);
The problem is the DisparityRange is limited to be in the range of [-2464, 2464]. Thus, I am getting an error msg like this one bellow.
Error using disparity
The value of 'DisparityRange' is invalid. Expected DisparityRange to be an array with all of the values >
-2466.
Error in vision.internal.disparityParser (line 38)
parser.parse(varargin{:});
Error in disparity>parseOptionalInputs (line 264)
r = vision.internal.disparityParser(imageSize, getDefaultParameters(),...
Error in disparity>parseInputs (line 244)
r = parseOptionalInputs(imageSize, varargin{:});
Error in disparity (line 137)
r = parseInputs(I1, I2, varargin{:});
My questions:
1. I could not find the function (vision.internal.disparityParser). Where is should be located.
2. I would like to modify the code to work for rainges beyond the specified limit. Is that possible?
3. For anyone who worked with the C++ version of the SGM function (OpenCV), does the same problem exist (i.e., the disparity range limits).
Thank you!
:)
I could only answer the first question. The function vision.internal.disparityParser is located at $MATLAB/toolbox/vision/vision/+vision/+internal/disparityParser.m .

Eigen code fail in release mode but work in debug mode

Hi everyone who use Eigen, I encountered a strange question here.
I implemented a Unscented Kalman Filter with Eigen.
It works very well on my PC, but the same piece of code will generate segmentation fault on my embedded system, Odroid XU (Armv7 Architecture).
After hours of debugging, I found the problem was with this part:
qrSolver.compute(OS.transpose());
m_q=qrSolver.householderQ();
m_r = qrSolver.matrixQR().triangularView<Upper>();
S_pre = m_r.block(0,0,n,n).transpose();
if (w_c0 < 0)
internal::llt_inplace<float,Upper>::rankUpdate(S_pre,
sqrt(-w_c0)*(sigmaPoints.col(0) - state_pre),
-1);
else
internal::llt_inplace<float,Upper>::rankUpdate(S_pre,
sqrt(w_c0)*(sigmaPoints.col(0) - state_pre),
1);
where I first compute the QR decomposition of matrix OS (dimension n-by-3n), and then perform rank update of its R component (dimension n-by-n). internal::llt_inplace::rankUpdate is a function in Eigen library which is not documented. It just perform rank-1 update to its first argument. This function can be found in ~/path_to_Eigen/Cholesky/LLT.h
The most strange thing of this piece of code is, with -DCMAKE_BUILD_TYPE=Debug it works perfectly, while if I compile with -DCMAKE_BUILD_TYPE=Release, this code fails.
I would like to ask can anyone understand this or does anyone have similar issue before. Please help, thanks a lot.

OpenCV invalid operands error

I'm trying to compile some OpenCV code without success. So please if you can help me It would be really nice.
This is the code:
cv::Vec3b c = my_cv_mat.at<cv::Vec3b>(i, j) / interval;
cv::Vec3b t = another_cv_mat.at<cv::Vec3b>(i, j) / interval;
The error is:
Invalid operands to binary expression ('cv::Vec<unsigned char,3>' and 'int')
One thing to note is that I am compiling an iOS app with OpenCV support.Any ideas how can I fix this?. I already checked the source code and it's exactly the same as other projects which are working fine.
Thanks a lot.
Is your my_cv_mat and your another_cv_mat an image with three channels? If it is not your code will probably result in an error or return bogus values. You are probably using a grayscale or binary image. In that case use cv::uchar in stead of cv::Vec3b.