Git Product home page Git Product logo

openscan's Introduction

OpenScan

This repository will be superseded by the following: Github-OpenScan2, since I decided to rewrite the code and thus lay a cleaner foundation for future developments. Especially the new IMX519 camera will only be supported by the new firmware, so please feel free to join the discussion and development :)

Older Firmware (for stock pi cameras + OpenScan Mini/Classic):

Overview:

The Raspberry Pi + OpenScan Pi Shield can be used to control two independent stepper motors and a variety of different cameras (Pi Camera, DSLR - via GPhoto and external Cameras like Smartphone and others). The mechanism can be used in various forms (see for example https://www.thingiverse.com/thing:3050437 or https://www.thingiverse.com/thing:2944570 and it could be easily adapted to be used as a camera slider or in other mechanisms.

Setup

In order to add the OpenScan functionality to an existing raspbian system and understand all the dependencies, here is a full step-by-step list of the setup:

sudo apt-get update
sudo apt-get upgrade
mkdir -p /home/pi/shared/ui/data/old_flows && mkdir /home/pi/shared/log

Dependencies

sudo apt-get install python3-pip && sudo apt-get install python-pip && sudo apt-get install python-pil

PiCamera

sudo apt-get install python3-picamera && sudo apt-get install python-picamera
sudo raspi-config

--> interface options --> enable camera

Increase GPU Memory

(which seems to be needed for a stable operation of the interface)

sudo raspi-config

-->Performance Options --> GPU Memory --> 256 (instead of 128)

Samba

Samba is a fileserver, that allows you to access the Pi's filesystem via network folders. This functionality is optional but comes in quite handy.

sudo apt-get install samba samba-common-bin
sudo nano /etc/samba/smb.conf

Change the following lines:

workgroup = WORKGROUP
wins support = yes  
read only = no

Add to the end of the file:

[PiShare]
comment=Raspberry Pi Share
path=/home/pi/shared
browseable=Yes
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=yes

Set a network password:

sudo smbpasswd -a pi

Now you can access the filesystem of the raspberry pi through your network folder using the username "pi" and the given password.

Gphoto2

GPhoto2 is used to control DSLR cameras, which can be connected via USB. For a list of all supported cameras that can be used within this project see: https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/supported_cameras

For more details see: http://www.gphoto.org/doc/

sudo apt install libgphoto2-dev
sudo apt install gphoto2
sudo pip3 install -v gphoto2
sudo pip install -v gphoto2

for a list of all supported cameras see: http://www.gphoto.org/doc/remote/

NodeRed

NodeRed offers a great browser interface in order to control the steppers, cameras and accessories. For more details see: https://nodered.org/docs/getting-started/raspberrypi

Install NodeRed:

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

Set NodeRed to start automatically on boot:

sudo systemctl enable nodered.service

Time to restart the pi :)

sudo reboot -h

Change the default public folder of NodeRed by running

sudo nano /home/pi/.node-red/settings.js

And uncomment and change the following line (httpStatic:...):

httpStatic: '/home/pi/shared/',

Add the some palettes to NodeRed:

node-red-stop
cd ~/.node-red
npm install node-red-dashboard && npm install node-red-contrib-python3-function && npm install node-red-contrib-fs-ops && npm install node-red-contrib-isonline && npm i node-red-node-ui-table

Download the OpenScan Flow to node-red:

sudo wget -O /home/pi/.node-red/flows_raspberrypi.json https://raw.githubusercontent.com/OpenScanEu/OpenScan/master/update_universal.json && sudo cp /home/pi/.node-red/flows_raspberrypi.json /home/pi/.node-red/flows.json

Restart and done :))

sudo reboot -h

After the setup you can access the frontend in your browser by typing: IP:1880/ui The backend can be reached via IP:1880

Optional: Change hostname

sudo raspi-config

--> Network Options --> Hostname

Change hostname to OpenScanPi

Adjust the NodeRed Settings by opening

sudo nano /home/pi/.node-red/settings.js

uncomment "flowFile: ..." and change it to:

flowFile: 'flows_raspberrypi.json',

After the setup you can access the frontend in your browser by typing: OpenScanPi:1880/ui
The backend can be reached via OpenScanPi:1880
This works from any device, which is in the same network as the raspberry pi.

If you are logged in to your pi, you can also enter the user interface directly through localhost:1880/ui

Usage & Manual

For more information on the usage of the OpenScan Interface please consult the manual: https://github.com/OpenScanEu/OpenScan/raw/master/Manual_en.pdf

openscan's People

Contributors

beayemx avatar openscaneu 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openscan's Issues

SD card corruption and possible workouts

Hi, lately I have had a lot of SD card (trashing) corruption using Openscan. I use Sandisk Ultra SD cards. Looking for recommendations, anyone?

HW problems apart, I think it goes by:

  • Having Openscan making preview capturing all the time, even when the web frontpage is not loaded. A more conservative approach could be only capture preview on demand or whenever web page is active (via ping/pong, websocket)
  • Using Zip files to store the captures. Maybe a configurable output folder AND choosing if compressed or not would let using regular USB key/sdd to store the photos
  • Using ramdisk instead FS, for preview or to stream contents as a queue to an external server (Google Drive, S3, another host) (https://iotassistant.io/raspberry-pi/writing-to-file-on-ram-disk-on-raspberry-pi/)

A4988 drivers do not seem to work

I created my own shield following the circuit diagrams given. However, the stepper motors just seem to jump around. I am using A4988 drivers from HiLetGo. Any suggestions? I have tried testing the drivers stand alone, but they seem to be having the same problem stand alone as well. Am I missing something? Many suggestions on the internet talk about pulling down the STEP pin. Which A4988 boards do you recommend?

Ring light half working on classic

Ring light is not functioning as intended, only 4 of the 8 LEDs turn on when adjusting brightness.

Behaves identical to this issue from the forum that has been previously solved for the mini:
https://en.openscan.eu/forum/hardware/ring-light

I'm using the Classic with pi4 shield and ring light . Firmware used was the one listed on site and then updated to latest revision.
I've recently added the polariser so with only half the LEDs working the photos are currently far too dark.

crop() destroys quality and EXIF metadata

Meshrooms uses the EXIF metadata

commented crop() call :

ExifTool Version Number         : 11.54
File Name                       : nocrop.jpg
Directory                       : .
File Size                       : 4.4 MB
File Modification Date/Time     : 2020:10:05 01:36:04+02:00
File Access Date/Time           : 2020:10:27 13:34:59+01:00
File Creation Date/Time         : 2020:10:27 13:34:35+01:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Big-endian (Motorola, MM)
Make                            : RaspberryPi
Camera Model Name               : RP_imx219
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Modify Date                     : 2020:10:05 01:36:04
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/50
F Number                        : 2.0
Exposure Program                : Aperture-priority AE
ISO                             : 100
Exif Version                    : 0220
Date/Time Original              : 2020:10:05 01:36:04
Create Date                     : 2020:10:05 01:36:04
Components Configuration        : Y, Cb, Cr, -
Shutter Speed Value             : 1/50
Aperture Value                  : 2.0
Brightness Value                : 0.97
Max Aperture Value              : 2.0
Metering Mode                   : Center-weighted average
Flash                           : No Flash
Focal Length                    : 3.0 mm
Maker Note Unknown Text         : (Binary data 340 bytes, use -b option to extract)
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 3280
Exif Image Height               : 2464
Interoperability Index          : R98 - DCF basic file (sRGB)
Exposure Mode                   : Auto
White Balance                   : Auto
Compression                     : JPEG (old-style)
Thumbnail Offset                : 1058
Thumbnail Length                : 24576
Image Width                     : 3280
Image Height                    : 2464
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Aperture                        : 2.0
Image Size                      : 3280x2464
Megapixels                      : 8.1
Shutter Speed                   : 1/50
Thumbnail Image                 : (Binary data 24576 bytes, use -b option to extract)
Focal Length                    : 3.0 mm
Light Value                     : 7.6

not commented crop() call :

File Name                       : crop.jpg
Directory                       : .
File Size                       : 698 kB
File Modification Date/Time     : 2020:10:05 01:34:34+02:00
File Access Date/Time           : 2020:10:27 13:35:16+01:00
File Creation Date/Time         : 2020:10:27 13:33:06+01:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
Image Width                     : 2464
Image Height                    : 3280
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 2464x3280
Megapixels                      : 8.1

it also destroys quality even with no crop/resize

Register to Cloud not possible

Hello,

I recently updated to the latest version. Last year, you've send a token to me and I was able to test the awesome cloud functionality.
However, this token seems not to work anymore. I tried to register as a new user but the entire register flow seems to be broken to me.

I just see a popup which says I should enter e-mail address. But there is no input field and it closes after 3 seconds. Also there are no OK/Cancel buttons.
I tried to oversome this issue by simply changing the Layout of the dialog node. Layout was initially empty and I changed it to OK/Cancel. To proceed any further, I had to also enter my mail address, names et. as value for the OK button.
The process itself seems to be worked after this modification, hopefully you've got a request from me.

BR Patrick

Add EXIF metadata serialNumber based on #scanRun or based on hashed settings

For example, Meshroom uses the serial number in the EXIF informations to detect if two identical cameras (same model) were used in one scene.

I guess it's used by Meshroom/Alicevision to prevent any confusion with a set of pictures that differs from the rest, it's later maybe applying a less strict matching algorithm to merge the sets from the two cameras.

Applying a serial number from the run ID of the scan could be really simple, but it could maybe lead to issues if you do a very short complementary scan (with only 10 pictures of a specific angle, for example), meshroom could refuse to merge it, maybe.

Applying a serial number based on a hash of the camera settings could be a better alternative.

You can either choose to specify the cameraBody serial number of the cameraLens serial number.

Based on aliceVision sourcecode :
https://github.com/alicevision/AliceVision/blob/5eadcfab5c291e238edc61bb23c309202fc63668/src/aliceVision/sfmData/View.hpp#L290
https://github.com/alicevision/AliceVision/blob/5eadcfab5c291e238edc61bb23c309202fc63668/src/aliceVision/sfmData/View.hpp#L299

here are the possible strings you could write to in the exif metadata :

  • Camera Body

    • Exif:BodySerialNumber
    • cameraSerialNumber
    • SerialNumber
    • Serial Number
  • Camera Lens

    • Exif:LensSerialNumber
    • lensSerialNumber
    • lens serial number

ZIP64 extensions error

I remember having this error in before but it wasn't (somehow) causing any issue :

Dec  1 14:42:16 OpenScanPi Node-RED[269]: 1 Dec 14:42:16 - [error] [python3-function:Run Routine] Traceback (most recent call last):
Dec  1 14:42:16 OpenScanPi Node-RED[269]:   File "<string>", line 269, in <module>
Dec  1 14:42:16 OpenScanPi Node-RED[269]: 1 Dec 14:42:16 - [error] [python3-function:Run Routine]   File "<string>", line 248, in python_function
Dec  1 14:42:16 OpenScanPi Node-RED[269]:   File "<string>", line 166, in zip
Dec  1 14:42:16 OpenScanPi Node-RED[269]:   File "/usr/lib/python2.7/zipfile.py", line 824, in __exit__
Dec  1 14:42:16 OpenScanPi Node-RED[269]: 1 Dec 14:42:16 - [error] [python3-function:Run Routine]     self.close()
Dec  1 14:42:16 OpenScanPi Node-RED[269]:   File "/usr/lib/python2.7/zipfile.py", line 1371, in close
Dec  1 14:42:16 OpenScanPi Node-RED[269]: 1 Dec 14:42:16 - [error] [python3-function:Run Routine]     " would require ZIP64 extensions")
Dec  1 14:42:16 OpenScanPi Node-RED[269]: zipfile.LargeZipFile: Central directory offset would require ZIP64 extensions
Dec  1 14:42:16 OpenScanPi Node-RED[269]: 1 Dec 14:42:16 - [error] [python3-function:Run Routine] Python Function process exited with code 1
Dec  1 14:42:16 OpenScanPi Node-RED[269]: 1 Dec 14:42:16 - [info] [python3-function:Run Routine] Python function 'Run Routine' running on PID 3146

I fixed it by going into Run Routine module on scan tab

line 101

    with ZipFile("/home/pi/shared/temp.zip", "a", allowZip64=True) as zip:

to

    with ZipFile("/home/pi/shared/temp.zip", "a") as zip:

Ring Half light on Start Scan

Hi!
On my openscan mini, the ringlight goes to half light when starting a scan - indipendent of the setting before.

kernel upgrade to 6.1. breaks the imx519 driver

In latest version of "Raspbian Bullseye with Desktop" the command "apt upgrade" upgrades the kernel from 5.15.84 to 6.1.17. At least the imx519_kernel_driver has a problem with this new kernel. It is recommended to avoid apt upgrade or exclude kernel from upgrade by

sudo apt-mark hold libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 raspberrypi-bootloader raspberrypi-kernel raspberrypi-kernel-headers

Focus helper

Could it be possible to have some kind of "focus helper" ?

Let me explain.

On openscan mini, when we scan a non-spherical object, (a tall one, for example) we might need to adjust the focus before starting the scan and during it.

Could it be possible to have :

  • some kind of warning telling us to adjust the focus (right before starting the scan)

  • Focus helper tab, it gives a focus score using a zone at the middle of the image, display this score on the web page instead of the preview image itself so we can know when the focus is the best (as downloading the image on each frame is slower than just the score).

  • Mid scan, if focus score goes bellow a threshold, propose the user to readjust the focus.

pip3 search gphoto2 now fails

Hey,

Just to let you know the command pip3 search gphoto2 used to check gphoto2 is installed fails currently with

xmlrpc.client.Fault: <Fault -32500: "RuntimeError: PyPI's XMLRPC API has been temporarily disabled due to unmanageable load and will be deprecated in the near future. See https://status.python.org/ for more information.">

This is due to changes within status.python.org. I updated my local backend configuration to check for the following instead pip3 freeze | grep gphoto2 and it seems to work.

pi isn't the default user anymore

I think the documentation needs an update cause the pi imager recently dont't create the user pi by default. Instead a user name of your choice has to be set in configuration of imager. But it is recommended to name that user pi, cause the whole docu and also the software is prepared for /home/pi/OpenScan.

No preview during scan, flickering preview when idle

Hello,

I run the latest version and got some trouble with preview images I hadn't before.
When scanner is in idle (--READY--) state, preview image gets shown but switches between real image preview and a black (empty?) image. It changes approx every 0.5 second.

When running a scan, it doesn't show any preview. I verified that the last taken image gets stored as preview.jpg, but it doesn't show up. This is odd as I can't see, if the image set will become good or not during process.

Any chance to fix this?

BR Patrick

Threaded image processor

Hello,
As JPEG/JPG compression is fast but provides low quality and artifacts, it's possible to move to PNG (only by extension renaming in the python code) but it takes much more time for the raspberry ARM CPU to compress to PNG (as it's loss-less-ish) on a single core.

Moving the capture system to a threaded queue system would be great.

low quality is partially linked to #3

Open loop timing

First of all, thanks for creating and documenting this project!

I'm working with other colleagues at a local maker space to build an OpenScan system for use by our members. We've pretty much decided in favor of the Raspberry Pi controller instead of the Arduino version.

One remaining concern involves users who want to program a scan pattern into the controller and then set up a smartphone to take shots at a fixed interval, i.e., without explicit shutter control.

From the manual, it looks as though that can be accomplished in the user interface by setting the mode to External and Time per Foto to an appropriate value and ignoring Release time since that output would be unconnected. Is there any problem with doing that?
Screen Shot 2022-01-21 at 9 15 16 AM

Without digging into the code, my impression is that Time per Foto does not include the time for the stepper to move the axes to the next position. Is that correct? If so, is it reasonable to assume the transition time will be more or less constant, i.e., something that can determined empirically and added to the time interval on the camera side?

Thanks!

Conection fail cloud status

I am trying to test cloud render. it uploads but I cannot get an update. Whenever I push refresh I get a conection failed error

Clicking 'Finish' after scanning object, goes all over again

There is an issue that where you click on 'Finish' after scanning the object (instead of clicking 2nd pass) it goes all over again.

Steps to reproduce:

  1. Start scanning object (200 photos) with default project name
  2. After done scanning click 'finish'
  3. Current status changes to scanning again

Openscan version: 2022-08-16 beta

As far as I know there are no more up to date versions available.

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.