CommandLineParser ,loading image in opencv by command line arguments - c++

I see that in version 3 of Opencv , "CommandLineParser" is used much ;but I don't get how it works.I am new with programming.can anyone give me some help please?
another question is that , before I was working with Opencv 2 version , and reading image is quite simple by "Imread("file address",type)" but I see that in new version it is mostly done by commandine arguments . what is advantage of this,and how it works exactly?
I am working with Visual studio 2015 on Windows 10
thanks

Related

Example of OCRTesseract with OpenCV 3

I found that page about OCR using Tesseract on OpenCV 3.1. The problem is that given links include examples with older OpenCV versions. Is there any up to date example of usage of OCR Tesseract? and How can I told this to OpenCV authority?
The sample code below is unfortunately in Python with the text module/opencv_contrib of OpenCV 3.2. I compiled Tesseract 4.0.0alpha with OpenCV 3.2.0 binding to make it works few months ago. Hope this could be a reference for your C++ implementation.
# para: tessdata path, language, whitelist, psm, oem
tesser = cv2.text.OCRTesseract_create('C:/Program Files/Tesseract 4.0.0/tessdata/','eng',
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',11,3)
retval = tesser.run(processed_image, 0) # ' return string type
As far as I know, the Text module doesn't work well in OpenCV 3.0/3.1. Would suggest to use 3.2.0 to avoid any possible issue on earlier 3.x versions.

Migration from vtk5 to vtk7-> missing CopyIndormation from vtkPolyData

I am trying to migrate a program from vtk5.10 to vtk7.0 (QT 5.7, Visual Studio 2013). I have managed to do the proper changes in some functions. Although, now I get an error on a removed function (in vtk6) the CopyInformation.
newOutput->CopyInformation(mapper->GetInput());
Is there any other fuction that could substitute this one in vtk7.0? I have searched on the vtk6 migration guides, but I couldn't find any helpful information (for substitution). I am new in vtk, so any advice could help.
Thank you.

OpenCV with DirectX sample error

I am trying to run an OpenCV with DirectX example: d3dsample.cpp from [here]. But it crashes on
initializeContextFromD3D11Device
The error is "Access violation executing ..." (look like it is not possible to initialize the context from D3D to OpenCL. I have no idea to solve with this problem.
I found some possible duplicate at OpenCV question board [here], but they are no any progress through last year.
If some one success to build this sample code, please give a suggestion.
PS: I am using OpenCV 3.1 on Visual Studio 2013 (vc120), Nvidia GTX980 graphics card.
Update:
I am trying to debug with both d3d10_interop and d3d11_interop.
The d3d10_interop gave me a exeption:
C:\OpenCV\3.1\sources\modules\core\src\directx.cpp:449: error:
(-222) OpenCL: Can't create context for DirectX interop in function
cv::directx::ocl::initializeContextFromD3D10Device\n" ...} ...}

integrating cocos2d-x with gaf in visual studio

i'm using cocos2d-x 3.7 on windows, visual studio 2013 and GAF_VERSION 5.0.
i'v downloaded "Cocos2dxGAFPlayer" and copied it into cocos2d/external, after that i added the gafplayer project to my cocos2dx project solution. i'm not sure but i think i have configured it properly as its running while it has this code in "HelloWorld::init()" :
auto animation = GAFAsset::createWithBundle("anim1.zip", "anim1/anim1.gaf", nullptr);
object = animation->createObjectAndRun(true);
object->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
object->setPosition(Director::getInstance()->getVisibleSize() / 2);
this->addChild(object,1);
but by using this only the png file, containing parts of animation is shown( i have attached the file i mean).
when i use the zip file generated by gap in the GAFTest project by only replacing the recourse (not the source code) it works fine.
i've searched the net for a solution, and a correct way to integrate cocos2d-x and gaf. but i couldn't find a way.
please guide me.
is there any tutorial about how to integrate cocos2d-x with gaf on visual studio so i make sure i'm doing the configuration right?
tnx
A member of GAFmedia forum suggested something which solved the problem : http://gafmedia.com/forum/viewtopic.php?f=8&t=447
Postby Dmitry Bushtets ยป October 7th, 2015, 7:36 am
I have one idea. Have you method call to CODE: SELECT ALL
cocos2d::Director::setContentScaleFactor
in the code? (it can be in AppDelegate.cpp) If yes - try to remove
this call (set content scale factor to 1) and check result. Or
convert swf to gaf with CSF 1 and 2 (and 3, 4 maybe :) ). You can find
this option in GAF Converter. [Texture Atlas -> Scale Settings ->
Advanced]

Possible bug in OpenCV2.4 capturing frames from video

Could it be that there is a bug in OpenCV2.4 highgui for capturing frames from video in windows?
I installed both the precompiled libraries, the ones compiled by me, I can compile everything perfectly and I can run my programs if
they are image based. The problem is only for videos. OpenCV crashes in this function always:
virtual IplImage* retrieveFrame(int)
{
unsigned char* data = 0;
int step=0, width=0, height=0, cn=0;
if(!ffmpegCapture ||
!icvRetrieveFrame_FFMPEG_p(ffmpegCapture,&data,&step,&width,&height,&cn)) <-------CRASHES HERE
return 0;
cvInitImageHeader(&frame, cvSize(width, height), 8, cn);
cvSetData(&frame, data, step);
return &frame;
}
This is inside the class cap_ffmpeg.cpp and is called by VideoCapture.
I tried versions 2.4.2 and 2.4.9. My programes were working finde with opencv2
More information
Windows 7
Build the projects with cmake (important as it could be that cmake is not building/finding the right codecs)
VisualStudio 9 2008
OpenCV 2.4.2
EDIT
It looks like it is actually a bug, so, how can I solve this problem and change my code to be able to read avi files?
As a temporary solution I decided to re-encode the videos so OpenCV doesn't use the ffmpeg. I used VirtualDub with the microsoft video 1 compression, which uses "msvidc32.dll" driver.
It works with all my videos so it is enough by now as I can keep working with OpenCV in windows.
I had similar problem. I downloaded VirtualDub, but it did not open one of my avi video because of its FMP4 encode. So in the end, the solution that solved the problem was to install ffdshow, a decoder for windows. See this link: http://www.moviecodec.com/video-codecs/fmp4-codec-with-virtualdub-45814/
Then I do not need to use VirtualDub anymore to re-encode my video anymore!
if your using x64. Please use opencv_ffmpeg245_64.dll this solves may solve the problem. Or rename opencv_ffmpeg245_64.dll to opencv_ffmpeg245.dll may solve the problem.