Giter Club home page Giter Club logo

ps3eyedriver's People

Contributors

binaryshift avatar brendanwalker avatar cboulay avatar gaborpapp avatar hipstersloth avatar inspirit avatar joehowse avatar mbehensky avatar mkalten avatar poleguy avatar rovarma avatar thp avatar triang3l avatar zelmon64 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ps3eyedriver's Issues

10bit dynamic range

Hi, this might be of interest.

I've been playing with the ov534 linux kernel module to add gamma, framerates <1fps, etc, and used your register initialisation routines to get raw output working.

By setting DSP_Ctrl4[0], video format to RAW10 and framesize to 0x017700, I've managed to capture 10bit raw.

Four pixels every five bytes, with the lsb's packed into the fifth byte:
11111111 22222222 33333333 44444444 44332211

error after trying to install on mac using homebrew.

trying to install on mac

using homebrew :

brew install libusb
brew install sdl2
cd sdl
make

When running make it gives me make:

"pkg-config: Command not found
c++ -I../src -I. -std=c++11 -O3 -I/usr/local/include/SDL2 -D_THREAD_SAFE -c -o main.o main.cpp
In file included from main.cpp:9:
../src/ps3eye.h:19:10: fatal error: 'libusb.h' file not found
#include "libusb.h" " .

Then I do " make #include "libusb.h"

I get:

make: pkg-config: Command not found
c++ -I../src -I. -std=c++11 -O3 -I/usr/local/include/SDL2 -D_THREAD_SAFE -c -o main.o main.cpp
make: pkg-config: Command not found
c++ -I../src -I. -std=c++11 -O3 -I/usr/local/include/SDL2 -D_THREAD_SAFE -c -o ../src/ps3eye.o ../src/ps3eye.cpp
../src/ps3eye.cpp:333:5: warning: 'libusb_set_debug' is deprecated
[-Wdeprecated-declarations]
libusb_set_debug(usb_context, 1);
^
./libusb.h:1324:1: note: 'libusb_set_debug' has been explicitly marked
deprecated here
LIBUSB_DEPRECATED_FOR(libusb_set_option)
^
./libusb.h:89:49: note: expanded from macro 'LIBUSB_DEPRECATED_FOR'
#define LIBUSB_DEPRECATED_FOR(f) attribute((deprecated))
^
1 warning generated.
make: pkg-config: Command not found
c++ -I../src -I. -std=c++11 -O3 -I/usr/local/include/SDL2 -D_THREAD_SAFE -c -o ../src/ps3eye_capi.o ../src/ps3eye_capi.cpp
make: pkg-config: Command not found
c++ -o ps3eye_sdl main.o ../src/ps3eye.o ../src/ps3eye_capi.o -L/usr/local/lib -lSDL2
Undefined symbols for architecture x86_64:
"_libusb_alloc_transfer", referenced from:
ps3eye::URBDesc::start_transfers(libusb_device_handle*, unsigned int) in ps3eye.o
"_libusb_cancel_transfer", referenced from:
ps3eye::URBDesc::close_transfers() in ps3eye.o
"_libusb_claim_interface", referenced from:
ps3eye::PS3EYECam::init(unsigned int, unsigned int, unsigned short, ps3eye::PS3EYECam::EOutputFormat) in ps3eye.o
ps3eye::PS3EYECam::open_usb() in ps3eye.o
"_libusb_clear_halt", referenced from:
ps3eye::URBDesc::start_transfers(libusb_device_handle*, unsigned int) in ps3eye.o
"_libusb_close", referenced from:
ps3eye::USBMgr::listDevices(std::__1::vector<std::__1::shared_ptrps3eye::PS3EYECam, std::__1::allocator<std::__1::shared_ptrps3eye::PS3EYECam > >&) in ps3eye.o
ps3eye::PS3EYECam::~PS3EYECam() in ps3eye.o
ps3eye::PS3EYECam::release() in ps3eye.o
ps3eye::PS3EYECam::close_usb() in ps3eye.o
"_libusb_control_transfer", referenced from:
ps3eye::PS3EYECam::~PS3EYECam() in ps3eye.o
ps3eye::PS3EYECam::stop() in ps3eye.o
ps3eye::PS3EYECam::init(unsigned int, unsigned int, unsigned short, ps3eye::PS3EYECam::EOutputFormat) in ps3eye.o
ps3eye::PS3EYECam::ov534_set_frame_rate(unsigned short, bool) in ps3eye.o
ps3eye::PS3EYECam::ov534_reg_write(unsigned short, unsigned char) in ps3eye.o
ps3eye::PS3EYECam::sccb_reg_write(unsigned char, unsigned char) in ps3eye.o
ps3eye::PS3EYECam::sccb_reg_read(unsigned short) in ps3eye.o
...
"_libusb_exit", referenced from:
ps3eye::USBMgr::~USBMgr() in ps3eye.o
ps3eye::USBMgr::~USBMgr() in ps3eye.o
ps3eye::USBMgr::instance() in ps3eye.o
std::__1::__shared_ptr_pointer<ps3eye::USBMgr*, std::__1::default_deleteps3eye::USBMgr, std::__1::allocatorps3eye::USBMgr >::__on_zero_shared() in ps3eye.o
"_libusb_free_config_descriptor", referenced from:
ps3eye::URBDesc::start_transfers(libusb_device_handle*, unsigned int) in ps3eye.o
"_libusb_free_device_list", referenced from:
ps3eye::USBMgr::listDevices(std::__1::vector<std::__1::shared_ptrps3eye::PS3EYECam, std::__1::allocator<std::__1::shared_ptrps3eye::PS3EYECam > >&) in ps3eye.o
"_libusb_free_transfer", referenced from:
ps3eye::transfer_completed_callback(libusb_transfer*) in ps3eye.o
"_libusb_get_active_config_descriptor", referenced from:
ps3eye::URBDesc::start_transfers(libusb_device_handle*, unsigned int) in ps3eye.o
"_libusb_get_bus_number", referenced from:
ps3eye::PS3EYECam::getUSBPortPath(char*, unsigned long) const in ps3eye.o
"_libusb_get_device", referenced from:
ps3eye::URBDesc::start_transfers(libusb_device_handle*, unsigned int) in ps3eye.o
"_libusb_get_device_descriptor", referenced from:
ps3eye::USBMgr::listDevices(std::__1::vector<std::__1::shared_ptrps3eye::PS3EYECam, std::__1::allocator<std::__1::shared_ptrps3eye::PS3EYECam > >&) in ps3eye.o
"_libusb_get_device_list", referenced from:
ps3eye::USBMgr::listDevices(std::__1::vector<std::__1::shared_ptrps3eye::PS3EYECam, std::__1::allocator<std::__1::shared_ptrps3eye::PS3EYECam > >&) in ps3eye.o
"_libusb_get_port_numbers", referenced from:
ps3eye::PS3EYECam::getUSBPortPath(char*, unsigned long) const in ps3eye.o
"_libusb_handle_events_timeout_completed", referenced from:
ps3eye::USBMgr::transferThreadFunc() in ps3eye.o
"_libusb_init", referenced from:
ps3eye::USBMgr::USBMgr() in ps3eye.o
ps3eye::USBMgr::USBMgr() in ps3eye.o
ps3eye::USBMgr::instance() in ps3eye.o
"_libusb_open", referenced from:
ps3eye::USBMgr::listDevices(std::__1::vector<std::__1::shared_ptrps3eye::PS3EYECam, std::__1::allocator<std::__1::shared_ptrps3eye::PS3EYECam > >&) in ps3eye.o
ps3eye::PS3EYECam::init(unsigned int, unsigned int, unsigned short, ps3eye::PS3EYECam::EOutputFormat) in ps3eye.o
ps3eye::PS3EYECam::open_usb() in ps3eye.o
"_libusb_ref_device", referenced from:
ps3eye::USBMgr::listDevices(std::__1::vector<std::__1::shared_ptrps3eye::PS3EYECam, std::__1::allocator<std::__1::shared_ptrps3eye::PS3EYECam > >&) in ps3eye.o
"_libusb_release_interface", referenced from:
ps3eye::PS3EYECam::~PS3EYECam() in ps3eye.o
ps3eye::PS3EYECam::release() in ps3eye.o
ps3eye::PS3EYECam::close_usb() in ps3eye.o
"_libusb_set_debug", referenced from:
ps3eye::USBMgr::USBMgr() in ps3eye.o
ps3eye::USBMgr::USBMgr() in ps3eye.o
ps3eye::USBMgr::instance() in ps3eye.o
"_libusb_submit_transfer", referenced from:
ps3eye::URBDesc::start_transfers(libusb_device_handle*, unsigned int) in ps3eye.o
ps3eye::transfer_completed_callback(libusb_transfer*) in ps3eye.o
"_libusb_unref_device", referenced from:
ps3eye::PS3EYECam::~PS3EYECam() in ps3eye.o
ps3eye::PS3EYECam::release() in ps3eye.o
ps3eye::PS3EYECam::close_usb() in ps3eye.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Whats the last thing indicate and how can I fix it?

Randomly Accessing Camera with Green Image/ Distorted Image

Hey guys, wondering if anyone else has ran into this issue but about 30% of the time when accessing the PS3eye camera and grabbing the frames, all frames will have a green distorted tint to them and will never fix itself unless I reinitialize getting the frame.

We are running windows 7 with Visual studio 2013, lib-usb1.0.20, ATI Radeon R9 380 and 640x480 resolution or 320x240 with any frame rate. Has anyone else seen this issue?

Very Nice work!!! I am Impressed.

Youkoso!
Very nice driver and Very Nice work!
Thanx for developing a such thing.
Sorry for latest issue,
I am dumb and wouldn't see it is connected with libusb,
I changed some things, built libusb on my own and it is great!
One more time thank you and sorry for creating latest not needed issue.
Bye!

Access violation reading location after a couple hundred of captures

Hi,

Are you still maintaining this project?
I get an Access violation reading location after a couple hundred of captures
It might be a driver issue, I'm using the latest drivers from codelaboratories, and it shows similar issues
Please let me know if you're still interested
What information do you need?
How can I help?

Windows on ARM, Support?

Please let us know when can we have an ARM64 version for Windows on ARM OS. We can help you test We have Windows on Rasberry Pi setup. Please pursue it we at Windows on Rasberry Pi community will be glad to extend support in testing your drivers and tools for ARM64.

How to set auto-exposure mode ?

I am working with OpenCV 3.4.2 and Visual Studio 2015 / C++ on Windows 10.

I can set the exposure of the camera to any value by using this code:

cv::VideoCapture *cap;  
...
cap = new cv::VideoCapture(0);
cap->set(CV_CAP_PROP_EXPOSURE, exposure);   // exposure = [0, 255]

Now I would like to switch to auto-exposure too. How can I set the camera to auto-exposure mode?

I tried the following:

cap->set(CV_CAP_PROP_EXPOSURE, 0);       // not working
cap->set(CV_CAP_PROP_EXPOSURE, -1);      // not working
cap->set(CV_CAP_PROP_AUTO_EXPOSURE, 1);  // not working, exposure stays fixed
cap->set(CV_CAP_PROP_AUTO_EXPOSURE, 0);  // not working, exposure stays fixed
cap->set(CV_CAP_PROP_AUTO_EXPOSURE, -1); // not working, exposure stays fixed

Any idea?

image glitch

I experience image glitch in 640x480@60fps on slower OS X computers, especially when something cpu intensive processing is going on. Maybe it is usb packet corruption, which is not handled properly.

App Hanging when camera disconnected

So I'm using this in my openframeworks app.
When I'm physically disconnecting the camera from the computer - the app hangs on Ps3EyeDriver Transfer Thread.
I'm on windows 8.1

Trouble pulling frames from camera (update: Using libusb-win32 driver resolved issue)

I don't know if this is necessarily an "issue" per se, and could possibly be something to do with my system, but I'm hoping someone can help explain what's going on and point me in the right direction.

I'm using Windows 10 and MSVC Express 2013, compiling for x64. When I first attempted to run the SDL example, it just hung. Long story short, after a lot of messing around with drivers and the PS3EyeDriver code, I've ended up with this result.

For some reason, the UVC header has the UVC_STREAM_ERR flag set, which was initially causing it to drop all the data (and just sit there waiting for frames that never come). When I disabled the test for that, I confirmed that I actually am receiving good image data, but for some reason I'm not receiving all of it (only about the first TRANSFER_SIZE*NUM_TRANSFERS bytes of data from what I can tell). If I increase the TRANSFER_SIZE, I receive more data (although past a certain point it seems to lock up). It seems that data is being lost somewhere, but with my very limited knowledge of libusb I'm not sure where to look to see if it's a problem with the libusb interface, buffer sizes, buffer queues, or some problem with the WinUSB driver being used for the camera. I haven't seen any reports of anyone else having problems like this, so there's a good chance that it's something with my system, but I don't understand how it works at all in that case.

I've attached this image showing what I'm receiving (with TRANSFER_SIZE set to 16384*16 so I get more than just a sliver). The upper half seems to update at full speed, the lower half kind of intermittently/flickers, and of course the bottom pink part is never getting filled in at all.
Partial Image from Buffer

I'd greatly appreciate any tips you can give me!

Feature request: Raw image format

It is apparently possible to get raw sensor data in Bayer mosaic format from the camera, which is what CL-Eye uses. Would be great to have an option for this in PS3EYEDriver.

Green/black screen on startup (openFrameworks)

Hello,

I am using your Ps3Eye driver in openFrameworks. Sometimes when opening the application, there is a problem when grabbing the camera: I end up with a green or black screen and nothing else.

This seems to happen when something else is plugged to the same USB hub as the Ps3Eye.

Do you have any idea how we could fix this?

Thanks

JPEG Compression

Has anyone tried JPEG compression in PS3 Eye? Flipping register in {0x35, 0x02} for ov534(538) seems working but data is messed up...
There is some registers in ps3eye.c that is not present in ov534/ov538 and ov7720/ov7725, does anyone know details about them?

Compressed In-Camera JPEG Stream

PS3Eye was quite popular thanks to the RAW support, but unfortunately it takes a lot of bandwidth which limits the number of simultaneously connected cameras (in RAW it is possible to work with 6-10 cameras).
Luckily OV538 has a built in encoder for image compression, PS3Eye is most often used for tracking bright blobs and with custom gamma curve we can get simple in-camera thresholding, combining this with in-camera jpeg image compression we can significantly reduce the amount of data and (in theory) connect more than 100 cameras!

I managed to find a working combination of registers for compessed stream (in-camera YUV -> JPG) and captured it in a Wireshark and mannualy removed all 12-byte headers, jpg image streamed with JFIF header and it's perfectly working at 60fps.
Unfortunately I can't figure out how to force saving compressed images because frame_size size is static, but here we have dynamically changing size because of the jpeg compression. I have no idea how to get compressed stream and save it, libusb have something like actual_length that returns real transfer buffer size, but then again I have no idea how to make it work.

Segmentation Error

I know this is only officially supported on Mac and Windows. But I'm trying to get it to work on Ubuntu 18.04 and I'm running into this issue.

These are the steps I took after downloading the source code:

cd sdl
sudo make

I then got the following error:

g++ -I../src -I. -std=c++11 -O3 -I/usr/local/include/libusb-1.0 -I/usr/include/SDL2 -D_REENTRANT -c -o main.o main.cpp
g++ -I../src -I. -std=c++11 -O3 -I/usr/local/include/libusb-1.0 -I/usr/include/SDL2 -D_REENTRANT -c -o ../src/ps3eye_capi.o ../src/ps3eye_capi.cpp
g++ -I../src -I. -std=c++11 -O3 -I/usr/local/include/libusb-1.0 -I/usr/include/SDL2 -D_REENTRANT -c -o ../src/ps3eye.o ../src/ps3eye.cpp
g++ -o ps3eye_sdl main.o ../src/ps3eye_capi.o ../src/ps3eye.o -L/usr/local/lib -lusb-1.0 -lSDL2
/usr/bin/ld: ../src/ps3eye.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
makefile:34: recipe for target 'ps3eye_sdl' failed
make: *** [ps3eye_sdl] Error 1

After digging around, I added the -pthread flag to the makefile like so:

# Also SDL 2.0, e.g. via MacPorts or Homebrew
CXXFLAGS += $(shell sdl2-config --cflags)
LIBS += $(shell sdl2-config --libs) -pthread
endif

Now it compiles fine. However, if I try to then run the example, I get the following error:

$ sudo ./ps3eye_sdl
Segmentation fault

I looked in the source code and it seems to be falling over writing to the sccb_reg, but I'm out of my depth here and don't really know what that is. Any help would be appreciated! Is there a fundamental reason why it won't work on linux?

PS. Both my PSEye cameras are definitely plugged in and recognized by the system (I can view them using vokoscreen for example). And if I unplug them, it will throw the No PS3 Eye camera connected
error.

How do I compile/use this?

The link https://github.com/libusbx/libusbx is dead but https://github.com/libusbx has project https://github.com/libusbx/libusb-compat-0.1

Next I installed brew install libusb

PS3EYEDriver/sdl % make
make: sdl2-config: Command not found
c++ -I../src -I. -std=c++11 -O3 -I/usr/local/Cellar/libusb/1.0.20/include/libusb-1.0    -c -o main.o main.cpp
main.cpp:7:10: fatal error: 'SDL.h' file not found
#include <SDL.h>

Next brew install sdl2

PS3EYEDriver/sdl % make              
c++ -I../src -I. -std=c++11 -O3 -I/usr/local/Cellar/libusb/1.0.20/include/libusb-1.0 -I/usr/local/include/SDL2 -D_THREAD_SAFE   -c -o main.o main.cpp
c++ -I../src -I. -std=c++11 -O3 -I/usr/local/Cellar/libusb/1.0.20/include/libusb-1.0 -I/usr/local/include/SDL2 -D_THREAD_SAFE   -c -o ../src/ps3eye.o ../src/ps3eye.cpp
../src/ps3eye.cpp:403:16: warning: braces around scalar initializer [-Wbraced-scalar-init]
        exit_signaled({ false }),
                      ^~~~~~~~~
../src/ps3eye.cpp:404:22: warning: braces around scalar initializer [-Wbraced-scalar-init]
        active_camera_count({ 0 })
                            ^~~~~
2 warnings generated.
c++ -I../src -I. -std=c++11 -O3 -I/usr/local/Cellar/libusb/1.0.20/include/libusb-1.0 -I/usr/local/include/SDL2 -D_THREAD_SAFE   -c -o ../src/ps3eye_capi.o ../src/ps3eye_capi.cpp
c++ -o ps3eye_sdl main.o ../src/ps3eye.o ../src/ps3eye_capi.o -L/usr/local/Cellar/libusb/1.0.20/lib -lusb-1.0 -L/usr/local/lib -lSDL2

Running the code

PS3EYEDriver/sdl % ./ps3eye_sdl       
Renderer: opengl
Camera mode: 640x480@60
FPS: 53.68
FPS: 60.04
FPS: 60.04
FPS: 59.98

so it work but I expected I could use the camera with ie Skype or ScreenFlow.

What do I miss?

getFrame() Fails

Hi,
I want to try your PS3eye driver.
But the programm freeze on PS3EYECam::getFrame()
FrameQueue::Enqueue() is never called, because the variable packet type of the method ADDFRAME never assumes the value LAST_PACKET.

In the console I got the following message on calling libusb_get_device_list(...):
libusb: error [init_device] device '.\USB#VID_...." is no longer connected!

Hopefully you can help me...
I'm using Visual Studio 2013,
(Compile in x86)
Windows 10 x64
latest libusb compiled by same Settings

Kind regards,
Spy-Shifty

debayer algorithms cause bad-access-exceptions under some circumstances

Under heavy multi-camera load, I am getting seemingly random bad access exceptions on one line of the demosaicing code (for each of the gray/rgb/bgr). I believe I traced it to the following code:

https://github.com/inspirit/PS3EYEDriver/blob/master/src/ps3eye.cpp#L630-L642

for (int y = 0; y < frame_height-1; source_row += source_stride, dest_row += dest_stride, ++y)
{
    const uint8_t* source = source_row;
    const uint8_t* source_end = source + (source_stride-2); // -2 to deal with the fact that we're starting at the second pixel of the row and should end at the second-to-last pixel of the row (first and last are filled separately)
    uint8_t* dest = dest_row;		

    // Row starting with Green
    if (y % 2 == 0)
    {
        // Fill first pixel (green)
        dest[-1*swap_br]    = (source[source_stride] + source[source_stride + 2] + 1) >> 1;
        dest[0]             = source[source_stride + 1];
        dest[1*swap_br]     = (source[1] + source[source_stride * 2 + 1] + 1) >> 1; // THIS LINE
/// ...

I believe, for example, for a 640x480 image, when y == 478 (y only goes from 0 -> 479) then source[source_stride * 2 + 1] will yield an invalid memory address if the FrameBuffer source is the last frame in the ring buffer. By luck, the memory address is not invalid 50% of the time in a double frame buffer and increasing the number of buffers makes it less likely, but it still happens on occasion.

One quick and dirty method to fix it is to just loop over y < frame_height - 2. I'm in the process of digging into the demosaicing code to see if that makes sense.

@rovarma What do you think?

75 fps no such option

Anyone know the register command to send to get 75 fps the code only have up to 60fps

Performance issue using 2 cameras

It seems I'm experiencing performance degradation if I use 2 cameras
Running 2 separate processes does not seem to have this issue
Do you have any advice using multiple cameras?
At the moment I'm working on a single thread
Can I call ps3eye::PS3EYECam::updateDevices(); from multiple threads?

Strange artifacts when using 75fps video

First off, thank you so so much for your work. It's been absolutely indispensable in a few of my projects.

I'm trying out the 75fps mode, and I've noticed some strange artifacts beyond the green and purple stripes. Please see here:
capture

There is a horizontal divide for these artifacts halfway down the image. @rovarma, any thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.