PnP Camera Module

278 views
Skip to first unread message

Trampas Stern

unread,
Feb 13, 2019, 6:20:26 PM2/13/19
to OpenPnP
Many have talked about a PnP camera module. 

I would recommend getting a PI Zero and using an OV5640 camera module.  I did some work with the OV5640 and is a good chip with lots of features and great low light performance.  By connecting directly to the PI Zero you can go in and tweak the driver code to get what you need out the OV5640 chip.  With USB cameras they provide a limited subset of the chip's functionality and thus you are always hand tied and it is slower. 

Using the Raspberry PI zero you can use the USB interface to make the whole system look like a USB camera, or connect using wifi (or with ethernet if you have an adapter or use PI).   

My plan was to use the PI zero via a composite USB gadget interface, such that I got a serial port and the camera.  Then have the PI do some of the image processing. For example on the machine I had I used the camera to see when movement stopped. That is I would take multiple images from the camera and compare them, when they were the same I knew the movement had stopped and I could use image for processing.  This was slow via USB as the USB cameras often send a cached version and the images would be the same.  Also just sending images over USB was slow.  But using the PI zero you can do this quickly as image is local, then only send the image when it has stabilized.   I was also going to do more advance processing on the PI, for example the translation and rotation would be easy to do.   Here you just send the PI the Python script for the processing you want done for that chip/part and let it do it and send results back via USB serial port. 

Note you can also get a Banana PI, Orange PI, or Odroid, Wandboard or other linux boards which often have more processing power ethernet, and not much more expensive. 


Here is OV5647 module for $5:

The trick would be to find a module with a lens mount. 

Another trick I was going to do is mount a camera high on the head and then stitch together a view of the build area.  Then have that shown on the screen,  this way when I was searching to find cut strips of parts I could just click on the cut strips and get the head camera to move close to the right position.  

Cameras are cheap use as many as it takes. 

jdlv

unread,
Feb 13, 2019, 6:50:19 PM2/13/19
to ope...@googlegroups.com

Per Eklund

unread,
Feb 14, 2019, 9:44:47 AM2/14/19
to OpenPnP
Following that ebay link I found a good place for lenses.

It was a link from this place http://www.arducam.com/ where they have examples of pictures from low distortion vs. "normal" lenses.

I will defenately try the Raspberry PI camera and se what it can do.

--Per

Gugl User

unread,
Feb 14, 2019, 11:44:30 AM2/14/19
to OpenPnP
As the PI 3, Tinker etc. have only host-mode USB it would be interessting how the performance of the OV5647 would be in openpnp as ip-cam.
I just checked an old waveshare module (Type G, with M12 lens holder) on a RPI3B+ and streamed via mjpeg-streamer, but unfortunatly openpnp supports only onvif.

Did you get an onvif-server on raspi working with openpnp or is there a simple way to get the mjpeg-stream into openpnp?

Jodie

Steffen Esser

unread,
Feb 15, 2019, 11:07:18 AM2/15/19
to ope...@googlegroups.com
This sounds really interesting! I like the idea to let the pi process the camera data.. 
I´m pretty new to openpnp and opencv in general, so it will take some time for me to figure out the basics, but i´m open to try different ways and research this topic. 
Regarding the camera module.. i think i´ll try this model from aliexpress.. looks like the cheapest option for the ov5747 chip with m12 mount.. m12 is maybe the better option because we can use the low distortion lenses from arducam.
And this the lens i´m thinking about: https://www.uctronics.com/index.php/m40210m09s.html
Maybe we can share some code when i´m ready with my test setup.
Generally.. in the end, the complete opencv operation could be done on the rpi without even transfering the image, so you send a command via serial and get the positioning data back via serial, or do i overlook some essentials here? (Sorry if this is a dumb question.. i may should do some research first ;)
Please let me know if you make progress with this.

--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/0b0ffec6-6aaf-44f4-9618-34f8ebc3dcdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason von Nieda

unread,
Feb 15, 2019, 1:12:10 PM2/15/19
to ope...@googlegroups.com
I just want to give a heads up on this idea (which has come up many times over the years). OpenPnP expects direct access to camera images for all it's vision algorithms. To do something like this you'd be rewriting all of the vision algorithms, or finding a way to send pipelines to the module, get results back and then feed them back through the pipeline system.

When I first started adding vision to OpenPnP I tried to plan for this with the VisionProvider interface. My thought was that by implementing that interface we could make it easy to drop in professional off the shelf machine vision systems. The problem is that with every machine being so different, much more flexibility was needed, so the VisionProvider interface fell into disuse and the pipeline system mostly replaced it.

Now that we're further in, we've come full circle in a way. I think that now we ultimately really only need a small handful of vision algorithms and we could probably replace the pipeline system, but it would be a really big change and probably isn't likely to happen for quite a long time.

So, just a heads up: It's not a simple matter of offloading this. You'd need to do extensive work in OpenPnP too.

Jason


Gugl User

unread,
Feb 15, 2019, 1:37:33 PM2/15/19
to OpenPnP
Hi Jason,

As the image processing of openpnp is much faster on a 4 GHz intel cpu it should be left there, of course.

But i would like to compare some rpi-camera modules laying around and use it as cheap ip-cameras.

How can i get the mjpeg-stream from raspi into openpnp?

I'm sure there was a case here before, but the encyclopedia does not work since two days, because of troubles caused by google's servers.

Jodie

Jason von Nieda

unread,
Feb 15, 2019, 3:30:53 PM2/15/19
to ope...@googlegroups.com
I don't think you currently can without some hacking. The WebcamCaptureCamera would potentially support it, but I think it would need to be modified a bit to handle a URL rather than a device ID.

Jason



Gugl User

unread,
Feb 15, 2019, 6:37:30 PM2/15/19
to OpenPnP
Oh, i see. This means i've got to use the ipcam capabilities of Bartosz Firyn's driver - am i right?

The basic camera parameters like exposure (the most important for up-cam), color temperature etc. could be changed with a separate connection (with a web-if or tcp-server on raspi).

As java-newbie i've got to learn a lot here.

Jodie

Jason von Nieda

unread,
Feb 15, 2019, 11:02:52 PM2/15/19
to ope...@googlegroups.com
Yep, OpenPnP includes a driver that uses that library. It will just need some hacking to change how it gets the URL.

Jason


Trampas Stern

unread,
Feb 18, 2019, 6:54:10 AM2/18/19
to OpenPnP
You can set up a raspberry pi's USB connection to appear as web camera.  This should require no changes to OpenPnP. 

Gugl User

unread,
Feb 18, 2019, 12:45:53 PM2/18/19
to OpenPnP
Thank you Trampas,

I already checked the ov5647 on a normal raspberry (3b+) with ip mjpeg streaming but unfortunatley the latency is much too high.

So i have to fetch a pi-zero to test the gadget usb mode as you described.

Jodie
Reply all
Reply to author
Forward
0 new messages