OpenCV Image Capture Issue - opencv

I seem to be having an issue capturing images with OpenCv on my Pi 4 Buster. When I try to capture an image using OpenCV, it comes out like this:
Image Captured via OpenCV
Anyone know what may be causing the image to appear this way?
I have tested the camera using the raspistill command, the image appears as it should when I do this. I have been using OpenCV version 2.4.9.1 on Pi 3 Stretch for several years without issue. I am currently trying to upgrade to Pi 4 Buster. When I cloned OpenCV from Github onto the Pi 4 Buster, it gave me version 2.4.13.7. I don't want to switch to a newer version of OpenCV because I'm sure it will break everything else that works.

Related

Demo needs OpenCV for webcam images

I am trying to do object detection using YOLO from the official website:https://pjreddie.com/darknet/yolo/
But I cannot integrate OpenCV with it though I have already install OpenCV in my both python version python and python3
her is the error:
rajan#RGR:~/darknet$ ./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights videosample.mp4
Demo needs OpenCV for webcam images.
so can anyone help me to solve this, I have been trying to solve it for more than a week but I could not do it. I would be glad if someone gives me the solution. thank you in advance.
Hi. You should opencv =1 in makefile, and make again
if you want to test on a video then type
./darknet detector demo cfg/obj.data cfg/yolo-tiny-obj.cfg
backup/yolo-tiny-obj_40000.weights data/test.mp4
or you can upgrade your opencv

`opencv_createsamples` is missing

I need to train some images using OpenCV. But the issue is, I can't find opencv_createsamples program. I installed the OpenCV in the normal way, because I am using Windows 7. Where is this opencv_createsamples ? How can I get it?
It should be located under OpenCV-Dir\build\x64 or x86\vc1x\bin\.

Weather radar overlay on MapKit

I'v searched hi and low and being a novice developer I'm looking for some help. What I need to do is display weather radar over a map for a app I am trying to develop. Most of the content I have run across is outdated. My project is created using storyboards, looking for any assistance available with this issue. I have all the API's and associated info.
Thanks,
Creating an overview can be quite a cumbersome task. I found this tutorial to be a good start.
Basically the tutorial says that these steps have to be done:
I would recommend a 600 ppi tiff. My tiff had a resolution of about 4000*2000 pixel.
downlaod and install gdal: http://www.kyngchaos.com/software/frameworks. The installation of gdal is no joy. I can't explain every step here. Basically: first install using the complete installer. Then install numPy. Then copy gdal in the path with the terminal.
load the tiff into Google Maps to get the coordinates of the 4 corners.
create the vrt file with gdal. The command will look similar to this string: gdal_translate -of VRT -a_srs EPSG:4326 -gcp 0 0 7.435822 46.953453 -gcp 2285 0 7.460397 46.953453 -gcp 2285 1479 7.460397 46.942342 -gcp 0 1479 7.435822 46.942342 MN_A.tiff MN_A.vrt
Create the tiles with MapTiler. The Mac version didn't work for me, but the Windows version did the job.
You need to add these tiles to the project and create a folder reference for them. The code of the WWDC video Session 127 shows how that works.
repeat step 3-5 until the overlay works fine.

Can't get OpenCV + macam.component + PS3Eye working

I have compiled OpenCV in 32-bit mode on MacOS with quicktime turned on and ffmpeg turned off.
My application is just a simple program to display the output of the webcam in a window. The application works perfectly with my built in iSight camera and the macam app works perfectly with my PS3 Eye but I can't seem to get them to work together.
The application works fine with the iSight
capture = cvCaptureFromCAM(0);
but when I try to use the PS3 Eye
capture = cvCaptureFromCAM(1);
every time I try to grab a frame off of the camera
frame = cvQueryFrame( capture );
I get an error message.
startNextBulkRead-ReadPipeAsync: Error: kIOUSBEndpointNotFound - Not found
I have been battling with trying to get OpenCV working with my PS3 Eye webcam for over a week but just can't seem to get it working. When I run the macam app, it takes captures from the camera perfectly so it just seems to be some sort of compatibility/configuration issue. Any help would be appreciated.
I'm facing the same problem (with Mac OS X 10.7.2 and the latest OpenCV). The behavior is totally erratic but the error message appears a lot more often than an image is successfully grabbed from the camera.
The situation for video capture on OS X is complicated, and we lack a decent cross-platform video capture library for real-time applications.
However, I advise you to go with OpenFrameworks. It's a collection of libraries used mainly for interactive art and prototyping. While providing a lot of tools that are not necessarily useful if you just want to do some computer vision, there's OpenCV and a decent video capture facility that, from my experiments, works correctly with the PS3 Eye cam (and with a pretty good framerate).
I had the same problem and I solved it. I did several things so I don't know which one is the correct one, but this is what I did: updating os x to the last version, in my case now it is 10.7.3. Installing the last Xcode (with the apple dev tools and so, qt is the important thing), the version of Xcode I am using is 4.3.2. And compiling opencv to 32bits.

IplImage 'None' error on CaptureFromFile() - Python 2.7.1 and OpenCV 2.2 WinXP

I am running Python2.7.1 and OpenCV 2.2 without problems in my WinXP laptop and wrote a tracking program that is working without a glitch. But for some strange reason I cannot get the same program to run in any other computer where I tried to install OpenCV and Python (using the same binaries or appropriate 64 bit binaries). In those computers OpenCV seems to be correctly installed (although I have only tested and CaptureFromCamera() in the webcam of the laptop), but CaptureFromFile() return 'None' and give "error: Array should be CvMat or IplImage" after a QueryFrame, for example.
This simple code:
import cv /
videofile = cv.CaptureFromFile('a.avi') /
frame = cv.QueryFrame(videofile) /
print type(videofile) /
print type(frame)
returns:
type 'cv.Capture' /
type 'NoneType'
OpenCV and Python are in the windows PATH...
I have moved the OpenCV site-packages content back and forth to the Pyhton27 Lib\Site-packages folder.
I tried different avi files (just in case it was some CODEC problem). This AVI uses MJPEG encoding (and GSpot reports that ffdshow Video Decoder is used for reading).
Images work fine (I think): the simple convert code:
im = cv.LoadImageM("c:\tests\colormap3.tif")
cv.SaveImage("c:\tests\colormap3-out.png", im)
opens, converts and saves the new image...
I have tested with AVI files in different folders, using "c:\", "c:/", "c:\" and "c://".
I am lost here... Anyone has any idea of what stupid and noob mistake may be the cause of this? Thanks
It may sound stupid, but I just had the same issue with the same symptoms for the same code snippet (Python 2.7.1, Win 7, OpenCV 2.2.0). I changed file path from
capture = cv.CaptureFromFile('C:\Misc\tree.avi')
to
capture = cv.CaptureFromFile('C:/Misc/tree.avi')
and voila
<type 'cv.Capture'>
<type 'cv.iplimage'>
I was having this problem, and here is how I fixed it. I took a look at the output of OpenCV's cmake command, and it had the following line:
...
-- FFMPEG: NO
...
In order to fix this, you might be able to get away with simply installing the following libraries:
sudo apt-get install libavformat-dev libavcodec-dev libavfilter-dev libswscale-dev
Re-running cmake will hopefully now say:
...
-- FFMPEG: YES
...
Re-compile OpenCV, re-install it, and hopefully you can now read videos. If you still have problems, you can try to compile ffmpeg using the --enable-shared option, using these as guides:
http://opencv.willowgarage.com/wiki/FFMPEG
http://ubuntuforums.org/showthread.php?t=786095
Hope that helps.
This must be an issue with the default codecs. OpenCV uses brute force methods to open video files or capture from camera. It goes by trial and error through all sources/codecs/apis it can find in some reasonable order. (at least 1.1 did so).
That means that on n different systems (or days) you may get n different ways of accessing the same video. The order of multiple webcams for instance, is also non-deterministic and may depend on plugging order or butterflies.
Find out what your laptop uses, (re)install that on all the systems and retry.
Also, in the c version, you can look at the capture's properties
look for cvGetCaptureProperty and cvSetCaptureProperty where you might be able to hint to the format.
[EDIT]
Just looked i tup in the docs, these functions are also available in Python. Take a look, it should help.

Resources