Ask Your Question

aligoglos's profile - activity

2020-08-16 03:47:13 -0600 asked a question how to calculate scale with matchTemplate

how to calculate scale with matchTemplate I have problem that I hope someone give me a idea. In general I want to use ma

2020-06-26 10:01:38 -0600 received badge  Popular Question (source)
2019-10-01 13:36:05 -0600 received badge  Popular Question (source)
2019-10-01 00:17:35 -0600 received badge  Popular Question (source)
2019-09-30 23:26:45 -0600 marked best answer Sub Mat in mulidimensional Mat

I want to convert some codes from python to c++ . for example we have 3 dimensional array like (25 * 40 * 10) and we want to separate array, in python we have numpy arrays and simply do it with:

Probs = Y[...,0]
Affines = Y[...,2:] 
rx,ry = Y.shape[:2]
ywh = Y.shape[1::-1]
iwh = np.array(I.shape[1::-1],dtype=float).reshape((2,1))

but how can I implement this line in c++ with Mat?

2019-09-30 05:04:19 -0600 edited question Sub Mat in mulidimensional Mat

Sub Mat in mulidimensional Mat I want to convert some codes from python to c++ . for example we have 3 dimensional array

2019-09-30 05:02:19 -0600 asked a question Sub Mat in mulidimensional Mat

Sub Mat in mulidimensional Mat I want convert some codes from python to c++ . for example we have 3 dimensional array li

2017-06-30 23:45:54 -0600 asked a question how to recover train cascade from stage

i train cascade classifier in 20k positive and negative samples but after 1 day because power outage, turn off my pc. know there is way to recover my training from stage 3 or must began from first ?

2017-06-14 12:14:41 -0600 commented answer how to get angles of x y z in pose estimation?

but whats mean 2(r21,r11) ? mean of ',' its product or other mean ?

2017-06-14 10:45:00 -0600 received badge  Supporter (source)
2017-06-14 00:45:20 -0600 asked a question how to get angles of x y z in pose estimation?

i use landmark to extract face points and use solvePnP to estimate head pose but now i don't know how calculate head angles from X, Y and Z axis with solvePnP output parameters ? i try to convert rvet values to degree but seem some times values bigger than 180 !!!

2017-05-31 08:39:20 -0600 asked a question how to add openh264 to opencv

i want stream IP camera that compression is H264 i download open.h264 from openh and add system path var OPENH264_LIBRARY to dll files and even copy dll to my exe path but when i get image from camera this errors occur :

[h264 @ 000001ef9fd88c40] missing picture in access unit with size 120
[h264 @ 000001ef9fd88c40] No start code is found.
[h264 @ 000001ef9fd88c40] Error splitting the input into NAL units.

my code :

video_path = "http://admin:[email protected]:80/video.cgi?&.H264";
mCamera = new cv::VideoCapture();
mCamera->set(CV_CAP_PROP_FOURCC, CV_FOURCC('X', '2', '6', '4'));
isOpenedFile = mCamera->open(video_path);
2017-05-24 07:04:38 -0600 commented question cant add tracking modules to opencv solution

thanks works. but i think must write in tracking README file that tracking depend on dnn.

2017-05-23 13:08:48 -0600 received badge  Editor (source)
2017-05-23 11:47:57 -0600 asked a question cant add tracking modules to opencv solution

i use cmake GUI to create OpenCV.sln and build it. i set OPENCV_EXTRA_MODULES_PATH to opencv_contrib-3.2.0\modules and tick BUILD_opencv_tracking in BUILD but when i configure and generate solution and opened it with visual studio 14 all modules exist like xphoto , surface_matching , ... Except tracking module !!! i cant find why tracking project not add in opencv solution. anybody have idea ? my cmake options :

cmake output :

FP16: Compiler support is available
Found TBB: C:/Users/127051/Documents/Visual Studio 2015/Lib/tbb2017_20170118oss_win/tbb2017_20170118oss/lib/intel64/vc14/tbb.lib
found IPP (ICV version): 9.0.1 [9.0.1]
at: D:/SoftwareInstaltion/Opencv3.2/opencv/sources/Build2/3rdparty/ippicv/ippicv_win
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Caffe:   NO
Protobuf:   NO
Glog:   NO
freetype2:   NO
harfbuzz:    NO
Warning: Matlab bindings will only be built in Release configurations
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Module opencv_tracking disabled because opencv_dnn dependency can't be resolved!
Tesseract:   NO
Check contents of vgg_generated_48.i ...
Check contents of vgg_generated_64.i ...
Check contents of vgg_generated_80.i ...
Check contents of vgg_generated_120.i ...
Check contents of boostdesc_bgm.i ...
Check contents of boostdesc_bgm_bi.i ...
Check contents of boostdesc_bgm_hd.i ...
Check contents of boostdesc_binboost_064.i ...
Check contents of boostdesc_binboost_128.i ...
Check contents of boostdesc_binboost_256.i ...
Check contents of boostdesc_lbgm.i ...
Warning: Matlab bindings will only be built in Release configurations

General configuration for OpenCV 3.2.0 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            D:/SoftwareInstaltion/Opencv3.2/opencv_contrib-3.2.0/opencv_contrib-3.2.0/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2017-05-23T18:07:35Z
    Host:                        Windows 10.0.14393 AMD64
    CMake:                       3.5.2
    CMake generator:             Visual Studio 14 2015 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
    MSVC:                        1900

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.24210.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    ccache:                      NO
    Precompiled headers:         YES
    Extra dependencies:          comctl32 gdi32 ole32 setupapi ws2_32 ...
(more)
2017-05-08 22:52:19 -0600 commented question opencv exception in abs function

I'm sorry I was wrong. i use im.ptr<float>(i)[j] but my Mat type is CV_8UC. i convert my Mat to CV_32F and use im.at<float>(i,j), fixed issue.

2017-05-08 22:37:26 -0600 commented question opencv exception in abs function

but i don't use With_opencl when i compiled.

2017-05-08 11:52:11 -0600 commented question opencv exception in abs function

in my function get Mat image : imtemp2 = cv::abs(im);

2017-05-08 10:38:46 -0600 asked a question opencv exception in abs function

i want use abs function but every time i use it a type of exception occur !! once this exception :

Exception thrown: read access violation.

on below code in ocl.cpp line 4 :

bool useOpenCL()
{
    CoreTLSData* data = getCoreTlsData().get();
    if( data->useOpenCL < 0 )
    {
        try
        {
            data->useOpenCL = (int)haveOpenCL() && Device::getDefault().ptr() && Device::getDefault().available();
        }
        catch (...)
        {
            data->useOpenCL = 0;
        }
    }
    return data->useOpenCL > 0;
}

other this :

A heap has been corrupted .

on below code in alloc.cpp line 3:

void* fastMalloc( size_t size )
{
    uchar* udata = (uchar*)malloc(size + sizeof(void*) + CV_MALLOC_ALIGN);
    if(!udata)
        return OutOfMemoryError(size);
    uchar** adata = alignPtr((uchar**)udata + 1, CV_MALLOC_ALIGN);
    adata[-1] = udata;
    return adata;
}

another exception :

A heap has been corrupted  (ntdll.dll).

on opencl_core.cpp line 110 : handle = LoadLibraryA(path);

I am totally confused please help.

2017-04-08 02:05:09 -0600 asked a question svm->train raise exception with out train

i have vector<vector<float> > of features in size 1800*160 now i need train svm on it, i try use OPENCV SVM but in debug mode svm->train return false and in release mode this exeption raised :

Exception thrown at 0x00007FFF587AC387 (vcruntime140.dll):Access violation reading location 0x00000048B7FED000.

my code:

void Classifier::trainSVM(vector<vector<float> > data,cv::Mat Lable)
{
    // Train the SVM
    cv::Ptr<cv::ml::SVM> svm = cv::ml::SVM::create();
    svm->setType(cv::ml::SVM::C_SVC);
    svm->setKernel(cv::ml::SVM::LINEAR);
    svm->setTermCriteria(cv::TermCriteria(cv::TermCriteria::MAX_ITER, 50000, 1e-6));
    cv::Mat trainingData = cv::Mat(data.size(), 160, CV_32FC1, data.data());
    std::cout << "\nBegan Training Svm in vector faces.";
    bool trained = svm->train(trainingData, cv::ml::ROW_SAMPLE, Lable);
    if (trained)
        svm->save("svm_data.xml");
    std::cout << "\nEnd Training Svm in vector faces.";

}

my opencv version is: 3.2

2016-08-08 00:15:44 -0600 asked a question face detection improve

first i want know how much face angles change, haarcascade can detect faces?(because that seems haarcascade is very sensitive to angle) i want real time detect faces to 20 degree maximum and if no faces found report this. i use camshift tracking to improve face detection but track face in every angle and degree and i don't know how can detect in tracking step angle is more than 20 degree? thanks of your helping.

2016-05-14 01:10:01 -0600 received badge  Student (source)
2016-05-14 00:29:57 -0600 asked a question very very low performance

i want use ShapeContextDistanceExtractor according to shape_example.cpp source code in real time application and my images and mask is 85*55 pixel and simpleContour size is 300 but every ShapeContextDistanceExtractor.computeDistance takes about 18 to 20 seconds. why computeDistance is slow? Does the implementation in gpu? thanks.

2016-04-26 07:26:59 -0600 asked a question ANN_MLP Access violation Exception

i train ann to detect eye state with out problem but when i want to load pre trained file and predict samples this exception occurred : my training image size is 24*24;

Exception thrown at 0x00007FF8BB6980DC (opencv_world310d.dll) in SvmTrainingEye.exe: 0xC0000005: Access violation reading location 0x0000001F8768B000.

this is my code:

Mat openEye, closeEye,imgOpen,imgClose;
imgOpen = cv::imread("open.jpg");
imgClose = cv::imread("close.jpg");

cv::resize(imgOpen, openEye, cv::Size(24,24));
cv::resize(imgClose, closeEye, cv::Size(24, 24));

Mat lbpOpen, lbpClose;
if (openEye.channels() > 1)
    cvtColor(openEye, openEye, CV_BGR2GRAY);
lbp::ELBP(openEye, lbpOpen, 1, 16);
if (closeEye.channels() > 1)
    cvtColor(closeEye, closeEye, CV_BGR2GRAY);
lbp::ELBP(closeEye, lbpClose, 1, 16);

lbpOpen = lbpOpen.reshape(0, 1);
lbpClose = lbpClose.reshape(0, 1);

lbpOpen.convertTo(lbpOpen, CV_32FC1);
lbpClose.convertTo(lbpClose, CV_32FC1);

cv::Ptr<cv::ml::ANN_MLP> eyeNetwork;
eyeNetwork = Algorithm::load<ml::ANN_MLP>("Ann_sigmoid_eye.xml");

Mat outputOpen, outputClose;

eyeNetwork->predict(lbpOpen, outputOpen);
eyeNetwork->predict(lbpClose, outputClose);
2016-04-25 00:54:50 -0600 received badge  Enthusiast
2016-04-24 10:50:27 -0600 commented answer OpenCV Error When Train ANN_MLP

this fixed by :

Data.convertTo(Data, CV_32FC1); Lables.convertTo(Lables, CV_32FC1);

2016-04-24 10:49:59 -0600 received badge  Scholar (source)
2016-04-24 10:15:50 -0600 commented answer OpenCV Error When Train ANN_MLP

i comment this line : //Data = Mat(numberOfCloseEye + numberOfOpenEye, imageDimention*imageDimention, CV_32FC1);

but previous exception again occurred.

2016-04-24 10:03:35 -0600 commented answer OpenCV Error When Train ANN_MLP

i apply this changes but this time this exception occurred : OpenCV Error: Assertion failed ((layout == ROW_SAMPLE && responses.rows == nsamples) || (layout == COL_SAMPLE && responses.cols == nsamples)) in cv::ml::TrainDataImpl::setData, file C:\buildslave64\win64_amdocl\master_PackSlave-win64-vc14-shared\opencv\modules\ml\src\data.cpp, line 290

2016-04-24 07:25:28 -0600 asked a question OpenCV Error When Train ANN_MLP

i want train neural network to classify two type of images but when train network this error occurred :

OpenCV Error: Bad argument (output training data should be a floating-point matrix with the number of rows equal to the number of training samples and the number of columns equal to the size of last (output) layer) in cv::ml::ANN_MLPImpl::prepare_to_train, file C:\buildslave64\win64_amdocl\master_PackSlave-win64-vc14-shared\opencv\modules\ml\src\ann_mlp.cpp, line 675

my code :

#include "opencv2\core.hpp"#include "opencv2\imgproc.hpp"#include "opencv2\imgcodecs.hpp"#include "opencv2\highgui.hpp"#include "opencv2\ml.hpp"#include <string>#include "lbp.h"
using namespace cv;
using namespace cv::ml;
void LoadTrainingData();

Mat Data; Mat Lables; //const int numberOfClass1 = 2384; //const int numberOfClass2 = 2462; const int numberOfClass1 = 23; const int numberOfClass2 = 24; int Class1 = 1; int Class2 = -1; const int imageDimention = 22;

std::string NumberToString(size_t Number) { std::stringstream ss; ss << Number; return ss.str(); }

void main() { LoadTrainingData(); Ptr<ann_mlp> annClassifier; annClassifier = ANN_MLP::create(); annClassifier->setActivationFunction(ANN_MLP::ActivationFunctions::SIGMOID_SYM); Mat layers(1, 3, CV_32F); layers.at<float>(0) = Data.cols; layers.at<float>(1) = 100; layers.at<float>(2) = 2; annClassifier->setLayerSizes(layers); annClassifier->setTermCriteria(TermCriteria(TermCriteria::MAX_ITER, 100, 1e-6)); annClassifier->setTrainMethod(ANN_MLP::TrainingMethods::BACKPROP); bool trained = annClassifier->train(Data,ROW_SAMPLE,Lables); if (trained) annClassifier->save("Ann_sigmoid_eye"); }

void LoadTrainingData() { Data = Mat(numberOfClass1 + numberOfClass2, imageDimention*imageDimention, CV_32FC1); Lables = Mat(numberOfClass1 + numberOfClass2,1 , CV_32SC1); // load openEye Mat img; Mat lbpImg; Mat row; std::string path; for (size_t i = 1; i <= numberOfClass2; i++) { path = "class1 (" + NumberToString(i) + ").jpg"; img = imread(path); if (img.channels() > 1) cvtColor(img, img, CV_BGR2GRAY); lbp::ELBP(img,lbpImg, 1, 16);
row = lbpImg.reshape(0, 1); row.convertTo(row, CV_32FC1); Data.push_back(row); Lables.push_back(Class1); } for (size_t i = 1; i <= numberOfClass1; i++) { path ="class2 (" + NumberToString(i) + ").jpg"; img = imread(path); if (img.channels() > 1) cvtColor(img, img, CV_BGR2GRAY); lbp::ELBP(img,lbpImg, 1, 16); row = lbpImg.reshape(0, 1); row.convertTo(row, CV_32FC1); Data.push_back(row); Lables.push_back(Class2); } }

i don't why this happen ! please help me,thanks.

2016-03-30 04:00:53 -0600 commented question detectMultiScale return illogical result

i install visual studio 2015 (vs 14) and reconfiguration linker to vs 14 and copy new vs14 dll into my debug folder but didn't different this exception occurred. i thing is bug in opencv library. my new information : window 10 X64 , opencv 3.1 , visual studio 2015 update 1

2016-03-25 02:03:27 -0600 commented question detectMultiScale return illogical result

and add both of opencv_world310.dll , opencv_world310d.dll in debug directory

2016-03-25 02:01:49 -0600 commented question detectMultiScale return illogical result

i add both of : opencv_world310.lib , opencv_world310d.lib into AdditionalDependencies and my My PC is an x64 architecture.