Ruby on Rails webapp that reads a video that contains coordinates as text, updated per second, and produces a set of images, one per each coordinate change, with their corresponding coordinates by reading the text in the video.
Pull image:
docker pull hamax97/coordinates-readerRun in terminal:
docker run -d -e SECRET_KEY_BASE=$(bin/rails secret) -p 3000:3000 -h coordinates-reader --name coordinates-reader coordinates-reader:latestTODO: Run in Docker Desktop.
Build image:
docker build -t coordinates-reader .Tag and push:
docker tag <image_id> hamax97/coordinates-reader:<version>
docker push hamax97/coordinates-reader:<version>Developed with:
- Ubuntu 20.04
- Ruby 3.2.0
- Rails 7.0.4
- PostgreSQL 12
- Text extraction: Tesseract version 5.3.0
- Video processing: FFMPEG version 7:4.2.7-0ubuntu0.1
Install Tessearct:
echo "deb https://notesalexp.org/tesseract-ocr5/focal/ focal main" >> /etc/apt/sources.list
wget -O - https://notesalexp.org/debian/alexp_key.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y tesseract-ocr=5.3.0-1 libtesseract-dev=5.3.0-1Install FFMPEG:
sudo apt-get -y install ffmpeg=7:4.2.7-0ubuntu0.1
Install libraries used by rails for image processing:
# required for gem image_processing, which required for displaying images.
sudo apt-get -y install libvips42Install PostgreSQL and set the password for user coordinates_reader to CoordinatesReader123*:
sudo apt-get install postgresql-12 postgresql-client-12
# set password to: CoordinatesReader123*
sudo -u postgres createuser -s coordinates_reader -PPlease note that bin/rails db:create db:migrate and bin/rails active_storage:install are run only
once to initliaze the DB. After that, starting the PostgreSQL service and the rails server will work.
sudo service postgresql start
bin/rails db:create db:migrate
bin/rails servertesseract -c load_system_dawg=0 -c load_freq_dawg=0 <path_to_image> out
tesseract -c load_system_dawg=0 -c load_freq_dawg=0 -c tessedit_char_whitelist="0123456789. -+" <path_to_image> out
tesseract <path_to_image> out --loglevel ALL tesseract.configUseful links:
- First frame:
ffmpeg -i example.mp4 -vframes 1 000000.png- Rest of the frames:
ffmpeg -i example.mp4 -vf fps=1 %06d.png