open cv cv::neon_cvtColorBGRA2GRAY issue - iphone

I am converting an image in cartoon like, My application run well in simulator. And desired output is coming, but problem is that when I run my app on device it gives error on below line.
if TARGET_IPHONE_SIMULATOR
cv::cvtColor(bgr, gray, CV_BGRA2GRAY);
else
cv::neon_cvtColorBGRA2GRAY(bgr, gray);// got error in this line
endif
error : no member name neon_cvtColorBGRA2GRAY in namespace cv
Thanks

This function is not a part of OpenCV. It must have been manually coded to the cv namespace. With that being said, you will need to provide the code that implements that function. After a quick search, it seems like this is what you want:
https://github.com/BloodAxe/OpenCV-Tutorial/blob/master/OpenCV%20Tutorial/cvneon.cpp
Just take this .cpp file and the respective .h file from this repo and add them to your project.

Related

How to add a custom library using add_block?

I created a custom library. This library contains only one subsytem block named RADAR. I am trying to use add_block and add this subsytem. Without any error the simulink file opens but the block does not appear.
This is how I load my library.
load_system('libdeneme');
And these are some of the code lines I tried.
add_block('simulink/libdeneme/RADAR','autoCreateDeneme')
add_block('simulink/libdeneme/RADAR','autoCreateDeneme')
add_block('libdeneme/RADAR','autoCreateDeneme')
add_block('libdeneme/RADAR',)
The source needs to be the library name then the name of the block in the library. Your first 2 lines don't work because your library is not the simulink library. But the source name in your last 2 attempts look right.
The destination needs to be the name of the model followed by the name to give the new block. Neither of your examples follow that format. (Surely the last example you give throws an error as it is invalid MATLAB syntax?)
You want something like
add_block('libdeneme/RADAR','nameOfModelToCopyTo/nameToGiveBlockInModel');

fatal error: itkMultiScaleHessianBasedMeasureImageFilter.h: No such file or directory #include "itkMultiScaleHessianBasedMeasureImageFilter.h"

I am trying to run the itkMultiScaleHessianBasedMeasureImageFilter program for blood vessels segmentation given in the below link
https://itk.org/ITKExamples/src/Nonunit/Review/SegmentBloodVesselsWithMultiScaleHessianBasedMeasure/Documentation.html
But I am getting the following error.
fatal error: itkMultiScaleHessianBasedMeasureImageFilter.h: No such file or directory
I am unable to understand that for Input, 2D slice/image should give or 3D image series of CT scan?
Also, I tried the code from
https://itk.org/ITKExamples/src/Filtering/ImageFeature/SegmentBloodVessels/Documentation.html
but this is also not working.
Can Someone please provide the solution?
With ITK 4.x and earlier, some of the classes were in Review module, which is turned off by default. That means you need to set CMake variable Module_ITKReview to ON when configuring/compiling ITK.

Referencing External Files in JModelica

I have a Modelica file that references c code during simulation through an external library *.a file.
For example:
model CallAdd
input Real FirstInput(start=0);
input Real SecondInput(start=0);
output Real FMUOutput(start=0);
function CAdd
input Real x(start=0);
input Real y(start=0);
output Real z(start=0);
external "C" annotation(Library = "CAdd", LibraryDirectory = "modelica://CallAdd");
end CAdd;
equation
FMUOutput = CAdd(FirstInput,SecondInput);
annotation(uses(Modelica(version = "3.2.1")));
end CallAdd;
When opening the Modelica model in OpenModelica the required files appear to be automatically loaded because it simulates and gives appropriate results.
However, when I try to compile the Modelica file with JModelica-SDK-1.12 I receive an error that the library *.a file could not be found.
So my question is: What is the proper way to reference additional files when using compile_fmu in JModelica?
With no success, I've tried:
# Import the compiler function
from pymodelica import compile_fmu
model_name = "CallAdd"
mo_file = "CallAdd.mo"
# Compile the model and save the return argument, for use later if wanted
my_fmu = compile_fmu(model_name, mo_file, target="cs",compiler_options = {'extra_lib_dirs':'C:/ToFolderContainingLib/'})
The strange thing is that when I was using JModelica-1.17 (non-SDK) the file compiled fine but the results didn't make sense. I was recommended to try the SDK version to see if it fixed my errors in my previous post here.
Try positioning the external library in sub-folder named as the platform your currently on. So in your example, I'd position the library (libCAdd.a) in sub-folder named linux64, as I'm on a 64bit Linux machine and then run the code.
If is a small piece of C code, as a last alternative you could try to include the C file directly in the Modelica code:
external "C" annotation(Include="
// the entire C code here
");
Hopefully the JModelica people will give you a better answer soon.
You could try to ask this on their website also:
http://www.jmodelica.org/forum

Fiji error: "No images file selected" when using a macro that calls the plugin 'Average Images'

I would like to create a macro with Fiji, that then I would run by using matlab.
I would like to average 3 images by using the Plugins>Stacks>Average Images.
I used first Plugins>Macro>Record... to get an idea what to use. Here is the result:
run("Average Images", "add=D:\\Corinne\\diabetes_paper_meas\\2013_01_29\\Measurement.007_cb\\Measurement._cb_frame0_pvar-8bit_combined.tif add=D:\\Corinne\\diabetes_paper_meas\\2013_01_29\\Measurement.007_cb\\Measurement._cb_frame1_pvar-8bit_combined.tif add=D:\\Corinne\\diabetes_paper_meas\\2013_01_29\\Measurement.007_cb\\Measurement._cb_frame2_pvar-8bit_combined.tif");
saveAs("Tiff", "D:\\Corinne\\diabetes_paper_meas\\2013_01_29\\Measurement.007_cb\\test.tif");
However, even when I run this macro I got an error: No images file selected. However, in Fiji you do not need to open any images to run the plugin but you add the files through a window interface...
So of course, since just running the macro is not working I get the same error when I use the following macro:
file = getArgument;
if (file=="") exit ("No argument!");
setBatchMode(true);
file_vasc = file;
file_vasc_frame_0 = file;
file_vasc_frame_1 = replace(file, "\\_frame0_pvar-8bit_combined.tif", "_frame1_pvar-8bit_combined.tif");
file_vasc_frame_2 = replace(file, "\\_frame0_pvar-8bit_combined.tif", "_frame2_pvar-8bit_combined.tif");
run("Average Images", "add=file_vasc_frame_0 add=file_vasc_frame_1 add=file_vasc_frame_2");
file_vasc_out = replace(file, "frame0_pvar-8bit_combined.tif", "_vasc_averaged.tif");
saveAs("Tiff", file_vasc_out);
Somebody has an idea what should I do?
Thanks
The Average Images plugin is using dialogs in a non-standard way and therefore is not scriptable: when running the plugin in Fiji with the macro recorder active (Plugins>Macros>Record... and then Plugins>Stacks>Average Images), you will see Fiji complain as soon as you add a second file to the list:
Duplicate keyword:
Command: "Average images"
Keyword: "add"
Value: /path/to/your/file
Add an underscore to the corresponding label in the dialog to make the first word unique.
This clearly is a bug in the plugin (it makes multiple use of the same OpenDialog thereby recording duplicate keywords in the macro recorder). You can report it via Help>Report a bug, however I fear that this plugin is not actively maintained at the moment.
In any case, there is a simple alternate way to average images in ImageJ without requiring this plugin, using the Image>Stacks>Images to Stack and Image>Stacks>Z Project... commands:
setBatchMode(true);
open("/path/to/first-image.tif");
open("/path/to/second-image.tif");
run("Images to Stack", "name=stack title=[]");
run("Z Project...");
saveAs("Tiff", "/path/to/new-file-name.tif");

smoke effect in the ogre3d

I am working the particle effects in ogre3d for iphone
Ogre::ParticleSystem* sunParticle = OgreFramework::getSingletonPtr()->m_pSceneMgr- >createParticleSystem("Smoke", "Examples/Smoke");
sunParticle = OgreFramework::getSingletonPtr()->m_pSceneMgr->createParticleSystem("Smoke", "Examples/Smoke");
Ogre::SceneNode* particleNode = OgreFramework::getSingletonPtr()->m_pSceneMgr->getRootSceneNode()->createChildSceneNode("Particle");
particleNode->attachObject(sunParticle);
This is my plugin code
# Defines plugins to load
# Define plugin folder
PluginFolder=./
# Define plugins
Plugin=RenderSystem_GL
Plugin=Plugin_ParticleFX
In staticloader also contains this installing manually
#ifdef OGRE_STATIC_ParticleFX
mParticleFXPlugin = OGRE_NEW ParticleFXPlugin();
root.installPlugin(Plugin_ParticleFX);
root.loadPlugin(mParticleFXPlugin);
endif
I have also add the .particle file
I think i followed all the steps
An exception has occurred: OGRE EXCEPTION(2:InvalidParametersException): Cannot find required template 'Examples/Smoke' in ParticleSystemManager::createSystem at /Users/davidrogers/Documents/Ogre/ogre-v1-7/OgreMain/src/OgreParticleSystemManager.cpp (line 327)
2012-03-22 14:06:46.757 iphonesampleOgreapp[23041:207] Applications are expected to have a root view controller at the end of application launch
You need to specify the resource folder(s), too, to be able to use the actual particle scripts. Are you absolutely sure you do this correctly?
Have a look at this tutorial.
I really think that this error message sounds like the ressources are not correctly initialized or -if they are- the particle script is simply erroneous.