Re: [beagleboard] Re: VGA camera capture

2016-05-26 Thread João M . S . Silva

It does have MJPEG but opencv is converting the format to YUYV. And also
does your board have I/O pins digital and analogue?


It has lots of GPIO's, but I don't know if any of them are analog: 
https://www.olimex.com/Products/OLinuXino/A20/A20-OLinuXino-LIME/open-source-hardware


João M. S. Silva

--
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/5746D34E.4050905%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [beagleboard] Re: VGA camera capture

2016-05-26 Thread João M . S . Silva
I suppose you were using OpenCV in C++. For setting the desired 
resolution in C++ you have to do as you did in the Python code. 
Something like: http://stackoverflow.com/a/24867771


You should also set it to MJPEG, if possible: 
http://docs.opencv.org/2.4/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=cv_cap_prop_frame_width#videocapture-set


Please be more structured and succinct in what your current issue is so 
that it's easier to help. Have you considered the code from 
https://linuxtv.org/downloads/v4l-dvb-apis/capture-example.html?


Is your code in Python or C++?

In order to solve the larger problem you have to break it down into 
smaller ones.


João M. S. Silva

On 05/26/2016 09:23 AM, Tinashe Mudavanhu wrote:

I have finally managed to get a video stream (at least i can say for
now) by changing the frame resolution inside the python opencv code
using instructions on
http://stackoverflow.com/questions/11420748/setting-camera-parameters-in-opencv-python.
The maximum resolution i can set it to was 640x480 with a 5fps frame
rate, increasing the frame rate will result in a select timeout message.
At 320x240 i can set it  up to 30fps and running htop the CPU
utilization will be fluctuating around 86-90%. The python code was
taking about 12% and most of the chunk was on tightvnc about 60% (maybe
because of the frame window being displayed).

This is the code i was running;

import cv2


#capture from camera at location 0
cap = cv2.VideoCapture(0)
#set the width and height, and UNSUCCESSFULLY set the exposure time
cap.set(3,320)
cap.set(4,240)
cap.set(5, 30)

while True:
 ret, img = cap.read()
 cv2.imshow("input", img)
 #cv2.imshow("thresholded", imgray*thresh2)

 key = cv2.waitKey(10)
 if key == 27:
 break


cv2.destroyAllWindows()
cap.release()

And also the resolution i forced the camera to in the opencv code is the
one displayed after running v4l2-ctl -V;
root@beaglebone:~/Project/Testing# v4l2-ctl -V
Format Video Capture:
 Width/Height  : 320/240
 Pixel Format  : 'YUYV'
 Field : None
 Bytes per Line: 640
 Size Image: 153600
 Colorspace: SRGB
root@beaglebone:~/Project/Testing#

What you figured out about bandwidth is really a serious issue. I have a
friend who did not experience this problem on their RPi (only much
higher resolutions resulted in select timeout messages, message because
i don't think it is an error)  maybe because it has many USB ports
meaning higher bandwidth compared to BBB with only one.
I wonder what will happen when connecting the BBB wirelessly, with a
wifi dongle and camera on a USB hub.



On Thu, May 26, 2016 at 8:39 AM, Tinashe Mudavanhu <tinam...@gmail.com
<mailto:tinam...@gmail.com>> wrote:

Silva,

It does have MJPEG but opencv is converting the format to YUYV. And
also does your board have I/O pins digital and analogue?

On Thu, May 26, 2016 at 8:35 AM, Tinashe Mudavanhu
<tinam...@gmail.com <mailto:tinam...@gmail.com>> wrote:

The 160x120 video stream had no latency but the other camera
with 1280x720 was slow, video was displayed as images being
flipped like book pages.

I need to understand something from your files. Does it mean the
rest of my iris recognition code has to be in the
framegrabber.py client file and also this file can also run on
BBB? Do i need the zhelper.h file when my PC is running Ubuntu?

Here is my setup like. I have a PC running Ubuntu connected to
the BBB via usb and also sharing internet via the same cable
(there is no wired connection, only the PC is connected to
wifi). I want to see the video stream on my BBB for debugging
purposes and once it is working fine it doesn't have to show the
video stream. I am accessing the BBB Desktop/GUI via a tightvnc
client running on my Ubuntu PC. Thats when i will move to the
hub for a wired connection so that everyone connected to the hub
can access web pages served by the BBB (running lighttpd
webserver).

I was successful in the part of running BBB as a webserver
(without an video stream to show on the site because i don't
need it) but then the first part of getting a video stream to
show was not possible because of select timeout errors.

On Thu, May 26, 2016 at 12:35 AM, Matthew Witherwax
<ablec...@gmail.com <mailto:ablec...@gmail.com>> wrote:

Looks like framegrabber was able to capture images based on
the output you provided. Did you look at the images?

If it works for you then the code for the subscriber here
http://blog.lemoneerlabs.com/post/bbb-mjpeg-streaming will
show you how to load it into opencv.

------------
   

Re: [beagleboard] Re: VGA camera capture

2016-05-25 Thread João M . S . Silva
now the results.

5.  The UVC implementation in
Linux does not support still
image capture.  This means
tools like v4l2grab set the
camera to record in a mode
that uses no compression or
intra-frame compression

(http://en.wikipedia.org/wiki/Intra-frame)
and then grab frames from the
stream.  This is why the
format and frame rate affect
the capture.  The stream has
to be open and the data
pulled before we can grab an
image.

6.  Possibly, see 3.

7.  For my purposes, I have
not tested plug-and-play so I
cannot say much about it.


        On Mon, Sep 9, 2013 at 1:15
PM, João M. S. Silva
<joao.m.sa...@gmail.com> wrote:

Thanks Matthew, Don.

Here is my follow up:

1. Matthew, what is you
blog address?

2. I compiled v4l2grab
and used the -I switch to
adjust the fps. I found
out that with the
Logitech camera I can
capture 640x480 at up to
6 fps. With -I 7 or
above, it hangs. With
another cheap camera,
even -I 1 hangs!

3. Is 13.2 MB/s somehow
BBB's limit? Why?

4. My cheap cameras are
YUYV capable and one of
them is MJPEG capable.
The Logitech is both YUYV
and MJPEG capable.

5. As I've read elsewhere
UVC does not allow to get
still images, so video
performance issues affect
still image capturing,
right? is there a way to
capture pure still images
(bandwidth limitations
should be irrelevant in
that case)?

6. Overall, this is an
issue from the BBB,
right? All of this works
in my laptop and in BBXM.
Is it a bug from the BBB
USB implementation?

7. I also found BBB's USB
is not really
plug-and-play. Sometimes
devices don't get
recognized and a reboot
is needed.

Thanks.

--
For more options, visit
http://beagleboard.org/discuss
---
You received this message
because you are
subscribed to a topic in
the Google Groups
"BeagleBoard" group.
 

Re: [beagleboard] Re: VGA camera capture

2016-05-25 Thread João M . S . Silva

Hi Tinashe,

My two cents:


root@beaglebone:~/libjpeg-turbo-1.3.0/build# make
make  all-recursive
make[1]: Entering directory `/root/libjpeg-turbo-1.3.0/build'
Making all in java
make[2]: Entering directory `/root/libjpeg-turbo-1.3.0/build/java'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/libjpeg-turbo-1.3.0/build/java'
Making all in simd
make[2]: Entering directory `/root/libjpeg-turbo-1.3.0/build/simd'
make  all-am
make[3]: Entering directory `/root/libjpeg-turbo-1.3.0/build/simd'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/root/libjpeg-turbo-1.3.0/build/simd'
make[2]: Leaving directory `/root/libjpeg-turbo-1.3.0/build/simd'
Making all in md5
make[2]: Entering directory `/root/libjpeg-turbo-1.3.0/build/md5'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/libjpeg-turbo-1.3.0/build/md5'
make[2]: Entering directory `/root/libjpeg-turbo-1.3.0/build'
make[2]: Leaving directory `/root/libjpeg-turbo-1.3.0/build'
make[1]: Leaving directory `/root/libjpeg-turbo-1.3.0/build'
root@beaglebone:~/libjpeg-turbo-1.3.0/build#


There is no error above.


Before compiling libjpeg-turbo i tested my code to see what will be
happening on the resolution and frame rate. I am working with a Logitech
QuickCam E3500 which has support for both YUVY and MJPEG. I set the
resolution to 320x240 with a 30fps frame rate but after running the
code, got select timeout errors and the resolution had changed to
640x480 YUVY with a 15fps frame rate;


Due to this, among other reasons, we gave up on the BeagleBone Black and 
are now using an A20-OLinuXino-LIME.


João M. S. Silva

--
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/5745B238.8020505%40gmail.com.
For more options, visit https://groups.google.com/d/optout.