Ask Your Question

kingdavidek's profile - activity

2015-08-05 14:02:02 -0600 asked a question Cannot save video??

I don't know what it is. I keep trying to simply save video which is streamed via my webcam to a file called output.avi

I have looked at the documentation, I have looked at questions online, it seems like it should be a very standard operation but for some reason, I run the code and then there is no file. Nothing. Not even an empty file.

This is the last piece of code I tried to run.

PLease please help

2015-08-05 04:27:49 -0600 asked a question Any way to read video frames other than VideoCapture?

Essentially, i need a way to capture video frames using python (or in my particular case, raspicam camera.start_recording) and then being able to process the frames using openCV.

Rather than opening the video feed and reading frames via the CPU as OpenCV does.

2015-08-05 04:18:17 -0600 asked a question Can thresholding only be applied to a grayscale image?

I have read many articles like this which suggest that you can only apply a threshold to a grayscale picture.

I have also seen splitting of RGB or HSV values to apply a threshold to the individual channels. However, is it possible to apply a threshold to an image, to all of these channels, without the need for a time expensive split/merge operation?

2015-08-04 10:54:16 -0600 commented question Accessing Y information from Raspicam (Python)

what would i be decoding? The final array? Would I do this simply with the imdecode function?

2015-08-04 10:41:45 -0600 asked a question Access numpy array in openCV

Using the documentation here, in section 4.4 the code is:

> import time import picamera import
> picamera.array import cv2
> 
> with picamera.PiCamera() as camera:
>     camera.start_preview()
>     time.sleep(2)
>     with picamera.array.PiRGBArray(camera) as
> stream:
>         camera.capture(stream, format='bgr')
>         # At this point the image is available as stream.array
>         image = stream.array

As i understand it, this returns a numpy array to be read in openCV correct? My question is, how do I then open/access it to perform image processing on it in openCV?

2015-08-04 10:34:03 -0600 commented question Accessing Y information from Raspicam (Python)

I want to avoid using videocapture because I would like to access the frames straight from the GPU. If i have a numpy array, which i do, shouldn't i theoretically be able to access it in opencv?

2015-08-04 10:00:01 -0600 commented question Accessing Y information from Raspicam (Python)

I don't know. But the images I am trying to read are simply the frames of the video capture, so they should only be accessible within the program right?

Also, if it helps, I did array.shape on the array and it returned (256, 256, 3). Are these the dimensions of the matrix? Ie. is it a 256 by 256 by 3 matrix?

2015-08-04 08:48:44 -0600 commented question Accessing Y information from Raspicam (Python)

I just tried it. And you are correct, i got the error I wrote

img = cv2.imread('array',0) if (img): cv2.imshow('image',img) else: print "no image loaded"

And I got 'no image loaded'. What am I doing wrong?

2015-08-04 06:37:44 -0600 commented question Accessing Y information from Raspicam (Python)

Hi, Sorry, I know this is wrong because I get an error :

OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /home/pi/OpenCV/opencv-2.4.11/modules/highgui/src/window.cpp, line 261 Traceback (most recent call last): File "captureYUV.py", line 26, in <module> cv2.imshow('image',img) cv2.error: /home/pi/OpenCV/opencv-2.4.11/modules/highgui/src/window.cpp:261: error: (-215) size.width>0 && size.height>0 in function imshow

I do not know if these means that OPenCV cannot read the numpy data or if it simply means that it can read it, but it cannot open it as an image for some reason?

2015-08-04 06:01:41 -0600 asked a question Accessing Y information from Raspicam (Python)

Hi, I am having trouble loading a YUV array in OpenCV. I am trying it on a raspberry pi and I used the code that I saw in the answer to this question

Essentially, I have gotten raw YUV info from the Raspberry pi camera and I have it converted to a numpy array, frame by frame. My question now is: how can i see this numpy array in OpenCV? I would like to load the frames as images, and ultimately, I would like to isolate the Y channel for analysis. SO far, I just got the array and did this:

img = cv2.imread('ArrayY',0)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Which is probably wrong. Thanks for your help in advance,

Cheers,

David