I'm launching a program of mine which uses openCV/Opengl and which used to work fine with no errors. Now when it starts I get this:
OpenCL program build log: -D LOCAL_SIZE_X=8 -D LOCAL_SIZE_Y=8 -D SPLIT_STAGE=1 -D N_STAGES=20 -D MAX_FACES=10000 -D LBP
ptxas application ptx input, line 637; error : Instruction '{atom,red}.shared' requires .target sm_12 or higher
ptxas application ptx input, line 884; error : Instruction '{atom,red}.shared' requires .target sm_12 or higher
ptxas fatal : Ptx assembly aborted due to errors
(Mac Os X 10.11)
and then my program continues running normally. I have no idea what might be causing this and if this is relevant or not to my code and I have no idea where to look either. The very same code used to be OK. Is it something related to the openGL wrapper libraries I use? How serious is this? Could somebody please explain this error to me?
EDIT
I managed to identify the code which causes this error:
face_cascade.detectMultiScale(frame_gray, faces, 1.1, 2, 0, cv::Size(80, 80));
this is essentially a call to cv::CascadeClassifier::detectMultiScale with a cv::Mat a std::vector<cv::Rect> an a cv::Size as arguments.
Related
When I attempt to tune my Moses tuner (according to the moses baseline), it reaches the end of my tuning dataset (75k lines) and then exits on the code:
Executing: /home/alexm/Desktop/dissertation/models/cy-en/transsystem/mert-work/extractor.sh > extract.out 2> extract.err
Exit code: 127
ERROR: Failed to run '/home/alexm/Desktop/dissertation/models/cy-en/transsystem/mert-work/extractor.sh'. at ../../../mosesdecoder/scripts/training/mert-moses.pl line 1775.
It exits without giving the current tuning weights too, causing the loss of hours of progress.
It seems like you're missing some file or access to it
127 typically means command not found
Are you missing the file /home/alexm/Desktop/dissertation/models/cy-en/transsystem/mert-work/extractor.sh ?
I'm working on a project that I found online (Yolo Object Detection with OpenCV, one of Pyimageresearch projects). So, I downloaded the whole code and saved it in the Downloads folder as it was recommended the run the cmd line script:
python /home/ubuntu/Downloads/yolo-object-detection/yolo_video.py \
> --input /home/ubuntu/Downloads/yolo-object-detection/videos/WS-1sec.mp4 \
> --output /home/ubuntu/Downloads/yolo-object-detection/output/WS-1sec.avi \
> --yolo /home/ubuntu/Downloads/yolo-object-detection/yolo-coco
but the output was:
[INFO] loading YOLO from disk...
OpenCV(3.4.1-dev) Error: Parsing error (Unknown layer type: shortcut) in ReadDarknetFromCfgFile, file /home/ubuntu/src/opencv/modules/dnn/src/darknet/darknet_io.cpp, line 503
Traceback (most recent call last):
File "/home/ubuntu/Downloads/yolo-object-detection/yolo_video.py", line 42, in <module>
net = cv2.dnn.readNetFromDarknet(configPath, weightsPath)
cv2.error: OpenCV(3.4.1-dev) /home/ubuntu/src/opencv/modules/dnn/src/darknet/darknet_io.cpp:503: error: (-212) Unknown layer type: shortcut in function ReadDarknetFromCfgFile
I'm running the same exact version of OpenCV 3.4.1 on another machine and it worked there! This time I'm working on the Tetson TX2 but didn't rum!
Link to original project is here.
Any idea why these error occurs please!?
I think you might have the wrong OpenCV version. Check this answer:
OpenCV unknown layer type running darknet detect
"Support for running YOLOv3 has been added to OpenCV master branch (3.4.3)."
I installed drake binary in my ubuntu 16.04 xenial by
curl -o drake.tar.gz https://drake-packages.csail.mit.edu/drake/continuous/drake-latest-xenial.tar.gz
sudo tar -xvzf drake.tar.gz -C /opt
And I find_package(drake) in my cmake and try to do optimization.
But I got the following error
/opt/drake/include/drake/common/autodiff.h:15:1: error: static assertion failed: Drake requires Eigen >= v3.3.3.
static_assert(EIGEN_VERSION_AT_LEAST(3, 3, 3)
and
/opt/drake/include/drake/common/autodiffxd.h:232:69: error: ‘MakeAutoDiffScalar’ was not declared in this scope
return MakeAutoDiffScalar(m_value * other, m_derivatives * other);
I think I am including right Eigen which is located in
/opt/drake/include/eigen3.
How could I fix it?
By the way in the Mac, it works well with the same code.
It may be that you've (either directly or indirectly) called find_package(Eigen) before you did so on Drake, in which case CMake may be finding your system Eigen rather than the Drake-provided version; this is noted here (sorry that it's not yet in a more obvious location):
https://github.com/RobotLocomotion/drake-shambhala/tree/b3d7804/drake_cmake_installed/src/pcl#eigen
If you do find_package(drake) first, then it should allow find_package(Eigen) to work later on.
If that doesn't work, could you post a link to your code in a GitHub repository, or can you make a minimal reproduction issue?
I am using OpenCV 2.4.5 on Ubuntu 12.04 64-bit. I would like to be able to set the resolution of the input from my Logitech C310 webcam. The camera supports up to 1280x960 at 30fps, and I am able to view the video at this resolution in guvcview. But OpenCV always gets the video at only 640x480.
Trying to change the resolution with cap.set(CV_CAP_PROP_FRAME_WIDTH, 1280) and cap.set(CV_CAP_PROP_FRAME_HEIGHT, 960) immediately after the VideoCapture cap is created has no effect; trying to set them immediately before getting every frame causes the program to crash immediately. I cannot reduce the resolution with this method either. I am also getting the error "HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP". I think this may be related, because it appears once when the VideoCapture is created, and once when I try to set the width and height (but, oddly, not if I try to set only one of them).
I know I'm not the first to have this problem, but I have yet to find a solution after much Googling and scouring of SO and elsewhere on the internet (among the many things I've already tried to no avail is the answer to this StackOverflow question: Increasing camera capture resolution in OpenCV). Is this a bug in OpenCV? If so, it's a rather glaring one.
Here's an example of code that exhibits the problem (just a modified version of OpenCV's video display code):
#include <cv.h>
#include <highgui.h>
using namespace cv;
int main(int argc, char** argv)
{
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
cap.set(CV_CAP_PROP_FRAME_WIDTH, 160);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 120);
Mat image;
namedWindow("Video", CV_WINDOW_AUTOSIZE);
while(1)
{
// cap.set(CV_CAP_PROP_FRAME_WIDTH, 160);
// cap.set(CV_CAP_PROP_FRAME_HEIGHT, 120);
cap >> image;
imshow("Video", image);
if(waitKey(10) == 99 ) break;
}
return
}
As it is, that gets me two "HIGHGUI ERROR"s as described above and I get a 640x480 output. I know that 160x120 is a resolution that my camera supports from running v4l2-ctl --list-formats-ext. If I uncomment the two commented-out lines in the while loop, the program crashes immediately.
These might be related or have possible solutions: http://answers.opencv.org/question/11427/decreasing-capture-resolution-of-webcam/, http://answers.opencv.org/question/30062/error-setting-resolution-of-video-capture-device/
This is a bug in the v4l "version" (build) of OpenCV 2.4 (including 2.4.12), but the bug is not in the libv4l version. For OpenCV 3.1.0, neither the v4l nor the libv4l version has the bug.
(Your error error message HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP indicates that you have the v4l version; the message is in cap_v4l.cpp, see code, but not in cap_libv4l.cpp.)
A workaround to get the v4l version of OpenCV 2.4 to work at a fixed resolution other than 640x480 is
changing the values for DEFAULT_V4L_WIDTH and DEFAULT_V4L_HEIGHT in
modules/highgui/src/cap_v4l.cpp and re-building OpenCV, kudos to this
answer.
If you want to build the libv4l version instead, all you likely need to do is
install libv4l-dev and rebuild OpenCV; WITH_LIBV4L was enabled by default for me. If it is not, your cmake command should contain
-D WITH_LIBV4L=ON
The cmake output (or version_string.tmp) for a libv4l build contains something like
Video I/O:
...
V4L/V4L2: Using libv4l1 (ver 0.8.6) / libv4l2 (ver 0.8.6)
(For a v4l build, it is just V4L/V4L2: NO/YES.)
Just wanted to add my CMAKE options to build with Java on the Raspberry Pi 3 based on Ulrich's comprehensive answer for OpenCV 3.2.0. Make a /build folder a in the same folder as OpenCV CMakeList.txt and execute this script for the new /build folder:
sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_OPENCL=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_SHARED_LIBS=OFF -D JAVA_INCLUDE_PATH=$JAVA_HOME/include -D JAVA_AWT_LIBRARY=$JAVA_HOME/jre/lib/arm/libawt.so -D JAVA_JVM_LIBRARY=$JAVA_HOME/jre/lib/arm/server/libjvm.so -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TESTS=OFF -D WITH_MATLAB=OFF -D WITH_CUFFT=OFF -D WITH_CUDA=OFF -D WITH_CUBLAS=OFF -D WITH_GTK=OFF -D WITH_WEBP=OFF -D BUILD_opencv_apps=OFF -D BUILD_PACKAGE=OFF -D WITH_LIBV4L=ON ..
You can use v4l2-ctl to set frame size of captured video like below.
v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=1
You can find more information at this link
Maybe you can try this, but I am not sure if this is what you want:
#include <X11/Xlib.h>
Display* disp = XOpenDisplay(NULL);
Screen* scrn = DefaultScreenOfDisplay(disp);
int height = scrn->height;
int width = scrn->width;
//Create window for the ip cam video
cv::namedWindow("Front", CV_WINDOW_NORMAL);
cvSetWindowProperty( "Front", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN );
//Position of the screen where the video is shows
cvMoveWindow("Front", 0, 0);
cvResizeWindow( "Front", width, height );
Like this you get the full screen for any screen.
I've just run cmake -D CMAKE_BUILD_TYPE=RELEASE .. from OpenCV/build, and got in my output:
-- OpenCV modules:
-- To be built: core imgproc flann highgui features2d calib3d ml video
objdetect contrib nonfree gpu legacy photo python
stitching ts videostab
-- Disabled: -
-- Disabled by dependency: -
-- Unavailable: androidcamera java world
The thing is, compilation with gpu fails, maybe because my machine doesn't have one? (It's an EC2 instance).
make fails with an odd error:
Scanning dependencies of target opencv_test_gpu
[ 72%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_gpumat.cpp.o
[ 72%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/utility.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_filters.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_copy_make_border.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/main.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_threshold.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_video.cpp.o
[ 73%] Building CXX object modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_core.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
make[2]: *** [modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_core.cpp.o] Error 4
make[1]: *** [modules/gpu/CMakeFiles/opencv_test_gpu.dir/all] Error 2
make: *** [all] Error 2
I've tried using the flag -DOPENCV_MODULES_DISABLED_USER="gpu" but that produces weird output with gpu listed as to be built and disabled.
-- OpenCV modules:
-- To be built: core imgproc flann highgui features2d calib3d ml video objdetect contrib nonfree gpu legacy photo python stitching ts videostab
-- Disabled: gpu
-- Disabled by dependency: -
-- Unavailable: androidcamera java world
How do I compile without gpu?
To disable building a specific module, use
-D BUILD_opencv_{modulename}=OFF
In this case, use
-D BUILD_opencv_gpu=OFF
Try to add -D WITH_CUDA=OFF to your cmake command line.
For OpenCV 2.4.11 on EC2, I had to include both -D BUILD_opencv_gpu=OFF and -D WITH_CUDA=OFF. I also included -D WITH_1394=OFF to avoid a warning in python. So:
cd opencv-2.4.11/
mkdir release
cd release/
cmake -D BUILD_opencv_gpu=OFF -D WITH_CUDA=OFF -D WITH_1394=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
This is caused by not having enough memory with your EC2 instance. I got a similar error (different module) with an EC2/Micro running Ubuntu 12.10, but it was smooth sailing on an EC2/Small.
The real question is , your device run out off memory.
This happens when gcc don't have enough memory. Trust me, since I had the same problem.
Had the same problem. It's a memory issue; increasing the swap space fixed it for me. Open a terminal and enter this:
free
dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
mkswap /var/swap.img
swapon /var/swap.img
free
Then proceed with your make.
Source
I have fixed this particular problem in a most horrible way:
touch modules/gpu/CMakeFiles/opencv_test_gpu.dir/test/test_core.cpp.o
make
Compilation then completes ok. This isn't really a solution though, so I'd like to know if there's a proper fix.