Coder Social home page Coder Social logo

super8filmscanner's Introduction

3D printed Super 8 Film Scanner

Using OpenCV and Open Source software to scan and create videos from Super 8 film reel, along with a 3D printed frame.

The code and scanner were created quickly to achieve the job of scanning a handful of Super 8 reels at an acceptable quality.

The code is not optimised or user friendly, but pull requests are very welcome!

The code is unlikely to run straight out of the box on your computer/system, it will need minor amendments to folder names/paths etc.

Items needed for this project:

YouTube video

See the video on how to use and build this device.

https://youtu.be/rd1Xu6e6nrw

Setup

This is a rough setup description and some steps might be missing, but here is what's necessary:

Step 1 - Flash Marlin to the mainboard

Flash your mainboard with the Marlin Firmware. You can find the latest release here.

Open Arduino IDE, make the required changes (for your mainboard), connect the Mainboard via USB and upload the firmware to the Mainboard.

Step 2 - Install RaspOS on the Raspberry Pi

Install the Raspberry Pi Imager, which you can find here.

Plug in the microSD card into your computer and choose to install the Legacy 32-bit OS in the imager software. Use CTRL+SHIFT+X to open the advanced settings. Choose a hostname, for example "scanner". Then add a username and password. Activate SSH under "services" and add your Wifi settings.

Step 3 - Wiring

Assemble the scanner according to the 3D files.

Mainboard

Plug in the stepper drivers into the mainboards Y and Z axis, then plug in the stepper motors in these axis. You should add the heatsink to the Y axis stepper driver, as it's the one used the most.

Slot the Raspberry Pi HQ cameras ribbon cable into the Raspberry Pi and lock it in place.

Plug the LED wires into the fan header.

Connect the power supply to the mainboard via the two cables. Make sure the power supply is disconnected.

Connect the mainboard to the Raspberry Pi.

Step 4 - Connecting to the Raspberry Pi

If you don't plan to use the scanner with dedicated monitor, keyboard and mouse, you have to connect to it via Terminal and VNC.

Turn on the Raspberry Pi and the PSU.

Use SSH to connect to @scanner.local, then install VNC server to control your scanner in the future. If your screen stays black after connecting, run "vncserver-virtual" to add a virtual display.

Step 5 - Install dependencies

To install OpenCV, run sudo apt-get update , then sudo apt-get install build-essential cmake pkg-config libjpeg-dev libtiff5-dev libjasper-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libfontconfig1-dev libcairo2-dev libgdk-pixbuf2.0-dev libpango1.0-dev libgtk2.0-dev libgtk-3-dev libatlas-base-dev gfortran libhdf5-dev libhdf5-serial-dev libhdf5-103 python3-pyqt5 python3-dev -y

you might also need to run pip install opencv-python==4.5.3.56 .

Scanning Process

Step 1 - Capture full frame masters

On a Raspberry Pi (4 is possible), use the python code in RasPi_Camera_Super8Scanner.py to capture all the individual frames to individual PNG files.

This will generate a large number of files (3000+) of significant file size 2+MByte each. Camera captures approximately 3megapixel images.

Scanning is slow, running around 1.25 frames per second, so a 3 minute reel takes 1 hour.

Speed was not a critical issue when designing this solution, however the longest delay is capturing the image from the Raspberry Pi camera.

The images captured would look like this (only higher resolution). Notice you can see the sproket hole and the black border on the right of the image. Full frame sample image

Step 2 - Alignment

Step one captured the full frame of the film, this process takes those master images and accurately crops them to vertically and horizontally align them based on the sproket hole.

OpenCV is used to detect the hole and align/crop the image.

The code is in ImageRegistrationCropping.py its likely you will need to tweak the code to cater for the particular file size/resolution you are using and the camera configuration.

Look for the variable frame_dims to control the output image dimensions. Its likely you will also need to change the folder names.

The files are put into a folder named "Aligned". Example image. Aligned frame sample image

Step 3 - Denoise (optional)

A post process called de-noise filtering can be used to improve image quality. This code can be found in Denoise.py

This is a significantly slow process, so a faster CPU helps a lot. You can tweak the amount of correction made with these values

h=3, hColor=3, templateWindowSize=7,searchWindowSize=29

For a description of the paramters, check out the OpenCV documentation.

The files are put into a folder named "Denoise". Example image. Frame after denoise filtering

Step 4 - Create Video

FFMPEG

You can use the open source FFMPEG tool to convert a series of pictures into a video, using a command similar to this:

ffmpeg.exe -y -start_number 0 -framerate 18 -i "Aligned\frame_%08d.png" -vcodec h264 -preset slower -tune grain -crf 15 -vf "fps=18,format=yuv420p" -r 18 film_output.mp4

Video editor software

Alternatively, use video editing software like Davinci Resolve to import the pictures and generate a video.

This can also be used to colour correct the film, remove noise and grain and generally improve the final video.

super8filmscanner's People

Contributors

stuartpittaway avatar thejokoono 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

super8filmscanner's Issues

Scanning of 8mm movies instead of Super 8

Hi Stuart,

I came across your cool project on youtube. I have rebuilded everything, but at the end I figured out, that my inherited film rolls are 8mm instead of Super 8. Almost everything ist the same except the sprocket holes, they are not centered with each frame, but they are in between.

Is there a chance to adapt this behaviour? What variables are relevant?

Kind regards,
Dirk

PS.:
sorry writing an issue as an email

CAD Files Missing?

Hey Stuart!
i have download the Cad files and assembley and opende it in Freecad and it seems that the Microscope lens and sled design you show in the video are not in the cad files? i also found in the files a "film_sproket" that i didnt see in the assembly? do you have perhabs a "final" assembly that you can upload? :)
cheers and thx Janosch

Motherboard cabeling

Hey Stuart,

thank you for your awesome work on this! I'm about to try to recreate your project and was wondering if you could include a picture of the motherboard cabeling? Unfortunately that's the only part your youtube video does not show.

I assume you just plugged in the X and Y stepper motors into the associated ports?

HDR bracketing

Hey Stuart,

I'm just in the process of printing the parts you've designed for the structure of the scanner.

I was wondering if you had any ideas on how you could integrate bracketing to enable creating a Mertens merge image?
There is a project called YART (https://github.com/dgalland/yart), which you're probably aware of, that does this and it looks like it works very well for bringing back some shadows and highlights from the scans.

Cheers!

Camera CAD Files

Hello Stuart,

Great project. I am working to convert your 8mm project to 16mm to capture old 16mm football films. I noticed the CAD files from your final design do not appear in the git hub project, particularly the parts for the camera lens to focus the view, updated sled, and brackets to lock the camera in place. Is it please possible to post them here on github? Cheers!

Regards - Dave

Microscope & Camera Sled CAD Files

Great project! I've printed the 3D pieces and started assembling the scanner, however having trouble getting the camera assembly to mount and align properly. Could you please post the CAD files for the sled you created for the new camera and microscope lens. Also the clamps that are on the top. I'm building a version to accommodate 7" & 9" reels, and to scan both Super 8 & Reg 8mm film. I've located some old slot car foam tires to use for the pinch rollers. Once again Brilliant project!

HQ Camera Microscope Lens Mount Bracket missing

I have looked through all the assembly files, and cannot find the HQ camera/microscope lens mounting brackets.
The FSCAD assembly files only show a generic tube shape for the lens, and the tapered mount shown in the Youtube video is no where to be found. At least by my inexperienced Freecad usage.

Here are the files I examined:
CameraMount-RaspPiAdvanced.FCStd
PIHQMicroscopeCamera.FCStd
Super8FilmScanner.FCStd
Assemby.FCStd

Am I missing something?
Thanks for this project. I plan to put this together and modify it for full size Super8mm film reels

Raspberry Pi OS have moved from libmmal.so to use libcamera

I came across you project and have been working on building it out for .... awhile. I have all the pieces together but am running into issues with what I understand to the best of my limited knowledge, is the Raspberry OS has changed some of the dependencies. I'm not sure if there are others, but from what I have read, Pi no longer uses libmmal.so.

I haven't been able to install it when running the current OS (12 bookworm). Honestly, this is my first foray into modifying any code. I've started to learn some Python basics, but I modifying to change how the the script works might be a bit out of my depth.

I just wanted to see if anyone had updated the script to work with the most recent libcamera, or if there was another work around.

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.