opencv\modules\core\src\persistence.cpp:2697: error: (-27) NULL or empty buffer in function cvOpenFileStorage - c++

I am trying to run a facedetection application and I get the following error:
Unexpected Standard exception from MEX file.
What() is:..\..\..\..\opencv\modules\core\src\persistence.cpp:2697: error: (-27)
NULL or empty buffer in function cvOpenFileStorage

If you're using haarcascade_frontalface_default.xml, check the xml file content.
The first 3 lines should be:
<?xml version="1.0"?>
<!--
Stump-based 24x24 discrete(?) adaboost frontal face detector.
I inadvertently downloaded the html that linked to the haarcascade_frontalface_default.xml file instead of the xml itself and got the same error you did.

You should provide some code and information.Nevertheless the error indicates that it can not access the haarcascade file. I suggest you make sure you have the "xml" in the same folder as your code (e.g. "ViewController.mm") and check permissions. additionally Assuming you are using Objective-c or swift:
1-check the file is in your Xcode project; and, if it is,
2-check it's included in the 'Copy Bundle Resources' phase underneath your selected Target (in the project tree view on the left in the normal Xcode window layout) and, if it is,
3-look inside the generated application bundle (find your product, right click, select 'Reveal in Finder', from Finder right click on the app and select 'Show Package Contents', then look for your file in there) to make sure that it's there.

I've got the same problem, and then I figure out what's the problem
First
Add file haarcascade_frontalface_default.xml to xcode project
make sure when you add the xml file with option below:
Destination: Copy items if need [check]
Added Folder: Create Folder References [check]
Add to targets: Your Project target [check]
Second
in you Wrapper.mm file add this code to your obj-c function:
const NSString* cascadePath = [[NSBundle mainBundle]pathForResource:#"haarcascade_frontalface_default" ofType:#"xml"];
or in case you wanna load the xml file, use this code:
cv::CascadeClassifier classifier;
const NSString* cascadePath = [[NSBundle mainBundle]pathForResource:#"haarcascade_frontalface_default" ofType:#"xml"];
classifier.load([cascadePath UTF8String]);
this actually fixes my problem, anywaythis question has been questioned for a long time but I hope someone face this problem can come to this answer and help them solve their problem like mine, cheer.

Related

How to load PNG file into my custom component? Cannot get correct instance

I want to create a custom control (from TPanel) that holds some TImages.
I want to display PNG (with transparency) into those mages. Therefore, I am TRYING to attach the PNG via IDE's "Resource and Images" to the package.
The problem is that when I put the component into a test application it will fail on MyPng->LoadFromResourceName line with "resource not found". Interestingly, if I add the PNG as a resource to the test application, it will work.
This means that the component is looking into the wrong module for the PNG resource.
I print the instance with ShowMessage it shows indeed "ComponentTester.exe".
__fastcall TVolumeCtrl::TVolumeCtrl(TComponent* Owner)
: TPanel(Owner)
{
HINST h = FindClassHInstance(__classid(TVolumeCtrl));
ShowMessage(GetModuleName(h));
TPngImage *Png3 = new TPngImage();
MyPng->LoadFromResourceName(h, "Btn1");
How to get the correct instance?
Note: The PNG files ARE compiled into the RES file generated. I looked inside with a Hex viewer.
The only explanation that makes sense is that you are not using runtime packages. So you aren't loading the module that contains the resource.
The right way to link the resource for the component is to use a $R directive in the source file that declares the type, TVolumeCtrl in this case. That way the resource will be linked to whichever module contains the implementation of TVolumeCtrl. That's going to be a package when you are compiling the runtime package (which is used at designtime by your designtime package), and it will be the executable when you compile an executable that does not use runtime packages.

Unknown class swift

I have for months tried to find what causes the following in Xcode. I have deleted the temporary files, searched through the MainStoryboard file - no success.. I dont know how to fix it.. Source code of project is on GitHub (https://github.com/rsyncOSX/Version3.x).
One problem solved - the second issue is still there. Have searched through Main.storyboard file, cannot spot the problem. The ViewController IDed by 3xI-3C-guU is valid. I am also finding reference to fs3-Ij-mBm searching in Main.storyboard.
2016-12-19 09:06:43.068961 RsyncOSX[10461:604908] Unknown class
_TtC8RsyncOSX21TabViewControllerMain in Interface Builder file at path /Volumes/Home/thomas/Library/Developer/Xcode/DerivedData/RsyncOSX-budzkonsqjvzovfxbfnmopllerwh/Build/Products/Debug/RsyncOSX.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-abu-zT-Ht4.nib.
2016-12-19 09:06:43.270247 RsyncOSX[10461:604908] Unknown class View
in Interface Builder file at path
/Volumes/Home/thomas/Library/Developer/Xcode/DerivedData/RsyncOSX-budzkonsqjvzovfxbfnmopllerwh/Build/Products/Debug/RsyncOSX.app/Contents/Resources/Base.lproj/Main.storyboardc/3xI-3C-guU-view-fs3-Ij-mBm.nib.
This problem can occur when you change a classname of a UIViewController even though a storyboard does still have the old classname. You can fix this by finding out which storyboard it is that is causing this problem (try the search function in Xcode, it will tell you that you can find classname in file example.storyboard) and update the name accordingly.

Getting an incorrect permissions screen in the webview Blackberry 10 Cascades Beta 3 SDK in Dev Alpha Simulator

I am trying to make dynamically generated html 5 graphs show up in a webview in Blackberry 10 Cascades. I have confirmed the html5 that I have generated, draws the correct graphs. My problem is that when I try to implement this in the Blackberry 10 Cascades Beta 3 SDK (using the Blackberry 10 Dev Alpha Simulator), the webview that is supposed to show the graph, just looks like this:
Here is the code that leads to this error:
//html_ already contains the html-5 code to make the graph at this point in the code
//This is the file path to a local file that is actually accessable in the emulator
//and not just from Windows
//
QFile *chartFile = new QFile("app/native/assets/data/chart.html");
if (chartFile->open(QIODevice::WriteOnly)) {
chartFile->write(html_.toUtf8());
chartFile->flush();
chartFile->close();
}
if (chartFile) delete chartFile;
if (graphView_) {
graphView_->setHtml("");
graphView_->setUrl(QUrl::fromLocalFile("app/native/assets/data/chart.html"));
}
I checked the permissions of that file, put they are all Allow (777 permissions for those who know Unix style permissions).
I added access_internet to the bar-descriptor.xml, eventhough my app was already able to access remote sites, just to see if that would fix it, but it did not.
I've been searching around trying to find a solution to this problem, but I have not.
If anyone could help me out with this, it would be greatly appreciated.
-------------------------------------------------------
Update:
I changed the code to set the html directly, now I have this:
if (graphView_) {
graphView_->setHtml(html_, QUrl("app/native/assets/data/chart.html"));
}
But nothing shows. It seems I have the wrong relative path relative to my base url.
My base url is this: QUrl("app/native/assets/data/chart.html")
My relative paths all begin with: ./Highcharts/js/...
My relative paths are located under: app/native/assets/data/Highcharts/js
It seems to me that I this should work, but when I do this, I just a blank screen, as if it can not find my relative paths. So I don't know what's going on here either.
I found a solution that works. I'm using the first approach, not the updated approach, but instead of
graphView_->setUrl(QUrl("app/native/assets/data/chart.html"));
I'm using:
graphView_->setUrl(QUrl("local:///assets/data/chart.html"));
And I have left the rest of the code the same, and it works.

"Unexpected line" exception when using component load rules for RTC Jazz build engine

I have a component named MyComponent with the following folder structure in RTC:
/MyProject
/MyProject/TestFile.txt
/MyProject/Folder1
/MyProject/Folder1/loadrules.txt
/MyProject/Folder1/TestFile2.txt
And this is what I have in my loadrules.txt file::
versionableName=/MyProject/TestFile.txt
I've specified the loadrules.txt file in my build definition for this component as the component load rule, but when the build runs, I'm getting the following exception when it tries to fetch the files:
com.ibm.team.repository.common.TeamRepositoryException: Unexpected line "versionableName=/MyProject/TestFile.txt" encountered in build load rules for component "MyComponent"
at com.ibm.team.filesystem.client.internal.load.LoadRule.getRules(LoadRule.java:176)
at com.ibm.team.filesystem.client.internal.load.LoadRule.addLoadRules(LoadRule.java:101)
at com.ibm.team.build.internal.scm.ComponentLoadRules.getLoadRules(ComponentLoadRules.java:134)
at com.ibm.team.build.internal.engine.JazzScmPreBuildParticipant.preBuild(JazzScmPreBuildParticipant.java:235)
at com.ibm.team.build.internal.engine.BuildLoop.invokePreBuildParticipants(BuildLoop.java:844)
at com.ibm.team.build.internal.engine.BuildLoop$2.run(BuildLoop.java:650)
at java.lang.Thread.run(Thread.java:662)
Any idea what I'm doing wrong? I've tried following the example here but I can't figure why it's not working for me. Regardless of what I put in the loadrules.txt file (nothing/empty string, random garbage text, etc.), I still get this exception for the first line of the file.
This is in RTC 3.0
This kind of error is likely to be an encoding issue.
One way to test that is to create the loadrules.txt through the scm command-line interface, as detailed in "Reference > Source control command line reference > scm > create"
scm create loadrules [options]
The OP holic87 confirms:
I just used Notepad++ to recreate the text file and it's working as expected now.

Visual C++ - Throwing unhandled exception from setting forms icon?

I can compile the solution with no errors, but when I'll try to run it, I get a crash window:
An unhandled exception of type
'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "<myformname>.resources" was corerctly embedded or linked into assembly "<myprojectname>" at compile time, or that all the satellite assemblies required are loaded and fully signed.
And after I press Break it throws me to the line:
this->Icon = (cli::safe_cast<System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon")));
If I comment this line out, everything works just fine, but my program doesn't have icon.
Anyone else had this problem? Found a solution? I couldn't find anything clear enough for me to understand, problem is really annoying me, only solution I found was to declare my form class before any other classes, but I don't even have any other classes in my solution?
I also have only one project in this solution, ms support said something about having multiple projects, which I don't have, so it was no use either.
Take a look here :
http://www.mztools.com/articles/2005/MZ2005007.aspx
The exception is thrown because your icon cannot be located. You will probably need to compiles your resources under one .dll and put this under en-US subfolder on your project output. It did the trick for me at least. There are probably other solutions to your problem too.
Do not panic like I did. The root cause of the problem is that the compiled resource file is different from the one that is asked to load at runtime. This happens because the underlying build-script cannot detect the filename or namespace changes made after the form is created.
For example, At first we started a project named x . And our $(RootNamespace) becomes x. And we created a form named y. So our XML resource file y.resx gets compiled into x.y.resource . At this point the icon change works.
Now somehow we changed the project name or the namespace to z. But our $(RootNamespace) remains the x. While at compile-time it wrongly generates old x.y.resource, but at links-time it links z.y.resource. And at this point the icon change does not work.
It can also happen if the form is under some nested namespace which is not known in the project file.
It can be fixed by changing the compilation output of the y.resx file . It can be done by right-clicking the resource and changing the Resource Logical Name to $(RootNamespace).%(Filename).resources .
I will also make sure that ProjectName,AssemblyName and RootNamespace are the same in the .vcxproj file. Somehow if the form is declared under a nested namespace like RootNamespace.gui , then the output file of the resource should be $(RootNamespace).gui.%(Filename).resources .