issues with create an opencv window - opencv

I have Mac OS Lion 10.7.5 and xCode 4.6. I've downloaded an opencv template. Then retrive a framework and want to create my own project. For the first i install cmake 2.8.10, add a framework and that's it. In main.m i try to create a window:
#import <UIKit/UIKit.h>
#include "opencv2/highgui/highgui_c.h"
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
IplImage* img = cvLoadImage("1.png", 8);
cvNamedWindow("Example",CV_WINDOW_AUTOSIZE); //Thread 1: signal SIGANRT
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
And in debug area i got following:
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /Volumes/minijHome/Documents/xcode_mini/hillegass/advancedIOS/postCourse/openCV/clean-downloads/openCVgitClone/opencv/modules/highgui/src/window.cpp, line 652
libc++abi.dylib: terminate called throwing an exception
What i have to do?

Related

Cannot install Rails 6 due to annobin

I wrote my first major rails app in 2008 and have been using it since. Over the years I've installed it at least 10 times. Now I cannot install Rails 6. The installation fails at nokogiri with the following error in /usr/local/lib64/gems/ruby/nokogiri-1.10.9/mkmf.log:
cc1: fatal error: inaccessible plugin file /usr/local/gcc8/lib/gcc/x86_64-pc-linux-gnu/8.3.0/plugin/annobin.so expanded from short plugin name annobin: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
I've tried to learn what annobin is with no luck. I've attempted to install annobin from github, but that does not provide the functionality rails is looking for. Of course, this little program compiles and runs just fine. So I have no idea why rails now requires annobin to install. In this context I'm not even sure what a plugin is.
Many thanks for any help.

'iterator' file not found when compiling bar for iOS

I was using Xcode 11 to compile zbar for my iOS Device.
However it gives me this error:'iterator' file not found
Some code:
#ifndef _ZBAR_IMAGE_H_
#define _ZBAR_IMAGE_H_
/// #file
/// Image C++ wrapper
#ifndef _ZBAR_H_
# error "include zbar.h in your application, **not** zbar/Image.h"
#endif
#include <assert.h>
#include <iterator>
#include "Symbol.h"
#include "Exception.h"
I have tried to clean and rebuild and this didn't seem to work.
Environment:
Mac OS Catalina 10.15 Beta (19A558d)
Xcode 11.0(11A420a)
C11
<iterator> is a c++ reference, please refer to here.
so,
a. Renaming the image.c to image.cpp
or
b. Compile with g++, NOT gcc
would be helpful.

CMake does not find OpenCV

I seem to have an issue with my CMakeLists and opencv.
I am currently using opencv version 2.4 which is confirmed by
pkg-config --modversion opencv
2.4.8
and
dpkg -l libopencv*
which outputs http://pastebin.com/ZJEfLjDX
But for some reason when i cmake a simple program such as
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
if ( argc != 2 )
{
printf("usage: DisplayImage.out <Image_Path>\n");
return -1;
}
Mat image;
image = imread( argv[1], 1 );
if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Display Image", WINDOW_AUTOSIZE );
imshow("Display Image", image);
waitKey(0);
return 0;
}
Will cmake not continue due to this error.
CMake Error at /opt/ros/indigo/share/OpenCV-3.1.0-dev/OpenCVModules.cmake:183 (message):
The imported target "opencv_core" references the file
"/opt/ros/indigo/lib/libopencv_core3.so.3.1.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/opt/ros/indigo/share/OpenCV-3.1.0-dev/OpenCVModules.cmake"
but not all the files it references.
Call Stack (most recent call first):
/opt/ros/indigo/share/OpenCV-3.1.0-dev/OpenCVConfig.cmake:86 (include)
CMakeLists.txt:3 (find_package)
-- Configuring incomplete, errors occurred!
with this CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
The project has no ros dependency, and I have no idea why it is looking for OpenCVConfig.cmake inside ros.
A simple locate shows that the correct version is available other places
locate OpenCVConfig.cmake
/home/k/opencv/opencv-2.4.8/build/OpenCVConfig.cmake
/home/k/opencv/opencv-2.4.8/build/unix-install/OpenCVConfig.cmake
/home/k/opencv/opencv-2.4.8/cmake/OpenCVConfig.cmake
/home/k/opencv/opencv-2.4.8/cmake/templates/OpenCVConfig.cmake.in
/opt/ros/indigo/share/OpenCV-3.1.0-dev/OpenCVConfig.cmake
/usr/local/share/OpenCV/OpenCVConfig.cmake
/usr/share/OpenCV/OpenCVConfig.cmake
but why does it choose to use the one from ros, which I am not sure is even an option if I don't have opencv3.1.0-dev installed?
I know that a solution to this problem would be SET the path. But why can't find_package make use of the 2.4.8 version? I even tried to change the filename of /opt/ros/indigo/share/OpenCV-3.1.0-dev/OpenCVConfig.cmake to /opt/ros/indigo/share/OpenCV-3.1.0-dev/OpenCVConfig.cmake.old, which caused the same error?... Why is cmake not able to find opencv by simple using find_package( OpenCV REQUIRED ), and how do I make it so that it possible to find using this.

How to build GNUstep programs on OpenBSD?

I am trying to build a GNUStep program on OpenBSD. I installed packages gnustep-base and gnustep-make.
my main.m:
#import <Foundation/Foundation.h>
int main(void)
{
NSLog(#"Hello World!");
return 0;
}
GNUmakefile:
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = main
main_OBJC_FILES = main.m
include $(GNUSTEP_MAKEFILES)/tool.make
Then, I initialize the GNUstep environment using
. /usr/local/share/GNUstep/Makefiles/GNUstep.sh
And then I run:
make
This does not recognize the GNUmakefile.
Does anybody know how I can build a GNUstep program on OpenBSD?
On my Arch Linux installation, similar procedure works fine.
Try make -f GNUmakefile. If this command fails, install gmake and try gmake -f GNUmakefile.

Is it possible to compile iPhone app via command-line gcc?

If i want to compile minimum OSX app via command-line gcc i can compile the file test.m:
#import <AppKit/AppKit.h>
int main( int argc, char** argv ) { return 0; }
via following command:
gcc -c test.m
But how to compile iOS app same way? I change test.m to refer iOS cocoa touch:
#import <UIKit/UIKit.h>
int main( int argc, char** argv ) { return 0; }
And this is no longer compiles with error:
test.m:1:24: error: UIKit/UIKit.h: No such file or directory
You probably want to use xcodebuild if you're building apps from the command line, as they consist of more than just Objective-C files.

Resources