HyperBlend is a new type of hyperspectral image simulator based on Blender.

Overview

HyperBlend version 0.1.0

This is the HyperBlend leaf spectra simulator developed in Spectral Laboratory of University of Jyväskylä. You can use and modify this software under MIT licence.

Currently, HyperBlend can only simulate point-spectrometer-like spectral data. It needs actual measured reflectance and transmittance data which it tries to replicate.

Installing

Clone the repository to some location on your machine. Create a python environment by running conda env create -n hb --file hb_env.yml in yor anaconda command prompt when in project root directory. Use your favourite IDE for editing and running the code (developed using PyCharm). Command line build and run is untested, but it should work as well.

You will also need open-source 3D-modeling and rendering software Blender, which you can download and install from (blender.org). At least versions 2.8x and 2.9x should work (developed on version 2.93.5). Change your Blender executable path to constants.py.

Working principle

The measured reflectances and transmittances look like this:

wavelength [nm] reflectance transmittance
400 0.21435 0.26547
401 0.21431 0.26540
... ... ...

We call this the target. Reflectance and transmittance values represent the fraction of reflected and transmitted light so both values are separately bound to closed interval [0,1] and their sum cannot exceed 1.

We use a Blender scene with a rectangular box that represents a leaf. The material of the leaf has four adjustable parameters: absorption particle density, scattering particle density, scattering anisotropy, and mix factor. These control how the light is scattered and absorbed in the leaf material.

For each wavelength in the target, we adjust the leaf material parameters until the modeled reflectance and transmittance match the target values.

Usage

The entry point of the software is __main__.py file. For testing the software without actual data, run

from src import presets

presets.optimize_default_target()

that uses hard-coded test spectrum of a leaf.

The base element of the software is a measurement set identified by set_name, which consists of one or more samples identified by sample_id. To initialize a new set, initialize an Optimization object which will create a directory structure for given set_name under optimization directory.

To use real measured data, you should use

data.toml_handling.write_target(set_name:str, data, sample_id=0)

where data is a list of wavelength, reflectance, transmittance 3-tuples (or lists). This will write the data to disk in human-readable toml-formatted form that the rest of the code can understand.

Now you can start the optimization process. To summarize a simple use case in one snippet:

from src.optimization import Optimization
from data import toml_handlling as TH

data = [[400, 0.21435, 0.26547], [401, 0.21431, 0.26540]]
set_name = 'test_set'

o = Optimization(set_name)
TH.write_target(set_name, data, sample_id=0)
o.run_optimization()

The results are written onto disk in the set's directory as toml files and plotted to .png images.

Project structure, i.e., where to find stuff

Descriptions of the most important files.

  • optimization Optimization results and targets are stored here in set-wise sub-directories.
  • src Top level source code package.
    • __main__.py Entrypoint of the software.
    • constants.py Mainly names of things that should not be changed unless you are sure what you are doing. With the exception of path to Blender executable that you have to change to match your installation.
    • optimization.py Optimization work is done here.
    • plotter.py Responsible for plotting the results.
    • presets.py Default runnable example with hard-coded spectral values.
    • data Package responsible for data structure. Making changes in here will likely result in failure to read old optimization results.
      • file_handling.py Creation and removal of files and directories. Data structure reduction and expansion for more convenient file sharing.
      • file_names.py Knows all filenames in the project. Generator-parser pairs.
      • path_handling.py Knows the most important paths used in the project. Some paths may still need to be generated manually.
      • toml_handling.py Writing and reading of result data files.
    • rendering Package responsible for calling Blender.
    • utils Package containing miscellaneous utility modules.
  • bs_render_single.py Blender render script file.
  • scene_leaf_material.blend Bender scene file that is run by the bs_render_single.py.
You might also like...
Program to export all new icons from the latest Fortnite patch

Assets Exporter This program allows you to generate all new icons of a patch in png! Requierements Python =3.8 (installed on your computer) If you wa

An open source image editor which can manipulate an image in many ways!

Image Editor - An open source image editor which can manipulate an image in many ways! If you need any more modes in repo or I

Image enhancing model for making a blurred image to be somehow clearer than before

This is a very small prject which helps in enhancing the images by taking a Input images. This project has many features like detcting the faces and enhaning the faces itself and also a feature which enhances the whole image

Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine.
Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine.

img2dataset Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine. Also supports

A pure python implementation of the GIMP XCF image format. Use this to interact with GIMP image formats
A pure python implementation of the GIMP XCF image format. Use this to interact with GIMP image formats

Pure Python implementation of the GIMP image formats (.xcf projects as well as brushes, patterns, etc)

Image Reading, Metadata Conversion, and Image Writing for Microscopy Images in Python

AICSImageIO Image Reading, Metadata Conversion, and Image Writing for Microscopy Images in Pure Python Features Supports reading metadata and imaging

This app finds duplicate to near duplicate images by generating a hash value for each image stored with a specialized data structure called VP-Tree which makes searching an image on a dataset of 100Ks almost instantanious
This app finds duplicate to near duplicate images by generating a hash value for each image stored with a specialized data structure called VP-Tree which makes searching an image on a dataset of 100Ks almost instantanious

Offline Reverse Image Search Overview This app finds duplicate to near duplicate images by generating a hash value for each image stored with a specia

Quickly 'anonymize' all people in an image. This script will put a black bar over all eye-pairs in an image

Face-Detacher Quickly 'anonymize' all people in an image. This script will put a black bar over all eye-pairs in an image This is a small python scrip

Fast Image Retrieval is an open source image retrieval framework

Fast Image Retrieval is an open source image retrieval framework release by Center of Image and Signal Processing Lab (CISiP Lab), Universiti Malaya. This framework implements most of the major binary hashing methods, together with both popular backbone networks and public datasets.

Comments
  • Usage of the program

    Usage of the program

    Hi!

    Thanks for this implementation, I have been looking to run it since a couple of days but I can't get it to be done. Is there any tutorial or instructions for somebody who is new to this type of software (and blender)? I tried running bs_render_single.py from IDE, from Conda Prompt, and from blender itself, but nothing seems to work.

    Also, I tried to run main.py from windows cmd, from my IDE, and from Conda prompt, but it throws errors in references. I tried changing all the references to match what is being called, but I end up with an error that some files (and the directory optimization) does not exist. Tried to run code from the readme, but still can't get to work.

    Would be very helpful if somebody can help me through some basic follow up on how to run this implementation.

    Best regards!

    opened by fieterovich 12
Releases(v0.2.0)
  • v0.2.0(Nov 28, 2022)

    This is the second released version of HyperBlend on our way towards a full canopy scale vegetation simulator. HyperBlend is developed in Spectral Laboratory of University of Jyväskylä by Kimmo Riihiaho (kimmo.a.riihiaho at jyu.fi).

    Version 0.2.0 will break many things in the previous version. Don't expect simulations created in 0.1.0 to work. Also the folder structure and some constants have been reorganized and renamed.

    Main improvements in this version:

    1. Simulation speed 200 times faster (simulation accuracy decreases 2-4 times)
      • You can still use the old simulation method if you need maximum accuracy
    2. Incorporation of the PROSPECT leaf model
      • You can now use PROSPECT parameters such as water thickness and chlorophyll content
      • It is fairly simple to plug in any other leaf model you would like. Just follow how our local prospect module does it, and you should be fine
    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Nov 11, 2021)

    This is the first release of HyperBlend. This release only demonstrates the usability of Blender in simulating hyperspectral reflectance and transmittance properties of plant leaves. Future releases will add more useful functionalities to the software.

    Created by @11kaks

    Source code(tar.gz)
    Source code(zip)
Owner
SILMAE
Spectral Imaging Laboratory for Multidisciplinary Analysis and Expertise
SILMAE
Convert the SVG code to PNG and replace the line by a call to the image in markdown

Convert the SVG code to PNG and replace the line by a call to the image in markdown

6 Sep 06, 2022
A tool for hiding data inside of images

Stegenography-tool a tool for hiding data inside of images Quick test: do python steg-encode.py test/message.txt test/covid19.png to generate the test

luke 2 Nov 02, 2021
将位图转为彩色矢量 svg 图片

一个将位图描摹为彩色矢量 svg 图片的程序,是一个命令行工具,使用 Python 脚本实现,运行环境 Python3.8+。 ✨ 效果 以一个字帖图片为例,这是 png 格式的位图(370KB): 这是颜

Haujet Zhao 104 Dec 30, 2022
AutoGiphyMovie lets you search giphy for gifs, converts them to videos, attach a soundtrack and stitches it all together into a movie!

AutoGiphyMovie lets you search giphy for gifs, converts them to videos, attach a soundtrack and stitches it all together into a movie!

Satya Mohapatra 18 Nov 13, 2022
3D Reconstruction Software

Meshroom is a free, open-source 3D Reconstruction Software based on the AliceVision Photogrammetric Computer Vision framework. Learn more details abou

AliceVision 8.7k Jan 02, 2023
Converting Images Into Minecraft Houses

Converting Images Into Minecraft Houses In this particular project, we turned a 2D Image into Minecraft pixel art and then scaled it in 3D such that i

Mathias Oliver Valdbjørn Jørgensen 1 Feb 02, 2022
Python pygame project that turns your images to matrix rain

Matrix-Rain-An-Image This project implements the classic Matrix digital rain effect in python with pygame to build up an image provided with multiple

7 Dec 11, 2022
Script that organizes the Google Takeout archive into one big chronological folder

Script that organizes the Google Takeout archive into one big chronological folder

Mateusz Soszyński 1.6k Jan 09, 2023
pix2tex: Using a ViT to convert images of equations into LaTeX code.

The goal of this project is to create a learning based system that takes an image of a math formula and returns corresponding LaTeX code.

Lukas Blecher 2.6k Dec 30, 2022
Fix datetime EXIF data in photos downloaded from Google Takeout

fix-google-takeout Warning Use at your own risk. Backup your photos. Overview Google takeout for photos

Mayank Mandava 20 Nov 05, 2022
An API that renders HTML/CSS content to PNG using Chromium

html_png An API that renders HTML/CSS content to PNG using Chromium Disclaimer I am not responsible if you happen to make your own instance of this AP

10 Aug 08, 2022
A GUI-based (PyQt5) tool used to design 2D linkage mechanism.

Pyslvs-UI A GUI-based (PyQt5) tool used to design 2D linkage mechanism. Planar Linkages Simulation Python-Solvespace: Kernel from Solvespace with Cyth

Yuan Chang 141 Dec 13, 2022
Dynamic image server for web and print

Quru Image Server - dynamic imaging for web and print QIS is a high performance web server for creating and delivering dynamic images. It is ideal for

Quru 84 Jan 03, 2023
Anime2Gif - an algorithm that detects scenes in a video and generates gifs from it

Anime2Gif Anime2Gif is an algorithm that detects scenes in a video and generates gifs from it. How to use To use it, first, you'll need to install it'

1 Dec 09, 2021
Generative Art Synthesizer - a python program that generates python programs that generates generative art

GAS - Generative Art Synthesizer Generative Art Synthesizer - a python program that generates python programs that generates generative art. Examples

Alexey Borsky 43 Dec 03, 2022
Alternate Python bindings for the Open Asset Import Library (ASSIMP)

Impasse A simple Python wrapper for assimp using cffi to access the library. Requires Python = 3.7. It's a fork of PyAssimp, Assimp's official Python

Salad Dais 3 Sep 26, 2022
Convert bitmap images to seeds for Tiny-83 NFT project.

What is this? This tool allows you to convert any 14p high and 22p wide Bitmap (.bmp) to the seed needed for the Tiny-83 NFT project. Project Twitter:

shib_maximalist 1 Oct 31, 2021
利用近邻法的弱点实现图片缩小后变成另一张图

这是我一个视频的配套代码。 视频是:利用近邻法的弱点实现图片缩小后变成另一张图 https://www.bilibili.com/video/BV1Lf4y1r7dZ 配套代码中,仅generate.py是核心文件,其余的图片神马的,都是赠品。 这个核心文件利用了近邻法缩放的弱点,可以将图a的像素按

偶尔有点小迷糊 182 Dec 19, 2022
Depix is a tool for recovering passwords from pixelized screenshots.

This implementation works on pixelized images that were created with a linear box filter. In this article I cover background information on pixelization and similar research.

23.1k Jan 04, 2023
thumbor is an open-source photo thumbnail service by globo.com

Survey If you use thumbor, please take 1 minute and answer this survey? It's only 2 questions and one is multiple choice!!! thumbor is a smart imaging

Thumbor (by @globocom) 9.3k Dec 31, 2022